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.

    access to config language setting

    Scheduled Pinned Locked Moved Development
    24 Posts 5 Posters 15.7k Views 5 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.
    • S Offline
      sdetweil @justjim1220
      last edited by sdetweil

      @justjim1220 no… you are not understanding me…

      how do i get the USERS config for language and timezone? not system time, etc…

      user is in Norway…

      this.config.language
      

      doesn’t exist in the calendar module… so the set locale will fail…

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      justjim1220J 3 Replies Last reply Reply Quote 1
      • justjim1220J Offline
        justjim1220 Module Developer @sdetweil
        last edited by

        @sdetweil after you add all that I posted, in your config file the use can add the timezone and language they want to use.

        {
            module: "calendar",
            position: "top_left",
            config: {
                language: "en",
                timezone: "Norway/Oslo"
            }
        },

        "Life's Too Short To Dance With Ugly People"
        Jim Hallock - 1995

        S 1 Reply Last reply Reply Quote 0
        • justjim1220J Offline
          justjim1220 Module Developer @sdetweil
          last edited by

          @sdetweil

          you will also need to add this to your start section:

          / /Set locale.
          moment.updateLocale(config.language, this.getLocaleSpecification(config.timeZone));
          

          "Life's Too Short To Dance With Ugly People"
          Jim Hallock - 1995

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

            @justjim1220 but I don’t want to duplicate the language config…

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            strawberry 3.141S 1 Reply Last reply Reply Quote 1
            • strawberry 3.141S Offline
              strawberry 3.141 Project Sponsor Module Developer @sdetweil
              last edited by

              @sdetweil the global language is accessible like this config.language see example https://github.com/MichMich/MagicMirror/blob/master/modules/default/clock/clock.js#L49

              Please create a github issue if you need help, so I can keep track

              S 1 Reply Last reply Reply Quote 1
              • justjim1220J Offline
                justjim1220 Module Developer @sdetweil
                last edited by

                @sdetweil

                I just did added this to the calendar config and it changed it automatically:

                    {
                        module: "calendar",
                	position: "top_left",	// This can be any of the regions. Best results in left or right regions.
                	config: {
                		language: "fr",
                		timezone: "France/Paris"
                	}
                    },
                

                "Life's Too Short To Dance With Ugly People"
                Jim Hallock - 1995

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

                  @strawberry-3-141 cool, thanks

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  cowboysdudeC 1 Reply Last reply Reply Quote 1
                  • cowboysdudeC Offline
                    cowboysdude Module Developer @sdetweil
                    last edited by cowboysdude

                    @sdetweil said in access to config language setting:

                    @strawberry-3-141 cool, thanks

                    The kid knows his stuff! He’s a good guy! Matter of fact he gave me this to add to my module if it’s of any help :)

                    I use this under the start: function()

                      this.config.lang = this.config.lang || config.language; //automatically overrides and sets 
                         language :)      
                      this.config.units = this.config.units || config.units;
                    
                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      justbob
                      last edited by

                      Sorry for necroing this post, but from all I’ve read so far, this came up with most relevant information and solutions.

                      My question is this - is there a reason why the language change via config was never incorporated in this module?

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

                        @justbob what module? this was a general question, not tied to any module

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        J 1 Reply Last reply Reply Quote 0
                        • J Offline
                          justbob @sdetweil
                          last edited by

                          @sdetweil You mentioned default calendar module, and there were talks about default clock, so my questions referred to those…

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

                            @justbob what do you mean language change?

                            the modules use the default translations

                            set by changing language line 33 of the config.js.sample

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            J 1 Reply Last reply Reply Quote 1
                            • J Offline
                              justbob @sdetweil
                              last edited by

                              @sdetweil OMG, you are right, thank you for pointing out the line!:man_bowing:

                              I was so focused on lines below line 39 (modules), that I completely skipped the ones above as I considered them to be mere comments… :man_facepalming_light_skin_tone:

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

                                @justbob everything ABOVE modules applies to all , its the overall environment

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

                                J 1 Reply Last reply Reply Quote 0
                                • J Offline
                                  justbob @sdetweil
                                  last edited by

                                  @sdetweil I am aware of that, but somehow I just ignored it as I was “on auto-pilot”. :grinning_face_with_sweat:

                                  1 Reply Last reply Reply Quote 1

                                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                  With your input, this post could be even better 💗

                                  Register Login
                                  • 1
                                  • 2
                                  • 1 / 2
                                  • 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