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

Plural correction of danish translation #329

Open
Lars-Sommer opened this issue Nov 25, 2024 · 6 comments
Open

Plural correction of danish translation #329

Lars-Sommer opened this issue Nov 25, 2024 · 6 comments

Comments

@Lars-Sommer
Copy link

Cron Expression
0 3 * * 0,5,6

Expected Output
"Kl 03:00, på søndage, fredage, og lørdage"

Actual Output
"Kl 03:00, på søndag, fredag, og lørdage"

I think this translation might be wrong. The first two days are definite singular, but the last day is plural. You therefore might get the impression that the cron runs only on this 'søndag' (sunday), this 'fredag' (friday) but on all 'lørdage' (saturdays).

@rmja

@rmja
Copy link
Contributor

rmja commented Nov 25, 2024

@bradymholt do you have a good suggestion on how to accomplish this?

@bradymholt
Copy link
Owner

Can the translations just be updated? (here)

@rmja
Copy link
Contributor

rmja commented Nov 26, 2024

@bradymholt Consider this test:

    it("0 3 * * 4,5", function () {
      assert.equal(
        cronstrue.toString(this.test?.title as string, { locale: "da" }),
        "Kl 03:00, på torsdage og fredage"
      );
    });

The issue is that in Danish, we use different endings on the day of week depending on whether we mean "next Thursday" in singular og "next and following Thursdays".

My initial pr added an "e" to the end of the dow name by simply modifying commaOnlyOnX0 from ", på %s" to ", på %se", eg.:
"mandag" -> "mandage"
"tirsdag" -> "tirsdage"

That works for a single dow, but as soon as we add more weekdays this of cause fails, because each of the days needs the "e" in the end. The pr only adds the e to the last dow.

@bradymholt
Copy link
Owner

Oh wow, this is a very specific variation with Danish it seems. Is there any way to change the translation so that it is more generic to account for both variations? Outside of that, the only other way I can think to handle this is to add daysOfTheWeekPlural (here) (or something similar) and pull from those when needed. But, I think Danish would be the only translation to use this.

@rmja
Copy link
Contributor

rmja commented Nov 26, 2024

@Lars-Sommer How about "Kl 03:00, på enhver søndag, fredag, og lørdag" or similar. That would remove the need for the plural weekday.

@Lars-Sommer
Copy link
Author

@Lars-Sommer How about "Kl 03:00, på enhver søndag, fredag, og lørdag" or similar. That would remove the need for the plural weekday.

I think that would be a good alternative 👍

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

No branches or pull requests

3 participants