MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    SOLVED Capitalize the first letter of the day/month in clock module

    Troubleshooting
    3
    8
    1341
    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.
    • El Bardo
      El Bardo last edited by

      Hello everyone, today I tried to change the language from config.js and generally everything went well. But I do not understand why in the Italian language and in many others it is not possible to capitalize the first letters of the month and days, is there a way to achieve this? It bothers me the fact I’m forced to use the English language to get an elegant result with capital letters in the right place and not being able to use my language … Thanks in advance!

      idoodler 1 Reply Last reply Reply Quote 0
      • idoodler
        idoodler Module Developer @El Bardo last edited by

        @el-bardo Please show us the relevent parts of your config.js. Are you using the default clock?

        From my head I can only think of custom CSS to archive capitalization:
        text-transform: capitalize;

        1 Reply Last reply Reply Quote 0
        • El Bardo
          El Bardo last edited by El Bardo

          @idoodler Yes, I’m using the default clock module. Can you show me how implement this thing? I’m a bit novice here :smiling_face_with_open_mouth_cold_sweat:

          Mykle1 1 Reply Last reply Reply Quote 0
          • Mykle1
            Mykle1 Project Sponsor Module Developer @El Bardo last edited by

            @el-bardo

            You could try, in your custom.css file, add:

            .clock {
              text-transform: capitalize;
            }
            

            Create a working config
            How to add modules

            El Bardo 1 Reply Last reply Reply Quote 1
            • El Bardo
              El Bardo @Mykle1 last edited by El Bardo

              @mykle1 thank you, I’ll give it a try later!

              Meanwhile, I tried to find a solution and I think I found a very basic one. I simply edited the file “moment-with-locales.js” in /home/pi/MagicMirror/vendor/node_modules/moment/min/moment-with-locales.js by changing the parts related to my language from

              hooks.defineLocale('it', {
                  months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'),
                  monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'),
                  weekdays : 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split('_'),
                  weekdaysShort : 'dom_lun_mar_mer_gio_ven_sab'.split('_'),
                  weekdaysMin : 'do_lu_ma_me_gi_ve_sa'.split('_'),
              

              to

              hooks.defineLocale('it', {
                  months : 'Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settembre_Ottobre_Novembre_Dicembre'.split('_'),
                  monthsShort : 'Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic'.split('_'),
                  weekdays : 'Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato'.split('_'),
                  weekdaysShort : 'Dom_Lun_Mar_Mer_Gio_Ven_Sab'.split('_'),
                  weekdaysMin : 'Do_Lu_Ma_Me_Gi_Ve_Sa'.split('_'),
              

              I noticed that this change works on all other modules

              idoodler 1 Reply Last reply Reply Quote 0
              • idoodler
                idoodler Module Developer @El Bardo last edited by

                @el-bardo I would not recogmend to edit the moment.js library. Yes, it may solve your problem but changes to this library will also affect other modules.

                In general it is unsave to just adapt a 3rd party library.

                El Bardo 1 Reply Last reply Reply Quote 0
                • El Bardo
                  El Bardo @idoodler last edited by

                  @idoodler What could happen? Malfunctions and errors?

                  idoodler 1 Reply Last reply Reply Quote 0
                  • idoodler
                    idoodler Module Developer @El Bardo last edited by

                    @el-bardo You never know how other module devs use such functions.

                    Always use the most non-inversive way which would be the custom CSS way.

                    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 Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                    This forum is using NodeBB as its core | Contributors
                    Contact | Privacy Policy