| | 616 | |
|---|
| | 617 | /** |
|---|
| | 618 | * Returns a list of Locales for which the User |
|---|
| | 619 | * is considered proficient. |
|---|
| | 620 | * |
|---|
| | 621 | * @return List of the User's proficient locales |
|---|
| | 622 | */ |
|---|
| | 623 | public List<Locale> getProficientLocales() { |
|---|
| | 624 | String proficientLocalesProperty = getUserProperty(OpenmrsConstants.USER_PROPERTY_PROFICIENT_LOCALES); |
|---|
| | 625 | |
|---|
| | 626 | if ((proficientLocales == null) || (!parsedProficientLocalesProperty.equals(proficientLocalesProperty))) { |
|---|
| | 627 | parsedProficientLocalesProperty = proficientLocalesProperty; |
|---|
| | 628 | proficientLocales = new ArrayList<Locale>(); |
|---|
| | 629 | |
|---|
| | 630 | String[] proficientLocalesArray = proficientLocalesProperty.split(","); |
|---|
| | 631 | for (String proficientLocaleSpec : proficientLocalesArray) { |
|---|
| | 632 | if (proficientLocaleSpec.length() > 0) { |
|---|
| | 633 | Locale proficientLocale = LocaleFactory.fromSpecification(proficientLocaleSpec); |
|---|
| | 634 | if (!proficientLocales.contains(proficientLocale)) { |
|---|
| | 635 | proficientLocales.add(proficientLocale); |
|---|
| | 636 | if (proficientLocale.getCountry() != "") { |
|---|
| | 637 | // add the language also |
|---|
| | 638 | Locale languageOnlyLocale = LocaleFactory.fromSpecification(proficientLocale.getLanguage()); |
|---|
| | 639 | if (!proficientLocales.contains(languageOnlyLocale)) { |
|---|
| | 640 | proficientLocales.add(LocaleFactory.fromSpecification(proficientLocale.getLanguage())); |
|---|
| | 641 | } |
|---|
| | 642 | } |
|---|
| | 643 | } |
|---|
| | 644 | } |
|---|
| | 645 | } |
|---|
| | 646 | } |
|---|
| | 647 | return proficientLocales; |
|---|
| | 648 | } |
|---|