1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +03:00

initial changes required for i18n system

This commit is contained in:
cTn 2014-03-20 22:24:49 +01:00
parent 985d5233a2
commit c9d22a9002
4 changed files with 38 additions and 1 deletions

32
js/localization.js Normal file
View file

@ -0,0 +1,32 @@
function localize() {
var localized = 0;
var translate = function(messageID) {
localized++;
return chrome.i18n.getMessage(messageID);
};
$('[i18n]:not(.i18n-replaced').each(function() {
var element = $(this);
element.html(translate(element.attr('i18n')));
element.addClass('i18n-replaced');
});
$('[i18n_title]:not(.i18n_title-replaced').each(function() {
var element = $(this);
element.attr('title', translate(element.attr('i18n_title')));
element.addClass('i18n_title-replaced');
});
$('[i18n_value]:not(.i18n_value-replaced').each(function() {
var element = $(this);
element.val(translate(element.attr('i18n_value')));
element.addClass('i18n_value-replaced');
});
return localized;
}