programmer_rulit, вот пример локализации:
<select onchange="changeLang(this)">
<option value="romanNumerals">Римские цифры</option>
<option value="arabicNumerals" selected>Арабские цифры</option>
</select>
<div id="digits">1, 2, 3, 4, 5, 6, 7, 8, 9</div>
<script>
var dictionary = {
romanNumerals: [ "0", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX" ],
arabicNumerals: [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ]
};
var prevLang = document.querySelector("option[selected]").value;
var separator = ", ";
function changeLang(element) {
var currentLang = element.options[element.selectedIndex].value;
digits.innerHTML = digits.innerHTML
.split(separator)
.map(function (digit) {
var index = dictionary[prevLang].indexOf(digit);
return dictionary[currentLang][index];
})
.join(separator);
prevLang = currentLang;
}
</script>