AUI
Documentation
Components
Upgrade guides
Support
Getting started
FAQ
Version 8.8
Older versions
Changelog
General UI components
Avatars
Badges
Banners
Buttons
Dropdowns
Dialog 2
Expanders
Flags
Inline dialogs
Icons
Labels
Lozenges
Messages
Progress indicators
Progress trackers
RESTful tables
Spinners
Sortable tables
Tables
Tabs
Toolbar 2
Tooltips
Triggers
Forms and form components
Forms
Form labels
Form notification
Form validation
Date pickers
Single selects
Select2
Toggle buttons
Page and content structure
Typography
Page layout
Page headers
Page panels
Content groups
Navigation patterns
In-product help patterns
Application header
Sidebar
System notification
AUI resources
Helper functions
Hidden and assistive CSS
Internationalisation
Keyboard shortcuts
Soy
Template
deprecated
Internationalisation
Ask a question
Function
Description
Available since
Example
format
Provides an easy way to substitute parameters into a string.
1.0.0
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
// 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') );