×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    Question about display language ?

    Dear All,
    Displaying other language( thai language ) depend on java mobile phone
    or Font( javax.microedition.lcdui.Font ) in j2me ?

    Regard,
    Abdun

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    393

    RE: Question about display language ?

    It depends on the phone. You can use Resource classes as the one below to achieve localisation.

    public class Resouces {
    public static final int ID_GAME_NEW = 0;
    public static final int ID_GAME_OPTIONS = 1;
    public static final int ID_GAME_HIGHSCORES = 2;
    public static final int ID_GAME_INSTRUCTIONS = 3;
    public static final int ID_GAME_ABOUT = 4;
    public static final int ID_GAME_CONTINUE = 5;
    public static final int ID_GAME_BACK = 6;
    public static final int ID_GAME_MORE = 7;
    public static final int ID_GAME_EXIT = 8;
    public static final int ID_GAME_LEVEL = 9;
    public static final int ID_GAME_SOUNDS = 10;
    public static final int ID_GAME_VIBRA = 11;
    public static final int ID_GAME_NAME = 12;

    // List of supported locales./ The strings are Nokia-specific values of the
    // "microedition.locale" system property.
    private static final String[] supportedLocales = {"en", "fi-FI", "fr", "de" };

    private static final String[][] strings = {
    { "New game", "Settings", "High scores", "Instructions",
    "About", "Continue", "Back", "More", "Exit game",
    "Level", "Sounds", "Shakes", "Game name" },

    { "Uusi peli", "Asetukset", "Huipputulokset", "Peliohjeet",
    "Tietoja", "Jatka", "Poistu", "Jatka", "Poistu",
    "Vaikeusaste", "Pelinet", "Vrintehosteet", "Pelin nimi" },
    { "Nouveau jeu", "Paramtres", "Scores", "Instructions",
    "A propos", "Continuer", "Retour", "Suite", "Sortir",
    "Niveau", "Sons", "Vibrations", "Jeu nom" },

    { "Neues Spiel", "Einstellungen", "Rekord", "Anleitung",
    "ber", "Weiter", "Zurck", "Weiter", "Beenden",
    "Ebene", "Ton", "Vibrationen", "Spiel name" }
    };

    public static String getString(int key) {
    String locale = System.getProperty("microedition.locale"
    if(locale == null)
    locale = new String(""

    // Find the index of the locale id
    int localeIndex = -1;
    for(int i=0; i<supportedLocales.length; i++) {
    if (locale.equals(supportedLocales[i])) {
    localeIndex = i;
    break;
    }
    }

    if (localIndex == -1) // Not found
    return strings[0][key]; // defaults to first language, in this example English
    return strings[localeIndex][key];
    }


    public class OptionList extends List implements CommandListener {
    private void init(GameMIDlet parent) {
    this.parent = parent;
    this.addCommand(back);
    this.setCommandListener(this);

    // These are just an example for the game specific options
    this.append(Resources.getString(Resources.ID_GAME_LEVEL), null);
    this.append(Resources.getString(Resources.ID_GAME_SOUNDS), null);
    this.append(Resources.getString(Resources.ID_GAME_VIBRA, null);
    }
    }

    [N]/ Forum Nokia
    Cheers,
    Nitin

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    RE: Question about display language ?

    If depend on phone then How can i know phone supported what language ?

    Regard,
    Jakkapop

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    RE: Question about display language ?

    If depend on phone then How can i know phone supported what language ?

    Regard,
    Abdun

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    RE: Question about display language ?

    If depend on phone then How can i know phone supported what language ?

    Regard,
    Abdun

  6. #6
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    393

    RE: Question about display language ?

    System.getProperty("microedition.locale" //Always contains language and optionally the country code

    Please also refer to the JAVA? MIDP APPLICATION DEVELOPER?S
    GUIDE FOR NOKIA DEVICES at http://www.forum.nokia.com/main/1,35452,1_0_10_10,00.html
    Cheers,
    Nitin

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    RE: Question about display language ?

    Thank you for suggestion and refer document.

    Regard,
    Jakkapop

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×