Skip to content

Commit

Permalink
Fixed time formats for various locales (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
lreis authored Nov 13, 2023
1 parent 9049be4 commit edabbee
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/i18n/locales/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class ar implements Locale {
}

use24HourTimeFormatByDefault() {
return false;
return true;
}

anErrorOccuredWhenGeneratingTheExpressionD() {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/be.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class be implements Locale {
return null;
}
use24HourTimeFormatByDefault() {
return true;
return false;
}
everyMinute() {
return "кожную хвіліну";
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class ca implements Locale {
}

use24HourTimeFormatByDefault() {
return false;
return true;
}

anErrorOccuredWhenGeneratingTheExpressionD() {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class es implements Locale {
}

use24HourTimeFormatByDefault() {
return false;
return true;
}

anErrorOccuredWhenGeneratingTheExpressionD() {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/fi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Locale } from "../locale";
export class fi implements Locale {
use24HourTimeFormatByDefault() {
return false;
return true;
}

anErrorOccuredWhenGeneratingTheExpressionD(): string {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/hu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class hu implements Locale {
}

use24HourTimeFormatByDefault() {
return false;
return true;
}

anErrorOccuredWhenGeneratingTheExpressionD() {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class id implements Locale {
}

use24HourTimeFormatByDefault() {
return false;
return true;
}

anErrorOccuredWhenGeneratingTheExpressionD() {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/ja.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Locale } from "../locale";
export class ja implements Locale {
use24HourTimeFormatByDefault() {
return false;
return true;
}

everyMinute(): string {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/nb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class nb implements Locale {
return null;
}
use24HourTimeFormatByDefault() {
return false;
return true;
}
anErrorOccuredWhenGeneratingTheExpressionD() {
return "En feil inntraff ved generering av uttrykksbeskrivelse. Sjekk cron syntaks.";
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class nl implements Locale {
return null;
}
use24HourTimeFormatByDefault() {
return false;
return true;
}
everyMinute() {
return "elke minuut";
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/pt_BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class pt_BR implements Locale {
return null;
}
use24HourTimeFormatByDefault() {
return false;
return true;
}
anErrorOccuredWhenGeneratingTheExpressionD() {
return "Ocorreu um erro ao gerar a descrição da expressão Cron.";
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class sw implements Locale {
}

use24HourTimeFormatByDefault() {
return false;
return true;
}

anErrorOccuredWhenGeneratingTheExpressionD() {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/vi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class vi implements Locale {
}

use24HourTimeFormatByDefault() {
return false;
return true;
}

anErrorOccuredWhenGeneratingTheExpressionD() {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/zh_TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class zh_TW implements Locale {
return ", 從 %s 年至 %s 年";
}
use24HourTimeFormatByDefault() {
return false;
return true;
}
everyMinute() {
return "每分鐘";
Expand Down
89 changes: 84 additions & 5 deletions test/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("i18n", function () {
it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "es" }),
"Cada 5 minutos, entre las 03:00 PM y las 03:59 PM, de lunes a viernes"
"Cada 5 minutos, entre las 15:00 y las 15:59, de lunes a viernes"
);
});
});
Expand Down Expand Up @@ -60,6 +60,13 @@ describe("i18n", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "id" }), "Setiap menit");
});

it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "id" }),
"Setiap 5 menit, diantara 15:00 dan 15:59, Senin sampai Jumat"
);
});
});

describe("nb", function () {
Expand Down Expand Up @@ -139,7 +146,7 @@ describe("i18n", function () {
it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "nl" }),
"Elke 5 minuten, tussen 03:00 PM en 03:59 PM, maandag t/m vrijdag"
"Elke 5 minuten, tussen 15:00 en 15:59, maandag t/m vrijdag"
);
});
});
Expand All @@ -164,14 +171,14 @@ describe("i18n", function () {
it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "pt_BR" }),
"A cada 5 minutos, entre 03:00 PM e 03:59 PM, de segunda-feira a sexta-feira"
"A cada 5 minutos, entre 15:00 e 15:59, de segunda-feira a sexta-feira"
);
});

it("*/5 15 * * MON-FRI,SUN", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "pt_BR" }),
"A cada 5 minutos, entre 03:00 PM e 03:59 PM, somente de segunda-feira a sexta-feira e domingo"
"A cada 5 minutos, entre 15:00 e 15:59, somente de segunda-feira a sexta-feira e domingo"
);
});
});
Expand Down Expand Up @@ -263,7 +270,7 @@ describe("i18n", function () {
it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "zh_TW" }),
"每 5 分鐘, 在 03:00 PM 和 03:59 PM 之間, 星期一 到 星期五"
"每 5 分鐘, 在 15:00 和 15:59 之間, 星期一 到 星期五"
);
});
});
Expand All @@ -285,42 +292,91 @@ describe("i18n", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "da" }), "Hvert minut");
});

it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "da" }),
"Hvert 5. minut, mellem 15:00 og 15:59, mandag til og med fredag"
);
});
});

describe("fa", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "fa" }), "هر دقیقه");
});

it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "fa" }),
"هر 5 دقیقه, بین 15:00 و 15:59, دوشنبه تا جمعه"
);
});
});

describe("sl", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "sl" }), "Vsako minuto");
});

it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "sl" }),
"Vsakih 5 minut, od 15:00 do 15:59, od Ponedeljek do Petek"
);
});
});

describe("ca", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "ca" }), "Cada minut");
});

it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "ca" }),
"Cada 5 minuts, entre les 15:00 i les 15:59, de dilluns a divendres"
);
});
});

describe("ko", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "ko" }), "1분마다");
});

it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "ko" }),
"5분마다, 오후 03:00에서 오후 03:59 사이, 월요일에서 금요일까지"
);
});
});

describe("hu", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "hu" }), "Minden percben");
});

it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "hu" }),
"Minden 5. percben, 15:00 és 15:59 között, hétfő - péntek"
);
});
});

describe("af", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "af" }), "Elke minuut");
});

it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "af" }),
"Elke 5 minute, tussen 15:00 en 15:59, Maandag deur na Vrydag"
);
});
});

describe("th", function () {
Expand Down Expand Up @@ -350,7 +406,15 @@ describe("i18n", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "ar" }), "كل دقيقة");
});

it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "ar" }),
"كل 5 دقائق, بين 15:00 و 15:59، الإثنين حتى الجمعة"
);
});
});

describe("my", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "my" }), "Setiap minit");
Expand Down Expand Up @@ -392,6 +456,7 @@ describe("i18n", function () {
});

});

describe("bg", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "bg" }), "Всяка минута");
Expand All @@ -403,4 +468,18 @@ describe("i18n", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "bg" }), "Всеки 5 минути, от 15:00 до 15:59, от понеделник до петък");
});
});

describe("be", function () {
it("* * * * *", function () {
assert.equal(cronstrue.toString(this.test?.title as string, { locale: "be" }), "Кожную хвіліну");
});

it("*/5 15 * * MON-FRI", function () {
assert.equal(
cronstrue.toString(this.test?.title as string, { locale: "be" }),
"Кожныя 5 хвілін, з 03:00 PM па 03:59 PM, панядзелак па пятніца"
);
});
});

});

0 comments on commit edabbee

Please sign in to comment.