Table of contents


  • File extension: .js

  • I18n type: 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 in a similar manner to JSON). This means that when you download your source/translations, keys will be quoted.

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"
});

Read more


Continue Reading

Did this answer your question?