Internationalisation

Function
Description
Available since
Example
format

Provides an easy way to substitute parameters into a string.

1.0.0
AخA
 
AJS.format("This is a {0} test of {1}", "simple", "message format")
AJS.format("Have a {0} day", "good"); /* Have a good day */
AJS.format("Have a '{0}' day", "good"); /* Have a '{0}' day */
AJS.format("Have a ''{0}'' {1}", "good", "Monday"); /* Have a 'good' Monday */
I18n

I18n keys.

5.4.0
x
 
// Gets the i18n value
AJS.I18n.getText('aui.toggle.on')
// Returns the key
AJS.I18n.getText('aui.key.that.does.not.exist')
// Raw translation strings are stored in `AJS.I18n.keys`.
// Translation text should always be retrieved through `AJS.I18n.getText`.
AJS.I18n.keys['aui.test'] = 'Le test';
AJS.I18n.getText('aui.test');
// If there are keys that have {0} params in them, AJS formatting can apply
// Note: don't modify existing entries in AJS.I18N.keys directly, this is
// done for demonstration purposes
AJS.I18n.keys['aui.test'] = 'this is a {0} test';
console.log(
AJS.I18n.getText('aui.test', 'formatting')
);