Open yahya-ebizz opened 2 years ago
I spotted it is not working on Android 13 ether. It is translating half of the app, also changing language 2 or more times when app is active is especially critical..
the library works great on Android 10, but when tested on Android 12 I found that words do translate to the right language but layout don't change direction ltr to rtl and vise versa
@zeroDivider @ahmed-elkhadragy Trying to figure out what is the cause of your issue with new android versions
@zeroDivider @ahmed-elkhadragy Trying to figure out what is the cause of your issue with new android versions
- Do you restart your activity/app once the new locale is applied?
- Do you use the navigation component/fragments for your screens?
Hello, yes I used receeate() to restart the activity and it indded changes language but it's all about layout direction and I don't use navigation component nor fragment my app is single screen single activity app.. I turned around the issue right now until it's figured out by making the locale change in different activity and reopening the original activity and it works fine but my original plan was to change locale from the same screen/activity
reason: IME_AUTOFILL_DEFAULT_SUPPORTED_LOCALES_IS_EMPTY Change ID: 169273070 Default State: Enabled for apps that target Android 12 (API level 31) or higher. For apps targeting Android 12 (API level 31) and higher, [getSupportedLocales()](https://developer.android.com/reference/android/view/inputmethod/InlineSuggestionsRequest#getSupportedLocales()) now returns an empty locale list when it's not set, instead of the default system locale.
PS: Just passing by, due to an attempt to migrate from Sharedpreferences to DataStore
My option fun Configuration.getFirstLocale(): Locale = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { getSystemLocale() } else { val locales = ConfigurationCompat.getLocales(this) if (locales.isEmpty) localeENGLISH else (locales[0] ?: localeENGLISH) }
fun getSystemLocale(): Locale = getSystemLocales().get(0) ?: Locale.getDefault() fun getSystemLocales(): LocaleListCompat = ConfigurationCompat.getLocales(Resources.getSystem().configuration)
Hey @yahya-ebizz
Could you please share more details on what is wrong with Android 11 and 12?
I've tested the sample app using the latest versions, but I haven't come across any issues.