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

Wrong narrow stand-alone locale #10664

Open
goldim opened this issue Feb 27, 2024 · 6 comments · May be fixed by #10668
Open

Wrong narrow stand-alone locale #10664

goldim opened this issue Feb 27, 2024 · 6 comments · May be fixed by #10668

Comments

@goldim
Copy link
Contributor

goldim commented Feb 27, 2024

During implementing cldr functionality via Intl API. I am stucked with some tests of method getDayNames.
What we have:

var narrowDays = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
this.assertJsonEquals(
  narrowDays,
  Date.getDayNames("narrow", useLocale, "stand-alone").map(function (v) {
    return v + "";
  })
);

But if we have a look at cldr data we will see that for narrow both as "format" and "stand-alone" case there are words with only one letter.
If it is a bug then how does it have to be handled? Fixing tests will lead to error in current implementation (cldr) or it could be changed only with new impl via Intl API?

@johnspackman
Copy link
Member

So CLDR has a single-character day name, but Intl only goes as short as two character day names?

Perhaps we should define a set of overrides for specific locales, and then maintain that (hopefully very small) list ourselves?

@goldim
Copy link
Contributor Author

goldim commented Feb 27, 2024

@johnspackman What it is in my link:

<dayContext type="stand-alone">
<dayWidth type="abbreviated">
	<day type="sun">So</day>
	<day type="mon">Mo</day>
	<day type="tue">Di</day>
	<day type="wed">Mi</day>
	<day type="thu">Do</day>
	<day type="fri">Fr</day>
	<day type="sat">Sa</day>
</dayWidth>
<dayWidth type="narrow">
	<day type="sun">S</day>
	<day type="mon">M</day>
	<day type="tue">D</day>
	<day type="wed">M</day>
	<day type="thu">D</day>
	<day type="fri">F</day>
	<day type="sat">S</day>
</dayWidth>
</dayContext>

You may see that for narrow stand-alone case one-letter words but in the test checking against 2. Is the test wrong?

Btw I have other rep and there are for de_DE listed all cases ("narrow", "wide", "abbreviated", "short"). But in this one narrow stand-alone version has also consist of one letter.

Perhaps we should define a set of overrides for specific locales, and then maintain that (hopefully very small) list ourselves?

No, we shouldn't. Intl has everything but I can stumble on some date/time format I can not reimplement, maybe.

@hkollmann
Copy link
Member

Why is the test working in the current version?

@goldim
Copy link
Contributor Author

goldim commented Feb 27, 2024

@hkollmann bc it was implemented with an error? Look at the source file:

 cldr["cldr_day_stand-alone_narrow_fri"] = find(
                row.dayWidth[0].day,
                "type",
                "fri",
                getText
);

We take the first element (index 0) but it is abbreviated.

@goldim goldim changed the title Wrong narrow stand-alone locale de_DE Wrong narrow stand-alone locale Feb 27, 2024
@hkollmann
Copy link
Member

Wrong test hides wrong implementation.
Should be fixed both

@goldim
Copy link
Contributor Author

goldim commented Mar 1, 2024

@hkollmann but I think of just fixing it in new implementation if I finish it.

@goldim goldim linked a pull request Mar 5, 2024 that will close this issue
10 tasks
@goldim goldim linked a pull request Mar 5, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants