• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

How to support multiple translations in different UI and API?

Scheduled Pinned Locked Moved Development
1 Posts 1 Posters 144 Views 1 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    winstonma
    last edited by Sep 6, 2020, 6:03 AM

    My modules would like to support multiple languages (e.g. zh-hk and zh-tw). But actually both language uses the same set of language (Traditional Chinese).

    UI

    I could support both language in the following function:

      getTranslations: function () {
        return {
          ...
          "zh-hk": "translations/zh-tw.json"
          "zh-tw": "translations/zh-tw.json"
        };
    

    Is it possible that I could pre-map zh-hk to zh-tw so that I only need to keepzh-tw in getTranslations?

    API

    The API also returned the localized value based on the language parameters. Therefore I would like to convert zh-hk and zh-tw into zh-hant required by the API (in two different lines). Currently I am doing the conversion in a hard-code way. Is it possible that I could pre-map zh-hk to zh-tw so that I could translatezh-tw into zh-hant in the API code?

    1 Reply Last reply Reply Quote 0
    • 1 / 1
    1 / 1
    • First post
      1/1
      Last post
    Enjoying MagicMirror? Please consider a donation!
    MagicMirror created by Michael Teeuw.
    Forum managed by Sam, technical setup by Karsten.
    This forum is using NodeBB as its core | Contributors
    Contact | Privacy Policy