diff --git a/browser/base/content/browser-doctype.inc b/browser/base/content/browser-doctype.inc index cc1fb950f452..ad08f4b03464 100644 --- a/browser/base/content/browser-doctype.inc +++ b/browser/base/content/browser-doctype.inc @@ -3,8 +3,6 @@ %brandDTD; %browserDTD; - -%browserPocketDTD; %baseMenuDTD; diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index a8ae76c91a49..d219f9a81fc1 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -1563,25 +1563,6 @@ let BookmarkingUI = { updatePocketItemVisibility: function BUI_updatePocketItemVisibility(prefix) { let hidden = !CustomizableUI.getPlacementOfWidget("pocket-button"); - if (!hidden) { - let locale = Cc["@mozilla.org/chrome/chrome-registry;1"]. - getService(Ci.nsIXULChromeRegistry). - getSelectedLocale("browser"); - if (locale != "en-US") { - if (locale == "ja-JP-mac") - locale = "ja"; - let url = "chrome://browser/content/browser-pocket-" + locale + ".properties"; - let bundle = Services.strings.createBundle(url); - let item = document.getElementById(prefix + "pocket"); - try { - item.setAttribute("label", bundle.GetStringFromName("pocketMenuitem.label")); - } catch (err) { - // GetStringFromName throws when the bundle doesn't exist. In that - // case, the item will retain the browser-pocket.dtd en-US string that - // it has in the markup. - } - } - } document.getElementById(prefix + "pocket").hidden = hidden; document.getElementById(prefix + "pocketSeparator").hidden = hidden; }, diff --git a/browser/base/content/browser-pocket-de.properties b/browser/base/content/browser-pocket-de.properties deleted file mode 100644 index 77f3917b7575..000000000000 --- a/browser/base/content/browser-pocket-de.properties +++ /dev/null @@ -1,16 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# This is a temporary file, later versions of Firefox will use -# browser.properties in the usual L10N location. - -pocket-button.label = Pocket -pocket-button.tooltiptext = Bei Pocket speichern - -# From browser-pocket.dtd -saveToPocketCmd.label = Seite bei Pocket speichern -saveToPocketCmd.accesskey = k -saveLinkToPocketCmd.label = Link bei Pocket speichern -saveLinkToPocketCmd.accesskey = o -pocketMenuitem.label = Pocket-Liste anzeigen diff --git a/browser/base/content/browser-pocket-en-US.properties b/browser/base/content/browser-pocket-en-US.properties deleted file mode 100644 index d3f548cb80a0..000000000000 --- a/browser/base/content/browser-pocket-en-US.properties +++ /dev/null @@ -1,9 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# This is a temporary file, later versions of Firefox will use -# browser.properties in the usual L10N location. - -pocket-button.label = Pocket -pocket-button.tooltiptext = Save to Pocket diff --git a/browser/base/content/browser-pocket-es-ES.properties b/browser/base/content/browser-pocket-es-ES.properties deleted file mode 100644 index 419e1cbbfed3..000000000000 --- a/browser/base/content/browser-pocket-es-ES.properties +++ /dev/null @@ -1,16 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# This is a temporary file, later versions of Firefox will use -# browser.properties in the usual L10N location. - -pocket-button.label = Pocket -pocket-button.tooltiptext = Guardar en Pocket - -# From browser-pocket.dtd -saveToPocketCmd.label = Guardar página en Pocket -saveToPocketCmd.accesskey = k -saveLinkToPocketCmd.label = Guardar enlace en Pocket -saveLinkToPocketCmd.accesskey = k -pocketMenuitem.label = Ver lista de Pocket diff --git a/browser/base/content/browser-pocket-ja.properties b/browser/base/content/browser-pocket-ja.properties deleted file mode 100644 index 94c85ee6114f..000000000000 --- a/browser/base/content/browser-pocket-ja.properties +++ /dev/null @@ -1,16 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# This is a temporary file, later versions of Firefox will use -# browser.properties in the usual L10N location. - -pocket-button.label = Pocket -pocket-button.tooltiptext = Pocket に保存 - -# From browser-pocket.dtd -saveToPocketCmd.label = Pocket にページを保存 -saveToPocketCmd.accesskey = k -saveLinkToPocketCmd.label = Pocket にリンクを保存 -saveLinkToPocketCmd.accesskey = o -pocketMenuitem.label = Pocket のマイリストを表示 diff --git a/browser/base/content/browser-pocket-ru.properties b/browser/base/content/browser-pocket-ru.properties deleted file mode 100644 index 840e6de8c6fe..000000000000 --- a/browser/base/content/browser-pocket-ru.properties +++ /dev/null @@ -1,16 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# This is a temporary file, later versions of Firefox will use -# browser.properties in the usual L10N location. - -pocket-button.label = Pocket -pocket-button.tooltiptext = Сохранить в Pocket - -# From browser-pocket.dtd -saveToPocketCmd.label = Сохранить страницу в Pocket -saveToPocketCmd.accesskey = х -saveLinkToPocketCmd.label = Сохранить ссылку в Pocket -saveLinkToPocketCmd.accesskey = а -pocketMenuitem.label = Показать список Pocket diff --git a/browser/base/content/browser-pocket.dtd b/browser/base/content/browser-pocket.dtd deleted file mode 100644 index 460866f777ba..000000000000 --- a/browser/base/content/browser-pocket.dtd +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index 0dd166986cab..ca15a131ffa5 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -198,29 +198,6 @@ nsContextMenu.prototype = { (targetURI.schemeIs("about") && ReaderMode.getOriginalUrl(targetURI.spec))); canPocket = canPocket && window.gBrowser && this.browser.getTabBrowser() == window.gBrowser; - if (canPocket) { - let locale = Cc["@mozilla.org/chrome/chrome-registry;1"]. - getService(Ci.nsIXULChromeRegistry). - getSelectedLocale("browser"); - if (locale != "en-US") { - if (locale == "ja-JP-mac") - locale = "ja"; - let url = "chrome://browser/content/browser-pocket-" + locale + ".properties"; - let bundle = Services.strings.createBundle(url); - let saveToPocketItem = document.getElementById("context-pocket"); - let saveLinkToPocketItem = document.getElementById("context-savelinktopocket"); - try { - saveToPocketItem.setAttribute("label", bundle.GetStringFromName("saveToPocketCmd.label")); - saveToPocketItem.setAttribute("accesskey", bundle.GetStringFromName("saveToPocketCmd.accesskey")); - saveLinkToPocketItem.setAttribute("label", bundle.GetStringFromName("saveLinkToPocketCmd.label")); - saveLinkToPocketItem.setAttribute("accesskey", bundle.GetStringFromName("saveLinkToPocketCmd.accesskey")); - } catch (err) { - // GetStringFromName throws when the bundle doesn't exist. In that - // case, the item will retain the browser-pocket.dtd en-US string that - // it has in the markup. - } - } - } this.showItem("context-pocket", canPocket && showSaveCurrentPageToPocket); let showSaveLinkToPocket = canPocket && !showSaveCurrentPageToPocket && (this.onSaveableLink || this.onPlainTextLink); diff --git a/browser/base/content/web-panels.xul b/browser/base/content/web-panels.xul index 0b1f84e3f877..4a520befe9b2 100644 --- a/browser/base/content/web-panels.xul +++ b/browser/base/content/web-panels.xul @@ -12,8 +12,6 @@ %browserDTD; - -%browserPocketDTD; %textcontextDTD; ]> diff --git a/browser/base/jar.mn b/browser/base/jar.mn index 0f4d2da3874f..90aaf100dc3e 100644 --- a/browser/base/jar.mn +++ b/browser/base/jar.mn @@ -75,12 +75,6 @@ browser.jar: * content/browser/browser.css (content/browser.css) * content/browser/browser.js (content/browser.js) * content/browser/browser.xul (content/browser.xul) - content/browser/browser-pocket-en-US.properties (content/browser-pocket-en-US.properties) - content/browser/browser-pocket.dtd (content/browser-pocket.dtd) - content/browser/browser-pocket-de.properties (content/browser-pocket-de.properties) - content/browser/browser-pocket-es-ES.properties (content/browser-pocket-es-ES.properties) - content/browser/browser-pocket-ja.properties (content/browser-pocket-ja.properties) - content/browser/browser-pocket-ru.properties (content/browser-pocket-ru.properties) * content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml) * content/browser/chatWindow.xul (content/chatWindow.xul) content/browser/tab-content.js (content/tab-content.js) diff --git a/browser/components/customizableui/CustomizableWidgets.jsm b/browser/components/customizableui/CustomizableWidgets.jsm index a26e592e6ab7..df9ac7a79896 100644 --- a/browser/components/customizableui/CustomizableWidgets.jsm +++ b/browser/components/customizableui/CustomizableWidgets.jsm @@ -1065,11 +1065,10 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) { if (Services.prefs.getBoolPref("browser.pocket.enabled")) { let isEnabledForLocale = true; - let browserLocale; if (Services.prefs.getBoolPref("browser.pocket.useLocaleList")) { let chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"] .getService(Ci.nsIXULChromeRegistry); - browserLocale = chromeRegistry.getSelectedLocale("browser"); + let browserLocale = chromeRegistry.getSelectedLocale("browser"); let enabledLocales = []; try { enabledLocales = Services.prefs.getCharPref("browser.pocket.enabledLocales").split(' '); @@ -1080,32 +1079,12 @@ if (Services.prefs.getBoolPref("browser.pocket.enabled")) { } if (isEnabledForLocale) { - if (browserLocale == "ja-JP-mac") - browserLocale = "ja"; - let url = "chrome://browser/content/browser-pocket-" + browserLocale + ".properties"; - let strings = Services.strings.createBundle(url); - let label; - let tooltiptext; - try { - label = strings.GetStringFromName("pocket-button.label"); - tooltiptext = strings.GetStringFromName("pocket-button.tooltiptext"); - } catch (err) { - // GetStringFromName throws when the bundle doesn't exist. In that case, - // fall back to the en-US browser-pocket.properties. - url = "chrome://browser/content/browser-pocket-en-US.properties"; - strings = Services.strings.createBundle(url); - label = strings.GetStringFromName("pocket-button.label"); - tooltiptext = strings.GetStringFromName("pocket-button.tooltiptext"); - } - let pocketButton = { id: "pocket-button", defaultArea: CustomizableUI.AREA_NAVBAR, introducedInVersion: "pref", type: "view", viewId: "PanelUI-pocketView", - label: label, - tooltiptext: tooltiptext, // Use forwarding functions here to avoid loading Pocket.jsm on startup: onViewShowing: function() { return Pocket.onPanelViewShowing.apply(this, arguments); diff --git a/browser/components/pocket/jar.mn b/browser/components/pocket/jar.mn index f69d31ed65f6..e7fc957b862a 100644 --- a/browser/components/pocket/jar.mn +++ b/browser/components/pocket/jar.mn @@ -34,7 +34,6 @@ browser.jar: content/browser/pocket/panels/img/tag_close@2x.png (panels/img/tag_close@2x.png) content/browser/pocket/panels/img/tag_closeactive@1x.png (panels/img/tag_closeactive@1x.png) content/browser/pocket/panels/img/tag_closeactive@2x.png (panels/img/tag_closeactive@2x.png) - content/browser/pocket/panels/js/dictionary.js (panels/js/dictionary.js) content/browser/pocket/panels/js/messages.js (panels/js/messages.js) content/browser/pocket/panels/js/saved.js (panels/js/saved.js) content/browser/pocket/panels/js/signup.js (panels/js/signup.js) diff --git a/browser/components/pocket/main.js b/browser/components/pocket/main.js index 66af96a78cf2..f20e96c41778 100644 --- a/browser/components/pocket/main.js +++ b/browser/components/pocket/main.js @@ -611,6 +611,19 @@ var pktUI = (function() { } }) }); + + var _initL10NMessageId = "initL10N"; + pktUIMessaging.addMessageListener(_initL10NMessageId, function(panelId, data) { + var strings = {}; + var bundle = Services.strings.createBundle("chrome://browser/locale/browser-pocket.properties"); + var e = bundle.getSimpleEnumeration(); + while(e.hasMoreElements()) { + var str = e.getNext().QueryInterface(Components.interfaces.nsIPropertyElement); + strings[str.key] = str.value; + } + pktUIMessaging.sendResponseMessageToPanel(panelId, _initL10NMessageId, { strings: strings }); + }); + } // -- Browser Navigation -- // diff --git a/browser/components/pocket/panels/js/dictionary.js b/browser/components/pocket/panels/js/dictionary.js deleted file mode 100644 index 936a078253ff..000000000000 --- a/browser/components/pocket/panels/js/dictionary.js +++ /dev/null @@ -1,155 +0,0 @@ -Translations = {}; -Translations.en = -{ - addtags: "Add Tags", - alreadyhaveacct: "Already a Pocket user?", - continueff: "Continue with Firefox", - errorgeneric: "There was an error when trying to save to Pocket.", - learnmore: "Learn More", - loginnow: "Log in", - maxtaglength: "Tags are limited to 25 characters", - mustbeconnected: "You must be connected to the Internet in order to save to Pocket. Please check your connection and try again.", - onlylinkssaved: "Only links can be saved", - pagenotsaved: "Page Not Saved", - pageremoved: "Page Removed", - pagesaved: "Saved to Pocket", - processingremove: "Removing Page...", - processingtags: "Adding tags...", - removepage: "Remove Page", - save: "Save", - saving: "Saving...", - signupemail: "Sign up with email", - signuptosave: "Sign up for Pocket. It’s free.", - suggestedtags: "Suggested Tags", - tagline: "Save articles and videos from Firefox to view in Pocket on any device, any time.", - taglinestory_one: "Click the Pocket Button to save any article, video or page from Firefox.", - taglinestory_two: "View in Pocket on any device, any time.", - tagssaved: "Tags Added", - signinfirefox: "Sign in with Firefox", - signupfirefox: "Sign up with Firefox", - viewlist: "View List" -}; - -Translations.de = -{ - addtags: "Tags hinzufügen", - alreadyhaveacct: "Sind Sie bereits Pocket-Nutzer?", - continueff: "Mit Firefox fortfahren", - errorgeneric: "Beim Speichern des Links bei Pocket ist ein Fehler aufgetreten.", - learnmore: "Mehr erfahren", - loginnow: "Anmelden", - maxtaglength: "Tags dürfen höchsten 25 Zeichen lang sein.", - mustbeconnected: "Bitte überprüfen Sie, ob Sie mit dem Internet verbunden sind.", - onlylinkssaved: "Es können nur Links gespeichert werden", - pagenotsaved: "Seite nicht gespeichert", - pageremoved: "Seite entfernt", - pagesaved: "Bei Pocket gespeichert", - processingremove: "Seite wird entfernt…", - processingtags: "Tags werden hinzugefügt…", - removepage: "Seite entfernen", - save: "Speichern", - saving: "Speichern…", - signupemail: "Mit E-Mail registrieren", - signuptosave: "Registrieren Sie sich bei Pocket. Das ist kostenlos.", - suggestedtags: "Vorgeschlagene Tags", - tagline: "Speichern Sie Artikel und Videos aus Firefox bei Pocket, um sie jederzeit und auf jedem Gerät ansehen zu können.", - taglinestory_one: "Klicken Sie auf die Pocket-Schaltfläche, um beliebige Artikel, Videos und Seiten aus Firefox zu speichern.", - taglinestory_two: "Lesen Sie diese mit Pocket, jederzeit und auf jedem Gerät.", - tagssaved: "Tags hinzugefügt", - signinfirefox: "Mit Firefox anmelden", - signupfirefox: "Mit Firefox registrieren", - viewlist: "Liste anzeigen" -}; - -Translations.es = -{ - addtags: "Añadir etiquetas", - alreadyhaveacct: "¿Ya tiene cuenta Pocket?", - continueff: "Continuar con Firefox", - errorgeneric: "Se ha producido un error al guardar el enlace en Pocket.", - learnmore: "Saber más", - loginnow: "Iniciar sesión", - maxtaglength: "Las etiquetas están limitadas a 25 caracteres.", - mustbeconnected: "Compruebe que tiene conexión a Internet.", - onlylinkssaved: "Solo se pueden guardar enlaces", - pagenotsaved: "Página no guardada", - pageremoved: "Página eliminada", - pagesaved: "Guardada en Pocket", - processingremove: "Eliminando página…", - processingtags: "Añadiendo etiquetas…", - removepage: "Eliminar página", - save: "Guardar", - saving: "Guardando…", - signupemail: "Regístrese con su correo.", - signuptosave: "Regístrese en Pocket. Es gratis.", - suggestedtags: "Etiquetas sugeridas", - tagline: "Guarde artículos y vídeos desde Firefox en Pocket para verlos en cualquier dispositivo y en cualquier momento.", - taglinestory_one: "Pulse el botón Pocket para guardar cualquier artículo, vídeo o página desde Firefox.", - taglinestory_two: "Véalo en Pocket en cualquier dispositivo y en cualquier momento.", - tagssaved: "Etiquetas añadidas", - signinfirefox: "Inicie sesión con Firefox", - signupfirefox: "Regístrese con Firefox", - viewlist: "Ver lista" -}; - -Translations.ja = -{ - addtags: "タグを追加", - alreadyhaveacct: "アカウントをお持ちですか?", - continueff: "Firefox で続行", - errorgeneric: "Pocket にリンクを保存中に問題が発生しました。", - learnmore: "詳細", - loginnow: "ログイン", - maxtaglength: "タグは 25 文字までです。", - mustbeconnected: "インターネットに接続されていることを確認してください。", - onlylinkssaved: "リンクのみ保存できます", - pagenotsaved: "ページを保存できませんでした", - pageremoved: "ページを削除しました", - pagesaved: "Pocket に保存しました", - processingremove: "ページを削除中...", - processingtags: "タグを追加中...", - removepage: "ページを削除", - save: "保存", - saving: "保存中...", - signupemail: "メールでアカウント登録", - signuptosave: "Pocket にアカウント登録してください。無料です。", - suggestedtags: "タグ候補", - tagline: "Pocket でいつでもどこでも見られるよう、Firefox から記事や動画を保存できます。", - taglinestory_one: "Firefox から記事や動画やページを保存するには、Pocket ボタンをクリックしてください。", - taglinestory_two: "Pocket でいつでもどこでも見られます。", - tagssaved: "タグを追加しました", - signinfirefox: "Firefox でログイン", - signupfirefox: "Firefox でアカウント登録", - viewlist: "マイリストを表示" -}; - -Translations.ru = -{ - addtags: "Добавить теги", - alreadyhaveacct: "Уже используете Pocket?", - continueff: "Продолжить через Firefox", - errorgeneric: "Не удалось сохранить в Pocket.", - learnmore: "Узнайте больше", - loginnow: "Войдите", - maxtaglength: "Длина тега не должна превышать 25 символов.", - mustbeconnected: "Убедитесь, что вы подключены к Интернет.", - onlylinkssaved: "Можно сохранять только ссылки", - pagenotsaved: "Страница не сохранена", - pageremoved: "Страница удалена", - pagesaved: "Сохранено в Pocket", - processingremove: "Удаление страницы...", - processingtags: "Добавление тегов...", - removepage: "Удалить страницу", - save: "Сохранить", - saving: "Сохранение...", - signupemail: "Регистрация по эл. почте", - signuptosave: "Зарегистрируйтесь в Pocket. Это бесплатно.", - suggestedtags: "Рекомендуемые теги", - tagline: "Сохраняйте статьи и видео из Firefox для просмотра в Pocket на любом устройстве, в любой момент.", - taglinestory_one: "Щёлкните по кнопке Pocket, чтобы сохранить любую статью, видео или страницу из Firefox.", - taglinestory_two: "Просматривайте их в Pocket на любом устройстве, в любой момент.", - tagssaved: "Теги добавлены", - signinfirefox: "Войти через Firefox", - signupfirefox: "Регистрация через Firefox", - viewlist: "Просмотреть список" -}; diff --git a/browser/components/pocket/panels/js/saved.js b/browser/components/pocket/panels/js/saved.js index 596aaefa01e9..8079df160543 100644 --- a/browser/components/pocket/panels/js/saved.js +++ b/browser/components/pocket/panels/js/saved.js @@ -12,7 +12,6 @@ var PKT_SAVED_OVERLAY = function (options) this.savedItemId = 0; this.savedUrl = ''; this.premiumStatus = false; - this.panelId = 0; this.preventCloseTimerCancel = false; this.closeValid = true; this.mouseInside = false; @@ -461,89 +460,7 @@ var PKT_SAVED_OVERLAY = function (options) } this.getTranslations = function() { - var language = this.locale || ''; - this.dictJSON = {}; - - var dictsuffix = 'en-US'; - - if (language.indexOf('en') == 0) - { - dictsuffix = 'en'; - } - else if (language.indexOf('it') == 0) - { - dictsuffix = 'it'; - } - else if (language.indexOf('fr-ca') == 0) - { - dictsuffix = 'fr'; - } - else if (language.indexOf('fr') == 0) - { - dictsuffix = 'fr'; - } - else if (language.indexOf('de') == 0) - { - dictsuffix = 'de'; - } - else if (language.indexOf('es-es') == 0) - { - dictsuffix = 'es'; - } - else if (language.indexOf('es-419') == 0) - { - dictsuffix = 'es_419'; - } - else if (language.indexOf('es') == 0) - { - dictsuffix = 'es'; - } - else if (language.indexOf('ja') == 0) - { - dictsuffix = 'ja'; - } - else if (language.indexOf('nl') == 0) - { - dictsuffix = 'nl'; - } - else if (language.indexOf('pt-pt') == 0) - { - dictsuffix = 'pt_PT'; - } - else if (language.indexOf('pt') == 0) - { - dictsuffix = 'pt_BR'; - } - else if (language.indexOf('ru') == 0) - { - dictsuffix = 'ru'; - } - else if (language.indexOf('zh-tw') == 0) - { - dictsuffix = 'zh_TW'; - } - else if (language.indexOf('zh') == 0) - { - dictsuffix = 'zh_CN'; - } - else if (language.indexOf('ko') == 0) - { - dictsuffix = 'ko'; - } - else if (language.indexOf('pl') == 0) - { - dictsuffix = 'pl'; - } - - this.dictJSON = Translations[dictsuffix]; - if (typeof this.dictJSON !== 'object') - { - this.dictJSON = Translations['en']; - } - if (typeof this.dictJSON !== 'object') - { - this.dictJSON = {}; - } + this.dictJSON = window.pocketStrings; }; }; @@ -607,17 +524,18 @@ PKT_SAVED.prototype = { if (this.inited) { return; } + this.panelId = pktPanelMessaging.panelIdFromURL(window.location.href); this.overlay = new PKT_SAVED_OVERLAY(); this.inited = true; }, addMessageListener: function(messageId, callback) { - pktPanelMessaging.addMessageListener(this.overlay.panelId, messageId, callback); + pktPanelMessaging.addMessageListener(this.panelId, messageId, callback); }, sendMessage: function(messageId, payload, callback) { - pktPanelMessaging.sendMessage(this.overlay.panelId, messageId, payload, callback); + pktPanelMessaging.sendMessage(this.panelId, messageId, payload, callback); }, create: function() { @@ -643,8 +561,6 @@ PKT_SAVED.prototype = { myself.overlay.locale = locale[1].toLowerCase(); } - myself.overlay.panelId = pktPanelMessaging.panelIdFromURL(window.location.href); - myself.overlay.create(); // tell back end we're ready @@ -686,6 +602,10 @@ $(function() thePKT_SAVED.init(); } - window.thePKT_SAVED.create(); + // send an async message to get string data + thePKT_SAVED.sendMessage("initL10N", {}, function(resp) { + window.pocketStrings = resp.strings; + window.thePKT_SAVED.create(); + }); }); diff --git a/browser/components/pocket/panels/js/signup.js b/browser/components/pocket/panels/js/signup.js index cd7d5031b28c..ab5b0896bfff 100644 --- a/browser/components/pocket/panels/js/signup.js +++ b/browser/components/pocket/panels/js/signup.js @@ -20,7 +20,6 @@ var PKT_SIGNUP_OVERLAY = function (options) this.inoverflowmenu = false; this.pockethost = "getpocket.com"; this.fxasignedin = false; - this.panelId = 0; this.dictJSON = {}; this.initCloseTabEvents = function() { $('.btn,.pkt_ext_learnmore,.alreadyhave > a').click(function(e) @@ -58,89 +57,7 @@ var PKT_SIGNUP_OVERLAY = function (options) }; this.getTranslations = function() { - var language = this.locale || ''; - this.dictJSON = {}; - - var dictsuffix = 'en-US'; - - if (language.indexOf('en') == 0) - { - dictsuffix = 'en'; - } - else if (language.indexOf('it') == 0) - { - dictsuffix = 'it'; - } - else if (language.indexOf('fr-ca') == 0) - { - dictsuffix = 'fr'; - } - else if (language.indexOf('fr') == 0) - { - dictsuffix = 'fr'; - } - else if (language.indexOf('de') == 0) - { - dictsuffix = 'de'; - } - else if (language.indexOf('es-es') == 0) - { - dictsuffix = 'es'; - } - else if (language.indexOf('es-419') == 0) - { - dictsuffix = 'es_419'; - } - else if (language.indexOf('es') == 0) - { - dictsuffix = 'es'; - } - else if (language.indexOf('ja') == 0) - { - dictsuffix = 'ja'; - } - else if (language.indexOf('nl') == 0) - { - dictsuffix = 'nl'; - } - else if (language.indexOf('pt-pt') == 0) - { - dictsuffix = 'pt_PT'; - } - else if (language.indexOf('pt') == 0) - { - dictsuffix = 'pt_BR'; - } - else if (language.indexOf('ru') == 0) - { - dictsuffix = 'ru'; - } - else if (language.indexOf('zh-tw') == 0) - { - dictsuffix = 'zh_TW'; - } - else if (language.indexOf('zh') == 0) - { - dictsuffix = 'zh_CN'; - } - else if (language.indexOf('ko') == 0) - { - dictsuffix = 'ko'; - } - else if (language.indexOf('pl') == 0) - { - dictsuffix = 'pl'; - } - - this.dictJSON = Translations[dictsuffix]; - if (typeof this.dictJSON !== 'object') - { - this.dictJSON = Translations['en']; - } - if (typeof this.dictJSON !== 'object') - { - this.dictJSON = {}; - } + this.dictJSON = window.pocketStrings; }; }; @@ -175,8 +92,6 @@ PKT_SIGNUP_OVERLAY.prototype = { this.locale = locale[1].toLowerCase(); } - this.panelId = pktPanelMessaging.panelIdFromURL(window.location.href); - if (this.active) { return; @@ -231,17 +146,18 @@ PKT_SIGNUP.prototype = { if (this.inited) { return; } + this.panelId = pktPanelMessaging.panelIdFromURL(window.location.href); this.overlay = new PKT_SIGNUP_OVERLAY(); this.inited = true; }, addMessageListener: function(messageId, callback) { - pktPanelMessaging.addMessageListener(this.overlay.panelId, messageId, callback); + pktPanelMessaging.addMessageListener(this.panelId, messageId, callback); }, sendMessage: function(messageId, payload, callback) { - pktPanelMessaging.sendMessage(this.overlay.panelId, messageId, payload, callback); + pktPanelMessaging.sendMessage(this.panelId, messageId, payload, callback); }, create: function() { @@ -260,6 +176,10 @@ $(function() thePKT_SIGNUP.init(); } - window.thePKT_SIGNUP.create(); + // send an async message to get string data + thePKT_SIGNUP.sendMessage("initL10N", {}, function(resp) { + window.pocketStrings = resp.strings; + window.thePKT_SIGNUP.create(); + }); }); diff --git a/browser/components/pocket/panels/saved.html b/browser/components/pocket/panels/saved.html index bd4d863eb6f1..59f0e3d711d8 100644 --- a/browser/components/pocket/panels/saved.html +++ b/browser/components/pocket/panels/saved.html @@ -10,9 +10,8 @@ - - \ No newline at end of file + diff --git a/browser/components/pocket/panels/signup.html b/browser/components/pocket/panels/signup.html index 18b7db5c4f4e..4c54bd6f4af4 100644 --- a/browser/components/pocket/panels/signup.html +++ b/browser/components/pocket/panels/signup.html @@ -9,9 +9,8 @@ - - \ No newline at end of file + diff --git a/browser/locales/en-US/chrome/browser/browser-pocket.properties b/browser/locales/en-US/chrome/browser/browser-pocket.properties new file mode 100644 index 000000000000..bddb7fba6be3 --- /dev/null +++ b/browser/locales/en-US/chrome/browser/browser-pocket.properties @@ -0,0 +1,31 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +addtags = Add Tags +alreadyhaveacct = Already a Pocket user? +continueff = Continue with Firefox +errorgeneric = There was an error when trying to save to Pocket. +learnmore = Learn More +loginnow = Log in +maxtaglength = Tags are limited to 25 characters +mustbeconnected = You must be connected to the Internet in order to save to Pocket. Please check your connection and try again. +onlylinkssaved = Only links can be saved +pagenotsaved = Page Not Saved +pageremoved = Page Removed +pagesaved = Saved to Pocket +processingremove = Removing Page… +processingtags = Adding tags… +removepage = Remove Page +save = Save +saving = Saving… +signupemail = Sign up with email +signuptosave = Sign up for Pocket. It’s free. +suggestedtags = Suggested Tags +tagline = Save articles and videos from Firefox to view in Pocket on any device, any time. +taglinestory_one = Click the Pocket Button to save any article, video or page from Firefox. +taglinestory_two = View in Pocket on any device, any time. +tagssaved = Tags Added +signinfirefox = Sign in with Firefox +signupfirefox = Sign up with Firefox +viewlist = View List diff --git a/browser/locales/en-US/chrome/browser/browser.dtd b/browser/locales/en-US/chrome/browser/browser.dtd index 6660865ae052..838e49e4d9d8 100644 --- a/browser/locales/en-US/chrome/browser/browser.dtd +++ b/browser/locales/en-US/chrome/browser/browser.dtd @@ -860,3 +860,10 @@ just addresses the organization to follow, e.g. "This site is run by " --> + + + + + + + diff --git a/browser/locales/en-US/chrome/browser/customizableui/customizableWidgets.properties b/browser/locales/en-US/chrome/browser/customizableui/customizableWidgets.properties index c16994f0f48f..f61b20c17d89 100644 --- a/browser/locales/en-US/chrome/browser/customizableui/customizableWidgets.properties +++ b/browser/locales/en-US/chrome/browser/customizableui/customizableWidgets.properties @@ -113,5 +113,10 @@ web-apps-button.tooltiptext = Discover Apps devtools-webide-button2.label = WebIDE devtools-webide-button2.tooltiptext = Open WebIDE (%S) +# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext): "Pocket" +# is a brand name. +pocket-button.label = Pocket +pocket-button.tooltiptext = Save to Pocket + e10s-button.label = New Non-e10s Window e10s-button.tooltiptext = Open a new Non-e10s Window diff --git a/browser/locales/jar.mn b/browser/locales/jar.mn index 40bc5ad361ee..cdedba73520f 100644 --- a/browser/locales/jar.mn +++ b/browser/locales/jar.mn @@ -26,6 +26,7 @@ locale/browser/browser.dtd (%chrome/browser/browser.dtd) locale/browser/baseMenuOverlay.dtd (%chrome/browser/baseMenuOverlay.dtd) locale/browser/browser.properties (%chrome/browser/browser.properties) + locale/browser/browser-pocket.properties (%chrome/browser/browser-pocket.properties) locale/browser/customizableui/customizableWidgets.properties (%chrome/browser/customizableui/customizableWidgets.properties) locale/browser/devtools/animationinspector.dtd (%chrome/browser/devtools/animationinspector.dtd) locale/browser/devtools/animationinspector.properties (%chrome/browser/devtools/animationinspector.properties)