Repository: bradymholt/cRonstrue

Issue:
Plural correction of danish translation
**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 

Discussion:
@rmja: @bradymholt do you have a good suggestion on how to accomplish this?@bradymholt: Can the translations just be updated? ([here](https://github.com/bradymholt/cRonstrue/blob/main/src/i18n/locales/da.ts))@rmja: @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: 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](https://github.com/bradymholt/cRonstrue/blob/main/src/i18n/locales/en.ts#L160C3-L160C16)) (or something similar) and pull from those when needed.  But, I think Danish would be the only translation to use this.@rmja: @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: > @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 👍@bradymholt: @rmja would you be up for submitting a PR?@rmja: @bradymholt sorry, I missed that we had agreed on something here. I have made #344 which includes the proposal from https://github.com/bradymholt/cRonstrue/issues/329#issuecomment-2500868158

Solution patch:
diff --git a/src/i18n/locales/da.ts b/src/i18n/locales/da.ts
index 2590d66..b16a748 100644
--- a/src/i18n/locales/da.ts
+++ b/src/i18n/locales/da.ts
@@ -50,8 +50,8 @@ export class da implements Locale {
   commaOnlyInX0() {
     return ", kun i %s";
   }
-  commaOnlyOnX0() {
-    return ", på %se";
+  commaOnlyOnX0(s?: string) {
+    return ", på enhver %s";
   }
   commaAndOnX0() {
     return ", og på %s";



Test patch:
diff --git a/test/i18n.ts b/test/i18n.ts
index d53cdeb..eac2b7a 100644
--- a/test/i18n.ts
+++ b/test/i18n.ts
@@ -1,6 +1,7 @@
 import "mocha";
-import { assert } from "chai";
 import cronstrue from "../src/cronstrue-i18n";
+import chai = require("chai");
+let assert = chai.assert;
 
 describe("i18n", function () {
   describe("de", function () {
@@ -345,7 +346,14 @@ describe("i18n", function () {
     it("0 3 * * 4", function () {
       assert.equal(
         cronstrue.toString(this.test?.title as string, { locale: "da" }),
-        "Kl 03:00, på torsdage"
+        "Kl 03:00, på enhver torsdag"
+      );
+    });
+
+    it("0 3 * * 4,5", function () {
+      assert.equal(
+        cronstrue.toString(this.test?.title as string, { locale: "da" }),
+        "Kl 03:00, på enhver torsdag og fredag"
       );
     });
   });