/
loc.ts
43 lines (36 loc) · 882 Bytes
/
loc.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
@module ember
*/
import { loc } from '@ember/string';
import { helper } from '../helper';
/**
Calls [String.loc](/ember/release/classes/String/methods/loc?anchor=loc) with the
provided string. This is a convenient way to localize text within a template.
For example:
```javascript
Ember.STRINGS = {
'_welcome_': 'Bonjour'
};
```
```handlebars
<div class='message'>
{{loc '_welcome_'}}
</div>
```
```html
<div class='message'>
Bonjour
</div>
```
See [String.loc](/ember/release/classes/String/methods/loc?anchor=loc) for how to
set up localized string references.
@method loc
@for Ember.Templates.helpers
@param {String} str The string to format.
@see {String#loc}
@public
@deprecated
*/
export default helper(function (params) {
return loc.apply(null, params as any /* let the other side handle errors */);
});