LocaleManagerCompat
class LocaleManagerCompat
Helper for accessing features in android.app.LocaleManager in a backwards compatible fashion.
Summary
Public functions |
|
|---|---|
java-static LocaleListCompat |
@AnyThreadReturns application locales for the calling app as a |
java-static LocaleListCompat |
@AnyThreadReturns the current system locales, ignoring app-specific overrides. |
Public functions
getApplicationLocales
@AnyThread
java-static fun getApplicationLocales(context: Context): LocaleListCompat
Returns application locales for the calling app as a LocaleListCompat. This API for non-androidx.appcompat.app.AppCompatDelegate context to easily get the per-app locale on the prior API 33 devices.
Returns a getEmptyLocaleList if no app-specific locales are set.
getSystemLocales
@AnyThread
java-static fun getSystemLocales(context: Context): LocaleListCompat
Returns the current system locales, ignoring app-specific overrides.
Note: Apps should generally access the user's locale preferences as indicated in their in-process android.os.LocaleLists. However, in case an app-specific locale is set, this method helps cater to rare use-cases which might require specifically knowing the system locale.