Skip to content

Commit

Permalink
Added ukrainian translation by Matronium and worked around firefox bu…
Browse files Browse the repository at this point in the history
…g related to proxies
  • Loading branch information
TheGhostOfInky committed Jun 15, 2024
1 parent 7b6ffd6 commit b600253
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 12 deletions.
10 changes: 5 additions & 5 deletions scripts/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ const langRequested = window.location.search.substring(1).split('&')[0]
const langEnforce = langRequested ? [langRequested] : null

export async function loadL10n() {
const langs = ['cs', 'de', 'en', 'es', 'ko', 'pt', 'zhcn', 'zhtw', 'fr']
const l10nDataList = await Promise.all([
...langs.map(lang =>
const langs = ['cs', 'de', 'en', 'es', 'ko', 'pt', 'zhcn', 'zhtw', 'fr', 'uk']
const [l10nDataList, i18nBuilderMod] = await Promise.all([
Promise.all(langs.map(lang =>
fetch(`./scripts/l10n/${lang}.json`)
.then(res => res.json())
.catch(err => {
throw Error(`Fail to load ${lang} lang data.\n\n${err.message}`)
})
),
)),
import("https://unpkg.com/@aurium/[email protected]") // parallel loading
])
const i18nBuilder = l10nDataList.pop().default
const i18nBuilder = i18nBuilderMod.default
const l10nData = {}
langs.forEach((lang, i) => l10nData[lang] = l10nDataList[i])
window.i18n = i18nBuilder(l10nData, langEnforce)
Expand Down
Loading

0 comments on commit b600253

Please sign in to comment.