-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Support for two-letter days-of-week #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@eternicode, you could overwrite the language definition for moment.weekdaysShort = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']; If you are planning on internationalization, you could write your own custom language definition. For more see http://momentjs.com/docs/#/i18n/adding-language/. |
@rockymeza That's fine for one-off uses, but I'm planning moment.js support for bootstrap-datepicker. The idea is to take advantage of moment's existing translations, for users who are already using it. Currently, I'm simply taking the first two letters of the three-letter translations ('ddd'), but there are some locales (like French) that use representations that are not two letters, and others (like Spanish) whose minimal representation is different than the first two letters of the short representation (Sáb vs Sa). |
@eternicode It appears that the format string Perhaps we could do a |
@rockymeza , yeah, I saw the |
@timrwood, what do you think about adding a |
If we're going to support it, we should probably go all the way and make sure each lang has a What if we allowed langs to not declare a Then, if a language needs special handling for the If we do it this way, we should also do this for |
@eternicode, do you think you would willing to write a pull request for this enhancement? |
@rockymeza sure, I'll take a stab at it this weekend. How do you guys want to source the translations? I'm thinking we can copy from jQuery UI datepicker's dayNamesMin translations. It's MIT license (which it looks like momentjs is, as well?), though I doubt this qualifies as "substantial portions of code". |
@timrwood, license stuff? |
Yeah, it's data, not code, so I don't think there is a problem. We can tag all the original lang contributors in the pull request and ask them to verify the accuracy. I'm working on adding the lang authors to the comments of each lang file for future reference. |
I like the idea of having those author names in there. Also, it is a little difficult to know what the language is based on the shortcut name. Would it be possible to add the language name inside the comments too? |
Here's the format I was thinking of using. // moment.js language configuration
// language : catalan (ca)
// author : Juan G. Hurtado : https://github.com/juanghurtado
(function () {
var lang = { |
and done... 01618d4 |
Added a commit that I believe covers it. For the most part, I normalized the minimal versions to title-case without periods. There were a few that don't use romanic letters (cv, jp, zh-*, and ru being the ones that stood out) that I left as-is. Choices for chuvash (cv) were base on the attachment to this glibc issue |
Excellent work! I know working with all the lang files is a pain in the ass, so much thanks for working on this! I'll tag all the authors of the original language files in the morning and once they put in their 2 cents I'll merge the pull request. Thanks @eternicode! |
@juanghurtado @mirontoli @mrbase @lluchs @chrisgedrim We're adding even shorter weekday name translations to moment.js. Each of you contributed a language translation, so could you look over the translation you provided and let us know if the weekdaysMin values look good? Sorry for the mass post... |
@julionc @eillarra @bleadof @jfroffice @hinrik @aliem @baryon @kyungw00k @rexxars @jjupiter Looks like theres a limit on how many people you can tag in a comment. See above. |
@evoL @jalex79 @Viktorminator @ulmus @erhangundogan @suupic @ben-lin See above. |
They look right for "gl" and "ca" locales. Not usual form of the abbr., of course (the usual one is located under |
I think that the italian translations can be a little shorter |
Yeah, this is intended for things like date pickers where space is limited. |
Oh I see, for date pickers the right one is indeed |
Looks fine for de. |
@@ -51,6 +51,7 @@ | |||
monthsShort : "tam_hel_maa_huh_tou_kes_hei_elo_syy_lok_mar_jou".split("_"), | |||
weekdays : "sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"), | |||
weekdaysShort : "su_ma_ti_ke_to_pe_la".split("_"), | |||
weekdaysMin : "Su_Ma_Ti_Ke_To_Pe_La".split("_"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be changed. In Finnish we don't use capital letter in the default shortening of the week days.
They should still be su_ma_ti_ke_to_pe_la .
See references:
http://webcgi.oulu.fi/oykk/abc/kielenhuolto/oikeinkirjoitus/lyhenteet/lyhenteiden_lajit/
http://koulut.tampere.fi/materiaalit/kieli/3_2_3.html
http://fi.wikipedia.org/wiki/Lyhenne
You can see the jQuery UI localization for locales references. |
both zh-tw and zh-cn are good in pull request https://github.com/eternicode/moment/commit/f47cb47a8990ccd731faa4d9b22413d1db995069#commitcomment-1328986, nice works :) |
pl is alright, great work! |
@@ -7,6 +7,7 @@ | |||
monthsShort : "urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"), | |||
weekdays : "igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"), | |||
weekdaysShort : "ig._al._ar._az._og._ol._lr.".split("_"), | |||
weekdaysMin : "Ig_Al_Ar_Az_Og_Ol_Lr".split("_"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem for Basque: the default shortening of the week days should stay in lowercase. (view Finnish comment by @bleadof )
@julionc Don't know for the other languages, but at least for Basque the jQuery UI localization is not right. |
@@ -7,6 +7,7 @@ | |||
monthsShort : "jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"), | |||
weekdays : "söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"), | |||
weekdaysShort : "sön_mån_tis_ons_tor_fre_lör".split("_"), | |||
weekdaysMin : "Sö_Må_Ti_On_To_Fr_Lö".split("_"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the finnish weekdays, the days should not be capitalized in Swedish, even when abbreviated. The correct string is
weekdaysMin : "sö_må_ti_on_to_fr_lö".split("_"),
looks fine for da |
will be better for fr. |
The Icelandic ones look fine. |
@@ -7,6 +7,7 @@ | |||
monthsShort : "jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"), | |||
weekdays : "søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"), | |||
weekdaysShort : "søn_man_tir_ons_tor_fre_lør".split("_"), | |||
weekdaysMin : "Sø_Ma_Ti_On_To_Fr_Lø".split("_"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the finnish and swedish weekdays, the days should not be capitalized in Norwegian, even when abbreviated. The correct string is
weekdaysMin : "sø_ma_ti_on_to_fr_lø".split("_"),
@ulmus phrased it so well, I thought I would steal it directly ;-)
@@ -7,6 +7,7 @@ | |||
monthsShort : "кăр_нар_пуш_ака_май_çĕр_утă_çур_ав_юпа_чӳк_раш".split("_"), | |||
weekdays : "вырсарникун_тунтикун_ытларикун_юнкун_кĕçнерникун_эрнекун_шăматкун".split("_"), | |||
weekdaysShort : "выр_тун_ытл_юн_кĕç_эрн_шăм".split("_"), | |||
weekdaysMin : "вр_тн_ыт_юн_кç_эр_шм".split("_"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! It is correct for Chuvash language, it is also according to a month template in Chuvash Wikipedia with short weekdays names
@timrwood Yes, those Portuguese short names are correct, and you are correct that there is no short two-character version for Saturday and Sunday. |
This seems to have settled. Pulling it in. |
Support for two-letter days-of-week
This would be useful for a datepicker or other calendar implementation, for example, where the convention is two-letter day column headers.