Skip to content

Commit

Permalink
[mekomsolutions#212] Message Source should interpret messages.propert…
Browse files Browse the repository at this point in the history
…ies with no suffix as Englis
  • Loading branch information
mogoodrich committed Dec 16, 2022
1 parent 29bb7b1 commit 41c2bfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected String resolveCodeWithoutArguments(String code, Locale locale) {
if (message != null) {
return message;
}
return resolveCodeWithoutArguments(code, Locale.getDefault(), localesAttempted);
return resolveCodeWithoutArguments(code, Locale.ENGLISH, localesAttempted);
}

/**
Expand All @@ -149,8 +149,6 @@ protected String resolveCodeWithoutArguments(String code, Locale locale, Set<Loc
} else if (getFallbackLanguages().containsKey(locale.getLanguage())) {
Locale fallbackLanguage = new Locale(getFallbackLanguages().get(locale.getLanguage()));
return resolveCodeWithoutArguments(code, fallbackLanguage, localesAttempted);
} else {
return resolveCodeWithoutArguments(code, Locale.ENGLISH, localesAttempted);
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ public void shouldDefaultToDefaultLocaleSettingIfNoMessageFoundInLocale() {
}

@Test
public void shouldDefaultToSystemLocaleIfNoMessageFoundInLocale() {
public void shouldReturnEnglishIfNoOtherMatchesFound() {
Locale.setDefault(Locale.FRANCE);
LocaleUtility.setDefaultLocaleCache(LocaleUtils.toLocale("fr"));
Context.setLocale(Locale.FRANCE);
testMessage("Only defined in English", "metadata.healthcenter.onlyInEnglish");
}
Expand Down

0 comments on commit 41c2bfb

Please sign in to comment.