Added russian translation by Alexander Simkin, LICENSE file and minor changes
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..23b8b3e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Adrià Vilanova Martínez
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
diff --git a/_locales/ca/messages.json b/_locales/ca/messages.json
index a825ecd..e99d7b8 100644
--- a/_locales/ca/messages.json
+++ b/_locales/ca/messages.json
@@ -15,6 +15,16 @@
"message": "Tradueix la selecció al...",
"description": "Title of the context menu that appears when a right click is done. Inside this prent menu there are the menus"
},
+ "contextmenu_title2" : {
+ "message": "Tradueix la selecció a '$language$'",
+ "description": "Title of the context menu that appears when a right click is done and there's only one language available.",
+ "placeholders": {
+ "language": {
+ "content": "$1",
+ "example": "Language to translate into."
+ }
+ }
+ },
"contextmenu_edit" : {
"message": "Edita idiomes...",
"description": "Title of the option inside the 'Translate section into...' context menu."
diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index 66ae9cd..fd9fb40 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -15,6 +15,16 @@
"message": "Translate selection into...",
"description": "Title of the context menu that appears when a right click is done. Inside this parent menu there are the menus"
},
+ "contextmenu_title2" : {
+ "message": "Translate selection into '$language$'",
+ "description": "Title of the context menu that appears when a right click is done and there's only one language available.",
+ "placeholders": {
+ "language": {
+ "content": "$1",
+ "example": "Language to translate into."
+ }
+ }
+ },
"contextmenu_edit": {
"message": "Edit languages...",
"description": "Title of the option inside the 'Translate section into...' context menu."
diff --git a/_locales/es/messages.json b/_locales/es/messages.json
index a33c70f..b643411 100644
--- a/_locales/es/messages.json
+++ b/_locales/es/messages.json
@@ -15,6 +15,16 @@
"message": "Traducir selección al...",
"description": "Title of the context menu that appears when a right click is done. Inside this prent menu there are the menus"
},
+ "contextmenu_title2" : {
+ "message": "Traducir selección al '$language$'",
+ "description": "Title of the context menu that appears when a right click is done and there's only one language available.",
+ "placeholders": {
+ "language": {
+ "content": "$1",
+ "example": "Language to translate into."
+ }
+ }
+ },
"contextmenu_edit" : {
"message": "Modifica idiomas...",
"description": "Title of the option inside the 'Translate section into...' context menu."
diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json
new file mode 100644
index 0000000..7c8503b
--- /dev/null
+++ b/_locales/ru/messages.json
@@ -0,0 +1,73 @@
+/*
+ * Translation contributed by Alexander Simkin
+ *
+ *
+ */
+{
+ "appName": {
+ "message": "Перевести выбранный текст",
+ "description": "The app name"
+ },
+ "appBetaName": {
+ "message": "Перевести выбранный текст (Beta)",
+ "description": "The beta app name"
+ },
+ "appDescription": {
+ "message": "Перевод выбранного текста с помощью Google Переводчика",
+ "description": "The app description"
+ },
+ "contextmenu_title": {
+ "message": "Перевести на...",
+ "description": "Title of the context menu that appears when a right click is done. Inside this parent menu there are the menus"
+ },
+ "contextmenu_title2" : {
+ "message": "Перевести на '$language$'",
+ "description": "Title of the context menu that appears when a right click is done and there's only one language available.",
+ "placeholders": {
+ "language": {
+ "content": "$1",
+ "example": "Language to translate into."
+ }
+ }
+ },
+ "contextmenu_edit": {
+ "message": "Настройки...",
+ "description": "Title of the option inside the 'Translate section into...' context menu."
+ },
+ "options_welcome": {
+ "message": "Добро пожаловать!",
+ "description": "Title of the options page"
+ },
+ "options_introduction": {
+ "message": "Выберите языки, которые вы хотите видеть в контекстном меню.",
+ "description": "Introduction paragraph to the options pages"
+ },
+ "options_languageselectheader": {
+ "message": "Языки:",
+ "description": "Header of the language select option."
+ },
+ "options_otheroptionsheader": {
+ "message": "Другие опции:",
+ "description": "Header of the options page."
+ },
+ "options_tabsoption_1": {
+ "message": "Открывать вкладку Google Переводчика в новой вкладке для каждого перевода.",
+ "description": "Option which defines how should the app behave in relation to tabs."
+ },
+ "options_tabsoption_2": {
+ "message": "Открывать Google Переводчик в одной вкладке, и перезаписывать предыдущие результаты, вместо открытия нескольких вкладок.",
+ "description": "Option which defines how should the app behave in relation to tabs."
+ },
+ "options_tabsoption_3": {
+ "message": "Открыть Google Переводчик в новой панели и перезаписать последний результат перевода (нужно активировать флаг <a href='chrome://flags/#enable-panels' id='panelsflag'>--enable-panels</a>). <sup style='color:red; font-weight: bold;'>ЭКСПЕРИМЕНТАЛЬНАЯ ФУНКЦИЯ</sup>",
+ "description": "Option which defines how should the app behave in relation to tabs."
+ },
+ "options_savebutton": {
+ "message": "Сохранить",
+ "description": "Save button in the settings page"
+ },
+ "notification_install_title": { "message": "Спасибо за установку \"Перевести выбранный текст\"" },
+ "notification_install_message": { "message": "Нажмите сюда, чтобы настроить расширение." },
+ "notification_upgradedtostorage_title": { "message": "\"Перевести выбранный текст\" было обновлено до 0.6!" },
+ "notification_upgradedtostorage_message": { "message": "Теперь настройки расширения будут синхронизироваться со всеми вашими устройствами, но придётся настроить расширение снова :-( Нажмите сюда, чтобы настроить расширение." }
+}
\ No newline at end of file
diff --git a/background.js b/background.js
index ec92764..a82ee27 100644
--- a/background.js
+++ b/background.js
@@ -55,21 +55,41 @@
chrome.storage.sync.get("languages", function(items) {
chrome.contextMenus.removeAll();
- var parent = chrome.contextMenus.create({"title": chrome.i18n.getMessage("contextmenu_title"), "contexts":["selection"]});
+ var count = 0, singleone = true;
for (var language in items.languages) {
- var languagem = isoLangs[language];
- var title = languagem.name + " ("+languagem.nativeName+")";
- var id = chrome.contextMenus.create({"title": title, "parentId": parent, "contexts":["selection"], "onclick": click});
- array_elements[id] = new Array();
- array_elements[id]["langCode"] = language;
- array_elements[id]["langName"] = languagem.name;
- array_elements[id]["langNativeName"] = language.nativeName;
+ if (count == 0) {
+ count++;
+ } else {
+ singleone = false;
+ break;
+ }
}
- var id = chrome.contextMenus.create({"type": "separator","parentId": parent, "contexts":["selection"], "onclick": click2});
-
- var id = chrome.contextMenus.create({"title": chrome.i18n.getMessage("contextmenu_edit"), "parentId": parent, "contexts":["selection"], "onclick": click2});
+ if (singleone) {
+ for (var language in items.languages) {
+ var languagem = isoLangs[language];
+ var title = languagem.name + " ("+languagem.nativeName+")";
+ var parent = chrome.contextMenus.create({"title": chrome.i18n.getMessage("contextmenu_title2", languagem.name), "contexts": ["selection"], "onclick": click});
+ array_elements[parent] = new Array();
+ array_elements[parent]["langCode"] = language;
+ array_elements[parent]["langName"] = languagem.name;
+ array_elements[parent]["langNativeName"] = language.nativeName;
+ }
+ } else {
+ var parent = chrome.contextMenus.create({"title": chrome.i18n.getMessage("contextmenu_title"), "contexts": ["selection"]});
+ for (var language in items.languages) {
+ var languagem = isoLangs[language];
+ var title = languagem.name + " ("+languagem.nativeName+")";
+ var id = chrome.contextMenus.create({"title": title, "parentId": parent, "contexts":["selection"], "onclick": click});
+ array_elements[id] = new Array();
+ array_elements[id]["langCode"] = language;
+ array_elements[id]["langName"] = languagem.name;
+ array_elements[id]["langNativeName"] = language.nativeName;
+ }
+ var id = chrome.contextMenus.create({"type": "separator","parentId": parent, "contexts":["selection"], "onclick": click2});
+ var id = chrome.contextMenus.create({"title": chrome.i18n.getMessage("contextmenu_edit"), "parentId": parent, "contexts":["selection"], "onclick": click2});
+ }
});
}
diff --git a/manifest.json b/manifest.json
index 567ee82..d742a5e 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,8 +1,8 @@
{
"manifest_version": 2,
- "name": "__MSG_appName__",
+ "name": "__MSG_appBetaName__",
"description": "__MSG_appDescription__",
- "version": "0.6.1.1",
+ "version": "0.6.2",
"permissions": [
"contextMenus",
"storage",
diff --git a/options.css b/options.css
index b4122d1..f1bc8ed 100644
--- a/options.css
+++ b/options.css
@@ -4,6 +4,7 @@
background-image: url('translate-1.png');
background-repeat: repeat;
background-position: left top;
+ font-size: 100%!important;
}
h1 {
text-align:center;