localisation in android

Put your problem here if it does not fit any of the other categories.

localisation in android

Postby shiteiru » Thu Jun 26, 2008 2:42 pm

Compressed in one short sentence:
as far as i can see localisation support in android is pretty shitty...

I tried to write my own localisation classes and although they work i feel very uncomfortable with them.
One of the main issues is, that you have to declare the strings static and final:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  2. public static final String back = "main menu";
Parsed in 0.012 seconds, using GeSHi

so you cannot influence them once they have been created...that sucks.
As a result one has to write a class for every language one wants to support.

So..i created a file called "Localisation.java" with all the Strings and languages i'd like to support.
then i can import this file to the package wher i want to use it:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  2. import jp.tracker.localisation.android.*;
  4. //acces the defined Strings
  6. Localisation.Japan.*
  8. Localisation.English.*
  10. Loclisation.German.*
Parsed in 0.010 seconds, using GeSHi

so far so good...
the problem is that i have to check which language the user has chosen on EVERY SINGLE STRING i want to use from my "Localisatin.java" file
this leads to smth like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  2. if (language == "0"){show_pins.setText(Localisation.Japan.pinlist);}
  4.                        else{show_pins.setText(Localisation.English.pinlist);}
Parsed in 0.011 seconds, using GeSHi

and thats i have to say kinda horrific...it makes my hair stand up...

So if anyone has a suggestion for me about how to make it work better/smoother please let me know.

I would also be glad if anyone could tell me if there is a localisation support in android already integretade that i have overseen or if somethin alike is planned for a future sdk.

regards shiteiru している
Junior Developer
Junior Developer
Posts: 23
Joined: Tue May 20, 2008 7:16 pm


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 5 guests