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
  1.  
  2. public static final String back = "main menu";
  3.  
  4.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

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
  1.  
  2. import jp.tracker.localisation.android.*;
  3.  
  4. //acces the defined Strings
  5.  
  6. Localisation.Japan.*
  7.  
  8. Localisation.English.*
  9.  
  10. Loclisation.German.*
  11.  
  12.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

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
  1.  
  2. if (language == "0"){show_pins.setText(Localisation.Japan.pinlist);}
  3.  
  4.                        else{show_pins.setText(Localisation.English.pinlist);}
  5.  
  6.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


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 している
shiteiru
Junior Developer
Junior Developer
 
Posts: 23
Joined: Tue May 20, 2008 7:16 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 18 guests