mmcc007 / screenshots

Screenshots: A command line utility and package for capturing screenshots for Flutter
Other
266 stars 145 forks source link

Support for Hebrew locale on Android #184

Open amitkot opened 4 years ago

amitkot commented 4 years ago

My app is localised for multiple locales, one of which uses Hebrew language. When running screenshots with an Android emulator, the mechanism for switching locales is currently not working properly for Hebrew.

After the locale is changed to he-IL, the process gets stuck and never advances.

I used he-IL and running screenshots -v I noticed that the adb log command is waiting for an input that never arrives.

It seems there is an old standard for locales with Hebrew that used iw instead of he, and although the locale is now he-IL everywhere, the tools whose logs are being grepped doesn't output he. When running with the locale iw-IL, the screenshots tool worked fine for Android, but the screenshots were in iw-IL folder and iOS did not work properly.

amitkot commented 4 years ago

The grep command when using he-IL:

/usr/local/share/android-sdk/platform-tools/adb -s emulator-5554 logcat -b main *:S
ContactsDatabaseHelper:I ContactsProvider:I -e he_IL

Output without requiring the he-IL shows the service outputs iw_IL instead:

$ /usr/local/share/android-sdk/platform-tools/adb -s emulator-5554 logcat -b main *:S ContactsDatabaseHelper:I ContactsProvider:I
02-02 12:16:29.625  6445  6445 I ContactsDatabaseHelper: updateUseStrictPhoneNumberComparison: US
02-02 12:16:30.794  6445  6639 I ContactsProvider: Locale has changed from [en_US] to [iw_IL]
02-02 12:16:30.888  6445  6639 I ContactsDatabaseHelper: Switching to locale [iw_IL] (ICU v63.2.0.0)
02-02 12:16:31.002  6445  6639 I ContactsDatabaseHelper: Locale change completed in 113ms
02-02 12:16:31.005  6445  6639 I ContactsDatabaseHelper: Switching to locale [iw_IL] (ICU v63.2.0.0)
02-02 12:16:31.281  6445  6639 I ContactsDatabaseHelper: Locale change completed in 275ms
02-02 12:17:26.138  8703  8703 I ContactsDatabaseHelper: updateUseStrictPhoneNumberComparison: US
02-02 12:18:35.962  9516  9516 I ContactsDatabaseHelper: updateUseStrictPhoneNumberComparison: US
amitkot commented 4 years ago

Seems that Android emulator now supports setting the locale when starting it:

emulator -avd <avd-name> -change-locale fr-CA

Source - https://androidstudio.googleblog.com/2019/09/emulator-29112-stable.html

mmcc007 commented 4 years ago

You might be using an older emulator? Thanks for the tip!