Getting translatableString
Posted: Fri Aug 07, 2009 2:28 pm
by ConvertFromOldNGs
by Michael Hill >> Tue, 29 Aug 2000 3:35:18 GMT
Hi All,
Is there anyway to programatically get all the translatable string for a schema and subschemas?
Thanks for the help in advance...
Michael Hill
Re: Getting translatableString
Posted: Fri Aug 07, 2009 2:28 pm
by ConvertFromOldNGs
by John Eyers >> Wed, 30 Aug 2000 2:57:11 GMT
See the code below:
getXLS();
vars
sc : SchemaColl;
scm : Schema;
lc : Locale;
cs : Constant;
oa : ObjectArray;
obj : Object;
cn : ConstantNDict;begin
create sc transient;
create oa transient;
currentSchema.allSubschemas(sc);
sc.add(currentSchema);
foreach scm in sc do
write "schema " & scm.name;
oa.clear;
scm.getAllBaseLocales(oa);
foreach obj in oa do
lc := obj.Locale;
write "Locale " & lc.name;
cn := lc.getTranslatableStrings;
foreach cs in cn do
write "XLS " & cs.name & ": " & cs.getSource;
endforeach;
endforeach;
endforeach;
epilog
delete sc;
delete oa;
end;
Schema.allSubschemas gets all subschemas. Translatable strings are held by locale within each schema. Locale.getAllBaseLocales gets all unique (non-cloned) locales - if you want all locales, use .getAllLocales. Locale.getTranslatableStrings returns a ConstantNDict of Constants by name. The TranslatableString class is a subclass of Constant, with property of name and method getSource to return the source.