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:
parent
985d5233a2
commit
c9d22a9002
4 changed files with 38 additions and 1 deletions
32
js/localization.js
Normal file
32
js/localization.js
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue