diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiLocalizer.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiLocalizer.java index 9c3143fe04d..c3f7c5c425f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiLocalizer.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiLocalizer.java @@ -34,7 +34,9 @@ import java.util.concurrent.ConcurrentHashMap; */ public class HapiLocalizer { + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(HapiLocalizer.class); private List myBundle = new ArrayList(); + private final Map myKeyToMessageFormat = new ConcurrentHashMap(); public HapiLocalizer() { @@ -47,6 +49,24 @@ public class HapiLocalizer { } } + private String findFormatString(String theQualifiedKey) { + String formatString = null; + for (ResourceBundle nextBundle : myBundle) { + if (nextBundle.containsKey(theQualifiedKey)) { + formatString = nextBundle.getString(theQualifiedKey); + } + if (isNotBlank(formatString)) { + break; + } + } + + if (formatString == null) { + ourLog.warn("Unknown localization key: {}", theQualifiedKey); + formatString = "!MESSAGE!"; + } + return formatString; + } + public String getMessage(Class theType, String theKey, Object... theParameters) { return getMessage(theType.getName() + '.' + theKey, theParameters); } @@ -68,22 +88,4 @@ public class HapiLocalizer { return retVal; } } - - private String findFormatString(String theQualifiedKey) { - String formatString = null; - for (ResourceBundle nextBundle : myBundle) { - if (nextBundle.containsKey(theQualifiedKey)) { - formatString = nextBundle.getString(theQualifiedKey); - } - if (isNotBlank(formatString)) { - break; - } - } - - if (formatString == null) { - formatString = "!MESSAGE!"; - } - return formatString; - } - }