@Override protected String getMessageInternal(final String code, final Object[] args, final Locale locale) { if (!locale.equals(Locale.ENGLISH)) { val foundCode = IntStream.range(0, this.basenames.length) .filter(i -> { val filename = this.basenames[i] + '_' + locale; LOGGER.trace("Examining language bundle [{}] for the code [{}]", filename, code); val holder = this.getProperties(filename); return holder != null && holder.getProperties() != null && holder.getProperty(code) != null; }) .findFirst() .isPresent(); if (!foundCode) { LOGGER.trace("The code [{}] cannot be found in the language bundle for the locale [{}]", code, locale); } } return super.getMessageInternal(code, args, locale); }
@Override protected String getMessageInternal(final String code, final Object[] args, final Locale locale) { boolean foundCode = false; if (!locale.equals(Locale.ENGLISH)) { for (int i = 0; !foundCode && i < this.basenames.length; i++) { final String filename = this.basenames[i] + '_' + locale; logger.debug("Examining language bundle [{}] for the code [{}]", filename, code); final PropertiesHolder holder = this.getProperties(filename); foundCode = holder != null && holder.getProperties() != null && holder.getProperty(code) != null; } if (!foundCode) { logger.debug("The code [{}] cannot be found in the language bundle for the locale [{}]", code, locale); } } return super.getMessageInternal(code, args, locale); }
@Override protected String resolveCodeWithoutArguments(String code, Locale locale) { String module = RequestContextUtils.getModule(); Assert.hasText(module, " module is not specified!"); if(logger.isDebugEnabled()){ logger.debug("module:" + module); } for (String basename : basefilenames) { List<String> filenames = calculateAllFilenames(basename, locale); for (String filename : filenames) { if (StringUtils.endsWithIgnoreCase(filename, module)) { PropertiesHolder propHolder = getProperties(filename); String result = propHolder.getProperty(code); if (result != null) { return result; } } } } return super.resolveCodeWithoutArguments(code, locale); }
/** * Resolves the given message code as key in the retrieved bundle files, * returning the value found in the bundle as-is (without MessageFormat parsing). */ @Override protected String resolveCodeWithoutArguments(String code, Locale locale) { if (getCacheMillis() < 0) { PropertiesHolder propHolder = getMergedProperties(locale); String result = propHolder.getProperty(code); if (result != null) { return result; } } else { for (String basename : getBasenameSet()) { List<String> filenames = calculateAllFilenames(basename, locale); for (String filename : filenames) { PropertiesHolder propHolder = getProperties(filename); String result = propHolder.getProperty(code); if (result != null) { return result; } } } } return null; }
/** * Resolves the given message code as key in the retrieved bundle files, * returning the value found in the bundle as-is (without MessageFormat parsing). */ @Override protected String resolveCodeWithoutArguments(String code, Locale locale) { if (getCacheMillis() < 0) { PropertiesHolder propHolder = getMergedProperties(locale); String result = propHolder.getProperty(code); if (result != null) { return result; } } else { for (String basename : getBasenameSet()) { List<String> filenames = calculateAllFilenames(basename, locale); for (String filename : filenames) { PropertiesHolder propHolder = getProperties(filename); String result = propHolder.getProperty(code); if (result != null) { return result; } } } } return null; }
/** * Resolves the given message code as key in the retrieved bundle files, * returning the value found in the bundle as-is (without MessageFormat parsing). */ @Override protected String resolveCodeWithoutArguments(String code, Locale locale) { if (getCacheMillis() < 0) { PropertiesHolder propHolder = getMergedProperties(locale); String result = propHolder.getProperty(code); if (result != null) { return result; } } else { for (String basename : getBasenameSet()) { List<String> filenames = calculateAllFilenames(basename, locale); for (String filename : filenames) { PropertiesHolder propHolder = getProperties(filename); String result = propHolder.getProperty(code); if (result != null) { return result; } } } } return null; }