From af7a53069a4ffb8f041b785d89fe0fcb9f4ca63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Thu, 5 Mar 2020 23:02:04 +0100 Subject: added i18n, converted HTML files, TODO: js UI responses, TODO: translations So basically, multilanguage support from an JavaScript object. - only slovenian and english - no change language UI yet - only HTML strings are actually translated \- all text is translated, but javascript M.toast and other similar stuff does not pass trough s(), d(), S() and D() functions yet - how to i18n: - add a string to js/lang/bundle.js TO ALL LANGUAGES (translation mgmt sys will have to be created) - HTML: create tags, where 1st ? tells wether to just output the string (s) without dot suffix or (d) to try and append a . (for sentences and paragraphs) if it is not there yet. second ? tells wether to leave lowercase strings (l) or (u) to force the first character of the string be uppercase (capitalize()). - put the key of your string as the innerHTML of the x-?? element. - JS: S("key") and D("key") return capitalized, s() and d() do not change case. --- js/initialize.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/initialize.js') diff --git a/js/initialize.js b/js/initialize.js index d62e8d4..b64cbcc 100644 --- a/js/initialize.js +++ b/js/initialize.js @@ -21,7 +21,9 @@ function setupStorage() { localforage.setItem("absences", {}), localforage.setItem("messages", {}), localforage.setItem("directory", {}), - localforage.setItem("meals", {}) + localforage.setItem("meals", {}), + // localforage.setItem("chosenCapitalize", true), // poor unused feature + localforage.setItem("chosenLang", "en") ]; Promise.all(promises_to_run) -- cgit v1.2.3