public static Locale getLocaleToBeUsed ( final UiProperties . Localization localizationProperties , final Locale desiredLocale ) { final List < String > availableLocals = localizationProperties . getAvailableLocals ( ) ; // ckeck if language code of UI locale matches an available local. // Country, region and variant are ignored. "availableLocals" must only // contain language codes without country or other extensions. if ( availableLocals . contains ( desiredLocale . getLanguage ( ) ) ) { return desiredLocale ; } return new Locale ( localizationProperties . getDefaultLocal ( ) ) ; }
Determine the language that should be used considering localization properties and a desired Locale