/** * Create I18N repository instance and configure it. See {@link ConfigBuilder} for configuration object properties. * * @param config configuration object. * @throws IllegalArgumentException if configured base directory does not denote an existing directory. * @throws IOException if reading directories content fails, perhaps for lack of authorization. * @throws BugError if no files matching files pattern found or missing locale directory. */ public I18nRepository(Config config) throws IOException { this.multiLocale = config.getProperty("multi-locale", Boolean.class, true); File baseDir = config.getProperty("base-dir", File.class); Params.isDirectory(baseDir, "Base directory"); FileFilter fileFilter = new WildcardFilter(config.getProperty("files-pattern", WildcardFilter.ACCEPT_ALL)); if(this.multiLocale) { this.iterable = new MultipleLocale(baseDir, config.getProperty("sub-path"), fileFilter); } else { this.iterable = new SingleLocale(baseDir, fileFilter); } }