Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation issue #6

Open
1 of 2 tasks
Tracked by #5
fionataeyang opened this issue Feb 25, 2020 · 0 comments
Open
1 of 2 tasks
Tracked by #5

Translation issue #6

fionataeyang opened this issue Feb 25, 2020 · 0 comments

Comments

@fionataeyang
Copy link
Contributor

fionataeyang commented Feb 25, 2020

@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
}
@serapath serapath mentioned this issue Feb 25, 2020
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant