From 96544aa63eefdbb6a3801ad059ca42b6ebe1e0fc Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Thu, 18 May 2017 21:25:09 -0300 Subject: [PATCH] Multi-language support! :flags: --- app/Application.js | 10 +- app/model/ServiceList.js | 1 + app/store/ServicesList.js | 92 +-- app/ux/Auth0.js | 4 +- app/ux/WebView.js | 6 +- app/view/add/Add.js | 24 +- app/view/add/AddController.js | 2 +- app/view/main/About.js | 14 +- app/view/main/Main.js | 44 +- app/view/main/MainController.js | 24 +- app/view/preferences/Preferences.js | 64 ++- app/view/preferences/PreferencesController.js | 9 + electron/main.js | 17 +- electron/menu.js | 539 +++++++++--------- index.html | 10 + languages.js | 51 ++ resources/languages/af.js | 1 + resources/languages/ar.js | 1 + resources/languages/ca.js | 1 + resources/languages/cs.js | 1 + resources/languages/da.js | 1 + resources/languages/de.js | 1 + resources/languages/el.js | 1 + resources/languages/en.js | 1 + resources/languages/es-ES.js | 1 + resources/languages/fa.js | 1 + resources/languages/fi.js | 1 + resources/languages/fr.js | 1 + resources/languages/he.js | 1 + resources/languages/hu.js | 1 + resources/languages/id.js | 1 + resources/languages/it.js | 1 + resources/languages/ja.js | 1 + resources/languages/ko.js | 1 + resources/languages/nl.js | 1 + resources/languages/no.js | 1 + resources/languages/pl.js | 1 + resources/languages/pt-BR.js | 1 + resources/languages/pt-PT.js | 1 + resources/languages/ro.js | 1 + resources/languages/ru.js | 1 + resources/languages/sr.js | 1 + resources/languages/sv-SE.js | 1 + resources/languages/tr.js | 1 + resources/languages/uk.js | 1 + resources/languages/vi.js | 1 + resources/languages/zh-CN.js | 1 + resources/languages/zh-TW.js | 1 + 48 files changed, 561 insertions(+), 382 deletions(-) create mode 100644 languages.js create mode 100644 resources/languages/af.js create mode 100644 resources/languages/ar.js create mode 100644 resources/languages/ca.js create mode 100644 resources/languages/cs.js create mode 100644 resources/languages/da.js create mode 100644 resources/languages/de.js create mode 100644 resources/languages/el.js create mode 100644 resources/languages/en.js create mode 100644 resources/languages/es-ES.js create mode 100644 resources/languages/fa.js create mode 100644 resources/languages/fi.js create mode 100644 resources/languages/fr.js create mode 100644 resources/languages/he.js create mode 100644 resources/languages/hu.js create mode 100644 resources/languages/id.js create mode 100644 resources/languages/it.js create mode 100644 resources/languages/ja.js create mode 100644 resources/languages/ko.js create mode 100644 resources/languages/nl.js create mode 100644 resources/languages/no.js create mode 100644 resources/languages/pl.js create mode 100644 resources/languages/pt-BR.js create mode 100644 resources/languages/pt-PT.js create mode 100644 resources/languages/ro.js create mode 100644 resources/languages/ru.js create mode 100644 resources/languages/sr.js create mode 100644 resources/languages/sv-SE.js create mode 100644 resources/languages/tr.js create mode 100644 resources/languages/uk.js create mode 100644 resources/languages/vi.js create mode 100644 resources/languages/zh-CN.js create mode 100644 resources/languages/zh-TW.js diff --git a/app/Application.js b/app/Application.js index 4395ec01..46a616d3 100644 --- a/app/Application.js +++ b/app/Application.js @@ -227,17 +227,17 @@ Ext.define('Rambox.Application', { '->' ,{ xtype: 'label' - ,html: 'New version is available! ('+json.version+')' + ( process.platform === 'win32' ? ' Is downloading in the background and you will notify when is ready to install it.' : '' ) + ,html: ''+locale['app.update[0]']+' ('+json.version+')' + ( process.platform === 'win32' ? ' Is downloading in the background and you will notify when is ready to install it.' : '' ) } ,{ xtype: 'button' - ,text: 'Download' + ,text: locale['app.update[1]'] ,href: process.platform === 'darwin' ? 'https://getrambox.herokuapp.com/download/'+process.platform+'_'+process.arch : 'https://github.com/saenzramiro/rambox/releases/latest' ,hidden: process.platform === 'win32' } ,{ xtype: 'button' - ,text: 'Changelog' + ,text: locale['app.update[2]'] ,ui: 'decline' ,tooltip: 'Click here to see more information about the new version.' ,href: 'https://github.com/saenzramiro/rambox/releases/tag/'+json.version @@ -255,8 +255,8 @@ Ext.define('Rambox.Application', { return; } else if ( !silence ) { Ext.Msg.show({ - title: 'You are up to date!' - ,message: 'You have the latest version of Rambox.' + title: locale['app.update[3]'] + ,message: locale['app.update[4]'] ,icon: Ext.Msg.INFO ,buttons: Ext.Msg.OK }); diff --git a/app/model/ServiceList.js b/app/model/ServiceList.js index 5225372e..a2c45e93 100644 --- a/app/model/ServiceList.js +++ b/app/model/ServiceList.js @@ -13,6 +13,7 @@ Ext.define('Rambox.model.ServiceList', { },{ name: 'description' ,type: 'string' + ,defaultValue: locale['services[27]'] },{ name: 'url' ,type: 'string' diff --git a/app/store/ServicesList.js b/app/store/ServicesList.js index 4d28e2a5..faecb169 100644 --- a/app/store/ServicesList.js +++ b/app/store/ServicesList.js @@ -25,7 +25,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'whatsapp' ,logo: 'whatsapp.png' ,name: 'WhatsApp' - ,description: 'WhatsApp is a cross-platform mobile messaging app for iPhone, BlackBerry, Android, Windows Phone and Nokia. Send text, video, images, audio for free.' + ,description: locale['services[0]'] ,url: 'https://web.whatsapp.com/' ,type: 'messaging' ,js_unread: 'function checkUnread(){var a=document.getElementsByClassName("infinite-list-item"),b=0;for(i=0;i0||0===a[i].getElementsByClassName("unread-count").length)){var c=parseInt(a[i].getElementsByClassName("unread-count")[0].innerHTML.trim());b+=isNaN(c)?0:c}updateBadge(b)}function updateBadge(count) { if (count && count >= 1) { rambox.setUnreadCount(count); } else { rambox.clearUnreadCount(); } }setInterval(checkUnread,1e3);' @@ -35,7 +35,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'slack' ,logo: 'slack.png' ,name: 'Slack' - ,description: 'Slack brings all your communication together in one place. It’s real-time messaging, archiving and search for modern teams.' + ,description: locale['services[1]'] ,url: 'https://___.slack.com/' ,type: 'messaging' ,js_unread: 'function checkUnread(){var a=0,b=0;$(".unread_msgs").each(function(){a+=isNaN(parseInt($(this).html())) ? 0 : parseInt($(this).html())}),$(".unread_highlights").each(function(){b+=isNaN(parseInt($(this).html())) ? 0 : parseInt($(this).html())}),updateBadge(a,b)}function updateBadge(a,b){var c=b>0?"("+b+") ":a>0?"(•) ":"";document.title=c+originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' @@ -44,7 +44,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'noysi' ,logo: 'noysi.png' ,name: 'Noysi' - ,description: 'Noysi is a communication tool for teams where privacy is guaranteed. With Noysi you can access all your conversations and files in seconds from anywhere and unlimited.' + ,description: locale['services[2]'] ,url: 'https://noysi.com/#/identity/sign-in' ,type: 'messaging' }, @@ -52,7 +52,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'messenger' ,logo: 'messenger.png' ,name: 'Messenger' - ,description: 'Instantly reach the people in your life for free. Messenger is just like texting, but you don\'t have to pay for every message.' + ,description: locale['services[3]'] ,url: 'https://www.messenger.com/login/' ,type: 'messaging' ,titleBlink: true @@ -62,7 +62,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'skype' ,logo: 'skype.png' ,name: 'Skype' - ,description: 'Stay in touch with family and friends for free. Get international calling, free online calls and Skype for Business on desktop and mobile.' + ,description: locale['services[4]'] ,url: 'https://web.skype.com/' ,type: 'messaging' ,userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586' @@ -72,7 +72,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'hangouts' ,logo: 'hangouts.png' ,name: 'Hangouts' - ,description: 'Hangouts bring conversations to life with photos, emoji, and even group video calls for free. Connect with friends across computers, Android, and Apple devices.' + ,description: locale['services[5]'] ,url: 'https://hangouts.google.com/' ,type: 'messaging' ,titleBlink: true @@ -84,7 +84,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'hipchat' ,logo: 'hipchat.png' ,name: 'HipChat' - ,description: 'HipChat is hosted group chat and video chat built for teams. Supercharge real-time collaboration with persistent chat rooms, file sharing, and screen sharing.' + ,description: locale['services[6]'] ,url: 'https://___.hipchat.com/chat' ,type: 'messaging' ,js_unread: 'function checkUnread(){var e=document.getElementsByClassName("hc-badge"),t=0;for(i=0;i=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' @@ -94,7 +94,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'telegram' ,logo: 'telegram.png' ,name: 'Telegram' - ,description: 'Telegram is a messaging app with a focus on speed and security. It’s super-fast, simple, secure and free.' + ,description: locale['services[7]'] ,url: 'https://web.telegram.org/' ,type: 'messaging' ,js_unread: 'function checkUnread(){var e=document.getElementsByClassName("im_dialog_badge badge"),t=0;for(i=0;i=1?rambox.setUnreadCount(e):rambox.clearUnreadCount()}setInterval(checkUnread,3000);' @@ -104,7 +104,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'wechat' ,logo: 'wechat.png' ,name: 'WeChat' - ,description: 'WeChat is a free messaging calling app that allows you to easily connect with family; friends across countries. It’s the all-in-one communications app for free text (SMS/MMS), voice; video calls, moments, photo sharing, and games.' + ,description: locale['services[8]'] ,url: 'https://web.wechat.com/' ,type: 'messaging' }, @@ -112,7 +112,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'gmail' ,logo: 'gmail.png' ,name: 'Gmail' - ,description: 'Gmail, Google\'s free email service, is one of the world\'s most popular email programs.' + ,description: locale['services[9]'] ,url: 'https://mail.google.com/mail/' ,type: 'email' ,allow_popups: true @@ -123,7 +123,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'inbox' ,logo: 'inbox.png' ,name: 'Inbox' - ,description: 'Inbox by Gmail is a new app from the Gmail team. Inbox is an organized place to get things done and get back to what matters. Bundles keep emails organized.' + ,description: locale['services[10]'] ,url: 'http://inbox.google.com/?cid=imp' ,type: 'email' ,manual_notifications: true @@ -134,7 +134,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'chatwork' ,logo: 'chatwork.png' ,name: 'ChatWork' - ,description: 'ChatWork is a group chat app for business. Secure messaging, video chat, task management and file sharing. Real-time communication and increase productivity for teams.' + ,description: locale['services[11]'] ,url: 'https://www.chatwork.com/login.php' ,type: 'messaging' ,note: 'To enable desktop notifications, you have to go to Options inside ChatWork.' @@ -143,7 +143,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'groupme' ,logo: 'groupme.png' ,name: 'GroupMe' - ,description: 'GroupMe brings group text messaging to every phone. Group message with the people in your life that are important to you.' + ,description: locale['services[12]'] ,url: 'https://web.groupme.com/signin' ,type: 'messaging' ,note: 'To enable desktop notifications, you have to go to Options inside GroupMe. To count unread messages, be sure to be in Chats.' @@ -154,7 +154,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'grape' ,logo: 'grape.png' ,name: 'Grape' - ,description: 'The world\'s most advanced team chat meets enterprise search' + ,description: locale['services[13]'] ,url: 'https://chatgrape.com/accounts/login/' ,type: 'messaging' }, @@ -162,7 +162,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'gitter' ,logo: 'gitter.png' ,name: 'Gitter' - ,description: 'Gitter is built on top of GitHub and is tightly integrated with your organisations, repositories, issues and activity.' + ,description: locale['services[14]'] ,url: 'https://gitter.im/' ,type: 'messaging' ,js_unread: 'function checkUnread(){var e=document.getElementsByClassName("room-item__unread-indicator"),t=0;for(i=0;i=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' @@ -171,7 +171,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'steam' ,logo: 'steam.png' ,name: 'Steam Chat' - ,description: 'Steam is a digital distribution platform developed by Valve Corporation offering digital rights management (DRM), multiplayer gaming and social networking services.' + ,description: locale['services[15]'] ,url: 'https://steamcommunity.com/chat' ,type: 'messaging' ,note: 'To enable desktop notifications, you have to go to Options inside Steam Chat.' @@ -181,7 +181,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'discord' ,logo: 'discord.png' ,name: 'Discord' - ,description: 'Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more.' + ,description: locale['services[16]'] ,url: 'https://discordapp.com/login' ,type: 'messaging' ,titleBlink: true @@ -192,7 +192,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'outlook' ,logo: 'outlook.png' ,name: 'Outlook' - ,description: 'Take control. Do more. Outlook is the free email and calendar service that helps you stay on top of what matters and get things done.' + ,description: locale['services[17]'] ,url: 'https://mail.live.com/' ,type: 'email' ,manual_notifications: true @@ -202,7 +202,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'outlook365' ,logo: 'outlook365.png' ,name: 'Outlook 365' - ,description: 'Outlook for Business' + ,description: locale['services[18]'] ,url: 'https://outlook.office.com/owa/' ,type: 'email' ,manual_notifications: true @@ -212,7 +212,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'yahoo' ,logo: 'yahoo.png' ,name: 'Yahoo! Mail' - ,description: 'Web-based email service offered by the American company Yahoo!. The service is free for personal use, and paid-for business email plans are available.' + ,description: locale['services[19]'] ,url: 'https://mail.yahoo.com/' ,type: 'email' ,note: 'To enable desktop notifications, you have to go to Options inside Yahoo! Mail.' @@ -221,7 +221,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'protonmail' ,logo: 'protonmail.png' ,name: 'ProtonMail' - ,description: 'Free and web-based encrypted email service founded in 2013 at the CERN research facility. ProtonMail is designed as a zero-knowledge system,[note 1] using client-side encryption to protect emails and user data before they are sent to ProtonMail servers, in contrast to other common webmail services such as Gmail and Hotmail.' + ,description: locale['services[20]'] ,url: 'https://mail.protonmail.com/inbox' ,type: 'email' }, @@ -229,7 +229,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'protonmailch' ,logo: 'protonmail.png' ,name: 'ProtonMail CH' - ,description: 'Free and web-based encrypted email service founded in 2013 at the CERN research facility. ProtonMail is designed as a zero-knowledge system,[note 1] using client-side encryption to protect emails and user data before they are sent to ProtonMail servers, in contrast to other common webmail services such as Gmail and Hotmail.' + ,description: locale['services[20]'] ,url: 'https://app.protonmail.ch/inbox' ,type: 'email' ,note: 'Read HERE to see the differences between protonmail.com and protonmail.ch.' @@ -238,7 +238,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'tutanota' ,logo: 'tutanota.png' ,name: 'Tutanota' - ,description: 'Tutanota is an open-source end-to-end encrypted email software and freemium hosted secure email service based on this software' + ,description: locale['services[21]'] ,url: 'https://app.tutanota.de/' ,type: 'email' }, @@ -246,7 +246,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'hushmail' ,logo: 'hushmail.png' ,name: 'Hushmail' - ,description: 'Web-based email service offering PGP-encrypted e-mail and vanity domain service. Hushmail offers "free" and "paid" versions of service. Hushmail uses OpenPGP standards and the source is available for download.' + ,description: locale['services[22]'] ,url: 'https://www.hushmail.com/hushmail/index.php' ,type: 'email' }, @@ -254,7 +254,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'missive' ,logo: 'missive.png' ,name: 'Missive' - ,description: 'Collaborative email and threaded group chat for productive teams. A single app for all your internal and external communication.' + ,description: locale['services[23]'] ,url: 'https://mail.missiveapp.com/login' ,type: 'messaging' ,js_unread: 'function checkUnread(){var e=document.getElementsByClassName("unseen-count"),t=0;for(i=0;i=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' @@ -263,7 +263,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'rocketchat' ,logo: 'rocketchat.png' ,name: 'Rocket Chat' - ,description: 'From group messages and video calls all the way to helpdesk killer features our goal is to become the number one cross-platform open source chat solution.' + ,description: locale['services[24]'] ,url: '___' ,type: 'messaging' ,note: 'You have to use this service by signing in with your email or username (No SSO allowed yet).' @@ -272,7 +272,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'wire' ,logo: 'wire.png' ,name: 'Wire' - ,description: 'HD quality calls, private and group chats with inline photos, music and video. Also available for your phone or tablet.' + ,description: locale['services[25]'] ,url: 'https://app.wire.com/' ,type: 'messaging' }, @@ -280,7 +280,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'sync' ,logo: 'sync.png' ,name: 'Sync' - ,description: 'Sync is a business chat tool that will boost productivity for your team.' + ,description: locale['services[26]'] ,url: 'https://m.wantedly.com/login' ,type: 'messaging' }, @@ -295,7 +295,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'yahoomessenger' ,logo: 'yahoomessenger.png' ,name: 'Yahoo! Messenger' - ,description: 'Allows you to instant message with anyone on the Yahoo server. Tells you when you get mail, and gives stock quotes.' + ,description: locale['services[28]'] ,url: 'https://messenger.yahoo.com/' ,type: 'messaging' ,js_unread: 'function checkUnread(){updateBadge(document.getElementsByClassName("list-item-unread-indicator").length)}function updateBadge(e){e>=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' @@ -304,7 +304,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'voxer' ,logo: 'voxer.png' ,name: 'Voxer' - ,description: 'Voxer is a messaging app for your smartphone with live voice (like a PTT walkie talkie), text, photo and location sharing.' + ,description: locale['services[29]'] ,url: 'https://web.voxer.com/' ,type: 'messaging' }, @@ -312,7 +312,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'dasher' ,logo: 'dasher.png' ,name: 'Dasher' - ,description: 'Dasher lets you say what you really want with pics, GIFs, links and more. Take a poll to find out what your friends really think of your new boo.' + ,description: locale['services[30]'] ,url: 'https://dasher.im/' ,type: 'messaging' }, @@ -320,7 +320,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'flowdock' ,logo: 'flowdock.png' ,name: 'Flowdock' - ,description: 'Flowdock is your team\'s chat with a shared inbox. Teams using Flowdock stay up-to-date, react in seconds instead of days, and never forget anything' + ,description: locale['services[31]'] ,url: 'https://www.flowdock.com/login' ,type: 'messaging' }, @@ -328,7 +328,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'mattermost' ,logo: 'mattermost.png' ,name: 'Mattermost' - ,description: 'Mattermost is an open source, self-hosted Slack-alternative. As an alternative to proprietary SaaS messaging, Mattermost brings all your team communication into one place, making it searchable and accessible anywhere.' + ,description: locale['services[32]'] ,url: '___' ,type: 'messaging' ,js_unread: 'Object.defineProperty(document,"title",{configurable:!0,set:function(a){document.getElementsByTagName("title")[0].innerHTML=a[0]==="*"?"(•) Mattermost":a},get:function(){return document.getElementsByTagName("title")[0].innerHTML}});' @@ -337,7 +337,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'dingtalk' ,logo: 'dingtalk.png' ,name: 'DingTalk' - ,description: 'DingTalk is a multi-sided platform empowers small and medium-sized business to communicate effectively.' + ,description: locale['services[33]'] ,url: 'https://im.dingtalk.com/' ,type: 'messaging' }, @@ -345,7 +345,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'mysms' ,logo: 'mysms.png' ,name: 'mysms' - ,description: 'The mysms family of applications helps you text anywhere and enhances your messaging experience on your smartphone, tablet and computer.' + ,description: locale['services[34]'] ,url: 'https://app.mysms.com/#login' ,type: 'messaging' ,js_unread: 'function checkUnread(){var e=document.getElementsByClassName("unread"),t=0;for(i=0;i=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}"https://app.mysms.com/#login"===document.baseURI&&(document.getElementsByClassName("innerPanel")[0].rows[0].style.display="none",document.getElementsByClassName("innerPanel")[0].rows[1].cells[0].firstElementChild.style.display="none",document.getElementsByClassName("msisdnLoginPanel")[0].style.display="inline");var originalTitle=document.title;setInterval(checkUnread,3000);' @@ -355,7 +355,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'icq' ,logo: 'icq.png' ,name: 'ICQ' - ,description: 'ICQ is an open source instant messaging computer program that was first developed and popularized.' + ,description: locale['services[35]'] ,url: 'https://web.icq.com/' ,type: 'messaging' ,js_unread: 'function checkUnread(){updateBadge(parseInt(document.getElementsByClassName("nwa-msg-counter")[0].style.display==="block"?document.getElementsByClassName("nwa-msg-counter")[0].innerHTML.trim():0))}function updateBadge(e){e>=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' @@ -364,7 +364,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'tweetdeck' ,logo: 'tweetdeck.png' ,name: 'TweetDeck' - ,description: 'TweetDeck is a social media dashboard application for management of Twitter accounts.' + ,description: locale['services[36]'] ,url: 'https://tweetdeck.twitter.com/' ,type: 'messaging' }, @@ -372,7 +372,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'custom' ,logo: 'custom.png' ,name: '_Custom Service' - ,description: 'Add a custom service if is not listed above.' + ,description: locale['services[38]'] ,url: '___' ,type: 'custom' ,allow_popups: true @@ -381,7 +381,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'zinc' ,logo: 'zinc.png' ,name: 'Zinc' - ,description: 'Zinc is a secure communication app for mobile workers, with text, voice, video, file sharing and more.' + ,description: locale['services[39]'] ,url: 'https://zinc-app.com/' ,type: 'messaging' }, @@ -389,7 +389,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'freenode' ,logo: 'freenode.png' ,name: 'FreeNode' - ,description: 'Freenode, formerly known as Open Projects Network, is an IRC network used to discuss peer-directed projects.' + ,description: locale['services[40]'] ,url: 'https://webchat.freenode.net/' ,type: 'messaging' }, @@ -397,7 +397,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'mightytext' ,logo: 'mightytext.png' ,name: 'Mighty Text' - ,description: 'Text from your computer, sync\'d with your Android phone & number.' + ,description: locale['services[41]'] ,url: 'https://mightytext.net/web/' ,type: 'messaging' }, @@ -405,7 +405,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'roundcube' ,logo: 'roundcube.png' ,name: 'Roundcube' - ,description: 'Free and open source webmail software for the masses, written in PHP.' + ,description: locale['services[42]'] ,url: '___' ,type: 'email' }, @@ -413,7 +413,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'horde' ,logo: 'horde.png' ,name: 'Horde' - ,description: 'Horde is a free and open source web-based groupware.' + ,description: locale['services[43]'] ,url: '___' ,type: 'email' ,js_unread: 'function checkUnread(){var e=document.getElementsByClassName("count"),t=0;for(i=0;i=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' @@ -423,7 +423,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'squirrelmail' ,logo: 'squirrelmail.png' ,name: 'SquirrelMail' - ,description: 'SquirrelMail is a standards-based webmail package written in PHP.' + ,description: locale['services[44]'] ,url: '___' ,type: 'email' ,js_unread: 'function checkUnread(){var e=document.getElementsByClassName("leftunseen"),t=0;for(i=0;i=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' @@ -432,7 +432,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'zohoemail' ,logo: 'zohoemail.png' ,name: 'Zoho Email' - ,description: 'Ad-free business Email Hosting with a clean, minimalist interface. Integrated Calendar, Contacts, Notes, Tasks apps.' + ,description: locale['services[45]'] ,url: 'https://mail.zoho.com/' ,type: 'email' ,js_unread: 'zmail.aInfo[zmail.accId].mailId = "a";' @@ -442,7 +442,7 @@ Ext.define('Rambox.store.ServicesList', { id: 'zohochat' ,logo: 'zohochat.png' ,name: 'Zoho Chat' - ,description: 'Zoho chat is a secure and scalable real-time communication and collaboration platform for teams to improve their productivity.' + ,description: locale['services[46]'] ,url: 'https://chat.zoho.com/' ,type: 'messaging' ,js_unread: 'NotifyByTitle.show = function(){};NotifyByTitle.start = function(){};NotifyByTitle.stop = function(){};function checkUnread(){var t=0;$(".msgnotify").each(function() { t += isNaN(parseInt($(this).html())) ? 0 : parseInt(parseInt($(this).html())) });updateBadge(t)}function updateBadge(e){e>=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' diff --git a/app/ux/Auth0.js b/app/ux/Auth0.js index 764ac955..245bc3c4 100644 --- a/app/ux/Auth0.js +++ b/app/ux/Auth0.js @@ -26,7 +26,7 @@ Ext.define('Rambox.ux.Auth0', { ,popupOptions: { nodeIntegration: 'no' } - //,language: 'en' + ,language: localStorage.getItem('locale-auth0') === null ? 'en' : localStorage.getItem('locale-auth0') }); me.auth0 = new Auth0({ clientID: auth0Cfg.clientID, domain : auth0Cfg.domain }); @@ -46,7 +46,7 @@ Ext.define('Rambox.ux.Auth0', { } // Display a spinner while waiting - Ext.Msg.wait('Please wait until we get your configuration.', 'Connecting...'); + Ext.Msg.wait(locale['app.window[29]'], locale['app.window[28]']); // Google Analytics Event ga_storage._trackEvent('Users', 'loggedIn'); diff --git a/app/ux/WebView.js b/app/ux/WebView.js index 3e721a92..9b37e37c 100644 --- a/app/ux/WebView.js +++ b/app/ux/WebView.js @@ -108,14 +108,14 @@ Ext.define('Rambox.ux.WebView',{ } ,'-' ,{ - text: 'Reload' + text: locale['app.webview[0]'] ,glyph: 'xf021@FontAwesome' ,scope: me ,handler: me.reloadService } ,'-' ,{ - text: 'Toggle Developer Tools' + text: locale['app.webview[3]'] ,glyph: 'xf121@FontAwesome' ,scope: me ,handler: me.toggleDevTools @@ -198,7 +198,7 @@ Ext.define('Rambox.ux.WebView',{ ,dock: 'bottom' ,defaultText: ' Ready' ,busyIconCls : '' - ,busyText: ' Loading...' + ,busyText: ' '+locale['app.webview[4]'] ,items: [ { xtype: 'tbtext' diff --git a/app/view/add/Add.js b/app/view/add/Add.js index 857d7e33..78544f08 100644 --- a/app/view/add/Add.js +++ b/app/view/add/Add.js @@ -27,7 +27,7 @@ Ext.define('Rambox.view.add.Add',{ ,initComponent: function() { var me = this; - me.title = (!me.edit ? 'Add ' : 'Edit ') + me.record.get('name'); + me.title = (!me.edit ? locale['app.window[0]'] : locale['app.window[1]']) + ' ' + me.record.get('name'); me.icon = me.record.get('type') === 'custom' ? (!me.edit ? 'resources/icons/custom.png' : (me.record.get('logo') === '' ? 'resources/icons/custom.png' : me.record.get('logo'))) : 'resources/icons/'+me.record.get('logo'); me.items = [ { @@ -35,7 +35,7 @@ Ext.define('Rambox.view.add.Add',{ ,items: [ { xtype: 'textfield' - ,fieldLabel: 'Name' + ,fieldLabel: locale['app.window[2]'] ,labelWidth: 40 ,value: me.record.get('type') === 'custom' ? (me.edit ? me.record.get('name') : '') : me.record.get('name') ,name: 'serviceName' @@ -49,7 +49,7 @@ Ext.define('Rambox.view.add.Add',{ ,items: [ { xtype: 'label' - ,text: 'URL:' + ,text: locale['app.window[17]']+':' ,width: 45 } ,{ @@ -126,7 +126,7 @@ Ext.define('Rambox.view.add.Add',{ } ,{ xtype: 'textfield' - ,fieldLabel: 'Logo' + ,fieldLabel: locale['app.window[18]'] ,emptyText: 'http://url.com/image.png' ,name: 'logo' ,vtype: me.record.get('type') === 'custom' ? 'url' : '' @@ -139,7 +139,7 @@ Ext.define('Rambox.view.add.Add',{ } ,{ xtype: 'fieldset' - ,title: 'Options' + ,title: locale['app.window[3]'] ,margin: '10 0 0 0' ,items: [ { @@ -148,7 +148,7 @@ Ext.define('Rambox.view.add.Add',{ ,items: [ { xtype: 'checkbox' - ,boxLabel: 'Align to Right' + ,boxLabel: locale['app.window[4]'] ,checked: me.edit ? (me.record.get('align') === 'right' ? true : false) : false ,name: 'align' ,uncheckedValue: 'left' @@ -156,7 +156,7 @@ Ext.define('Rambox.view.add.Add',{ } ,{ xtype: 'checkbox' - ,boxLabel: 'Mute all sounds' + ,boxLabel: locale['app.window[6]'] ,name: 'muted' ,checked: me.edit ? me.record.get('muted') : false ,uncheckedValue: false @@ -172,7 +172,7 @@ Ext.define('Rambox.view.add.Add',{ } ,{ xtype: 'checkbox' - ,boxLabel: 'Show notifications' + ,boxLabel: locale['app.window[5]'] ,name: 'notifications' ,checked: me.edit ? me.record.get('notifications') : true ,uncheckedValue: false @@ -188,7 +188,7 @@ Ext.define('Rambox.view.add.Add',{ } ,{ xtype: 'checkbox' - ,boxLabel: 'Trust invalid authority certificates' + ,boxLabel: locale['app.window[19]'] ,name: 'trust' ,hidden: me.record.get('type') !== 'custom' ,checked: me.edit ? me.record.get('trust') : true @@ -230,14 +230,14 @@ Ext.define('Rambox.view.add.Add',{ } ,{ xtype: 'fieldset' - ,title: 'Advanced' + ,title: locale['app.window[7]'] ,margin: '10 0 0 0' ,collapsible: true ,collapsed: true ,items: [ { xtype: 'textarea' - ,fieldLabel: 'Custom Code (read more)' + ,fieldLabel: locale['app.window[8]']+' ('+locale['app.window[9]']+')' ,allowBlank: true ,name: 'js_unread' ,value: me.edit ? me.record.get('js_unread') : '' @@ -263,7 +263,7 @@ Ext.define('Rambox.view.add.Add',{ me.buttons = [ { - text: 'Cancel' + text: locale['button[1]'] ,ui: 'decline' ,handler: 'doCancel' } diff --git a/app/view/add/AddController.js b/app/view/add/AddController.js index 18e74cc4..09a0b581 100644 --- a/app/view/add/AddController.js +++ b/app/view/add/AddController.js @@ -66,7 +66,7 @@ Ext.define('Rambox.view.add.AddController', { } // Apply the JS Code of the Tab if ( win.down('textarea').isDirty() ) { - Ext.Msg.confirm('CUSTOM CODE', 'Rambox needs to reload the service to execute the new JavaScript code. Do you want to do it now?', function( btnId ) { + Ext.Msg.confirm(locale['app.window[8]'].toUpperCase(), 'Rambox needs to reload the service to execute the new JavaScript code. Do you want to do it now?', function( btnId ) { if ( btnId === 'yes' ) view.reloadService(); }); } diff --git a/app/view/main/About.js b/app/view/main/About.js index 26417588..24e3c856 100644 --- a/app/view/main/About.js +++ b/app/view/main/About.js @@ -1,13 +1,13 @@ Ext.define('Rambox.view.main.About', { extend: 'Ext.window.Window' ,xtype: 'about' - ,title: 'About Rambox' + ,title: locale['app.about[0]'] ,autoShow: true ,modal: true ,resizable: false ,constrain: true ,width: 300 - ,height: 385 + ,height: 450 ,bodyPadding: 10 ,data: { version: require('electron').remote.app.getVersion() @@ -19,15 +19,15 @@ Ext.define('Rambox.view.main.About', { } ,tpl: [ '
' - ,'

Free, Open Source and Cross Platform messaging and emailing app that combines common web applications into one.

' - ,'
Version: {version}
' - ,'
Platform: {platform} ({arch})
' + ,'

'+locale['app.about[1]']+'

' + ,'
'+locale['app.about[2]']+': {version}
' + ,'
'+locale['app.about[3]']+': {platform} ({arch})
' ,'
Electron: {electron}
' ,'
Chromium: {chromium}
' ,'
Node: {node}
' ,'
' - ,'' + ,'' ,'
' - ,'
Developed by Ramiro Saenz
' + ,'
'+locale['app.about[4]']+' Ramiro Saenz
' ] }); diff --git a/app/view/main/Main.js b/app/view/main/Main.js index 3a18be6a..bc0ba841 100644 --- a/app/view/main/Main.js +++ b/app/view/main/Main.js @@ -37,7 +37,7 @@ Ext.define('Rambox.view.main.Main', { ,items: [ { xtype: 'panel' - ,title: 'Add a new Service' + ,title: locale['app.main[0]'] ,margin: '0 5 0 0' ,flex: 1 ,header: { height: 50 } @@ -47,7 +47,7 @@ Ext.define('Rambox.view.main.Main', { ,items: [ { xtype: 'checkbox' - ,boxLabel: 'Messaging' + ,boxLabel: locale['app.main[1]'] ,name: 'messaging' ,checked: true ,uncheckedValue: false @@ -55,7 +55,7 @@ Ext.define('Rambox.view.main.Main', { } ,{ xtype: 'checkbox' - ,boxLabel: 'Email' + ,boxLabel: locale['app.main[2]'] ,margin: '0 10 0 10' ,name: 'email' ,checked: true @@ -104,7 +104,7 @@ Ext.define('Rambox.view.main.Main', { ,'' ,'' ] - ,emptyText: '
No services found... Try another search.
' + ,emptyText: '
'+locale['app.main[3]']+'
' ,listeners: { itemclick: 'onNewServiceSelect' } @@ -113,7 +113,7 @@ Ext.define('Rambox.view.main.Main', { } ,{ xtype: 'grid' - ,title: 'Enabled Services' + ,title: locale['app.main[4]'] ,store: 'Services' ,hideHeaders: true ,margin: '0 0 0 5' @@ -123,7 +123,7 @@ Ext.define('Rambox.view.main.Main', { { ftype:'grouping' ,collapsible: false - ,groupHeaderTpl: '{columnName:uppercase}: {name:capitalize} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})' + ,groupHeaderTpl: '{columnName:uppercase}: {name:capitalize} ({rows.length} {[values.rows.length > 1 ? "'+locale['app.main[9]']+'" : "'+locale['app.main[8]']+'"]})' } ] ,plugins: { @@ -135,7 +135,7 @@ Ext.define('Rambox.view.main.Main', { xtype: 'button' ,glyph: 'xf1f8@FontAwesome' ,baseCls: '' - ,tooltip: 'Remove all Services' + ,tooltip: locale['app.main[10]'] ,handler: 'removeAllServices' } ] @@ -162,14 +162,14 @@ Ext.define('Rambox.view.main.Main', { ,items: [ { glyph: 0xf1f7 - ,tooltip: 'Prevent notifications' + ,tooltip: locale['app.main[11]'] ,getClass: function( value, metaData, record, rowIndex, colIndex, store, view ){ if ( record.get('notifications') ) return 'x-hidden'; } } ,{ glyph: 0xf026 - ,tooltip: 'Muted' + ,tooltip: locale['app.main[12]'] ,getClass: function( value, metaData, record, rowIndex, colIndex, store, view ){ if ( !record.get('muted') ) return 'x-hidden'; } @@ -183,13 +183,13 @@ Ext.define('Rambox.view.main.Main', { ,items: [ { glyph: 0xf013 - ,tooltip: 'Configure' + ,tooltip: locale['app.main[13]'] ,handler: 'configureService' ,getClass: function(){ return 'x-hidden-display'; } } ,{ glyph: 0xf1f8 - ,tooltip: 'Remove' + ,tooltip: locale['app.main[14]'] ,handler: 'removeService' ,getClass: function(){ return 'x-hidden-display'; } } @@ -209,7 +209,7 @@ Ext.define('Rambox.view.main.Main', { } ] ,viewConfig: { - emptyText: 'No services added...' + emptyText: locale['app.main[15]'] ,forceFit: true ,stripeRows: true } @@ -228,8 +228,8 @@ Ext.define('Rambox.view.main.Main', { ,items: [ { glyph: 'xf1f7@FontAwesome' - ,text: 'Don\'t Disturb: '+(JSON.parse(localStorage.getItem('dontDisturb')) ? 'ON' : 'OFF') - ,tooltip: 'Disable notifications and sounds in all services. Perfect to be concentrated and focused.
Shortcut key: F1' + ,text: locale['app.main[16]']+': '+(JSON.parse(localStorage.getItem('dontDisturb')) ? locale['app.window[20]'] : locale['app.window[21]']) + ,tooltip: locale['app.main[17]']+'
'+locale['app.main[18]']+': F1' ,enableToggle: true ,handler: 'dontDisturb' ,reference: 'disturbBtn' @@ -238,8 +238,8 @@ Ext.define('Rambox.view.main.Main', { } ,{ glyph: 'xf023@FontAwesome' - ,text: 'Lock Rambox' - ,tooltip: 'Lock this app if you will be away for a period of time.
Shortcut key: F2' + ,text: locale['app.main[19]'] + ,tooltip: locale['app.main[20]']+'
'+locale['app.main[18]']+': F2' ,handler: 'lockRambox' ,id: 'lockRamboxBtn' } @@ -294,24 +294,24 @@ Ext.define('Rambox.view.main.Main', { } ,'-' ,{ - text: 'Logout' + text: locale['app.main[21]'] ,glyph: 'xf08b@FontAwesome' ,handler: 'logout' } ] } ,{ - text: 'Login' + text: locale['app.main[22]'] ,icon: 'resources/auth0.png' ,id: 'loginBtn' - ,tooltip: 'Login to save your configuration (no credentials stored) to sync with all your computers.

Powered by Auth0 (http://auth0.com)' + ,tooltip: locale['app.main[23]']+'

'+locale['app.main[24]']+' Auth0 (http://auth0.com)' ,bind: { hidden: '{username}' } ,handler: 'login' } ,{ - tooltip: 'Preferences' + tooltip: locale['preferences[0]'] ,glyph: 'xf013@FontAwesome' ,handler: 'openPreferences' } @@ -327,7 +327,7 @@ Ext.define('Rambox.view.main.Main', { ,pressed: true } ,{ - text: 'Donation' + text: locale['app.main[25]'] ,glyph: 'xf21e@FontAwesome' ,handler: 'showDonate' } @@ -341,7 +341,7 @@ Ext.define('Rambox.view.main.Main', { ,'->' ,{ xtype: 'label' - ,html: ' with from Argentina as an Open Source project.' + ,html: ' '+locale['app.main[26]']+' '+locale['app.main[27]'].replace('Argentina', 'Argentina') } ,'->' ,{ diff --git a/app/view/main/MainController.js b/app/view/main/MainController.js index 9be48271..5c780959 100644 --- a/app/view/main/MainController.js +++ b/app/view/main/MainController.js @@ -106,7 +106,7 @@ Ext.define('Rambox.view.main.MainController', { ,removeService: function( gridView, rowIndex, colIndex, col, e, rec, rowEl ) { var me = this; - Ext.Msg.confirm('Please confirm...', 'Are you sure you want to remove '+rec.get('name')+'?', function(btnId) { + Ext.Msg.confirm(locale['app.window[12]'], locale['app.window[13]']+' '+rec.get('name')+'?', function(btnId) { if ( btnId === 'yes' ) me.removeServiceFn(rec.get('id')); }); } @@ -118,7 +118,7 @@ Ext.define('Rambox.view.main.MainController', { document.title = 'Rambox'; if ( btn ) { - Ext.Msg.confirm('Please confirm...', 'Are you sure you want to remove all services?', function(btnId) { + Ext.Msg.confirm(locale['app.window[12]'], locale['app.window[14]'], function(btnId) { if ( btnId === 'yes' ) { Ext.cq1('app-main').suspendEvent('remove'); Ext.getStore('Services').load(); @@ -227,7 +227,7 @@ Ext.define('Rambox.view.main.MainController', { localStorage.setItem('dontDisturb', btn.pressed); - btn.setText('Don\'t Disturb: ' + ( btn.pressed ? 'ON' : 'OFF' )); + btn.setText(locale['app.main[16]']+': ' + ( btn.pressed ? locale['app.window[20]'] : locale['app.window[21]'] )); // If this method is called from Lock method, prevent showing toast if ( !e ) return; @@ -244,7 +244,7 @@ Ext.define('Rambox.view.main.MainController', { var me = this; if ( ipc.sendSync('getConfig').master_password ) { - Ext.Msg.confirm('Lock Rambox', 'Do you want to use the Master Password as your temporal password?', function(btnId) { + Ext.Msg.confirm(locale['app.main[19]'], 'Do you want to use the Master Password as your temporal password?', function(btnId) { if ( btnId === 'yes' ) { setLock(ipc.sendSync('getConfig').master_password); } else { @@ -256,14 +256,14 @@ Ext.define('Rambox.view.main.MainController', { } function showTempPass() { - var msgbox = Ext.Msg.prompt('Lock Rambox', 'Enter a temporal password to unlock it later', function(btnId, text) { + var msgbox = Ext.Msg.prompt(locale['app.main[19]'], locale['app.window[22]'], function(btnId, text) { if ( btnId === 'ok' ) { - var msgbox2 = Ext.Msg.prompt('Lock Rambox', 'Repeat the temporal password', function(btnId, text2) { + var msgbox2 = Ext.Msg.prompt(locale['app.main[19]'], locale['app.window[23]'], function(btnId, text2) { if ( btnId === 'ok' ) { if ( text !== text2 ) { Ext.Msg.show({ - title: 'Warning' - ,message: 'Passwords are not the same. Please try again...' + title: locale['app.window[24]'] + ,message: locale['app.window[25]'] ,icon: Ext.Msg.WARNING ,buttons: Ext.Msg.OK ,fn: me.lockRambox @@ -337,7 +337,7 @@ Ext.define('Rambox.view.main.MainController', { xtype: 'component' ,autoEl: { tag: 'h1' - ,html: 'Rambox is locked' + ,html: locale['app.window[26]'] ,style: 'text-align:center;width:256px;' } } @@ -355,7 +355,7 @@ Ext.define('Rambox.view.main.MainController', { } ,{ xtype: 'button' - ,text: 'UNLOCK' + ,text: locale['app.window[27]'] ,glyph: 'xf13e@FontAwesome' ,width: 256 ,scale: 'large' @@ -384,7 +384,7 @@ Ext.define('Rambox.view.main.MainController', { var me = this; var logoutFn = function(callback) { - Ext.Msg.wait('Closing you session...', 'Logout'); + Ext.Msg.wait(locale['app.window[37]'], locale['app.main[21]']); // Google Analytics Event ga_storage._trackEvent('Users', 'loggedOut'); @@ -401,7 +401,7 @@ Ext.define('Rambox.view.main.MainController', { } if ( btn ) { - Ext.Msg.confirm('Logout', 'Are you sure you want to logout?', function(btnId) { + Ext.Msg.confirm(locale['app.main[21]'], locale['app.window[38]'], function(btnId) { if ( btnId === 'yes' ) { logoutFn(function() { me.removeAllServices(); diff --git a/app/view/preferences/Preferences.js b/app/view/preferences/Preferences.js index 4d5733d8..27df1f2b 100644 --- a/app/view/preferences/Preferences.js +++ b/app/view/preferences/Preferences.js @@ -14,7 +14,7 @@ Ext.define('Rambox.view.preferences.Preferences',{ type: 'preferences-preferences' } - ,title: 'Preferences' + ,title: locale['preferences[0]'] ,width: 420 ,modal: true ,closable: true @@ -24,13 +24,13 @@ Ext.define('Rambox.view.preferences.Preferences',{ ,resizable: false ,buttons: [ { - text: 'Cancel' + text: locale['button[1]'] ,ui: 'decline' ,handler: 'cancel' } ,'->' ,{ - text: 'Save' + text: locale['button[4]'] ,handler: 'save' } ] @@ -44,21 +44,73 @@ Ext.define('Rambox.view.preferences.Preferences',{ ,bodyPadding: 20 ,items: [ { + xtype: 'container' + ,layout: 'hbox' + ,items: [ + { + xtype: 'combo' + ,name: 'locale' + ,fieldLabel: 'Language' + ,labelAlign: 'left' + ,flex: 1 + ,labelWidth: 80 + ,value: config.locale + ,displayField: 'label' + ,valueField: 'value' + ,editable: false + ,store: Ext.create('Ext.data.Store', { + fields: ['value', 'label'] + ,data: [ + { 'value': 'ar', 'auth0': 'en', 'label': 'Arabic' } + ,{ 'value': 'cs', 'auth0': 'cs', 'label': 'Czech' } + ,{ 'value': 'nl', 'auth0': 'nl', 'label': 'Dutch' } + ,{ 'value': 'en', 'auth0': 'en', 'label': 'English' } + ,{ 'value': 'fr', 'auth0': 'fr', 'label': 'French' } + ,{ 'value': 'de', 'auth0': 'de', 'label': 'German' } + ,{ 'value': 'el', 'auth0': 'en', 'label': 'Greek' } + ,{ 'value': 'id', 'auth0': 'en', 'label': 'Indonesian' } + ,{ 'value': 'it', 'auth0': 'it', 'label': 'Italian' } + ,{ 'value': 'ko', 'auth0': 'en', 'label': 'Korean' } + ,{ 'value': 'fa', 'auth0': 'fa', 'label': 'Persian' } + ,{ 'value': 'pl', 'auth0': 'pl', 'label': 'Polish' } + ,{ 'value': 'pt-PT', 'auth0': 'pt-br', 'label': 'Portuguese' } + ,{ 'value': 'pt-BR', 'auth0': 'pt-br', 'label': 'Portuguese (Brazilian)' } + ,{ 'value': 'ru', 'auth0': 'ru', 'label': 'Russian' } + ,{ 'value': 'es-ES', 'auth0': 'es', 'label': 'Spanish' } + ,{ 'value': 'tr', 'auth0': 'tr', 'label': 'Turkish' } + ] + }) + } + ,{ + xtype: 'button' + ,text: 'Help us Translate' + ,style: 'border-top-left-radius:0;border-bottom-left-radius:0;' + ,href: 'https://crowdin.com/project/rambox/invite' + } + ] + } + ,{ + xtype: 'label' + ,text: 'English is the only language that has full translation. We are working with all the others, help us!' + ,style: 'display:block;font-size:10px;line-height:15px;' + ,margin: '0 0 10 0' + } + ,{ xtype: 'checkbox' ,name: 'auto_launch' - ,boxLabel: 'Start automatically on system startup' + ,boxLabel: locale['preferences[5]'] ,value: config.auto_launch } ,{ xtype: 'checkbox' ,name: 'start_minimized' - ,boxLabel: 'Start minimized' + ,boxLabel: locale['preferences[4]'] ,value: config.start_minimized } ,{ xtype: 'checkbox' ,name: 'hide_menu_bar' - ,boxLabel: 'Auto-hide Menu bar (Alt key to display)' + ,boxLabel: locale['preferences[1]']+' (Alt key to display)' ,value: config.hide_menu_bar ,hidden: process.platform !== 'win32' } diff --git a/app/view/preferences/PreferencesController.js b/app/view/preferences/PreferencesController.js index c90e9aec..5d356718 100644 --- a/app/view/preferences/PreferencesController.js +++ b/app/view/preferences/PreferencesController.js @@ -39,6 +39,15 @@ Ext.define('Rambox.view.preferences.PreferencesController', { // Proxy if ( values.proxy && (Ext.isEmpty(values.proxyHost) || Ext.isEmpty(values.proxyPort)) ) return; + // Locale + if ( values.locale !== ipc.sendSync('getConfig').locale ) { + localStorage.setItem('locale', values.locale); + localStorage.setItem('locale-auth0', me.getView().down('form').down('combo[name="locale"]').getSelection().get('auth0')); + Ext.Msg.confirm('Action required', 'To change the language of Rambox, you need to reload the app. Do you want to do it now?', function(btnId) { + if ( btnId === 'yes' ) ipc.send('relaunchApp'); + }); + } + ipc.send('setConfig', values); me.getView().close(); } diff --git a/electron/main.js b/electron/main.js index bc6b7241..1c6c6ca6 100644 --- a/electron/main.js +++ b/electron/main.js @@ -1,8 +1,6 @@ 'use strict'; const {app, protocol, BrowserWindow, dialog, shell, Menu, ipcMain, nativeImage, session} = require('electron'); -// Menu -const appMenu = require('./menu'); // Tray const tray = require('./tray'); // AutoLaunch @@ -32,6 +30,7 @@ const config = new Config({ ,proxy: false ,proxyHost: '' ,proxyPort: '' + ,locale: 'en' ,x: undefined ,y: undefined @@ -41,6 +40,9 @@ const config = new Config({ } }); +// Menu +const appMenu = require('./menu')(config); + // Configure AutoLaunch const appLauncher = new AutoLaunch({ name: 'Rambox' @@ -307,6 +309,17 @@ ipcMain.on('setServiceNotifications', function(event, partition, op) { }); }); +// Reload app +ipcMain.on('reloadApp', function(event) { + mainWindow.reload(); +}); + +// Relaunch app +ipcMain.on('relaunchApp', function(event) { + app.relaunch(); + app.exit(0); +}); + const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => { // Someone tried to run a second instance, we should focus our window. if (mainWindow) { diff --git a/electron/menu.js b/electron/menu.js index cc703ec5..da6aa85f 100644 --- a/electron/menu.js +++ b/electron/menu.js @@ -16,285 +16,296 @@ function sendAction(action) { win.webContents.send(action); } -const helpSubmenu = [ - { - label: `&Visit ${appName} Website`, - click() { - shell.openExternal('http://rambox.pro'); - } - }, - { - label: `&Facebook`, - click() { - shell.openExternal('https://www.facebook.com/ramboxapp'); - } - }, - { - label: `&Twitter`, - click() { - shell.openExternal('https://www.twitter.com/ramboxapp'); - } - }, - { - label: `&GitHub`, - click() { - shell.openExternal('https://www.github.com/saenzramiro/rambox'); - } - }, - { - type: 'separator' - }, - { - label: '&Report an Issue...', - click() { - const body = ` - +module.exports = function(config) { + const locale = require('../resources/languages/'+config.get('locale')); + const helpSubmenu = [ + { + label: `&`+locale['menu.help[0]'], + click() { + shell.openExternal('http://rambox.pro'); + } + }, + { + label: `&Facebook`, + click() { + shell.openExternal('https://www.facebook.com/ramboxapp'); + } + }, + { + label: `&Twitter`, + click() { + shell.openExternal('https://www.twitter.com/ramboxapp'); + } + }, + { + label: `&GitHub`, + click() { + shell.openExternal('https://www.github.com/saenzramiro/rambox'); + } + }, + { + type: 'separator' + }, + { + label: '&'+locale['menu.help[1]'], + click() { + const body = ` + - -- -> ${app.getName()} ${app.getVersion()} -> Electron ${process.versions.electron} -> ${process.platform} ${process.arch} ${os.release()}`; + + - + > ${app.getName()} ${app.getVersion()} + > Electron ${process.versions.electron} + > ${process.platform} ${process.arch} ${os.release()}`; - shell.openExternal(`https://github.com/saenzramiro/rambox/issues/new?body=${encodeURIComponent(body)}`); - } - }, - { - label: `&Ask for Help`, - click() { - shell.openExternal('https://gitter.im/saenzramiro/rambox'); - } - }, - { - label: `&Tools`, - submenu: [ - { - label: `&Clear Cache`, - click(item, win) { - win.webContents.session.clearCache(function() { - win.reload(); - }); - } - }, - { - label: `&Clear Local Storage`, - click(item, win) { - win.webContents.session.clearStorageData({ - storages: ['localstorage'] - }, function() { - win.reload(); - }); + shell.openExternal(`https://github.com/saenzramiro/rambox/issues/new?body=${encodeURIComponent(body)}`); + } + }, + { + label: `&`+locale['menu.help[2]'], + click() { + shell.openExternal('https://gitter.im/saenzramiro/rambox'); + } + }, + { + label: `&Tools`, + submenu: [ + { + label: `&Clear Cache`, + click(item, win) { + win.webContents.session.clearCache(function() { + win.reload(); + }); + } + }, + { + label: `&Clear Local Storage`, + click(item, win) { + win.webContents.session.clearStorageData({ + storages: ['localstorage'] + }, function() { + win.reload(); + }); + } } + ] + }, + { + type: 'separator' + }, + { + label: `&`+locale['menu.help[3]'], + click() { + shell.openExternal('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WU75QWS7LH2CA'); } - ] - }, - { - type: 'separator' - }, - { - label: `&Donate`, - click() { - shell.openExternal('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WU75QWS7LH2CA'); } - } -]; + ]; -let tpl = [ - { - label: '&Edit', - submenu: [ - { - role: 'undo' - }, - { - role: 'redo' - }, - { - type: 'separator' - }, - { - role: 'cut' - }, - { - role: 'copy' - }, - { - role: 'paste' - }, - { - role: 'pasteandmatchstyle' - }, - { - role: 'selectall' - }, - { - role: 'delete' - } - ] - }, - { - label: '&View', - submenu: [ - { - label: '&Reload', - accelerator: 'CmdOrCtrl+R', - click(item, focusedWindow) { - if (focusedWindow) focusedWindow.reload(); + let tpl = [ + { + label: '&'+locale['menu.edit[0]'], + submenu: [ + { + role: 'undo' + ,label: locale['menu.edit[1]'] + }, + { + role: 'redo' + ,label: locale['menu.edit[2]'] + }, + { + type: 'separator' + }, + { + role: 'cut' + ,label: locale['menu.edit[3]'] + }, + { + role: 'copy' + ,label: locale['menu.edit[4]'] + }, + { + role: 'paste' + ,label: locale['menu.edit[5]'] + }, + { + role: 'pasteandmatchstyle' + }, + { + role: 'selectall' + ,label: locale['menu.edit[6]'] + }, + { + role: 'delete' } - }, - { - label: '&Reload current Service', - accelerator: 'CmdOrCtrl+Shift+R', - click() { - sendAction('reloadCurrentService'); + ] + }, + { + label: '&'+locale['menu.view[0]'], + submenu: [ + { + label: '&'+locale['menu.view[1]'], + accelerator: 'CmdOrCtrl+R', + click(item, focusedWindow) { + if (focusedWindow) focusedWindow.reload(); + } + }, + { + label: '&Reload current Service', + accelerator: 'CmdOrCtrl+Shift+R', + click() { + sendAction('reloadCurrentService'); + } + }, + { + type: 'separator' + }, + { + role: 'zoomin' + }, + { + role: 'zoomout' + }, + { + role: 'resetzoom' } - }, - { - type: 'separator' - }, - { - role: 'zoomin' - }, - { - role: 'zoomout' - }, - { - role: 'resetzoom' - } - ] - }, - { - label: '&Window', - role: 'window', - submenu: [ - { - label: '&Minimize', - accelerator: 'CmdOrCtrl+M', - role: 'minimize' - }, - { - label: '&Close', - accelerator: 'CmdOrCtrl+W', - role: 'close' - }, - { - type: 'separator' - }, - { - role: 'togglefullscreen' - }, - { - label: '&Toggle Developer Tools', - accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I', - click(item, focusedWindow) { - if (focusedWindow) focusedWindow.webContents.toggleDevTools(); + ] + }, + { + label: '&'+locale['menu.window[0]'], + role: 'window', + submenu: [ + { + label: '&'+locale['menu.window[1]'], + accelerator: 'CmdOrCtrl+M', + role: 'minimize' + }, + { + label: '&'+locale['menu.window[2]'], + accelerator: 'CmdOrCtrl+W', + role: 'close' + }, + { + type: 'separator' + }, + { + role: 'togglefullscreen' + ,label: locale['menu.view[2]'] + }, + { + label: '&'+locale['menu.view[3]'], + accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I', + click(item, focusedWindow) { + if (focusedWindow) focusedWindow.webContents.toggleDevTools(); + } } - } - ] - }, - { - label: '&Help', - role: 'help' - } -]; + ] + }, + { + label: '&'+locale['menu.help[4]'], + role: 'help' + } + ]; -if (process.platform === 'darwin') { - tpl.unshift({ - label: appName, - submenu: [ - { - label: 'Preferences', - click() { - sendAction('showPreferences') - } - }, - { - label: `Check for updates...`, - click(item, win) { - const webContents = win.webContents; - const send = webContents.send.bind(win.webContents); - send('autoUpdater:check-update'); + if (process.platform === 'darwin') { + tpl.unshift({ + label: appName, + submenu: [ + { + label: locale['preferences[0]'], + click() { + sendAction('showPreferences') + } + }, + { + label: locale['menu.help[5]'], + click(item, win) { + const webContents = win.webContents; + const send = webContents.send.bind(win.webContents); + send('autoUpdater:check-update'); + } + }, + { + label: locale['menu.help[6]'], + click() { + sendAction('showAbout') + } + }, + { + type: 'separator' + }, + { + label: locale['menu.osx[0]'], + role: 'services', + submenu: [] + }, + { + type: 'separator' + }, + { + label: locale['menu.osx[1]'], + accelerator: 'Command+H', + role: 'hide' + }, + { + label: locale['menu.osx[2]'], + accelerator: 'Command+Alt+H', + role: 'hideothers' + }, + { + label: locale['menu.osx[3]'], + role: 'unhide' + }, + { + type: 'separator' + }, + { + role: 'quit', + label: locale['tray[1]'] } - }, - { - label: `About ${appName}`, - click() { - sendAction('showAbout') + ] + }); + } else { + tpl.unshift({ + label: '&'+locale['menu.file[0]'], + submenu: [ + { + label: locale['preferences[0]'], + click() { + sendAction('showPreferences') + } + }, + { + type: 'separator' + }, + { + role: 'quit', + label: locale['menu.file[1]'] } - }, - { - type: 'separator' - }, - { - label: 'Services', - role: 'services', - submenu: [] - }, - { - type: 'separator' - }, - { - label: `Hide ${appName}`, - accelerator: 'Command+H', - role: 'hide' - }, - { - label: 'Hide Others', - accelerator: 'Command+Alt+H', - role: 'hideothers' - }, - { - label: 'Show All', - role: 'unhide' - }, - { - type: 'separator' - }, - { - role: 'quit' + ] + }); + helpSubmenu.push({ + type: 'separator' + }); + helpSubmenu.push({ + label: `&`+locale['menu.help[5]'], + click(item, win) { + const webContents = win.webContents; + const send = webContents.send.bind(win.webContents); + send('autoUpdater:check-update'); } - ] - }); -} else { - tpl.unshift({ - label: '&File', - submenu: [ - { - label: 'Preferences', - click() { - sendAction('showPreferences') - } - }, - { - type: 'separator' - }, - { - role: 'quit' + }); + helpSubmenu.push({ + label: `&`+locale['menu.help[6]'], + click() { + sendAction('showAbout') } - ] - }); - helpSubmenu.push({ - type: 'separator' - }); - helpSubmenu.push({ - label: `&Check for updates...`, - click(item, win) { - const webContents = win.webContents; - const send = webContents.send.bind(win.webContents); - send('autoUpdater:check-update'); - } - }); - helpSubmenu.push({ - label: `&About ${appName}`, - click() { - sendAction('showAbout') - } - }); -} + }); + } -tpl[tpl.length - 1].submenu = helpSubmenu; + tpl[tpl.length - 1].submenu = helpSubmenu; -var menu = electron.Menu.buildFromTemplate(tpl); -module.exports = menu; + return electron.Menu.buildFromTemplate(tpl); +}; diff --git a/index.html b/index.html index 54cabb52..5891201c 100644 --- a/index.html +++ b/index.html @@ -33,6 +33,16 @@ + + + +