Hallo,
with Context.getSelectedLanguage() I can get the LocaleID to get attributes and names in the standard language.
But how can I get the alternate or fallback language?
If there is anyone who can help me I would be very happy.
Many thanks.
Holger
Hallo Robert,
many thanks for your answer. But -sorry- this is not really what I need.
With your line I can reed an attribute in the selected language and if this language is not maintained I get back the alternative language. The description on the help site is: "p_bUseLanguageFallback: if true, the fallback language is used if attribute is not maintained".
What I need is a bit different. In my objects the attributes normally are maintained in the standard language and in many cases additionally in the alternate language. And I have to read, change and write the value in both languages. Therefore I use the localeID to read and write the attribute in the standard language and I guess I can read and write the alternate language when I use the localeID of the alternate language.
My question is: How can I get the localeID of the alternate language?
Many thanks and sorry for the confusion.
Holger
Hi Holger,
ah ok.. Well I always use the following code to get all languages in the DB and then iterate through the languages. But isn't there something like Database.GetFallbackLanguage ? Hm...
Ah, this should help you: Language.isDefault ( )
var g_nLoc = new Array();
var g_sLoc = new Array();
// Build g_nLoc from LanguageList with SelectedLanguage as first entry
INIT_BuildLanguageList();
// ------------------------------------------------------------------------------------------------------------------------
/**
* Routine for building generating language list in array g_nLoc. SelectedLanguage is first entry
*/
// ------------------------------------------------------------------------------------------------------------------------
function INIT_BuildLanguageList() {
var arrLanguageList = null;
var iSelectedLang = 0;
var i = 0;
var j = 0;
// read db languages
iSelectedLang = Context.getSelectedLanguage();
arrLanguageList = ArisData.getActiveDatabase().LanguageList();
j = 0;
for(i = 0; i < arrLanguageList.length; i++){
if(arrLanguageList[i].LocaleId() == iSelectedLang){
g_nLoc[0] = iSelectedLang;
g_sLoc[g_nLoc[0]] = arrLanguageList[i].Name(iSelectedLang);
}
else{
j++;
g_nLoc[j] = arrLanguageList[i].LocaleId();
g_sLoc[g_nLoc[j]] = arrLanguageList[i].Name(iSelectedLang);
}
}
}