Skip to content

i18n: Add a RTL language #803

@chrisbobbe

Description

@chrisbobbe

If we add an RTL language to our supported locales—even if it has no translations yet—then widget tests exercising RTL can build ZulipApp without having to add an ad-hoc Directionality. They would do this by simulating the system language setting. For example in test/widgets/emoji_reaction_test.dart, in a test helper with a textDirection param:

+      final locale = switch (textDirection) {
+        TextDirection.ltr => const Locale('en'),
+        TextDirection.rtl => const Locale('ar'),
+      };
+      tester.platformDispatcher.localeTestValue = locale;
+      tester.platformDispatcher.localesTestValue = [locale];
+      addTearDown(tester.platformDispatcher.clearLocaleTestValue);
+      addTearDown(tester.platformDispatcher.clearLocalesTestValue);
+
+      await tester.pumpWidget(const ZulipApp());
+      // [etc.]

If ar isn't in the supported locales, though, ZulipApp understandably acts just as it would in the wild, when ar is selected in system settings: it falls back to English.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-i18nTranslation, localization, internationalization

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions