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 = $("