Class LanguageUtils


  • public class LanguageUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      LanguageUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void setLanguageAndCountry​(java.lang.String language, java.lang.String country, android.content.Context ctx)
      Sets the language and country locale for given language and country.
      static void setLanguageConfiguration​(android.content.res.Resources res)
      Method that will set correct language configuration to given Resources object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LanguageUtils

        public LanguageUtils()
    • Method Detail

      • setLanguageAndCountry

        public static void setLanguageAndCountry​(@Nullable
                                                 java.lang.String language,
                                                 @Nullable
                                                 java.lang.String country,
                                                 @NonNull
                                                 android.content.Context ctx)
        Sets the language and country locale for given language and country. If either language or country is null, default is loaded from shared preferences. If there is nothing in shared preferences, device default locale is used.
        Parameters:
        language - desired language
        country - desired country (to select country-specific language locale)
        ctx - context for accessing shared preferences
      • setLanguageConfiguration

        public static void setLanguageConfiguration​(@NonNull
                                                    android.content.res.Resources res)
        Method that will set correct language configuration to given Resources object.
        Parameters:
        res - Resources object whose language configuration should be updated.