diff --git a/locales/en/messages.json b/locales/en/messages.json index 17b5feadbf..8e24310d95 100755 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -171,6 +171,9 @@ "message": "Change language:", "description": "Try and be brief" }, + "userLanguageSelect": { + "message": "Select default language" + }, "language_default": { "message": "System Default" }, diff --git a/src/js/tabs/options.js b/src/js/tabs/options.js index 4a02a92148..946536f0a9 100644 --- a/src/js/tabs/options.js +++ b/src/js/tabs/options.js @@ -30,6 +30,7 @@ options.initialize = function (callback) { TABS.options.initDarkTheme(); TABS.options.initShowDevToolsOnStartup(); TABS.options.initShowNotifications(); + TABS.options.initUserLanguage(); TABS.options.initShowWarnings(); TABS.options.initMeteredConnection(); @@ -233,13 +234,34 @@ options.initShowNotifications = function () { options.initMeteredConnection = function () { const result = getConfig("meteredConnection"); $("div.meteredConnection input") - .prop("checked", !!result.meteredConnection) - .on('change', function () { - setConfig({ meteredConnection: $(this).is(":checked") }); - // update network status - ispConnected(); - }) - .trigger('change'); + .prop("checked", !!result.meteredConnection) + .on('change', function () { + setConfig({ meteredConnection: $(this).is(":checked") }); + // update network status + ispConnected(); + }) + .trigger('change'); +}; + +options.initUserLanguage = function () { + const userLanguage = i18n.selectedLanguage; + const userLanguageElement = $('#userLanguage'); + const languagesAvailables = i18n.getLanguagesAvailables(); + userLanguageElement.append(``); + userLanguageElement.append(''); + languagesAvailables.forEach(element => { + const languageName = i18n.getMessage(`language_${element}`); + userLanguageElement.append(``); + }); + + userLanguageElement + .val(userLanguage) + .on('change', e => { + i18n.changeLanguage(e.target.value); + // translate to user-selected language + i18n.localizePage(); + }) + .trigger('change'); }; // TODO: remove when modules are in place diff --git a/src/tabs/options.html b/src/tabs/options.html index 3dfa502cee..9908a71e4c 100644 --- a/src/tabs/options.html +++ b/src/tabs/options.html @@ -79,6 +79,14 @@ +
+ + + + +