diff options
author | altaf-creator <dev@altafcreator.com> | 2024-04-17 16:19:15 +0700 |
---|---|---|
committer | altaf-creator <dev@altafcreator.com> | 2024-04-17 16:19:15 +0700 |
commit | cd34dc6fb1cd47e578f761a7609bd976f253eac7 (patch) | |
tree | 3e488307733455c1a97b347a745d06f38ecf24e6 /scripts/localStorage.js | |
parent | 3d0ccfba34d6371b41e877189b78599ae7b2f98a (diff) |
idk what i did, i forgot. go check the diffs
Diffstat (limited to 'scripts/localStorage.js')
-rw-r--r-- | scripts/localStorage.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/localStorage.js b/scripts/localStorage.js new file mode 100644 index 0000000..c5eb43d --- /dev/null +++ b/scripts/localStorage.js @@ -0,0 +1,27 @@ +function langIndonesia() { + localStorage.setItem("lang", "id"); + window.location.reload(); +} + +function langEnglish() { + localStorage.setItem("lang", "en"); + window.location.reload(); +} + +function switchLang() { + switchLangStorage(); + window.location.reload(); +} + +function switchLangStorage() { + if (localStorage.getItem("lang") == "id") { + localStorage.setItem("lang", "en"); + } else { + localStorage.setItem("lang", "id"); + } +} + +function switchLangHref(destination) { + switchLangStorage(); + window.location.href = destination; +} |