feat: ship the interface in eight languages, with per-language plurals and mirroring

This commit is contained in:
randogoth 2026-10-11 14:54:43 +03:00
parent 6de6672ae3
commit a4a49f41d7
28 changed files with 1795 additions and 32 deletions

View file

@ -245,6 +245,50 @@ void main() {
expect(deps.browser.error.value, isNull);
});
testWidgets('choosing a language changes the interface in place',
(tester) async {
await pumpApp(tester);
await deps.browser.open(MewsUrls.settings);
await tester.pumpAndSettle();
expect(find.text('Settings'), findsOneWidget);
// The language group sits below the fold.
Future<void> scrollTo(String label) async {
final target = find.textContaining(label);
for (var i = 0; i < 30 && target.evaluate().isEmpty; i++) {
await tester.drag(find.byType(ListView), const Offset(0, -200));
await tester.pumpAndSettle();
}
await tester.ensureVisible(target.first);
await tester.pumpAndSettle();
}
// Each language is named in its own words, so it can be found from an
// interface the reader cannot read.
await scrollTo('Deutsch');
final stepsBack = deps.browser.canGoBack;
await tapRun(tester, 'Deutsch');
expect(deps.settings.language.value, 'de');
// Applied in place, like the other reader choices.
expect(deps.browser.currentPage.value?.url, MewsUrls.settings);
expect(deps.browser.canGoBack, stepsBack);
expect(find.text('Einstellungen'), findsOneWidget);
expect(find.text('Settings'), findsNothing);
// Hebrew turns the whole page around.
await scrollTo('עברית');
await tapRun(tester, 'עברית');
expect(deps.settings.language.value, 'he');
expect(deps.browser.currentPage.value?.direction, TextDirection.rtl);
// Back to English.
await scrollTo('English');
await tapRun(tester, 'English');
expect(deps.settings.language.value, 'en-US');
expect(deps.browser.currentPage.value?.direction, TextDirection.ltr);
expect(find.text('Settings'), findsOneWidget);
});
testWidgets('bare mews: and an unknown name resolve predictably',
(tester) async {
await pumpApp(tester);