Skip to content

Translation issue #6

@fionataeyang

Description

@fionataeyang

@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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions