Read the statement by Michael Teeuw here.
Capitalize the first letter of the day/month in clock module
-
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!
-
@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;
-
@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 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 fromhooks.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
-
@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.
-
@idoodler What could happen? Malfunctions and errors?
-
@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.