diff --git a/src/brackets.js b/src/brackets.js
index 547c26dde66..eb78dd6ba32 100644
--- a/src/brackets.js
+++ b/src/brackets.js
@@ -28,7 +28,9 @@
require.config({
paths: {
"text" : "thirdparty/text"
- }
+ },
+ // store the locale in localStorage until CEF sets the correct navigator.language
+ locale: window.localStorage.getItem("locale")
});
/**
diff --git a/src/command/Commands.js b/src/command/Commands.js
index 9c04893315e..5d13645d6ad 100644
--- a/src/command/Commands.js
+++ b/src/command/Commands.js
@@ -87,6 +87,7 @@ define(function (require, exports, module) {
exports.DEBUG_RUN_UNIT_TESTS = "debug.runUnitTests";
exports.DEBUG_SHOW_PERF_DATA = "debug.showPerfData";
exports.DEBUG_NEW_BRACKETS_WINDOW = "debug.newBracketsWindow";
+ exports.DEBUG_SWITCH_LANGUAGE = "debug.switchLanguage";
// Command that does nothing. Can be used for place holder menuItems
diff --git a/src/command/Menus.js b/src/command/Menus.js
index fa125d2e00a..12fbfbcf97f 100644
--- a/src/command/Menus.js
+++ b/src/command/Menus.js
@@ -905,6 +905,8 @@ define(function (require, exports, module) {
{key: "Cmd-R", platform: "mac"}]);
menu.addMenuItem(Commands.DEBUG_NEW_BRACKETS_WINDOW);
menu.addMenuDivider();
+ menu.addMenuItem(Commands.DEBUG_SWITCH_LANGUAGE);
+ menu.addMenuDivider();
menu.addMenuItem(Commands.DEBUG_RUN_UNIT_TESTS);
menu.addMenuItem(Commands.DEBUG_SHOW_PERF_DATA);
diff --git a/src/debug/DebugCommandHandlers.js b/src/debug/DebugCommandHandlers.js
index 6cdcbf61c8a..deb135b03ea 100644
--- a/src/debug/DebugCommandHandlers.js
+++ b/src/debug/DebugCommandHandlers.js
@@ -33,7 +33,9 @@ define(function (require, exports, module) {
Editor = require("editor/Editor").Editor,
Strings = require("strings"),
PerfUtils = require("utils/PerfUtils"),
- NativeApp = require("utils/NativeApp");
+ NativeApp = require("utils/NativeApp"),
+ NativeFileSystem = require("file/NativeFileSystem").NativeFileSystem,
+ FileUtils = require("file/FileUtils");
function handleShowDeveloperTools(commandData) {
brackets.app.showDeveloperTools();
@@ -130,6 +132,93 @@ define(function (require, exports, module) {
function _handleNewBracketsWindow() {
window.open(window.location.href);
}
+
+ function _handleSwitchLanguage() {
+ var stringsPath = FileUtils.getNativeBracketsDirectoryPath() + "/nls";
+ NativeFileSystem.requestNativeFileSystem(stringsPath, function (dirEntry) {
+ dirEntry.createReader().readEntries(function (entries) {
+
+ var $activeLanguage;
+ var $submit;
+ function setLanguage(event) {
+ if ($activeLanguage) {
+ $activeLanguage.css("font-weight", "normal");
+ }
+ $activeLanguage = $(event.currentTarget);
+ $activeLanguage.css("font-weight", "bold");
+ $submit.attr("disabled", false);
+ }
+
+ var $modal = $("
");
+
+ var $header = $("")
+ .append("×")
+ .append("" + Strings.LANGUAGE_TITLE + "
")
+ .appendTo($modal);
+
+ var $body = $("")
+ .appendTo($modal);
+
+ var $p = $("")
+ .text(Strings.LANGUAGE_MESSAGE)
+ .appendTo($body);
+
+ var $ul = $("
")
+ .on("click", "li", setLanguage)
+ .appendTo($p);
+
+ // add english
+ var $li = $("- ")
+ .text("en-EN")
+ .data("locale", "en-EN")
+ .appendTo($ul);
+
+ // inspect all children of dirEntry
+ entries.forEach(function (entry) {
+ if (entry.isDirectory && entry.name.match(/^[a-z]{2}-[A-Z]{2}$/)) {
+ var language = entry.name;
+ var $li = $("
- ")
+ .text(entry.name)
+ .data("locale", language)
+ .appendTo($ul);
+ }
+ });
+
+ var $footer = $("")
+ .appendTo($modal);
+
+ var $cancel = $("