From edabbee003de6508cb844a743f3550d08b6df1fe Mon Sep 17 00:00:00 2001 From: Leandro Reis Date: Mon, 13 Nov 2023 09:58:20 -0800 Subject: [PATCH] Fixed time formats for various locales (#306) --- src/i18n/locales/ar.ts | 2 +- src/i18n/locales/be.ts | 2 +- src/i18n/locales/ca.ts | 2 +- src/i18n/locales/es.ts | 2 +- src/i18n/locales/fi.ts | 2 +- src/i18n/locales/hu.ts | 2 +- src/i18n/locales/id.ts | 2 +- src/i18n/locales/ja.ts | 2 +- src/i18n/locales/nb.ts | 2 +- src/i18n/locales/nl.ts | 2 +- src/i18n/locales/pt_BR.ts | 2 +- src/i18n/locales/sw.ts | 2 +- src/i18n/locales/vi.ts | 2 +- src/i18n/locales/zh_TW.ts | 2 +- test/i18n.ts | 89 ++++++++++++++++++++++++++++++++++++--- 15 files changed, 98 insertions(+), 19 deletions(-) diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index f6dcb0d..e412147 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -16,7 +16,7 @@ export class ar implements Locale { } use24HourTimeFormatByDefault() { - return false; + return true; } anErrorOccuredWhenGeneratingTheExpressionD() { diff --git a/src/i18n/locales/be.ts b/src/i18n/locales/be.ts index be6ba99..e08741f 100644 --- a/src/i18n/locales/be.ts +++ b/src/i18n/locales/be.ts @@ -15,7 +15,7 @@ export class be implements Locale { return null; } use24HourTimeFormatByDefault() { - return true; + return false; } everyMinute() { return "кожную хвіліну"; diff --git a/src/i18n/locales/ca.ts b/src/i18n/locales/ca.ts index 53c1df1..6c2ec57 100644 --- a/src/i18n/locales/ca.ts +++ b/src/i18n/locales/ca.ts @@ -16,7 +16,7 @@ export class ca implements Locale { } use24HourTimeFormatByDefault() { - return false; + return true; } anErrorOccuredWhenGeneratingTheExpressionD() { diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 9cf43c9..05d9f32 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -16,7 +16,7 @@ export class es implements Locale { } use24HourTimeFormatByDefault() { - return false; + return true; } anErrorOccuredWhenGeneratingTheExpressionD() { diff --git a/src/i18n/locales/fi.ts b/src/i18n/locales/fi.ts index 51545ee..81e97c4 100644 --- a/src/i18n/locales/fi.ts +++ b/src/i18n/locales/fi.ts @@ -1,7 +1,7 @@ import { Locale } from "../locale"; export class fi implements Locale { use24HourTimeFormatByDefault() { - return false; + return true; } anErrorOccuredWhenGeneratingTheExpressionD(): string { diff --git a/src/i18n/locales/hu.ts b/src/i18n/locales/hu.ts index ee39440..e379dee 100644 --- a/src/i18n/locales/hu.ts +++ b/src/i18n/locales/hu.ts @@ -17,7 +17,7 @@ export class hu implements Locale { } use24HourTimeFormatByDefault() { - return false; + return true; } anErrorOccuredWhenGeneratingTheExpressionD() { diff --git a/src/i18n/locales/id.ts b/src/i18n/locales/id.ts index ad28a05..fc7d635 100644 --- a/src/i18n/locales/id.ts +++ b/src/i18n/locales/id.ts @@ -16,7 +16,7 @@ export class id implements Locale { } use24HourTimeFormatByDefault() { - return false; + return true; } anErrorOccuredWhenGeneratingTheExpressionD() { diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index 8ed23be..fdb3b5d 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -1,7 +1,7 @@ import { Locale } from "../locale"; export class ja implements Locale { use24HourTimeFormatByDefault() { - return false; + return true; } everyMinute(): string { diff --git a/src/i18n/locales/nb.ts b/src/i18n/locales/nb.ts index 63ff40b..91cca62 100644 --- a/src/i18n/locales/nb.ts +++ b/src/i18n/locales/nb.ts @@ -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."; diff --git a/src/i18n/locales/nl.ts b/src/i18n/locales/nl.ts index e20ab47..6e10868 100644 --- a/src/i18n/locales/nl.ts +++ b/src/i18n/locales/nl.ts @@ -15,7 +15,7 @@ export class nl implements Locale { return null; } use24HourTimeFormatByDefault() { - return false; + return true; } everyMinute() { return "elke minuut"; diff --git a/src/i18n/locales/pt_BR.ts b/src/i18n/locales/pt_BR.ts index 3926ef3..5a1874e 100644 --- a/src/i18n/locales/pt_BR.ts +++ b/src/i18n/locales/pt_BR.ts @@ -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."; diff --git a/src/i18n/locales/sw.ts b/src/i18n/locales/sw.ts index c23dc51..9dd881f 100644 --- a/src/i18n/locales/sw.ts +++ b/src/i18n/locales/sw.ts @@ -16,7 +16,7 @@ export class sw implements Locale { } use24HourTimeFormatByDefault() { - return false; + return true; } anErrorOccuredWhenGeneratingTheExpressionD() { diff --git a/src/i18n/locales/vi.ts b/src/i18n/locales/vi.ts index 8bc4792..8f7c375 100644 --- a/src/i18n/locales/vi.ts +++ b/src/i18n/locales/vi.ts @@ -16,7 +16,7 @@ export class vi implements Locale { } use24HourTimeFormatByDefault() { - return false; + return true; } anErrorOccuredWhenGeneratingTheExpressionD() { diff --git a/src/i18n/locales/zh_TW.ts b/src/i18n/locales/zh_TW.ts index bd9ae6f..d95ce71 100644 --- a/src/i18n/locales/zh_TW.ts +++ b/src/i18n/locales/zh_TW.ts @@ -15,7 +15,7 @@ export class zh_TW implements Locale { return ", 從 %s 年至 %s 年"; } use24HourTimeFormatByDefault() { - return false; + return true; } everyMinute() { return "每分鐘"; diff --git a/test/i18n.ts b/test/i18n.ts index f0edebc..b680e7b 100644 --- a/test/i18n.ts +++ b/test/i18n.ts @@ -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" ); }); }); @@ -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 () { @@ -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" ); }); }); @@ -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" ); }); }); @@ -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 之間, 星期一 到 星期五" ); }); }); @@ -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 () { @@ -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"); @@ -392,6 +456,7 @@ describe("i18n", function () { }); }); + describe("bg", function () { it("* * * * *", function () { assert.equal(cronstrue.toString(this.test?.title as string, { locale: "bg" }), "Всяка минута"); @@ -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, панядзелак па пятніца" + ); + }); + }); + });