Reputation: 10621
How can I set the dault language of an WebOs project? The standard way of adding internationalization in WebOS is to use the $L() function, where I can set a key to the translated string. But if the current language ist not specified in the project WebOS displays the key to the user. How can I stopp this behaviour and set a default language, that will be taken instead of the key.
PS: I think the Palm way of taking a real world sentences is not a good way of programming.
Bad example: $L("This should be not a real world sentence!!")
Better example: $L("key.subKey")
Upvotes: 0
Views: 692
Reputation: 639
You can use a key-value pair to solve this problem (from the Palm documentation):
If the original string is not appropriate as a key, the $L() function can be called with an explicit key:
$L("value":"Done", "key": "done_key");
At run-time, the result of the call to $L() is the translation of the string passed as value. The translations "live" in the /resources/locale/strings.json file.
Example: content of file app_name/resources/es_us/strings.json:
{
"My text here": "Mi texto aquí", "done_key": "Listo", "Some other string": "Some other string's translation"
}
Upvotes: 1