From 2fe98dd6f6ad303159615f9ac96d7b7982fc9ccf Mon Sep 17 00:00:00 2001 From: Tammo Pape Date: Wed, 1 May 2013 00:24:54 +0200 Subject: [PATCH 1/3] Added i18n labels for the Locales in switch language modal --- src/extensions/default/DebugCommands/main.js | 15 +++++++++++++-- src/nls/de/strings.js | 20 ++++++++++++++++++++ src/nls/root/strings.js | 6 ++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/extensions/default/DebugCommands/main.js b/src/extensions/default/DebugCommands/main.js index f3fe6e0068d..7faef0d482c 100644 --- a/src/extensions/default/DebugCommands/main.js +++ b/src/extensions/default/DebugCommands/main.js @@ -35,6 +35,7 @@ define(function (require, exports, module) { KeyBindingManager = brackets.getModule("command/KeyBindingManager"), Menus = brackets.getModule("command/Menus"), Strings = brackets.getModule("strings"), + StringUtils = brackets.getModule("utils/StringUtils"), PerfUtils = brackets.getModule("utils/PerfUtils"), ProjectManager = brackets.getModule("project/ProjectManager"), NativeApp = brackets.getModule("utils/NativeApp"), @@ -226,12 +227,22 @@ define(function (require, exports, module) { .val(val) .appendTo($select); } + + // returns the localized label for the given locale + // or the locale, if nothing found + function getLocalizedLabel(locale) { + + var key = "LOCALE_" + locale.toUpperCase().replace("-", "_"), + i18n = Strings[key]; + + return i18n === undefined ? locale : StringUtils.format(Strings.LOCALE_LABEL, locale, i18n); + } // add system default addLocale(Strings.LANGUAGE_SYSTEM_DEFAULT, null); // add english - addLocale("en", "en"); + addLocale(getLocalizedLabel("en"), "en"); // inspect all children of dirEntry entries.forEach(function (entry) { @@ -246,7 +257,7 @@ define(function (require, exports, module) { label += match[2].toUpperCase(); } - addLocale(label, language); + addLocale(getLocalizedLabel(label), language); } } }); diff --git a/src/nls/de/strings.js b/src/nls/de/strings.js index e17df5a34a0..f3b98964b7b 100644 --- a/src/nls/de/strings.js +++ b/src/nls/de/strings.js @@ -25,6 +25,26 @@ /*global define */ define({ + + /** + * Locales + */ + "LOCALE_DE" : "Deutsch", + "LOCALE_EN" : "Englisch", + "LOCALE_FR" : "Französisch", + "LOCALE_CS" : "Tschechisch", + "LOCALE_ES" : "Spanisch", + "LOCALE_IT" : "Italienisch", + "LOCALE_JA" : "Japanisch", + "LOCALE_NB" : "Norwegisch", + "LOCALE_PL" : "Polnisch", + "LOCALE_PT_BR" : "Portugiesisch, Brasilien", + "LOCALE_PT_PT" : "Portugiesisch", + "LOCALE_RU" : "Russisch", + "LOCALE_SV" : "Schwedisch", + "LOCALE_TR" : "Türkisch", + "LOCALE_ZH_CN" : "Chinesisch, vereinfacht", + /** * Errors */ diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index e3774ffbe71..1c136da8251 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -25,6 +25,12 @@ /*global define */ define({ + + /** + * Locales + */ + "LOCALE_LABEL" : "{0} ({1})", + /** * Errors */ From 13ff88088eea095749bc5ae35f7c685c35d4264c Mon Sep 17 00:00:00 2001 From: Tammo Pape Date: Thu, 2 May 2013 21:49:07 +0200 Subject: [PATCH 2/3] English locale i18n. Got rid of the locale label string. --- src/extensions/default/DebugCommands/main.js | 3 +- src/nls/de/strings.js | 38 ++++++++++---------- src/nls/root/strings.js | 24 ++++++++++--- 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/extensions/default/DebugCommands/main.js b/src/extensions/default/DebugCommands/main.js index 7faef0d482c..0e8f5947df5 100644 --- a/src/extensions/default/DebugCommands/main.js +++ b/src/extensions/default/DebugCommands/main.js @@ -35,7 +35,6 @@ define(function (require, exports, module) { KeyBindingManager = brackets.getModule("command/KeyBindingManager"), Menus = brackets.getModule("command/Menus"), Strings = brackets.getModule("strings"), - StringUtils = brackets.getModule("utils/StringUtils"), PerfUtils = brackets.getModule("utils/PerfUtils"), ProjectManager = brackets.getModule("project/ProjectManager"), NativeApp = brackets.getModule("utils/NativeApp"), @@ -235,7 +234,7 @@ define(function (require, exports, module) { var key = "LOCALE_" + locale.toUpperCase().replace("-", "_"), i18n = Strings[key]; - return i18n === undefined ? locale : StringUtils.format(Strings.LOCALE_LABEL, locale, i18n); + return i18n === undefined ? locale : i18n; } // add system default diff --git a/src/nls/de/strings.js b/src/nls/de/strings.js index f3b98964b7b..a9b308c1603 100644 --- a/src/nls/de/strings.js +++ b/src/nls/de/strings.js @@ -26,25 +26,6 @@ define({ - /** - * Locales - */ - "LOCALE_DE" : "Deutsch", - "LOCALE_EN" : "Englisch", - "LOCALE_FR" : "Französisch", - "LOCALE_CS" : "Tschechisch", - "LOCALE_ES" : "Spanisch", - "LOCALE_IT" : "Italienisch", - "LOCALE_JA" : "Japanisch", - "LOCALE_NB" : "Norwegisch", - "LOCALE_PL" : "Polnisch", - "LOCALE_PT_BR" : "Portugiesisch, Brasilien", - "LOCALE_PT_PT" : "Portugiesisch", - "LOCALE_RU" : "Russisch", - "LOCALE_SV" : "Schwedisch", - "LOCALE_TR" : "Türkisch", - "LOCALE_ZH_CN" : "Chinesisch, vereinfacht", - /** * Errors */ @@ -155,6 +136,25 @@ define({ "LANGUAGE_SUBMIT" : "{APP_NAME} neu starten", "LANGUAGE_CANCEL" : "Abbrechen", "LANGUAGE_SYSTEM_DEFAULT" : "Systemstandard", + + /** + * Locales + */ + "LOCALE_DE" : "Deutsch", + "LOCALE_EN" : "Englisch", + "LOCALE_FR" : "Französisch", + "LOCALE_CS" : "Tschechisch", + "LOCALE_ES" : "Spanisch", + "LOCALE_IT" : "Italienisch", + "LOCALE_JA" : "Japanisch", + "LOCALE_NB" : "Norwegisch", + "LOCALE_PL" : "Polnisch", + "LOCALE_PT_BR" : "Portugiesisch, Brasilien", + "LOCALE_PT_PT" : "Portugiesisch", + "LOCALE_RU" : "Russisch", + "LOCALE_SV" : "Schwedisch", + "LOCALE_TR" : "Türkisch", + "LOCALE_ZH_CN" : "Chinesisch, vereinfacht", /** * ProjectManager diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index 1c136da8251..aaba92f1128 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -26,11 +26,6 @@ define({ - /** - * Locales - */ - "LOCALE_LABEL" : "{0} ({1})", - /** * Errors */ @@ -137,6 +132,25 @@ define({ "LANGUAGE_SUBMIT" : "Reload {APP_NAME}", "LANGUAGE_CANCEL" : "Cancel", "LANGUAGE_SYSTEM_DEFAULT" : "System Default", + + /** + * Locales + */ + "LOCALE_CS" : "Czech", + "LOCALE_DE" : "German", + "LOCALE_EN" : "English", + "LOCALE_ES" : "Spanish", + "LOCALE_FR" : "French", + "LOCALE_IT" : "Italian", + "LOCALE_JA" : "Japanese", + "LOCALE_NB" : "Norwegian", + "LOCALE_PL" : "Polish", + "LOCALE_PT_BR" : "Portuguese, Brazil", + "LOCALE_PT_PT" : "Portuguese", + "LOCALE_RU" : "Russian", + "LOCALE_SV" : "Swedish", + "LOCALE_TR" : "Turkish ", + "LOCALE_ZH_CN" : "Chinese, simplified", /** * ProjectManager From 5fa03313bd67bc0f589653079628b73a58b8d4ad Mon Sep 17 00:00:00 2001 From: Tammo Pape Date: Thu, 9 May 2013 02:12:53 +0200 Subject: [PATCH 3/3] Removed trailing space in strings.js file --- src/nls/root/strings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index aaba92f1128..b3155eb9f81 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -149,7 +149,7 @@ define({ "LOCALE_PT_PT" : "Portuguese", "LOCALE_RU" : "Russian", "LOCALE_SV" : "Swedish", - "LOCALE_TR" : "Turkish ", + "LOCALE_TR" : "Turkish", "LOCALE_ZH_CN" : "Chinese, simplified", /**