diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-25 16:51:54 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-25 16:51:54 +1200 |
commit | 67dc1c43932bffaf9df2c9ec201cff879d0226d9 (patch) | |
tree | 18c96e48641c5fd681f2b1b4269f0793bd6d288e /web | |
parent | 6a0f2db76a2a60679183b98720a0e48d76778d26 (diff) | |
download | trackermap-server-67dc1c43932bffaf9df2c9ec201cff879d0226d9.tar.gz trackermap-server-67dc1c43932bffaf9df2c9ec201cff879d0226d9.tar.bz2 trackermap-server-67dc1c43932bffaf9df2c9ec201cff879d0226d9.zip |
Support interface localization
Diffstat (limited to 'web')
-rw-r--r-- | web/Application.js | 38 | ||||
-rw-r--r-- | web/Strings-ru.js | 32 |
2 files changed, 61 insertions, 9 deletions
diff --git a/web/Application.js b/web/Application.js index 2cd8df2a0..c522d50f7 100644 --- a/web/Application.js +++ b/web/Application.js @@ -14,15 +14,35 @@ * limitations under the License. */ -Ext.application({ - name: 'Traccar', - requires: [ - 'Strings', - 'Styles', - 'Login' - ], +Ext.Loader.setConfig({ + disableCaching: false +}); + +Ext.Loader.loadScript({ + + url: function() { + var urlParams = document.URL.split("?"); + var params = Ext.urlDecode(urlParams[urlParams.length - 1]); + + if (!params.lang) { + return "Strings.js"; + } else { + return "Strings-" + params.lang + ".js"; + } + }(), + + onLoad: function() { + + Ext.application({ + name: 'Traccar', + requires: [ + 'Styles', + 'Login' + ], - launch: function() { - Ext.create('Login').show(); + launch: function() { + Ext.create('Login').show(); + } + }); } }); diff --git a/web/Strings-ru.js b/web/Strings-ru.js new file mode 100644 index 000000000..73b3a329f --- /dev/null +++ b/web/Strings-ru.js @@ -0,0 +1,32 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Ext.define('Strings', { + singleton: true, + + login_title: 'Логин', + login_user: 'Пользователь', + login_password: 'Пароль', + login_register: 'Регистрация', + login_login: 'Вход', + login_failed: 'Неправильный логин или пароль.', + + device_title: 'Устройства', + device_name: 'Название', + device_identifier: 'Идентификатор', + + map_title: 'Карта' +}); |