PDA

View Full Version : How do you create a Resource Bundle?



NewsArchive
01-03-2002, 12:00 AM
I'm new to ISMP, and I can't seem to find any documentation on what
needs to be done to create a resource bundle. The install that I am
creating will be translated into 10 different languages. How/where do I
store my custom strings?


Thanks,
Anthony

NewsArchive
01-07-2002, 12:00 AM
Anthony,

You need to build class files for each language you want to support using a
specific naming convention based on the language and country. For instance,
English would be MyStrings_en and German would be MyStrings_de. However, if
you want to distinguish between Portuguese (Portugal) and Portuguese
(Brazil) you need to include the country code, such as in, MyStrings_pt_PT
or MyStrings_pt_BR.

Here is some basic java code to create the class files. You can replicate
the same code for each language, changing the MyStrings_en with the new
language code and replacing the English text with the new language text.

==========================================
import java.util.ListResourceBundle;
public class MyStrings_en extends ListResourceBundle
{
public Object[][] getContents() {return contents;}
static final Object[][] contents =
{
{"string1", "Welcome!"}
}
}
==========================================

Once you have all you .class file built (one for each language), you can
then insert them all into a .JAR file.

jar cvf MyStrings.jar MyStrings*.class

You then use the Embedded JARs property for each platform you are building
to include the strings into your installer.

To reference the string from your installer use the $L string resolver like
this:

$L(MyStrings, string1)

Hope this helps,

-Shawn

Anthony Hunter <anthony.hunter@wonderware.com> wrote in message
news:3C34D83D.1EB77BFB@wonderware.com...
> I'm new to ISMP, and I can't seem to find any documentation on what
> needs to be done to create a resource bundle. The install that I am
> creating will be translated into 10 different languages. How/where do I
> store my custom strings?
>
>
> Thanks,
> Anthony
>

NewsArchive
01-08-2002, 12:00 AM
Thanks. That did the trick.


Anthony

Shawn Campbell wrote:

> Anthony,
>
> You need to build class files for each language you want to support using a
> specific naming convention based on the language and country. For instance,
> English would be MyStrings_en and German would be MyStrings_de. However, if
> you want to distinguish between Portuguese (Portugal) and Portuguese
> (Brazil) you need to include the country code, such as in, MyStrings_pt_PT
> or MyStrings_pt_BR.
>
> Here is some basic java code to create the class files. You can replicate
> the same code for each language, changing the MyStrings_en with the new
> language code and replacing the English text with the new language text.
>
> ==========================================
> import java.util.ListResourceBundle;
> public class MyStrings_en extends ListResourceBundle
> {
> public Object[][] getContents() {return contents;}
> static final Object[][] contents =
> {
> {"string1", "Welcome!"}
> }
> }
> ==========================================
>
> Once you have all you .class file built (one for each language), you can
> then insert them all into a .JAR file.
>
> jar cvf MyStrings.jar MyStrings*.class
>
> You then use the Embedded JARs property for each platform you are building
> to include the strings into your installer.
>
> To reference the string from your installer use the $L string resolver like
> this:
>
> $L(MyStrings, string1)
>
> Hope this helps,
>
> -Shawn
>
> Anthony Hunter <anthony.hunter@wonderware.com> wrote in message
> news:3C34D83D.1EB77BFB@wonderware.com...
> > I'm new to ISMP, and I can't seem to find any documentation on what
> > needs to be done to create a resource bundle. The install that I am
> > creating will be translated into 10 different languages. How/where do I
> > store my custom strings?
> >
> >
> > Thanks,
> > Anthony
> >