×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Sep 2009
    Location
    Bangalore, India
    Posts
    49

    Help : LWUIT Localization

    Hi guys, Please help..

    For Localization in LWUIT we can make use of locale.res resources and we can change the static string that used in project..
    But what if we are getting string data/messages dynamically from server.. ?? How to localize in that case.. ???
    Regards
    Nilanchala

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Help : LWUIT Localization

    Quote Originally Posted by nilanchalapanigrahy View Post
    Hi guys, Please help..

    For Localization in LWUIT we can make use of locale.res resources and we can change the static string that used in project..
    But what if we are getting string data/messages dynamically from server.. ?? How to localize in that case.. ???
    For this you need to send the device default locale to the server on login for every session and server should then send you localized strings in response in Unicode which you can render on the device directly.
    Thanks,
    Ekta

  3. #3
    Registered User
    Join Date
    Aug 2011
    Posts
    9

    Unhappy Re: Help : LWUIT Localization

    I have made a simple form with one textFeild and a command, i want u have two language as farsi and english so that i can use them acc to my needs on run time. i have translate them using ResourceEdittor and have saved them with name English.res and Farsi.res and have added them to my resources. now i have problem in calling localization method as i have no idea how to do that...I will post my code here , please you correct me , its very eargent this is my code :

    public class Midlet extends javax.microedition.midlet.MIDlet {

    private Hashtable locale;

    public void startApp() {
    Display.init(this);

    try {
    Resources res = Resources.open("/Lang.res");


    locale = res.getL10N("locale", "en");


    } catch (IOException ex) {
    ex.printStackTrace();
    }

    Form main = new Form((String) locale.get("FORM"));
    main.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

    Label label = new Label((String) locale.get("NAME"));
    TextField tf1 = new TextField("");
    Button button = new Button((String) locale.get("OK"));

    main.addComponent(label);
    main.addComponent(tf1);
    main.addComponent(button);

    main.addCommand(new Command((String) locale.get("BACK")) {
    public void actionPerformed(ActionEvent evt) {}
    });
    main.show();
    }
    public void pauseApp() {}
    public void destroyApp(boolean unconditional) {}
    }

    and this is my English.res

    Export locale from the Theme Creator
    Tue Aug 02 19:35:55 IRDT 2011
    FORM=form

    OK=ok

    BACK=back

    NAME=name

  4. #4
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,429

    Re: Help : LWUIT Localization

    Hi Yavania, Welcome to Nokia Developer Discussion Boards!!

    There is a code sample How to use ResourceBundle for localization in Java ME I hope this would meet your requirements ?

    Regards
    Gopal

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Help : LWUIT Localization

    refer to this - http://lwuit.blogspot.com/2010/12/lw...al-part-7.htmlfor LWUIT specific localization support.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  6. #6
    Registered User
    Join Date
    Aug 2011
    Posts
    9

    Re: Help : LWUIT Localization

    thank you very much friends for all ur replies , i solved my problem , the name i was passing to getL10N() methos was incorrect....now im getting languages for both persian and english. but the problem is that when i set language for persian nothing appear on the form title, and the same happend for Commands but the same Persian text appear in other Components like Label, Dialog, Button, ...
    , In English all of them are getting tappeared, even when i set tform title or dommand name as persian constants , they r not comming in the form..

    do i need to write extra codes for title and command?? does LWUIT localization support translation of command and title automatically?
    pls helppppppp me...it is very eargent
    tanx in advance

  7. #7
    Registered User
    Join Date
    Aug 2011
    Posts
    9

    Re: Help : LWUIT Localization

    thanks buddy , i still can not localize command and title of a form in Persian, plz help me.

  8. #8
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,429

    Re: Help : LWUIT Localization

    Are you trying in real device or emulator, if in real device , which model ? If I understand correctly from you, the issue is Presian text is not displaying in Form title ? Is it one particular string causing the problem ? Have you tried using a different Persian string ? Does it work ?

    Regards
    Gopal

  9. #9
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Help : LWUIT Localization

    Quote Originally Posted by YAVANIA View Post
    thanks buddy , i still can not localize command and title of a form in Persian, plz help me.
    You need to provide localized version of all command in the form as resource bundle.
    For example it should have key menu = its value in arabic, key name exit and its value etc...
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  10. #10
    Registered User
    Join Date
    Aug 2011
    Posts
    9

    Re: Help : LWUIT Localization

    i finally solved this problem , thanks for all ur guids

Similar Threads

  1. LWUIT and arabic localization
    By the_king2008 in forum Mobile Java Tools & SDKs
    Replies: 8
    Last Post: 2011-08-08, 20:51
  2. Help for Localization in LWUIT..
    By nilanchalapanigrahy in forum Mobile Java General
    Replies: 4
    Last Post: 2010-06-25, 07:51
  3. Localization
    By pavan in forum Symbian
    Replies: 3
    Last Post: 2006-12-23, 06:41
  4. about localization
    By ceehira in forum Symbian
    Replies: 2
    Last Post: 2005-08-05, 07:29
  5. Localization
    By Nokia_Archive in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2002-05-15, 02:51

Posting Permissions

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