You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
/* JavaScript */varStrings=require("strings"),templateContent=require("text!templateContent.html");// load text content of template filevarhtml=Mustache.render(templateContent,Strings);// use Mustache to insert translated strings
String concatenation
Because word order varies between languages, don't assume you can append separate strings together in a fixed order (e.g. using + in JavaScript). Instead, make a single parameterized string:
Let's say you need to make a message that looks like "Current position: item I out of N."
Figure out which parts vary dynamically: "I" and "N" in this case.
Add parameterized string in strings.js: CURRENT_POSITION: "Current position: item {0} out of {1}",
Dynamically substitute values in JavaScript: StringUtils.format(Strings.CURRENT_POSITION, currentIndex, items.length)
TODO: explain how to do this in HTML/Mustache strings...
Implementation Details
Brackets uses the i18n plugin for RequireJS to load translations. The locale is determined by brackets.app.language (navigator.language isn't used due to a CEF3 bug). Our main strings module re-exports the root bundle (i.e. require("i18n!nls/strings.js")). Client code should only use the main strings module (i.e. require("strings")).
As of Sprint 13, brackets-shell hardcodes strings for both English and French, primarily for the limited set of native menus. Once native menus are implemented, there will be no translated strings in brackets-shell.