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.

    Question about translations/the translation system

    Scheduled Pinned Locked Moved Solved Troubleshooting
    3 Posts 2 Posters 296 Views 2 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.
    • C Offline
      cgillinger
      last edited by

      Im trying to make a module that displays a message. I’ve made translated language files, eg en.json, sv.json, uk.json etc. They work properly and is set by the global setting in config.js.

      However I would like the language setting in the modules own config.js section to override global. Eg I want to be able to have global setting=sv and module setting =en (as example).

      When I do that, console reports that it is using the module setting, but the display always gives me the global setting. Eg, the language of the message the module displays always shows in the langauge set in global setting.

      Is there any way to change this?

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @cgillinger
        last edited by

        @cgillinger This is one place where the inherited module functions are not so good

        getTranslations()

        happens WAY before any code is run so you can’t adjust its response based on other info the config might have provided…

        and we don’t expose any functions to do the work not related to the files returned from that function

        but your code could do the translations BEFORE giving the content to MM… so there would be nothing to translate

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        C 1 Reply Last reply Reply Quote 1
        • C Offline
          cgillinger @sdetweil
          last edited by

          @sdetweil Thnx, and figures. I guess its a fringe case anyway, having one global language and doing another for this (its a birthday message module Im working on). Ill just settle for using the global settings for now.

          /C

          1 Reply Last reply Reply Quote 0
          • S sdetweil has marked this topic as solved on
          • 1 / 1
          • First post
            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