-
Notifications
You must be signed in to change notification settings - Fork 278
Localizing Bramble
Brackets (bramble) uses RequireJS' i18n plugin to show localized content. Since strings are translated on Pontoon, they need to be stored in the locales/en-US/messages.properties
file.
We do not use most of the features and hence the strings that Brackets core provides. Hence, the strings that we do use have been extracted an put into the messages.properties
file. Any changes to the strings that we may use from Brackets core must be made in the messages.properties
file.
Note: Please follow the comment conventions used in the file and categorize the strings with the help of these comments.
All strings that are localizable for an extension must be put into the messages.properties
file located at locales/en-US/messages.properties
.
Note: Please follow the comment conventions used in the file. To add new strings for an extension, add a comment with the path to the extension above the list of strings.
To use a string in a source file, require in the strings file like so:
define(function(require) {
var Strings = require("strings");
// For extensions, use the following code instead
// var Strings = brackets.getModule("strings");
...
});
which will give you access to an object containing key-value pairs (similar to what is in the messages.properties
file) which can be used to access each string with their respective key. RequireJS will automatically use the correct locale's string as long as the correct key is used.
For development, you must run npm run localize && npm run localize dist
before running npm start
(this might change to make it easier). This will generate requirejs
compatible strings from the messages.properties
files. Anytime a new string is added, these steps must be repeated.
If running using the built version of Brackets i.e. grunt build-browser
or grunt build-browser-compressed
(and Thimble is configured to run in a production
environment), there is no need to run the localize
npm scripts since they are automatically run with the grunt
steps. However, any changes made to the messages.properties
file will require the grunt
step to be run again.
[PENDING]