Skip to content
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

feat: adding support for Welsh and es-ES #81

Merged
merged 1 commit into from
Mar 5, 2021
Merged

feat: adding support for Welsh and es-ES #81

merged 1 commit into from
Mar 5, 2021

Conversation

dlockhart
Copy link
Member

This adds support for Welsh (cy-GB) and es-ES.

@dlockhart dlockhart requested a review from margaree March 5, 2021 20:10
@@ -738,6 +738,18 @@ export function getDateTimeDescriptor() {
weekendStartDay = 4;
weekendEndDay = 5;
break;
case 'cy':
Copy link
Member Author

Choose a reason for hiding this comment

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

Most of this I grabbed from the monolith's LOCALE_CULTURE table and lang terms, the rest from the CLDR.

@@ -763,7 +775,7 @@ export function getDateTimeDescriptor() {
];
break;
case 'es':
dateFormats = ['dddd d\' de \'MMMM\' de \'yyyy', 'd\' de \'MMMM\' de \'yyyy', 'd/M/yyyy', 'MMMM yyyy', 'd\' de \'MMMM', 'd\' de \'MMM'];
dateFormats = ['dddd d\' de \'MMMM\' de \'yyyy', 'd\' de \'MMMM\' de \'yyyy', 'dd/MM/yyyy', 'MMMM yyyy', 'd\' de \'MMMM', 'd\' de \'MMM'];
Copy link
Member Author

Choose a reason for hiding this comment

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

There was a slight deviation here in the base es data we had, but now that the monolith has es-ES and it was the same as es-MX I've combined them.

@@ -116,6 +116,7 @@ export function getNumberDescriptor() {
let percentPattern = '{number} %';
let percentNegativePattern = '-{number} %';
switch (baseLanguage) {
case 'es':
Copy link
Member Author

Choose a reason for hiding this comment

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

Same here -- we were treating Mexico differently, but inspecting the data the monolith has for es-MX I noticed it matches es-ES so combining them.

{ locale: 'fr-CA', expect: ['01 h 28', '1:28 AM', '01 h 28 EST', '1:28 AM EST', '13 h 52', '1:52 PM', '13 h 52 EST', '1:52 PM EST'] },
{ locale: 'fr-FR', expect: ['01 h 28', '1:28 AM', '01 h 28 EST', '1:28 AM EST', '13 h 52', '1:52 PM', '13 h 52 EST', '1:52 PM EST'] },
Copy link
Member Author

Choose a reason for hiding this comment

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

Just a bit of alphabetizing.

dateFormats = ['dddd, d MMMM yyyy', 'dd MMMM yyyy', 'dd/MM/yyyy', 'MMMM yyyy', 'd MMMM', 'd MMM'];
months = [
['Ionawr', 'Chwefror', 'Mawrth', 'Ebrill', 'Mai', 'Mehefin', 'Gorffennaf', 'Awst', 'Medi', 'Hydref', 'Tachwedd', 'Rhagfyr'],
['Ion', 'Chwe', 'Maw', 'Ebr', 'Mai', 'Meh', 'Gor', 'Awst', 'Medi', 'Hyd', 'Tach', 'Rhag']
Copy link
Contributor

@margaree margaree Mar 5, 2021

Choose a reason for hiding this comment

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

It looks like Chwe should just be Chw (unless I'm looking at the wrong section of the table which is possible since it's giant - https://www.unicode.org/cldr/cldr-aux/charts/25/summary/cy.html#1404)

Copy link
Member Author

Choose a reason for hiding this comment

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

I ignored the CLDR for this stuff and pulled these from the monolith here:
https://search.d2l.dev/xref/lms/lp/_lang/LangTerms/translations/cy-gb/Standard.xml?r=760bcabb#1463

Not to say there aren't mistakes in there as I did find a legit one that I sent to be addressed.

@@ -331,6 +333,7 @@ describe('number', () => {
[
{ locale: 'ar', expect: ['42 %', '-42 %'] },
{ locale: 'ar-SA', expect: ['42 %', '-42 %'] },
{ locale: 'cy-GB', expect: ['42 %', '-42 %'] },
Copy link
Contributor

Choose a reason for hiding this comment

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

Welsh looks to not have the space between number and % (https://www.unicode.org/cldr/cldr-aux/charts/25/summary/cy.html#3303)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm... they're gonna hate my d2l-input-percent. 😬

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe they will ❤️ it, and everyone else will dislike. 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

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

😱

Copy link
Member Author

Choose a reason for hiding this comment

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

So again, I went with what the monolith has which has the space. I'm not sure what's "right" and I've raised issues against deviations in the monolith before.

Copy link
Member Author

Choose a reason for hiding this comment

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

Haha the only people who will hate your percent input Dave are those who put the percent first -- % 9... which is just Turkish out of the locales we support.

@dlockhart dlockhart merged commit 788beb5 into master Mar 5, 2021
@dlockhart dlockhart deleted the add-welsh branch March 5, 2021 21:39
@ghost
Copy link

ghost commented Mar 5, 2021

🎉 This PR is included in version 3.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ghost ghost added the released label Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants