English 中文(简体)
How to set default language in WebOs
原标题:

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")

问题回答

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"

}





相关问题
Orientation Questions - palm pre webos

Just a couple of quick questions...not too hard to answer hopefully! How do I set the allowed orientation from scene to scene? I can set it for the entire stage with: this.controller....

How to set default language in WebOs

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 ...

push scene by tapping on image

push scene by tapping on image. i am using one image when i am tap that image i want to push the new scene. it is not working. is there any way to push the scene when tap on image controle it showing ...

Is it possible to use d8 to measure memory usage?

With the release of the Closure compiler, I was hoping to see if there was a difference in memory usage between a js file using the compiler and one which had not. In particular, on a mobile ...

热门标签