aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/app.js19
-rw-r--r--web/app/Resources.js67
-rw-r--r--web/l10n/en.js66
-rw-r--r--web/l10n/ru.js66
4 files changed, 151 insertions, 67 deletions
diff --git a/web/app.js b/web/app.js
index 9599373a6..7b007a982 100644
--- a/web/app.js
+++ b/web/app.js
@@ -18,6 +18,25 @@ Ext.Loader.setConfig({
disableCaching: false
});
+{
+ var available = {
+ 'en': true,
+ 'ru': true
+ };
+
+ var language = Ext.Object.fromQueryString(window.location.search.substring(1)).locale;
+ if (language === undefined) {
+ language = window.navigator.userLanguage || window.navigator.language;
+ language = language.substr(0, 2);
+ }
+
+ if (!(language in available)) {
+ language = 'en'; // default
+ }
+
+ Ext.Loader.loadScript('/l10n/' + language + '.js');
+}
+
Ext.application({
name: 'Traccar',
extend: 'Traccar.Application'
diff --git a/web/app/Resources.js b/web/app/Resources.js
index fe08fb943..446c59594 100644
--- a/web/app/Resources.js
+++ b/web/app/Resources.js
@@ -14,73 +14,6 @@
* limitations under the License.
*/
-var strings = {
- shared_loading: 'Loading...',
-
- error_title: 'Error',
- error_unknown: 'Unknown error',
-
- login_title: 'Login',
- login_user_title: 'User',
- login_users_title: 'Users',
- login_name: 'Name',
- login_email: 'Email',
- login_password: 'Password',
- login_admin: 'Admin',
- login_register: 'Register',
- login_login: 'Login',
- login_failed: 'Incorrect email address or password',
- login_created: 'New user has been registered',
-
- user_remove_confirm: 'Remove user?',
-
- device_dialog: 'Device',
- device_title: 'Devices',
- device_name: 'Name',
- device_identifier: 'Identifier',
- device_remove_confirm: 'Remove device?',
- device_add: 'Add',
- device_edit: 'Edit',
- device_remove: 'Remove',
- device_logout: 'Logout',
- device_settings: 'Settings',
- device_settings_user: 'Account',
- device_settings_server: 'Server',
- device_settings_users: 'Users',
-
- report_title: 'Reports',
- report_device: 'Device',
- report_from: 'From',
- report_to: 'To',
- report_show: 'Show',
- report_clear: 'Clear',
- report_time: 'Time',
- report_valid: 'Valid',
- report_latitude: 'Latitude',
- report_longitude: 'Longitude',
- report_altitude: 'Altitude',
- report_speed: 'Speed',
- report_course: 'Course',
- report_address: 'Address',
-
- server_title: 'Server settings',
- server_latitude: 'Latitude',
- server_longitude: 'Longitude',
- server_zoom: 'Zoom',
- server_registration: 'Registration',
-
- dialog_save: 'Save',
- dialog_delete: 'Delete',
- dialog_cancel: 'Cancel',
-
- map_title: 'Map',
-
- state_title: 'State',
- state_name: 'Parameter',
- state_value: 'Value',
- state_protocol: 'Protocol'
-};
-
var styles = {
panel_padding: 10,
diff --git a/web/l10n/en.js b/web/l10n/en.js
new file mode 100644
index 000000000..78970b5b0
--- /dev/null
+++ b/web/l10n/en.js
@@ -0,0 +1,66 @@
+var strings = {
+ shared_loading: 'Loading...',
+
+ error_title: 'Error',
+ error_unknown: 'Unknown error',
+
+ login_title: 'Login',
+ login_user_title: 'User',
+ login_users_title: 'Users',
+ login_name: 'Name',
+ login_email: 'Email',
+ login_password: 'Password',
+ login_admin: 'Admin',
+ login_register: 'Register',
+ login_login: 'Login',
+ login_failed: 'Incorrect email address or password',
+ login_created: 'New user has been registered',
+
+ user_remove_confirm: 'Remove user?',
+
+ device_dialog: 'Device',
+ device_title: 'Devices',
+ device_name: 'Name',
+ device_identifier: 'Identifier',
+ device_remove_confirm: 'Remove device?',
+ device_add: 'Add',
+ device_edit: 'Edit',
+ device_remove: 'Remove',
+ device_logout: 'Logout',
+ device_settings: 'Settings',
+ device_settings_user: 'Account',
+ device_settings_server: 'Server',
+ device_settings_users: 'Users',
+
+ report_title: 'Reports',
+ report_device: 'Device',
+ report_from: 'From',
+ report_to: 'To',
+ report_show: 'Show',
+ report_clear: 'Clear',
+ report_time: 'Time',
+ report_valid: 'Valid',
+ report_latitude: 'Latitude',
+ report_longitude: 'Longitude',
+ report_altitude: 'Altitude',
+ report_speed: 'Speed',
+ report_course: 'Course',
+ report_address: 'Address',
+
+ server_title: 'Server settings',
+ server_latitude: 'Latitude',
+ server_longitude: 'Longitude',
+ server_zoom: 'Zoom',
+ server_registration: 'Registration',
+
+ dialog_save: 'Save',
+ dialog_delete: 'Delete',
+ dialog_cancel: 'Cancel',
+
+ map_title: 'Map',
+
+ state_title: 'State',
+ state_name: 'Parameter',
+ state_value: 'Value',
+ state_protocol: 'Protocol'
+};
diff --git a/web/l10n/ru.js b/web/l10n/ru.js
new file mode 100644
index 000000000..64fe8f617
--- /dev/null
+++ b/web/l10n/ru.js
@@ -0,0 +1,66 @@
+var strings = {
+ shared_loading: 'Loading...',
+
+ error_title: 'Error',
+ error_unknown: 'Unknown error',
+
+ login_title: 'Логин',
+ login_user_title: 'User',
+ login_users_title: 'Users',
+ login_name: 'Name',
+ login_email: 'Email',
+ login_password: 'Password',
+ login_admin: 'Admin',
+ login_register: 'Register',
+ login_login: 'Login',
+ login_failed: 'Incorrect email address or password',
+ login_created: 'New user has been registered',
+
+ user_remove_confirm: 'Remove user?',
+
+ device_dialog: 'Device',
+ device_title: 'Devices',
+ device_name: 'Name',
+ device_identifier: 'Identifier',
+ device_remove_confirm: 'Remove device?',
+ device_add: 'Add',
+ device_edit: 'Edit',
+ device_remove: 'Remove',
+ device_logout: 'Logout',
+ device_settings: 'Settings',
+ device_settings_user: 'Account',
+ device_settings_server: 'Server',
+ device_settings_users: 'Users',
+
+ report_title: 'Reports',
+ report_device: 'Device',
+ report_from: 'From',
+ report_to: 'To',
+ report_show: 'Show',
+ report_clear: 'Clear',
+ report_time: 'Time',
+ report_valid: 'Valid',
+ report_latitude: 'Latitude',
+ report_longitude: 'Longitude',
+ report_altitude: 'Altitude',
+ report_speed: 'Speed',
+ report_course: 'Course',
+ report_address: 'Address',
+
+ server_title: 'Server settings',
+ server_latitude: 'Latitude',
+ server_longitude: 'Longitude',
+ server_zoom: 'Zoom',
+ server_registration: 'Registration',
+
+ dialog_save: 'Save',
+ dialog_delete: 'Delete',
+ dialog_cancel: 'Cancel',
+
+ map_title: 'Map',
+
+ state_title: 'State',
+ state_name: 'Parameter',
+ state_value: 'Value',
+ state_protocol: 'Protocol'
+};