-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
@todo
- Need to make a calculate function to fit the contents when loading the texts on the landing page
- The different language is appearing different length with the characters.
- Thus, every translation needs to calculate by individually.
- add language parameter to the URL
e.g. https://playproject-io.github.io/?lang=<value> where <value> can be en or de or zh or zh-tw? ...etc...
const params = new URL(location.href).searchParams
const lang = params.get('lang')
console.log(lang) // e.g. => "en"
;(async filepath => {
const json = await fetch(filepath).then(response => response.text())
console.log(json)
})(new URL(`data.${lang}.json`, location.href).href)
// make english default
// => remove param if it's english
const params = new URL(location.href).searchParams
if (params.get('lang') === 'en') {
params.delete('lang')
location.search = params
}Metadata
Metadata
Assignees
Labels
No labels