-
-
Notifications
You must be signed in to change notification settings - Fork 5
Language with Script
StefansArya edited this page Jan 19, 2021
·
2 revisions
Loaded language are exposed to sf.lang.list
, and you can explore it from the browser's console.
console.log( sf.language.list );
The interpolate-able is language string "with {this} curly bracket".
sf.language.get('my.name', {name:"Alex"}); // My Name is Alex
When you implement this, it's value will be used for interpolate on related language path.
sf.language.interpolate = {
name:"Lusia",
timestamp:Date.now,
...
};
sf.language.get('my.name'); // My Name is Lusia
sf.language.get('my.name', /* {..interpolate data..}, */function(text){
text; // My Name is someone
});
sf.language.get(['date', 'my.name'], /* {...}, */, function(values){
/* values = {
'date': '7 January',
'my.name': 'My Name is Lusia'
}*/
});
// You can also do this without callback
var values = sf.language.get(['date', 'my.name']);
var obj = {
/* maybe model/component scope? */
key: "Waiting..."
};
sf.language.assign(obj, {
key:'language.path.here'
}, /* {interpolation data} */);
- Framework
-
Installation
- Build Configuration
- Hot Reload
- Loader
- Model
-
Component
- Reserved Element
- Empty Shell
- Include external template
- Space
-
Views (Router)
- URI
- Static Template
- Language
- Element's query helper
- Events
- URL Request
- Window Extends