Skip to content

Commit 187c602

Browse files
committed
Add saving language to local storage
1 parent f424beb commit 187c602

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/script.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ for (const key of Object.keys(supported_languages)) {
242242
li.innerHTML = `<h1>${lang['flag']}</h1>`
243243

244244
li.addEventListener('click', () => {
245+
localStorage.setItem('chosen-language', key)
245246
loadTranslations(key)
246247
})
247248

src/translations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ window.loadTranslations = async (_lang = lang) => {
6060
})
6161
}
6262

63-
loadTranslations()
63+
loadTranslations(localStorage.getItem('chosen-language') ?? lang)

0 commit comments

Comments
 (0)