开发者

Different languages

开发者 https://www.devze.com 2023-01-26 06:37 出处:网络
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.

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:

  1. Storing resources in Java properties files, like "KEY=Value"
  2. Separate resources for each language, like: messages_en, messages_fr, messages_gr and so on
  3. Use in code instead of static Strings references to Keys from properties
  4. Detect language using

    System.getProperty("microedition.locale");

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

精彩评论

暂无评论...
验证码 换一张
取 消