Skip to content

Commit

Permalink
Use two resource strings to describe day or days before the last day …
Browse files Browse the repository at this point in the history
…of the month.
  • Loading branch information
pangyikhei committed Oct 27, 2020
1 parent 64cfd63 commit 6ef01c0
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package com.cronutils.descriptor;

import com.cronutils.model.field.expression.Every;
import java.text.MessageFormat;
import java.time.DayOfWeek;
import java.time.Month;
import java.time.format.TextStyle;
Expand Down Expand Up @@ -84,11 +85,10 @@ public static DescriptionStrategy daysOfMonthInstance(final ResourceBundle bundl
.format("%s %s %s ", bundle.getString("the_nearest_weekday_to_the"), on.getTime().getValue(), bundle.getString("of_the_month"));
case L:
Integer daysBefore = on.getNth().getValue();
if (daysBefore > 0) {
String daysRep =
daysBefore == 1 ? bundle.getString("day") : bundle.getString("days");
return String.format("%d %s %s", daysBefore, daysRep,
bundle.getString("before_last_day_of_month"));
if (daysBefore > 1) {
return MessageFormat.format(bundle.getString("days_before_last_day_of_month"), daysBefore);
} else if (daysBefore == 1){
return bundle.getString("day_before_last_day_of_month");
} else {
return bundle.getString("last_day_of_month");
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ last=last
the_nearest_weekday_to_the=the nearest weekday to the
last_day_of_month=last day of month
last_weekday_of_month=last weekday of month
before_last_day_of_month=before the last day of the month
day_before_last_day_of_month=one day before the last day of the month
days_before_last_day_of_month={0} days before the last day of the month

pattern_every_seconds = {0} {1}
every_one=every
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ last=letzten
the_nearest_weekday_to_the=am n\ufffdchsten Werktag nach dem
last_day_of_month=letzten Tag des Monats
last_weekday_of_month=letzten Werktag des Monats
before_last_day_of_month=vor dem letzten Tag des Monats
day_before_last_day_of_month=einen Tag vor dem letzten Tag des Monats
days_before_last_day_of_month={0} Tage vor dem letzten Tag des Monats

pattern_every_seconds = {0} {1}
every_one=jede
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_el.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ last=\u03C4\u03B5\u03BB\u03B1\u03C5\u03C4\u03B1\u03AF\u03BF
the_nearest_weekday_to_the=\u03B7 \u03BA\u03BF\u03BD\u03C4\u03B9\u03BD\u03CC\u03C4\u03B5\u03C1\u03B7 \u03B5\u03C1\u03B3\u03AC\u03C3\u03B9\u03BC\u03B7 \u03C3\u03C4\u03BF
last_day_of_month=\u03C4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B1 \u03BC\u03AD\u03C1\u03B1 \u03C4\u03BF\u03C5 \u03BC\u03AE\u03BD\u03B1
last_weekday_of_month=\u03C4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B1 \u03B5\u03C1\u03B3\u03AC\u03C3\u03B9\u03BC\u03B7 \u03C4\u03BF\u03C5 \u03BC\u03AE\u03BD\u03B1
before_last_day_of_month=\u03C0\u03C1\u03B9\u03BD \u03B1\u03C0\u03CC \u03C4\u03B7\u03BD \u03C4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B1 \u03B7\u03BC\u03AD\u03C1\u03B1 \u03C4\u03BF\u03C5 \u03BC\u03AE\u03BD\u03B1
day_before_last_day_of_month=\u03BC\u03AF\u03B1 \u03B7\u03BC\u03AD\u03C1\u03B1 \u03C0\u03C1\u03B9\u03BD \u03B1\u03C0\u03CC \u03C4\u03B7\u03BD \u03C4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B1 \u03B7\u03BC\u03AD\u03C1\u03B1 \u03C4\u03BF\u03C5 \u03BC\u03AE\u03BD\u03B1
days_before_last_day_of_month={0} \u03B7\u03BC\u03AD\u03C1\u03B5\u03C2 \u03C0\u03C1\u03B9\u03BD \u03B1\u03C0\u03CC \u03C4\u03B7\u03BD \u03C4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B1 \u03B7\u03BC\u03AD\u03C1\u03B1 \u03C4\u03BF\u03C5 \u03BC\u03AE\u03BD\u03B1
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ last=last
the_nearest_weekday_to_the=the nearest weekday to the
last_day_of_month=last day of month
last_weekday_of_month=last weekday of month
before_last_day_of_month=before the last day of the month
day_before_last_day_of_month=one day before the last day of the month
days_before_last_day_of_month={0} days before the last day of the month
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ last=ultimo
the_nearest_weekday_to_the=dia de semana mas cercano a
last_day_of_month=ultimo dia del mes
last_weekday_of_month=ultimo dia de semana del mes
before_last_day_of_month=antes del \u00FAltimo d\u00EDa del mes
day_before_last_day_of_month=un día antes del último día del mes
days_before_last_day_of_month={0} días antes del último día del mes
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ days=jours
months=les mois
years=les ann\u00e9es
last_weekday_of_month=derni\u00e8re semaine du mois
before_last_day_of_month=avant le dernier jour du mois
day_before_last_day_of_month=un jour avant le dernier jour du mois
days_before_last_day_of_month={0} jours avant le dernier jour du mois
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_id.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ last=terakhir
the_nearest_weekday_to_the=hari kerja terdekat ke
last_day_of_month=hari terakhir di bulan
last_weekday_of_month=hari kerja terakhir di bulan
before_last_day_of_month=sebelum hari terakhir setiap bulan
day_before_last_day_of_month=satu hari sebelum hari terakhir bulan itu
days_before_last_day_of_month={0} hari sebelum hari terakhir setiap bulan
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ last=ultimo
the_nearest_weekday_to_the=il giorno della settimana più vicino a
last_day_of_month=ultimo giorno del mese
last_weekday_of_month=ultimo giorno della settimana nel mese
before_last_day_of_month=prima dell'ultimo giorno del mese
day_before_last_day_of_month=un giorno prima dell'ultimo giorno del mese
days_before_last_day_of_month={0} giorni prima dell'ultimo giorno del mese
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_ko.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ last=\uB9C8\uC9C0\uB9C9
the_nearest_weekday_to_the=\uAC00\uC7A5 \uAC00\uAE4C\uC6B4 \uD3C9\uC77C
last_day_of_month=\uB9D0\uC77C
last_weekday_of_month=\uB9C8\uC9C0\uB9C9 \uC8FC
before_last_day_of_month=\uB9E4\uC6D4 \uB9D0\uC77C \uC774\uC804
day_before_last_day_of_month=\uB9E4\uC6D4 \uB9D0\uC77C \uD558\uB8E8 \uC804
days_before_last_day_of_month=\uB9E4\uC6D4 \uB9D0\uC77C {0} \uC77C \uC804
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ last=laatste
the_nearest_weekday_to_the=de dichtsbijzijnde weekdag voor de
last_day_of_month=laaste dag van maand
last_weekday_of_month=laatste weekdag van maand
before_last_day_of_month=v\u00F3\u00F3r de laatste dag van de maand
day_before_last_day_of_month=een dag voor de laatste dag van de maand
days_before_last_day_of_month={0} dagen voor de laatste dag van de maand

pattern_every_seconds = {0} {1}
every_one=elke
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_pl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ last=ostatni
the_nearest_weekday_to_the=najbli\u017Cszy weekend
last_day_of_month=ostatni dzie\u0144 miesi\u0105ca
last_weekday_of_month=ostatni dzie\u0144 tygodnia w miesi\u0105cu
before_last_day_of_month=przed ostatnim dniem miesi\u0105ca
day_before_last_day_of_month=jeden dzie\u0144 przed ostatnim dniem miesi\u0105ca
days_before_last_day_of_month={0} dni przed ostatnim dniem miesi\u0105ca
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_pt.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ of_the_month=do m\u00eas
last=\u00faltima
the_nearest_weekday_to_the=o dia da semana mais pr\u00f3ximo do
last_day_of_month=\u00faltimo dia do m\u00eas
before_last_day_of_month=antes do \u00faltimo dia do m\u00EAs
day_before_last_day_of_month=um dia antes do \u00FAltimo dia do m\u00EAs
days_before_last_day_of_month={0} dias antes do \u00FAltimo dia do m\u00EAs
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ last=\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439
the_nearest_weekday_to_the=\u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0439 \u0431\u0443\u0434\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u043a
last_day_of_month=\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u043c\u0435\u0441\u044f\u0446\u0430
last_weekday_of_month=\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0431\u0443\u0434\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u043c\u0435\u0441\u044f\u0446\u0430
before_last_day_of_month=\u0434\u043E \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0433\u043E \u0434\u043D\u044F \u043C\u0435\u0441\u044F\u0446\u0430
day_before_last_day_of_month=\u0437\u0430 \u0434\u0435\u043D\u044C \u0434\u043E \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0433\u043E \u0434\u043D\u044F \u043C\u0435\u0441\u044F\u0446\u0430
days_before_last_day_of_month=\u0417\u0430 {0} \u0434\u043D\u044F \u0434\u043E \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0433\u043E \u0434\u043D\u044F \u043C\u0435\u0441\u044F\u0446\u0430
4 changes: 3 additions & 1 deletion src/main/resources/CronUtilsI18N_sw.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ last=mwisho
the_nearest_weekday_to_the=siku ya juma iliyokaribu na
last_day_of_month=siku ya mwisho ya mwezi
last_weekday_of_month=siku ya juma ya mwisho ya mwezi
before_last_day_of_month=kabla ya siku ya mwisho ya mwezi
day_before_last_day_of_month=siku moja kabla ya siku ya mwisho ya mwezi
days_before_last_day_of_month=Siku {0} kabla ya siku ya mwisho ya mwezi

3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ last=son
the_nearest_weekday_to_the=\u015Fu zamana en yak\u0131n hafta i\u00E7i g\u00FCn\u00FC
last_day_of_month=ay\u0131n son g\u00FCn\u00FC
last_weekday_of_month=ay\u0131n son hafta i\u00E7i g\u00FCn\u00FC
before_last_day_of_month=ay\u0131n son g\u00FCn\u00FCnden \u00F6nce
day_before_last_day_of_month=ay\u0131n son g\u00FCn\u00FCnden bir g\u00FCn \u00F6nce
days_before_last_day_of_month=Ay\u0131n son g\u00FCn\u00FCnden {0} g\u00FCn \u00F6nce
3 changes: 2 additions & 1 deletion src/main/resources/CronUtilsI18N_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ last=\u6700\u540e\u7684
the_nearest_weekday_to_the=\u6700\u8fd1\u7684\u5de5\u4f5c\u65e5\u8ddd
last_day_of_month=\u6bcf\u6708\u6700\u540e\u4e00\u5929
last_weekday_of_month=\u6708\u4efd\u7684\u6700\u540e\u4e00\u5468
before_last_day_of_month=\u6708\u5E95\u524D
day_before_last_day_of_month=\u8BE5\u6708\u6700\u540E\u4E00\u5929\u7684\u524D\u4E00\u5929
days_before_last_day_of_month=\u8BE5\u6708\u6700\u540E\u4E00\u5929\u7684\u524D{0}\u5929
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public void testOneDayBeforeLastDayOfMonth(){
CronDescriptor descriptor = CronDescriptor.instance(Locale.ENGLISH);
String description = descriptor.describe(quartzCron);

assertEquals( "at 11:00 1 day before the last day of the month", description);
assertEquals( "at 11:00 one day before the last day of the month", description);
}


Expand Down

0 comments on commit 6ef01c0

Please sign in to comment.