PDA

View Full Version : Help with Resource Bundles + Language!!!



drostowsky
04-20-2006, 02:28 PM
Ok, Im completely stumped as to how and get a Japanese version of my installer in ISMP 11.5. I added the translated strings to MyStrings. The various dialogs that use them use the $L() syntax. Basically, I just used the string picker dialog enter those for me into the dialog text fields. Next, I went to Media > Releases > Additional Resource Bundles, and clicked the "Add..." button. I typed "MyStrings" and it complained saying it cant find the resource. Ok, I went to the String Table and Exported the strings to ISMP_HOME/i18n. I see all these .properties files there. Great! Additional Resource Bundles doesnt give me the warning when I added "MyStrings" now. My Releases > Language Support has both Japanese and English listed. Good. So now I create the installer. Run on English machine, life is good. Run on Japanese machine, all my strings come up as "??????" I unzipped setup.jar and couldnt find any mention of my .properties files. Should they be in the root dir of setup.jar, or buried away in some subdir?

I even went so far as to create MyStrings_ja.java using java.util.ListResourceBundle and compiling and putting that into ISMP_HOME/classes/ (no package). Still, nothing.

What the heck am I missing?!!!!

RobertDickau
04-20-2006, 02:38 PM
You shouldn't need both the string table and external resource bundles; you could presumably use just one or the other with the $L expressions.

To see if it's a font problem, perhaps mock up fake strings for a third language, such as French? Or if you use external resource bundles, perhaps try running them through the Java SDK tool native2ascii?

drostowsky
04-20-2006, 03:54 PM
Right. I know I shouldnt need both, but in my frustration Im trying anything I can dream up to try and get these strings in the installer. Ideally, I want just the .properties files. so, I think that ISMP_HOME/i81n directory is where they go right?

I presume Im not missing any steps from my previous description, right? I tried various things with the root product, components, and features to specifically call out the languages in their Advanced > Locale properties, but no luck there either, so I just set them back to "Language Independent." I believe the real key is the Media > Releases > Lanuage Supported listbox to deciding what is language support will be built into the installer.

Ill try with another language, but the odd part is that on the Japanese machine, all the ISMP strings are correctly displayed, so I would expect my strings to be good too. I can actually see my Japanese strings in the tool ok. I used a text editor to view them in the .uip file. Still looks good. Is unzipping the setup.jar going to specifically have my .properties files in there, or does it get encoded somehow? Cause Im sure not seeing them anywhere in that file.

Thanks,
Dave

drostowsky
04-20-2006, 04:00 PM
Oh wait, a sec. Maybe I misread something above. Are you saying that if I put my Japanese strings in the Additional Tools > String Table, that I dont need to put the .properties files also in /i81n directory? I understand that its redundant to have both the .class file and .properties file, but are you saying all I need to do is have them listed in the String Table in the tool? i.e. Export is not necessary?

If thats the case, then that puts me right where I initially started. Because I assumed that putting them into the String Table would just automatically put them into my installer, but that didnt work so I started down this slippery slope.

-Dave

RobertDickau
04-20-2006, 04:05 PM
Correct, you shouldn't need to export properties files from the string table; that's provided for sending files out for translation by an external firm (or other department, or what-have-you). And if you use the string table, you certainly don't need to specify additional language bundles in the release properties; that's only for when you do use external properties files/resource bundles...

drostowsky
04-20-2006, 04:35 PM
OK, great. Thats good to know. Thanks for letting me know about native2ascii. Too bad I cant take that \uxxxx output from that and put it in the string table. That would probably solve my problem. Im going to try and put that in my .java resource class. That might be my answer.

I did notice that if I did a String Table > Import on the .properties file that the Japanese strings come up all funky. However, I initially just opened up notepad and ctrl+c ctrl+v them over into the tool, and they showed up good (but of course displayed as ??? from the installer).

Personally, I kind of like the .properties better since the translator doesnt need to have ISMP installed to input the strings. In that case, I would just leave the string table empty and then use the Resource Bundle?

drostowsky
04-20-2006, 06:11 PM
OK, I finally figured it out, or at least one way that worked for me. For all the poor souls who have the same problem, heres how I solved it.

1) Outside of ISMP, make a MyStrings_ja.java file.

2) The class should look like this:

public class MyStrings_ja extends java.util.ListResourceBundle
{
static final Object[][] contents = new String[][]
{
{ "UIE_Designer", "UIE\u00e3\u0192\u2021\u00e3\u201a\u00b6\u00e3\u201a\u00a4\u00e3\u0192\u0160\u00e3\u0192\u00bc"}, };

public Object[][] getContents()
{
return contents;
}
}

3) Our translator gave me a raw text file with the Japanese strings in it. I handmade a name,value pair file (i.e. the .properties file). I chugged that through the java native2ascii tool. It spit out all the \uXXXX strings. Thats what I put into my .java file.

4) compile the .java file like this: javac -encoding shiftjis *.java (encoding to shiftjis was the KEY. utf8 didnt seem to work out right, even though I think it should).

5) copy the resulting MyStrings_ja.class file to ISMP_HOME/classes

6) As pointed out in the previous reply's, you dont need anything in the String Table in the ISMP tool itself. Just use the $L(MyStrings, <insert key>) syntax in your dialog boxes etc.

7) You do need to set up Media > REleases > Language Support > Additional Resource Bundles > Add... > MyStrings. If it gives a warning, then that means your .class file is not under ISMP_HOME/classes, or itll give a warning that you dont have a default string table. Youll need a MyStrings.class that has your default language (English in my case). Just duplicate the above code into a MyStrings.java and youre good.

I have no idea why putting the Japanese directly into the tool's String Table came out as "?????" The key for me was to get the silly string table encoded as ShiftJIS, or youll spend 2 days on this problem and get a few more gray hairs.

-Dave

PS: This was all for a Windows Launcher install... Ill be doing MacOSX next. That should be fun. ;)