Dear All,
Displaying other language( thai language ) depend on java mobile phone
or Font( javax.microedition.lcdui.Font ) in j2me ?
Regard,
Abdun
Dear All,
Displaying other language( thai language ) depend on java mobile phone
or Font( javax.microedition.lcdui.Font ) in j2me ?
Regard,
Abdun
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
If depend on phone then How can i know phone supported what language ?
Regard,
Jakkapop
If depend on phone then How can i know phone supported what language ?
Regard,
Abdun
If depend on phone then How can i know phone supported what language ?
Regard,
Abdun
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
Thank you for suggestion and refer document.
Regard,
Jakkapop