loc (str, formats) String
public
Formats the passed string, but first looks up the string in the localized strings hash. This is a convenient way to localize text. See Ember.String.fmt()
for more information on formatting.
Note that it is traditional but not required to prefix localized string keys with an underscore or other character so you can easily identify localized strings.
Ember.STRINGS = { '_Hello World': 'Bonjour le monde', '_Hello %@ %@': 'Bonjour %@ %@' }; Ember.String.loc("_Hello World"); // 'Bonjour le monde'; Ember.String.loc("_Hello %@ %@", ["John", "Smith"]); // "Bonjour John Smith";
Parameters:
-
str
String
- The string to format
-
formats
Array
- Optional array of parameters to interpolate into string.
Returns:
-
String
- formatted string
Please login to continue.