Page 1 of 1

Locale string search

Posted: Fri Aug 07, 2009 10:48 am
by ConvertFromOldNGs
by Desmond >> Wed, 18 Apr 2001 21:33:38 GMT

Hi
In our project we've got lots of locale strings, if Jade can allow us to do a search on that, it will be great.

Re: Locale string search

Posted: Fri Aug 07, 2009 10:48 am
by ConvertFromOldNGs
by Graeme Joyce >> Thu, 19 Apr 2001 1:49:02 GMT

Hi Desmond - some of this might help.... ----------------------------------------------
vars
locale : Locale;
localeId : Integer;
stringDict : ConstantNDict;
xstring : Constant;begin

localeId := currentSchema.getCurrentLocaleId;
locale := currentSchema.getLocale (localeId.String);
stringDict := locale.getTranslatableStrings;

// You now have a dictionary of all translatable strings (key is string name) for the current locale.
// How you use it is up to you. eg you could do this:

xstring := stringDict ["currency_unit"];
if xstring <> null then
write xstring.valueAsString;
endif;

// which will write the value of the translatable string named "currency_unit" for the current locale.

// or this:
foreach xstring in stringDict do
if xstring.valueAsString = "yen" then
write xstring.name;
endif;
endforeach;

// which will write the name of the translatable string that has the value "yen" in this locale. ------------------------------------------------------

Using an iterator in conjunction with "startKeyGeq" will let you do "begins with" substring searches on string name....

HTH
Graeme