I'm developing an app for the nokia e75 using j2me. What is a good way of showing content in the right lang? I don't think that java beans are an option.
Just to be clear; the problem isn't to know what the lang is of the device, but how to generate the right content knowing the lang the 开发者_Python百科user uses.
thx
I'm using following strategy:
- Storing resources in Java properties files, like "KEY=Value"
- Separate resources for each language, like: messages_en, messages_fr, messages_gr and so on
- Use in code instead of static Strings references to Keys from properties
Detect language using
System.getProperty("microedition.locale");
After locale detection load appropriate language resource
The standard way of detecting the user's language is to read the language set for the phone.
System.getProperty("microedition.locale");
Implementation of Localization/Internationalization depends on the framework you are using.
- Here is a good article describing it
- Here is another one
精彩评论