AndroidUiTestingUtils
AndroidUiTestingUtils copied to clipboard
Complex locales are not supported
Describe the bug Complex locales, like "sr-Latn-RS" / "sr-Cyrl-RS" or "zh-Latn-TW-pinyin" cannot be set.
Environment The setup in which the bug is reproducible:
- Device or Emulator: Any
- API level: Any
- AndroidUiTestingUtils version: 1.1.2
- Affected Components: FragmentScenarioConfigurator.setlocale(), ActivityScenarioConfigurator.setLocale(), SystemLocaleTestRule, LocaleTestRule, ActivityScenarioForActivityRule(systemLocale = "my_locale"), fragmentScenarioConfiguratorRule(locale = "my_locale")
Expected behavior The locale should also be set correctly for those languages
Additional context
All the methods/components to set the Locale use the same methods as fastlane/Screengrab for converting strings into Locales. It means, they do not use Locale.forLanguageTag(), which supports such complex locales, but its own Localeutil method.
It is worth noticing that Locale.forLanguageTag() only supports IETF locale strings e.g. "en-US" but not ISO locale strings e.g. "en_US".
Moreover, the pseudolocales "en_XA" and "ar_XB" only exist as ISO locale Strings.
That is important to add support for complex locales, while still supporting ISO locales (at least as good as till AndroidUiTestingUtils 1.2.1) as well as pseudolocales