public class AppLocale
AppLocale is a android library to update the app language dynamically.
public static AppLocale INSTANCE
AppLocale is a android library to update the app language dynamically.
public static boolean isInitial()
If the desiredLocale
has not been changed yet.
desiredLocale
@Nullable public static AppLocaleRepository getAppLocaleRepository()
A interface AppLocaleRepository
to persist the supportedLocales
, the currentLocale
and
the desiredLocale
.
public static void setAppLocaleRepository(@Nullable AppLocaleRepository p)
A interface AppLocaleRepository
to persist the supportedLocales
, the currentLocale
and
the desiredLocale
.
@NotNull public static LocaleMatchingStrategy getLocaleMatchingStrategy()
The localeMatchingStrategy
used to determine the new currentLocale
after a change
to the desiredLocale
.
localeMatchingStrategy
,
currentLocale
,
desiredLocale
public static void setLocaleMatchingStrategy(@NotNull LocaleMatchingStrategy p)
The localeMatchingStrategy
used to determine the new currentLocale
after a change
to the desiredLocale
.
localeMatchingStrategy
,
currentLocale
,
desiredLocale
@NotNull public static java.util.List<java.util.Locale> getSupportedLocales()
public static void setSupportedLocales(@NotNull java.util.List<java.util.Locale> p)
@NotNull public static java.util.Locale getCurrentLocale()
The locale currently used by the app.
public static void setCurrentLocale(@NotNull java.util.Locale p)
The locale currently used by the app.
@NotNull public static java.util.Locale getDesiredLocale()
The locale which should ideally be used by the app.
Setting a new desiredLocale
will lead to a new currentLocale
as defined by the
localeMatchingStrategy
.
desiredLocale
,
currentLocale
,
localeMatchingStrategy
public static void setDesiredLocale(@NotNull java.util.Locale value)
The locale which should ideally be used by the app.
Setting a new desiredLocale
will lead to a new currentLocale
as defined by the
localeMatchingStrategy
.
desiredLocale
,
currentLocale
,
localeMatchingStrategy
@JvmStatic public static void addLocaleChangedListener(@NotNull LocaleChangedListener listener)
Add a listener for changes to the currentLocale
currentLocale
@JvmStatic public static void removeLocaleChangedListener(@NotNull LocaleChangedListener listener)
Remove a listener for changes to the currentLocale
currentLocale
@JvmStatic @NotNull public static android.content.Context wrap(@NotNull android.content.Context context)
Wraps the context with a ContextWrapper which provides the AppLocaleResources instead of the default resources. If the provided context is already wrapped, it will be returned unchanged by this method.