fix: improve i18n recurrence string rules

This commit is contained in:
2026-04-13 00:34:51 +03:00
parent 9555eaf636
commit 1e85d0c2a6
13 changed files with 93 additions and 115 deletions

View File

@@ -987,11 +987,6 @@ class RecurrenceMessages {
/// ```
String get weekly => """Weekly""";
/// ```dart
/// "Every 2 weeks"
/// ```
String get everyTwoWeeks => """Every 2 weeks""";
/// ```dart
/// "Monthly"
/// ```
@@ -1096,9 +1091,9 @@ class RecurrenceMessages {
String every(String unit) => """every $unit""";
/// ```dart
/// "every $count $unit"
/// "Every $unit"
/// ```
String everyN(int count, String unit) => """every $count $unit""";
String everyButton(String unit) => """Every $unit""";
/// ```dart
/// "on $days"
@@ -1106,25 +1101,28 @@ class RecurrenceMessages {
String onDays(String days) => """on $days""";
/// ```dart
/// "${_plural(count, one: 'day', many: 'days')}"
/// "${_plural(count, one: 'day', many: '$count days')}"
/// ```
String day(int count) => """${_plural(count, one: 'day', many: 'days')}""";
String day(int count) =>
"""${_plural(count, one: 'day', many: '$count days')}""";
/// ```dart
/// "${_plural(count, one: 'week', many: 'weeks')}"
/// "${_plural(count, one: 'week', many: '$count weeks')}"
/// ```
String week(int count) => """${_plural(count, one: 'week', many: 'weeks')}""";
String week(int count) =>
"""${_plural(count, one: 'week', many: '$count weeks')}""";
/// ```dart
/// "${_plural(count, one: 'month', many: 'months')}"
/// "${_plural(count, one: 'month', many: '$count months')}"
/// ```
String month(int count) =>
"""${_plural(count, one: 'month', many: 'months')}""";
"""${_plural(count, one: 'month', many: '$count months')}""";
/// ```dart
/// "${_plural(count, one: 'year', many: 'years')}"
/// "${_plural(count, one: 'year', many: '$count years')}"
/// ```
String year(int count) => """${_plural(count, one: 'year', many: 'years')}""";
String year(int count) =>
"""${_plural(count, one: 'year', many: '$count years')}""";
DayNamesRecurrenceMessages get dayNames => DayNamesRecurrenceMessages(this);
DayAbbrRecurrenceMessages get dayAbbr => DayAbbrRecurrenceMessages(this);
}
@@ -1373,7 +1371,6 @@ Please complete login in your browser.""",
"""recurrence.presets""": """Presets""",
"""recurrence.daily""": """Daily""",
"""recurrence.weekly""": """Weekly""",
"""recurrence.everyTwoWeeks""": """Every 2 weeks""",
"""recurrence.monthly""": """Monthly""",
"""recurrence.everyLabel""": """Every""",
"""recurrence.unit""": """Unit""",

View File

@@ -187,7 +187,6 @@ recurrence:
presets: Presets
daily: Daily
weekly: Weekly
everyTwoWeeks: Every 2 weeks
monthly: Monthly
everyLabel: Every
unit: Unit
@@ -208,12 +207,12 @@ recurrence:
notSet: not set
set: set
every(String unit): "every $unit"
everyN(int count, String unit): "every $count $unit"
everyButton(String unit): "Every $unit"
onDays(String days): "on $days"
day(int count): "${_plural(count, one: 'day', many: 'days')}"
week(int count): "${_plural(count, one: 'week', many: 'weeks')}"
month(int count): "${_plural(count, one: 'month', many: 'months')}"
year(int count): "${_plural(count, one: 'year', many: 'years')}"
day(int count): "${_plural(count, one: 'day', many: '$count days')}"
week(int count): "${_plural(count, one: 'week', many: '$count weeks')}"
month(int count): "${_plural(count, one: 'month', many: '$count months')}"
year(int count): "${_plural(count, one: 'year', many: '$count years')}"
dayNames:
monday: Monday
tuesday: Tuesday

View File

@@ -994,11 +994,6 @@ class RecurrenceMessagesDe extends RecurrenceMessages {
/// ```
String get weekly => """Wöchentlich""";
/// ```dart
/// "Alle 2 Wochen"
/// ```
String get everyTwoWeeks => """Alle 2 Wochen""";
/// ```dart
/// "Monatlich"
/// ```
@@ -1103,9 +1098,9 @@ class RecurrenceMessagesDe extends RecurrenceMessages {
String every(String unit) => """alle $unit""";
/// ```dart
/// "alle $count $unit"
/// "Alle $unit"
/// ```
String everyN(int count, String unit) => """alle $count $unit""";
String everyButton(String unit) => """Alle $unit""";
/// ```dart
/// "am $days"
@@ -1113,26 +1108,28 @@ class RecurrenceMessagesDe extends RecurrenceMessages {
String onDays(String days) => """am $days""";
/// ```dart
/// "${_plural(count, one: 'Tag', many: 'Tage')}"
/// "${_plural(count, one: 'Tag', many: '$count Tage')}"
/// ```
String day(int count) => """${_plural(count, one: 'Tag', many: 'Tage')}""";
String day(int count) =>
"""${_plural(count, one: 'Tag', many: '$count Tage')}""";
/// ```dart
/// "${_plural(count, one: 'Woche', many: 'Wochen')}"
/// "${_plural(count, one: 'Woche', many: '$count Wochen')}"
/// ```
String week(int count) =>
"""${_plural(count, one: 'Woche', many: 'Wochen')}""";
"""${_plural(count, one: 'Woche', many: '$count Wochen')}""";
/// ```dart
/// "${_plural(count, one: 'Monat', many: 'Monate')}"
/// "${_plural(count, one: 'Monat', many: '$count Monate')}"
/// ```
String month(int count) =>
"""${_plural(count, one: 'Monat', many: 'Monate')}""";
"""${_plural(count, one: 'Monat', many: '$count Monate')}""";
/// ```dart
/// "${_plural(count, one: 'Jahr', many: 'Jahre')}"
/// "${_plural(count, one: 'Jahr', many: '$count Jahre')}"
/// ```
String year(int count) => """${_plural(count, one: 'Jahr', many: 'Jahre')}""";
String year(int count) =>
"""${_plural(count, one: 'Jahr', many: '$count Jahre')}""";
DayNamesRecurrenceMessagesDe get dayNames =>
DayNamesRecurrenceMessagesDe(this);
DayAbbrRecurrenceMessagesDe get dayAbbr => DayAbbrRecurrenceMessagesDe(this);
@@ -1391,7 +1388,6 @@ Bitte melde dich in deinem Browser an.""",
"""recurrence.presets""": """Voreinstellungen""",
"""recurrence.daily""": """Täglich""",
"""recurrence.weekly""": """Wöchentlich""",
"""recurrence.everyTwoWeeks""": """Alle 2 Wochen""",
"""recurrence.monthly""": """Monatlich""",
"""recurrence.everyLabel""": """Alle""",
"""recurrence.unit""": """Einheit""",

View File

@@ -187,7 +187,6 @@ recurrence:
presets: Voreinstellungen
daily: "T\xE4glich"
weekly: "W\xF6chentlich"
everyTwoWeeks: Alle 2 Wochen
monthly: Monatlich
everyLabel: Alle
unit: Einheit
@@ -208,12 +207,12 @@ recurrence:
notSet: nicht gesetzt
set: gesetzt
every(String unit): "alle $unit"
everyN(int count, String unit): "alle $count $unit"
everyButton(String unit): "Alle $unit"
onDays(String days): "am $days"
day(int count): "${_plural(count, one: 'Tag', many: 'Tage')}"
week(int count): "${_plural(count, one: 'Woche', many: 'Wochen')}"
month(int count): "${_plural(count, one: 'Monat', many: 'Monate')}"
year(int count): "${_plural(count, one: 'Jahr', many: 'Jahre')}"
day(int count): "${_plural(count, one: 'Tag', many: '$count Tage')}"
week(int count): "${_plural(count, one: 'Woche', many: '$count Wochen')}"
month(int count): "${_plural(count, one: 'Monat', many: '$count Monate')}"
year(int count): "${_plural(count, one: 'Jahr', many: '$count Jahre')}"
dayNames:
monday: Montag
tuesday: Dienstag

View File

@@ -991,11 +991,6 @@ class RecurrenceMessagesEs extends RecurrenceMessages {
/// ```
String get weekly => """Semanal""";
/// ```dart
/// "Cada 2 semanas"
/// ```
String get everyTwoWeeks => """Cada 2 semanas""";
/// ```dart
/// "Mensual"
/// ```
@@ -1100,9 +1095,9 @@ class RecurrenceMessagesEs extends RecurrenceMessages {
String every(String unit) => """cada $unit""";
/// ```dart
/// "cada $count $unit"
/// "Cada $unit"
/// ```
String everyN(int count, String unit) => """cada $count $unit""";
String everyButton(String unit) => """Cada $unit""";
/// ```dart
/// "los $days"
@@ -1110,25 +1105,28 @@ class RecurrenceMessagesEs extends RecurrenceMessages {
String onDays(String days) => """los $days""";
/// ```dart
/// "${_plural(count, one: 'día', many: 'días')}"
/// "${_plural(count, one: 'día', many: '$count días')}"
/// ```
String day(int count) => """${_plural(count, one: 'día', many: 'días')}""";
String day(int count) =>
"""${_plural(count, one: 'día', many: '$count días')}""";
/// ```dart
/// "${_plural(count, one: 'semana', many: 'semanas')}"
/// "${_plural(count, one: 'semana', many: '$count semanas')}"
/// ```
String week(int count) =>
"""${_plural(count, one: 'semana', many: 'semanas')}""";
"""${_plural(count, one: 'semana', many: '$count semanas')}""";
/// ```dart
/// "${_plural(count, one: 'mes', many: 'meses')}"
/// "${_plural(count, one: 'mes', many: '$count meses')}"
/// ```
String month(int count) => """${_plural(count, one: 'mes', many: 'meses')}""";
String month(int count) =>
"""${_plural(count, one: 'mes', many: '$count meses')}""";
/// ```dart
/// "${_plural(count, one: 'año', many: 'años')}"
/// "${_plural(count, one: 'año', many: '$count años')}"
/// ```
String year(int count) => """${_plural(count, one: 'año', many: 'años')}""";
String year(int count) =>
"""${_plural(count, one: 'año', many: '$count años')}""";
DayNamesRecurrenceMessagesEs get dayNames =>
DayNamesRecurrenceMessagesEs(this);
DayAbbrRecurrenceMessagesEs get dayAbbr => DayAbbrRecurrenceMessagesEs(this);
@@ -1382,7 +1380,6 @@ Por favor, completa el inicio de sesión en tu navegador.""",
"""recurrence.presets""": """Preajustes""",
"""recurrence.daily""": """Diario""",
"""recurrence.weekly""": """Semanal""",
"""recurrence.everyTwoWeeks""": """Cada 2 semanas""",
"""recurrence.monthly""": """Mensual""",
"""recurrence.everyLabel""": """Cada""",
"""recurrence.unit""": """Unidad""",

View File

@@ -187,7 +187,6 @@ recurrence:
presets: Preajustes
daily: Diario
weekly: Semanal
everyTwoWeeks: Cada 2 semanas
monthly: Mensual
everyLabel: Cada
unit: Unidad
@@ -208,12 +207,12 @@ recurrence:
notSet: no establecido
set: establecido
every(String unit): "cada $unit"
everyN(int count, String unit): "cada $count $unit"
everyButton(String unit): "Cada $unit"
onDays(String days): "los $days"
day(int count): "${_plural(count, one: 'd\xEDa', many: 'd\xEDas')}"
week(int count): "${_plural(count, one: 'semana', many: 'semanas')}"
month(int count): "${_plural(count, one: 'mes', many: 'meses')}"
year(int count): "${_plural(count, one: 'a\xF1o', many: 'a\xF1os')}"
day(int count): "${_plural(count, one: 'día', many: '$count días')}"
week(int count): "${_plural(count, one: 'semana', many: '$count semanas')}"
month(int count): "${_plural(count, one: 'mes', many: '$count meses')}"
year(int count): "${_plural(count, one: 'año', many: '$count años')}"
dayNames:
monday: Lunes
tuesday: Martes

View File

@@ -991,11 +991,6 @@ class RecurrenceMessagesFr extends RecurrenceMessages {
/// ```
String get weekly => """Hebdomadaire""";
/// ```dart
/// "Toutes les 2 semaines"
/// ```
String get everyTwoWeeks => """Toutes les 2 semaines""";
/// ```dart
/// "Mensuel"
/// ```
@@ -1100,9 +1095,9 @@ class RecurrenceMessagesFr extends RecurrenceMessages {
String every(String unit) => """tous les $unit""";
/// ```dart
/// "tous les $count $unit"
/// "Tous les $unit"
/// ```
String everyN(int count, String unit) => """tous les $count $unit""";
String everyButton(String unit) => """Tous les $unit""";
/// ```dart
/// "le $days"
@@ -1110,25 +1105,28 @@ class RecurrenceMessagesFr extends RecurrenceMessages {
String onDays(String days) => """le $days""";
/// ```dart
/// "${_plural(count, one: 'jour', many: 'jours')}"
/// "${_plural(count, one: 'jour', many: '$count jours')}"
/// ```
String day(int count) => """${_plural(count, one: 'jour', many: 'jours')}""";
String day(int count) =>
"""${_plural(count, one: 'jour', many: '$count jours')}""";
/// ```dart
/// "${_plural(count, one: 'semaine', many: 'semaines')}"
/// "${_plural(count, one: 'semaine', many: '$count semaines')}"
/// ```
String week(int count) =>
"""${_plural(count, one: 'semaine', many: 'semaines')}""";
"""${_plural(count, one: 'semaine', many: '$count semaines')}""";
/// ```dart
/// "${_plural(count, one: 'mois', many: 'mois')}"
/// "${_plural(count, one: 'mois', many: '$count mois')}"
/// ```
String month(int count) => """${_plural(count, one: 'mois', many: 'mois')}""";
String month(int count) =>
"""${_plural(count, one: 'mois', many: '$count mois')}""";
/// ```dart
/// "${_plural(count, one: 'an', many: 'ans')}"
/// "${_plural(count, one: 'an', many: '$count ans')}"
/// ```
String year(int count) => """${_plural(count, one: 'an', many: 'ans')}""";
String year(int count) =>
"""${_plural(count, one: 'an', many: '$count ans')}""";
DayNamesRecurrenceMessagesFr get dayNames =>
DayNamesRecurrenceMessagesFr(this);
DayAbbrRecurrenceMessagesFr get dayAbbr => DayAbbrRecurrenceMessagesFr(this);
@@ -1386,7 +1384,6 @@ Veuillez terminer la connexion dans votre navigateur.""",
"""recurrence.presets""": """Préréglages""",
"""recurrence.daily""": """Quotidien""",
"""recurrence.weekly""": """Hebdomadaire""",
"""recurrence.everyTwoWeeks""": """Toutes les 2 semaines""",
"""recurrence.monthly""": """Mensuel""",
"""recurrence.everyLabel""": """Tous les""",
"""recurrence.unit""": """Unité""",

View File

@@ -187,7 +187,6 @@ recurrence:
presets: "Pr\xE9r\xE9glages"
daily: Quotidien
weekly: Hebdomadaire
everyTwoWeeks: Toutes les 2 semaines
monthly: Mensuel
everyLabel: Tous les
unit: "Unit\xE9"
@@ -208,12 +207,12 @@ recurrence:
notSet: "non d\xE9fini"
set: "d\xE9fini"
every(String unit): "tous les $unit"
everyN(int count, String unit): "tous les $count $unit"
everyButton(String unit): "Tous les $unit"
onDays(String days): "le $days"
day(int count): "${_plural(count, one: 'jour', many: 'jours')}"
week(int count): "${_plural(count, one: 'semaine', many: 'semaines')}"
month(int count): "${_plural(count, one: 'mois', many: 'mois')}"
year(int count): "${_plural(count, one: 'an', many: 'ans')}"
day(int count): "${_plural(count, one: 'jour', many: '$count jours')}"
week(int count): "${_plural(count, one: 'semaine', many: '$count semaines')}"
month(int count): "${_plural(count, one: 'mois', many: '$count mois')}"
year(int count): "${_plural(count, one: 'an', many: '$count ans')}"
dayNames:
monday: Lundi
tuesday: Mardi

View File

@@ -989,11 +989,6 @@ class RecurrenceMessagesHe extends RecurrenceMessages {
/// ```
String get weekly => """שבועי""";
/// ```dart
/// "כל שבועיים"
/// ```
String get everyTwoWeeks => """כל שבועיים""";
/// ```dart
/// "חודשי"
/// ```
@@ -1097,9 +1092,9 @@ class RecurrenceMessagesHe extends RecurrenceMessages {
String every(String unit) => """כל $unit""";
/// ```dart
/// "כל $count $unit"
/// "כל $unit"
/// ```
String everyN(int count, String unit) => """כל $count $unit""";
String everyButton(String unit) => """כל $unit""";
/// ```dart
/// "ב$days"
@@ -1107,26 +1102,28 @@ class RecurrenceMessagesHe extends RecurrenceMessages {
String onDays(String days) => """ב$days""";
/// ```dart
/// "${_plural(count, one: 'יום', many: 'ימים')}"
/// "${_plural(count, one: 'יום', two: 'יומיים', many: '$count ימים')}"
/// ```
String day(int count) => """${_plural(count, one: 'יום', many: 'ימים')}""";
String day(int count) =>
"""${_plural(count, one: 'יום', two: 'יומיים', many: '$count ימים')}""";
/// ```dart
/// "${_plural(count, one: 'שבוע', many: 'שבועות')}"
/// "${_plural(count, one: 'שבוע', two: 'שבועיים', many: '$count שבועות')}"
/// ```
String week(int count) =>
"""${_plural(count, one: 'שבוע', many: 'שבועות')}""";
"""${_plural(count, one: 'שבוע', two: 'שבועיים', many: '$count שבועות')}""";
/// ```dart
/// "${_plural(count, one: 'חודש', many: 'חודשים')}"
/// "${_plural(count, one: 'חודש', two: 'חודשיים', many: '$count חודשים')}"
/// ```
String month(int count) =>
"""${_plural(count, one: 'חודש', many: 'חודשים')}""";
"""${_plural(count, one: 'חודש', two: 'חודשיים', many: '$count חודשים')}""";
/// ```dart
/// "${_plural(count, one: 'שנה', many: 'שנים')}"
/// "${_plural(count, one: 'שנה', two: 'שנתיים', many: '$count שנים')}"
/// ```
String year(int count) => """${_plural(count, one: 'שנה', many: 'שנים')}""";
String year(int count) =>
"""${_plural(count, one: 'שנה', two: 'שנתיים', many: '$count שנים')}""";
DayNamesRecurrenceMessagesHe get dayNames =>
DayNamesRecurrenceMessagesHe(this);
DayAbbrRecurrenceMessagesHe get dayAbbr => DayAbbrRecurrenceMessagesHe(this);
@@ -1374,7 +1371,6 @@ Map<String, String> get messagesHeMap => {
"""recurrence.presets""": """הגדרות מוכנות""",
"""recurrence.daily""": """יומי""",
"""recurrence.weekly""": """שבועי""",
"""recurrence.everyTwoWeeks""": """כל שבועיים""",
"""recurrence.monthly""": """חודשי""",
"""recurrence.everyLabel""": """כל""",
"""recurrence.unit""": """יחידה""",

View File

@@ -187,7 +187,6 @@ recurrence:
presets: הגדרות מוכנות
daily: יומי
weekly: שבועי
everyTwoWeeks: כל שבועיים
monthly: חודשי
everyLabel: כל
unit: יחידה
@@ -208,12 +207,12 @@ recurrence:
notSet: לא נקבע
set: נקבע
every(String unit): "כל $unit"
everyN(int count, String unit): "כל $count $unit"
everyButton(String unit): "כל $unit"
onDays(String days): "ב$days"
day(int count): "${_plural(count, one: 'יום', many: 'ימים')}"
week(int count): "${_plural(count, one: 'שבוע', many: 'שבועות')}"
month(int count): "${_plural(count, one: 'חודש', many: 'חודשים')}"
year(int count): "${_plural(count, one: 'שנה', many: 'שנים')}"
day(int count): "${_plural(count, one: 'יום', two: 'יומיים', many: '$count ימים')}"
week(int count): "${_plural(count, one: 'שבוע', two: 'שבועיים', many: '$count שבועות')}"
month(int count): "${_plural(count, one: 'חודש', two: 'חודשיים', many: '$count חודשים')}"
year(int count): "${_plural(count, one: 'שנה', two: 'שנתיים', many: '$count שנים')}"
dayNames:
monday: יום שני
tuesday: יום שלישי

View File

@@ -62,7 +62,7 @@ String formatRrule(String rrule) {
_ => freq,
};
final prefix = interval == 1 ? r.every(unit) : r.everyN(interval, unit);
final prefix = r.every(unit);
if (byDay != null && freq == 'weekly') {
final days = byDay.split(',').map((d) => dayNames[d] ?? d).join(', ');

View File

@@ -174,7 +174,7 @@ class _RecurrenceDialogState extends State<_RecurrenceDialog> {
onTap: () => _applyPreset('WEEKLY', 1),
),
_PresetChip(
label: r.everyTwoWeeks,
label: r.everyButton(r.week(2)),
selected: _freq == 'WEEKLY' && _interval == 2,
onTap: () => _applyPreset('WEEKLY', 2),
),

View File

@@ -56,7 +56,7 @@ void main() {
expect(find.text('Presets'), findsOneWidget);
expect(find.text('Daily'), findsOneWidget);
expect(find.text('Weekly'), findsOneWidget);
expect(find.text('Every 2 weeks'), findsOneWidget);
expect(find.textContaining('2 week'), findsWidgets);
expect(find.text('Monthly'), findsOneWidget);
expect(find.text('Summary '), findsOneWidget);
});
@@ -88,11 +88,11 @@ void main() {
expect(find.textContaining('month'), findsWidgets);
});
testWidgets('tapping Every 2 weeks preset shows interval of 2', (
testWidgets('tapping every 2 weeks preset shows interval of 2', (
tester,
) async {
await openDialog(tester);
await tester.tap(find.text('Every 2 weeks'));
await tester.tap(find.textContaining('2 week'));
await tester.pumpAndSettle();
tester.takeException();
// summary should include "2"