Skip to content

Commit

Permalink
Merge branch 'release/v1.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineguilbert committed Jun 28, 2018
2 parents a335dde + 5f4c682 commit 1f55d49
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 17 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Just a simple project made with electron JS to show Android Messages from Google

To download the latest version, go to [release page](https://github.com/antoineguilbert/android-messages-for-desktop/releases).

![android-messages-macos](https://user-images.githubusercontent.com/16510381/42050509-71cc3c3a-7b09-11e8-8af2-419593ac033a.jpg)


## Todo

- [ ] Add custom notification with only the app icon
Expand Down
31 changes: 16 additions & 15 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function createWindow () {

mainWindow = new BrowserWindow(windowOptions)
//mainWindow.webContents.openDevTools();
//mainWindow.webContents.executeJavaScript("var elements = document.getElementsByTagName('link'); while (elements[0]) elements[0].parentNode.removeChild(elements[0])");

mainWindow.loadURL(url.format({
pathname: path.join('messages.android.com'),
Expand Down Expand Up @@ -55,19 +54,21 @@ function createWindow () {

//Creating the menu
function createMenu (){
var i18n = new(require('./translations/i18n'));

const template = [
{
label: 'Edition',
label: i18n.__('Edit'),
submenu: [
{label:'Copier',role: 'copy'},
{label:'Coller',role: 'paste'},
{label:'Tout sélectionner',role: 'selectall'},
{label: i18n.__('Copy'),role: 'copy'},
{label: i18n.__('Paste'),role: 'paste'},
{label: i18n.__('Select all'),role: 'selectall'},
{type: 'separator'},
{label:'Recharger',accelerator: 'CmdOrCtrl+R',click (item, focusedWindow) {if (focusedWindow) focusedWindow.reload()}},
{label: i18n.__('Reload'),accelerator: 'CmdOrCtrl+R',click (item, focusedWindow) {if (focusedWindow) focusedWindow.reload()}},
]
},
{
label: 'Fenêtre',
label: i18n.__('Window'),
role: 'window'
}
]
Expand All @@ -77,23 +78,23 @@ function createMenu (){
template.unshift({
label: name,
submenu: [
{label:'À propos',role: 'about'},
{label: i18n.__('About'),role: 'about'},
{type: 'separator'},
{label:'Déconnecter le compte', click: function click() {clearAppCache(); }},
{label: i18n.__('Disconnect account'), click: function click() {clearAppCache(); }},
{type: 'separator'},
{label:'Masquer '+name,role: 'hide'},
{label:'Masquer les autres',role: 'hideothers'},
{label:'Tout afficher',role: 'unhide'},
{label: i18n.__('Hide')+' '+name,role: 'hide'},
{label: i18n.__('Hider others'),role: 'hideothers'},
{label: i18n.__('Unhide'),role: 'unhide'},
{type: 'separator'},
{label:'Quitter',role: 'quit'}
{label: i18n.__('Quit'),role: 'quit'}
]
})

template[1].submenu.push()

template[2].submenu = [
{label: 'Réduire',accelerator: 'CmdOrCtrl+M',role: 'minimize'},
{label: 'Agrandir',role: 'zoom'}
{label: i18n.__('Minimize'),accelerator: 'CmdOrCtrl+M',role: 'minimize'},
{label: i18n.__('Zoom'),role: 'zoom'}
]
}

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "android-messages",
"productName": "Android Messages",
"appId": "com.antoineguilbert.android-messages",
"version": "1.1.1",
"version": "1.1.2",
"description": "Just a simple project made with electron JS to show Android Messages from Google in a app with notifications.",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -43,6 +43,7 @@
},
"dependencies": {
"electron-context-menu": "^0.10.0",
"electron-window-state": "^4.1.1"
"electron-window-state": "^4.1.1",
"i18n": "^0.8.3"
}
}
18 changes: 18 additions & 0 deletions translations/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Edit": "Edit",
"Cut": "Cut",
"Copy": "Copy",
"Paste": "Paste",
"Delete": "Delete",
"Select all": "Select all",
"Reload": "Reload",
"Window": "Window",
"Minimize": "Minimize",
"Zoom": "Zoom",
"About": "About",
"Disconnect account": "Disconnect account",
"Hide": "Hide",
"Hide others": "Hide others",
"Unhide": "Unhide",
"Quit": "Quit"
}
18 changes: 18 additions & 0 deletions translations/fr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Edit": "Édition",
"Cut": "Couper",
"Copy": "Copier",
"Paste": "Coller",
"Delete": "Supprimer",
"Select all": "Tout sélectionner",
"Reload": "Recharger",
"Window": "Fenêtre",
"Minimize": "Réduire",
"Zoom": "Agrandir",
"About": "À propos",
"Disconnect account": "Déconnecter le compte",
"Hide": "Masquer",
"Hide others": "Masquer les autres",
"Unhide": "Tout afficher",
"Quit": "Quitter"
}
25 changes: 25 additions & 0 deletions translations/i18n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//Constants
const path = require('path')
const electron = require('electron')
const fs = require('fs');

let loadedLanguage;
let app = electron.app;

module.exports = i18n;

function i18n() {
if(fs.existsSync(path.join(__dirname, app.getLocale() + '.js'))) {
loadedLanguage = JSON.parse(fs.readFileSync(path.join(__dirname, app.getLocale() + '.js'), 'utf8'));
}else{
loadedLanguage = JSON.parse(fs.readFileSync(path.join(__dirname, 'en.js'), 'utf8'));
}
}

i18n.prototype.__ = function(phrase) {
let translation = loadedLanguage[phrase]
if(translation === undefined) {
translation = phrase
}
return translation
}

0 comments on commit 1f55d49

Please sign in to comment.