Fix icons for russian interface

This commit is contained in:
Julia Radzhabova 2019-12-10 17:22:28 +03:00
parent f6dec13893
commit 62a47e5417
2 changed files with 13 additions and 2 deletions

View file

@ -38,7 +38,8 @@ Common.Locale = new(function() {
"use strict"; "use strict";
var l10n = null; var l10n = null;
var loadcallback, var loadcallback,
apply = false; apply = false,
currentLang = 'en';
var _applyLocalization = function(callback) { var _applyLocalization = function(callback) {
try { try {
@ -78,6 +79,10 @@ Common.Locale = new(function() {
return res || (scope ? eval(scope.name).prototype[prop] : ''); return res || (scope ? eval(scope.name).prototype[prop] : '');
}; };
var _getCurrentLanguage = function() {
return (currentLang || 'en');
};
var _getUrlParameterByName = function(name) { var _getUrlParameterByName = function(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
@ -87,9 +92,11 @@ Common.Locale = new(function() {
var _requireLang = function () { var _requireLang = function () {
var lang = (_getUrlParameterByName('lang') || 'en').split(/[\-_]/)[0]; var lang = (_getUrlParameterByName('lang') || 'en').split(/[\-_]/)[0];
currentLang = lang;
fetch('locale/' + lang + '.json') fetch('locale/' + lang + '.json')
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
currentLang = 'en';
if (lang != 'en') if (lang != 'en')
/* load default lang if fetch failed */ /* load default lang if fetch failed */
return fetch('locale/en.json'); return fetch('locale/en.json');
@ -130,7 +137,8 @@ Common.Locale = new(function() {
return { return {
apply: _applyLocalization, apply: _applyLocalization,
get: _get get: _get,
getCurrentLanguage: _getCurrentLanguage
}; };
})(); })();

View file

@ -601,6 +601,9 @@ define([
this.$window = $('#' + this.initConfig.id); this.$window = $('#' + this.initConfig.id);
if (Common.Locale.getCurrentLanguage() !== 'en')
this.$window.attr('applang', Common.Locale.getCurrentLanguage());
this.binding.keydown = _.bind(_keydown,this); this.binding.keydown = _.bind(_keydown,this);
// $(document).on('keydown', this.binding.keydown); // $(document).on('keydown', this.binding.keydown);