Skip to content

Conversation

Kartik18g
Copy link
Contributor

@Kartik18g Kartik18g commented Oct 6, 2020

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.

@jsf-clabot
Copy link

jsf-clabot commented Oct 6, 2020

CLA assistant check
All committers have signed the CLA.

@Kartik18g Kartik18g changed the title standalone and format added to "cs" locale [bugfix] #5074 standalone and format added to "cs" locale Oct 6, 2020
@coveralls
Copy link

Coverage Status

Coverage increased (+0.001%) to 88.499% when pulling cbf3a3b on Kartik18g:develop into b7ec8e2 on moment:develop.

@marwahaha
Copy link
Member

@petrbela could you take a look?

Copy link
Contributor

@petrbela petrbela left a 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,
Copy link
Contributor

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

Copy link
Contributor

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?

@@ -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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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(

@@ -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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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(

@Kartik18g
Copy link
Contributor Author

@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 .

@Kartik18g
Copy link
Contributor Author

@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,
Copy link
Contributor

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
@Kartik18g
Copy link
Contributor Author

@petrbela as you said I've reverted "monthsStrictRegex" to its original value.

@marwahaha marwahaha changed the title [bugfix] #5074 standalone and format added to "cs" locale [bugfix] add standalone and format to "cs" locale Oct 23, 2020
@marwahaha marwahaha merged commit 5d811c8 into moment:develop Oct 23, 2020
@indexxd
Copy link

indexxd commented Nov 4, 2022

@marwahaha the inflections here are wrong, i have created a PR to fix this

@petrbela could you please take a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No formatted month for 'cs' locale
6 participants