From 190f3aaf31fdfba96b0f5ff91dcbe4aba58dac71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Tue, 10 Mar 2020 16:25:29 +0100 Subject: 1.0.12-beta: podpora za jezike --- js/lang/bundle.js | 8 ++++--- js/settings.js | 17 +++++++++++++++ pages/changelog.html | 7 ++++++ pages/settings.html | 60 +++++++++++++++++++++++++++------------------------- sw.js | 4 +++- 5 files changed, 63 insertions(+), 33 deletions(-) create mode 100644 js/settings.js diff --git a/js/lang/bundle.js b/js/lang/bundle.js index 84698bc..c4c3a0b 100644 --- a/js/lang/bundle.js +++ b/js/lang/bundle.js @@ -260,7 +260,8 @@ var langstrings = { privacyAcceptWithUse: "your continued use of our website will be regarded as acceptance of our practices around privacy and personal information. If you have any questions about how we handle user data and personal information, feel free to contact us.", privacyEffectiveAsOf: "this policy is effective as of", // settings - language: "language" + language: "language", + languageSet: "language set, open another page for the changes to take effect" }, sl: { miscTranslationLanguage: "slovenščina", @@ -418,6 +419,7 @@ var langstrings = { privacyRefuse: "you are free to refuse our request for your personal information, with the understanding that we may be unable to provide you with some of your desired services.", privacyAcceptWithUse: "your continued use of our website will be regarded as acceptance of our practices around privacy and personal information. If you have any questions about how we handle user data and personal information, feel free to contact us.", privacyEffectiveAsOf: "this policy is effective as of", - language: "jezik" - }, + language: "jezik", + languageSet: "jezik nastavljen, odprite neko drugo stran da se pokažejo spremembe" + } } diff --git a/js/settings.js b/js/settings.js new file mode 100644 index 0000000..41c9df1 --- /dev/null +++ b/js/settings.js @@ -0,0 +1,17 @@ +// settings.js -- TODO + +async function setLanguage(langCode) { + localforage.setItem("chosenLang", langCode).then( () => { + UIAlert(D("languageSet"), "setLanguage(): languageSet"); + }); +} + +document.addEventListener("DOMContentLoaded", async () => { + $(document).on("click",".settings-language-selector", function () { + let languageToSet = $(this).attr('data-language'); + setLanguage(languageToSet); + }); + // Setup side menu + const menus = document.querySelectorAll(".side-menu"); + M.Sidenav.init(menus, { edge: "right", draggable: true }); +}); diff --git a/pages/changelog.html b/pages/changelog.html index ee1c3d7..ad4c9e8 100644 --- a/pages/changelog.html +++ b/pages/changelog.html @@ -48,6 +48,13 @@

changelog