-
Notifications
You must be signed in to change notification settings - Fork 7k
[bugfix] add standalone and format to "cs" locale #5749
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
@petrbela could you take a look? |
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.
The implementation looks good, just added the correct Czech inflections in the comments
src/locale/cs.js
Outdated
@@ -90,7 +95,7 @@ export default moment.defineLocale('cs', { | |||
monthsShortRegex: monthsRegex, | |||
// NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. | |||
// Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. | |||
monthsStrictRegex: /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i, | |||
monthsStrictRegex: /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpena|srpna|srpen|září|říjena|říjen|října|listopada|listopadu|listopad|prosinec|prosince)/i, |
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.
I think the original line covers all inflections, so this change is not needed
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.
Can you also revert this line pls?
src/test/locale/cs.js
Outdated
@@ -120,7 +120,7 @@ test('format ordinal', function (assert) { | |||
}); | |||
|
|||
test('format month', function (assert) { | |||
var expected = 'leden led_únor úno_březen bře_duben dub_květen kvě_červen čvn_červenec čvc_srpen srp_září zář_říjen říj_listopad lis_prosinec pro'.split( | |||
var expected = 'ledna led_února úno_března bře_dubna dub_května kvě_června čvn_července čvc_srpena srp_září zář_říjena říj_listopada lis_prosince pro'.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.
var expected = 'ledna led_února úno_března bře_dubna dub_května kvě_června čvn_července čvc_srpena srp_září zář_říjena říj_listopada lis_prosince pro'.split( | |
var expected = 'ledna led_února úno_března bře_dubna dub_května kvě_června čvn_července čvc_srpna srp_září zář_října říj_listopadu lis_prosince pro'.split( |
src/test/locale/cs.js
Outdated
@@ -133,6 +133,30 @@ test('format month', function (assert) { | |||
} | |||
}); | |||
|
|||
test('format month case', function (assert) { | |||
var months = { | |||
nominative: 'ledna_února_března_dubna_května_června_července_srpena_září_říjena_listopada_prosince'.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.
nominative: 'ledna_února_března_dubna_května_června_července_srpena_září_říjena_listopada_prosince'.split( | |
nominative: 'ledna_února_března_dubna_května_června_července_srpna_září_října_listopadu_prosince'.split( |
Co-authored-by: Petr Bela <bela.petr@gmail.com>
@petrbela Thanks for providing correct inflections, i've updated them in the latest commit. All tests passed successfully everything looks good, ready to be merged . |
@petrbela can you take a look at it? |
src/locale/cs.js
Outdated
@@ -90,7 +95,7 @@ export default moment.defineLocale('cs', { | |||
monthsShortRegex: monthsRegex, | |||
// NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. | |||
// Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. | |||
monthsStrictRegex: /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i, | |||
monthsStrictRegex: /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpena|srpna|srpen|září|říjena|říjen|října|listopada|listopadu|listopad|prosinec|prosince)/i, |
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.
Can you also revert this line pls?
monthsStrictRegex reverted to its original values
@petrbela as you said I've reverted "monthsStrictRegex" to its original value. |
@marwahaha the inflections here are wrong, i have created a PR to fix this @petrbela could you please take a look at this? |
fixes #5074
I've updated the "cs" locale by implementing standalone and formats, I was confused why these changes were needed because cs locale code was able to handle inflections like
leden - ledna
.únor - února
březen-března
etc without any problems. Then I realized adding format and standalone to 'cs' locale makes the code consistent with other locales like 'hi' and 'ru' .After making changes to the "cs" locale it's test needed to be updated because of moment expecting standalone values, I also added 'format month case test' for accusations and nominations.
Now, for the most part, cs locale code is consistent with other locales, but if you feel something needs to be changed I can do that.