String#loc()

loc (str, formats) Stringpublic

Defined in packages/ember-runtime/lib/system/string.js:179

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
doc_EmberJs
2016-11-30 16:53:29
Comments
Leave a Comment

Please login to continue.