protected Properties getAllProperties(Locale locale) { clearCacheIncludingAncestors(); PropertiesHolder propertiesHolder = getMergedProperties(locale); Properties properties = propertiesHolder.getProperties(); return properties; }
/** * Get a PropertiesHolder that contains the actually visible properties for a Locale, after * merging all specified resource bundles. Either fetches the holder from the cache or freshly * loads it. * * <p>Only used when caching resource bundle contents forever, i.e. with cacheSeconds < 0. * Therefore, merged properties are always cached forever. */ protected PropertiesHolder getMergedPluginProperties(Locale locale) { PropertiesHolder mergedHolder = this.cachedMergedPluginProperties.get(locale); if (mergedHolder != null) { return mergedHolder; } Properties mergedProps = new Properties(); mergedHolder = new PropertiesHolder(mergedProps, -1); for (String basename : pluginBaseNames) { List filenames = calculateAllFilenames(basename, locale); for (int j = filenames.size() - 1; j >= 0; j--) { String filename = (String) filenames.get(j); PropertiesHolder propHolder = getProperties(filename); if (propHolder.getProperties() != null) { mergedProps.putAll(propHolder.getProperties()); } } } this.cachedMergedPluginProperties.put(locale, mergedHolder); return mergedHolder; }
/** * Attempts to resolve a MessageFormat for the code from the list of plugin base names * * @param code The code * @param locale The locale * @return a MessageFormat */ protected MessageFormat resolveCodeFromPlugins(String code, Locale locale) { if (this.pluginCacheMillis < 0) { PropertiesHolder propHolder = getMergedPluginProperties(locale); MessageFormat result = propHolder.getMessageFormat(code, locale); if (result != null) { return result; } } else { for (String pluginBaseName : pluginBaseNames) { List filenames = calculateAllFilenames(pluginBaseName, locale); for (Object o : filenames) { String filename = (String) o; PropertiesHolder holder = getProperties(filename); MessageFormat result = holder.getMessageFormat(code, locale); if (result != null) return result; } } } return null; }