File Extension(s) | .js |
i18n type(s) | REQUIREJS |
This format is used by projects using the RequireJS framework. It is a JavaScript file that contains a single function define
, to which a (key, value) dictionary is passed.
Example:
define({
"JOIN": "Join",
"NEST": {
"SPLIT": "Split,
"INTERSECT": "Intersect"
},
"LIST": ["Element 1", "Element 2", "Element 3"]
});
File format
RequireJS supports two different types of i18n root definitions:
define({
"root": {
"cat": "cat",
"dog": "dog",
"mouse": "mouse"
}
});
define({
"cat": "cat",
"dog": "dog",
"mouse": "mouse"
});
📝Note: Transifex currently supports only the second format, i.e., root must be defined as a normal locale bundle (see the official documentation at the bottom of the page for further information).
Things to note
JavaScript allows keys within a dictionary to be defined without single/double quotes. When a RequireJS file is uploaded, Transifex will automatically add these quotes (the file is parsed similarly to JSON). This means that keys will be quoted when you download your source or translation files.
Example
Someone uploads a translation file, which looks like this:
define({
hello: "Hello"
});
Their strings are then translated into German. The translated file now looks like this:
define({
"hello": "Hallo"
});
Parser Behavior
The following table outlines what occurs to strings when using the API, CLI, or UI to manipulate translation files depending on download mode.
*The results are compatible with parser version 1.
📝 Note: Proofreading must be enabled for this logic to take effect. To learn how to enable proofreading, click here.
Additional information
💡Tip
Looking for more help? Get support from our Transifex Community Forum!
Find answers or post to get help from Transifex Support and our Community.