2026-07-23 02:18:04 +02:00
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
|
import 'package:plezy/i18n/strings.g.dart';
|
|
|
|
|
|
|
|
|
|
void main() {
|
2026-07-24 07:24:58 +02:00
|
|
|
test('completed locale entries override the English fallback', () async {
|
2026-07-23 02:18:04 +02:00
|
|
|
final english = await AppLocale.en.build();
|
2026-07-24 07:24:58 +02:00
|
|
|
final englishValues = <String>[
|
2026-07-23 02:18:04 +02:00
|
|
|
english.videoControls.showPlaybackControls,
|
|
|
|
|
english.videoControls.hidePlaybackControls,
|
|
|
|
|
english.settings.tvCornerSpotlightBackdrop,
|
|
|
|
|
english.settings.tvCornerSpotlightBackdropDescription,
|
|
|
|
|
];
|
|
|
|
|
|
2026-07-24 07:24:58 +02:00
|
|
|
expect(englishValues, everyElement(isNotEmpty));
|
2026-07-23 02:18:04 +02:00
|
|
|
|
2026-07-24 07:24:58 +02:00
|
|
|
for (final locale in AppLocale.values.where((locale) => locale != AppLocale.en)) {
|
2026-07-23 02:18:04 +02:00
|
|
|
final translations = await locale.build();
|
2026-07-24 07:24:58 +02:00
|
|
|
final localizedValues = <String>[
|
|
|
|
|
translations.videoControls.showPlaybackControls,
|
|
|
|
|
translations.videoControls.hidePlaybackControls,
|
|
|
|
|
translations.settings.tvCornerSpotlightBackdrop,
|
|
|
|
|
translations.settings.tvCornerSpotlightBackdropDescription,
|
|
|
|
|
];
|
2026-07-23 02:18:04 +02:00
|
|
|
|
2026-07-24 07:24:58 +02:00
|
|
|
for (var index = 0; index < localizedValues.length; index++) {
|
|
|
|
|
expect(
|
|
|
|
|
localizedValues[index],
|
|
|
|
|
isNot(englishValues[index]),
|
|
|
|
|
reason: '${locale.name} must provide its own completed translation at index $index',
|
|
|
|
|
);
|
|
|
|
|
}
|
2026-07-23 02:18:04 +02:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|