Re: Trouble with array localization.

20 views
Skip to first unread message

Willy

unread,
Sep 25, 2012, 11:22:09 AM9/25/12
to google-we...@googlegroups.com
I think I figured out...

Inside my classes I defined a variable like:

String fruits[] =
{
    myMessages.apple(),
    myMessages.pear()
};

and It works.

Thanks anyway, and excuse me for the double or triple message :P
And if there is a better solution please let me know! :D

--
Willy

Il giorno martedì 25 settembre 2012 10:10:42 UTC+2, Willy ha scritto:
Hi, 
I've some trouble with array localization.
In my software I've used this method to localize my string:
 
public interface MyMessages extends Messages {
    String first();
    String second();
}
 
The I've created the properties files:
#MyMessages_it.properties:
first = primo
second = secondo
   
#MyMessages_en.properties:
first = primo
second = secondo

Now the problem.
I've an array like that:

String fruits[] =
{
    "Apple",
    "Pear"
}

that I use like: "  = fruits[0] "

How can I localize that?

Now I'm using a function like that:

String printFruit(int j)
{
    if(j == 0)
        return myMessages.apple();
    else(j == 1)
        return myMessages.pear();
    else
        return myMessages.errorString();
}

PS: Sorry for the previous messages.

--
Willy

Reply all
Reply to author
Forward
0 new messages