var dialects = new Array(7);
var dialectTexts = new Array(7);
dialects[0] = «ENGLISH_EN_UK»;
dialectTexts[0] = «EN_UK»;
dialects[1] = «ENGLISH_EN_US»;
dialectTexts[1] = «EN_US»;
dialects[2] = «CATALAN_CA_STD»;
dialectTexts[2] = «CA_STD»;
dialects[3] = «CATALAN_CA_BAL»;
dialectTexts[3] = «CA_BAL»;
dialects[4] = «CATALAN_CA_VAL»;
dialectTexts[4] = «CA_VAL»;
dialects[5] = «PORTUGUESE_PT_BR»;
dialectTexts[5] = «PT_BR»;
dialects[6] = «PORTUGUESE_PT_EU»;
dialectTexts[6] = «PT_EU»;
/** Sets the possible dialects for the specified translation source language. */
function updateDialects(translateForm) {
// the selected translation direction
var transDir = translateForm.translationDirection.value;
// the selected source language
var pos = transDir.indexOf(‘-‘);
var sourceLang = transDir.substring(0, pos);
// the selected target language
var targetLang = transDir.substring(pos + 1);
// remove old dialect settings
translateForm.srcLangDialect.options.length = 0;
translateForm.srcLangDialect.options[translateForm.srcLangDialect.options.length] = new Option(«», «», true, true);
translateForm.tgtLangDialect.options.length = 0;
translateForm.tgtLangDialect.options[translateForm.tgtLangDialect.options.length] = new Option(«», «», true, true);
for (i = 0; i < dialects.length; i++) {
// a supported dialect has the syntax _, e.g. ENGLISH_UK
pos = dialects[i].indexOf(‘_’);
var dialLang = dialects[i].substring(0, pos); // the dialect language
var dialect = dialects[i].substring(pos + 1); // the dialect
if (sourceLang == dialLang) {
translateForm.srcLangDialect.options[translateForm.srcLangDialect.options.length] = new Option(dialectTexts[i], dialect, false, false);
}
if (targetLang == dialLang) {
translateForm.tgtLangDialect.options[translateForm.tgtLangDialect.options.length] = new Option(dialectTexts[i], dialect, false, false);
}
}
if (translateForm.srcLangDialect.options.length == 1) {
// no dialects
translateForm.srcLangDialect.disabled = true;
} else {
translateForm.srcLangDialect.disabled = false;
}
if (translateForm.tgtLangDialect.options.length == 1) {
// no dialects
translateForm.tgtLangDialect.disabled = true;
} else {
translateForm.tgtLangDialect.disabled = false;
}
}
EN_UK
EN_US
CA_STD
CA_BAL
CA_VAL
PT_BR
PT_EU
/
EN_UK
EN_US
CA_STD
CA_BAL
CA_VAL
PT_BR
PT_EU
|