/** * Resolves the locale from the given properties file. * * @param propertiesFile * the properties file * @param defaultLocale * the default locale * @param systemsDefault * if this flag is true the systems default locale will be taken if not found * @return the locale */ public static Locale resolveLocale(final File propertiesFile, final Locale defaultLocale, final boolean systemsDefault) { final String localeCode = propertiesFile.getName() .replaceAll("^" + resolveBundlename(propertiesFile) + "(_)?|\\.properties$", ""); return LocaleResolver.resolveLocale(localeCode, defaultLocale, systemsDefault); }
/** * {@inheritDoc} */ @Override public List<BundleNames> importProperties(BundleApplications bundleApplication, List<KeyValuePair<File, Locale>> foundProperties) throws IOException { final List<BundleNames> list = new ArrayList<>(); for (final KeyValuePair<File, Locale> entry : foundProperties) { final File propertiesFile = entry.getKey(); final Locale locale = entry.getValue(); final String bundlename = LocaleResolver.resolveBundlename(propertiesFile); final Properties properties = PropertiesExtensions.loadProperties(propertiesFile); final BundleNames bundleNames = updateProperties(bundleApplication, properties, bundlename, locale, false); list.add(bundleNames); bundleApplication = bundleApplicationsService.merge(bundleApplication); } return list; }