Skip to content

Commit

Permalink
TRUNK-3142: Fixed LocaleUtility to work with JDK 7
Browse files Browse the repository at this point in the history
  • Loading branch information
rkorytkowski committed Mar 29, 2013
1 parent df9ab34 commit 2ff133f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/src/main/java/org/openmrs/util/LocaleUtility.java
Expand Up @@ -19,6 +19,7 @@
import java.util.MissingResourceException;
import java.util.Set;

import org.apache.commons.lang.LocaleUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.GlobalProperty;
Expand Down Expand Up @@ -219,13 +220,13 @@ public boolean supportsPropertyName(String propertyName) {
/**
* Checks if specified locale object is valid
*
* @param locale
* object for validation
* @param locale object for validation
* @return true if locale is available
*/
public static boolean isValid(Locale locale) {
try {
return locale.getISO3Language() != null && locale.getISO3Country() != null;
//Check if the language is available and then verify the country separately, because e.g. fr_RW combination is not among available locales.
return LocaleUtils.isAvailableLocale(new Locale(locale.getLanguage())) && locale.getISO3Country() != null;
}
catch (MissingResourceException e) {
return false;
Expand Down

0 comments on commit 2ff133f

Please sign in to comment.