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.

    es language to uppercase

    Scheduled Pinned Locked Moved Troubleshooting
    6 Posts 2 Posters 832 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.
    • S Offline
      scumbelly
      last edited by

      Hi.

      I was wondering if anyone has ever tried to change the OpenWeather es language data from lower case to upper case? The clock/calendar modules for example display marzo instead of Marzo, days are in lower case, etc. She who must be obeyed was “commenting” on it. Is it possible to translate the es lowercase data to uppercase in translations es.json? I didn’t think I could because I thought the translated spanish data, plus calendar month starting on Domingo (oops - dom.), was data supplied from the OpenWeather app. It sure would be easier to do the translation in en.json. I did try “marzo”: “Marzo”, in the es.json file to no success. The month/day format is" MMM Do" in the .js so is it possible to do something weird with moment?

      Wheee!

      Thanks.

      lavolp3L 2 Replies Last reply Reply Quote 0
      • S Offline
        scumbelly
        last edited by

        I went through the locales.js and everything was lowercase.

        https://momentjs.com/downloads/moment-with-locales.js

        The only thing that I can think of doing was setting the config.js back to en.json and in the clock/calendar.js create a translation string and put that into es.json and leave the month starting on Domingo and not Lunes (like in the English en.json ). It’s confusing anyway to look at the english calendar with the week starting on Sunday and then you look at the Spanish calendar and it starts on Monday and visually things are off by one.

        Cheers

        1 Reply Last reply Reply Quote 0
        • lavolp3L Offline
          lavolp3 Module Developer @scumbelly
          last edited by

          @scumbelly said in es language to uppercase:

          Is it possible to translate the es lowercase data to uppercase in translations es.json? I didn’t think I could because I thought the translated spanish data, plus calendar month starting on Domingo (oops - dom.), was data supplied from the OpenWeather app. It sure would be easier to do the translation in en.json. I did try “marzo”: “Marzo”, in the es.json file to no success.

          Translations from the translations file only work when they are explicitely called in the source code using the translate function.
          Hence, a user cannot decide to translate anything by adding the translation.

          How to troubleshoot modules
          MMM-soccer v2, MMM-AVStock

          1 Reply Last reply Reply Quote 0
          • lavolp3L Offline
            lavolp3 Module Developer @scumbelly
            last edited by lavolp3

            @scumbelly APIs like openweather usually supply timestamps that get interpeted by moment(). So moment is the one putting out lowercase days/months instead of uppercase, not openweather.
            Go through the moment docs, and try to find out if you can somhow manipulate the case.

            How to troubleshoot modules
            MMM-soccer v2, MMM-AVStock

            1 Reply Last reply Reply Quote 0
            • S Offline
              scumbelly
              last edited by

              @lavolp3,

              Hi,

              I went through moment.js looking at ways to capitalize ‘domingo’ etc. I could create a function with ‘var str =’ and ‘var res =’, or do a moment.locale (“es”) define a var for months and days with uppercase and do a moment.UpdateLocale but all involving modifying the .js file.

              There was a solution editing the /MagicMirror/vendor/node_modules/moment/min/moment-with-locales.js which would change every module.

              However, this morning I tripped over just adding text-transform: capitalize to the .css for the module. I updated .clock and calendar_monthly. It worked. It’s simple and no messing with moment.locale and the .js

              I learned some things poking around in moment.js but the .css solution was way easier.

              Thank you for your insight and suggestions.

              Cheers!

              lavolp3L 1 Reply Last reply Reply Quote 1
              • lavolp3L Offline
                lavolp3 Module Developer @scumbelly
                last edited by

                @scumbelly great solution! css is really powerful!

                How to troubleshoot modules
                MMM-soccer v2, MMM-AVStock

                1 Reply Last reply Reply Quote 0
                • 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