mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-16 12:55:14 +03:00
Move src files
This commit is contained in:
parent
aab2a993c8
commit
24c81375a4
371 changed files with 120 additions and 120 deletions
41
src/js/localization.js
Normal file
41
src/js/localization.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
'use strict';
|
||||
|
||||
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');
|
||||
});
|
||||
|
||||
$('[i18n_placeholder]:not(.i18n_placeholder-replaced)').each(function() {
|
||||
var element = $(this);
|
||||
|
||||
element.attr('placeholder', translate(element.attr('i18n_placeholder')));
|
||||
element.addClass('i18n_placeholder-replaced');
|
||||
});
|
||||
|
||||
return localized;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue