by Eric Peachey >> Wed, 23 Jun 1999 23:56:55 GMT
Know how to use the translatable strings? Then read no further!
JADE has a useful feature that you may not have discovered. If you have a requirement for storing strings in your schema, and being able to have strings that can contain additional text set at run time, then you might want to look into translatable strings.
I couldn't work out from the on-line help how to use the strings in code. What follows is a query I sent to JADE support together with their reply - no offence intended to Ozzies.
---------------------------------------
1. 23Jun99 06:32 CNW - How do you access the strings in the current locale? I see that there's a method on Locale::getStringValue, and app has a property of currentLocale. How do those strings that look like they have parameters work e.g. MyString2(a,b) = a & 'hohoho' & b
If you can point me to the right piece of documentation on using these things and not just how to define them it'd be helpful.
Thanks,
Eric
2. 24Jun99 09:18 BJ - Eric,
Page 82-84 of the JADE Users Guide shows how to use translatable strings in a method. The key thing to note is that where you want to reference a translatable string you need to prefix the string name with a $ symbol. For example, suppose the following translatable string is defined (ignore my foreign spelling mistakes please):
The English New Zealand translation:
Greeting(a,b) = "Good Morning " & a & " " & b
The German Translation:
Greeting(a,b) = "Guten Morgen " & a & " " & b
The Italian Translation:
Greeting(a,b) = "Bonjorno " & a & " " & b
The Aussie Translation:
Greeting(a,b) = "Gidday mate"
// Notice the deliberate dropping of the name in true Aussie fashion !!!
Now, to make use of this message in say a status line message when they logon, you would do the following:
.....
stsLine.caption := $Greeting(txtFirstName.text, txtLastName.text);
.....
Note that you do not need to work out which greeting to use based on their current locale as JADE will substitute the appropriate greeting depending on the current windows locale setting for this machine.
If their windows locale was German, they would see: Guten Morgen John Smith
If their windows locale was Italian, they would see: Bonjorno John Smith
If their windows locale was English Australian they would see: Gidday Mate
If their windows locale was anything else, they would get the default: Good Morning John Smith
(Assuming the application default locale is set to English New Zealand.)