JavaPropertyScanner extends AbstractPropertyScanner implements PropertyScanner { @Override public File findTemplate(File propertyFile, ScanConfiguration config) { Matcher matcher = LOCALE_PATTERN.matcher(propertyFile.getName()); if(!matcher.matches()) return null; String prefix = matcher.group(1); String suffix = matcher.group(3); StringBuilder filename = new StringBuilder(prefix); if(config.getMasterLocale()!=null) { filename.append("_"); filename.append(config.getMasterLocale()); } filename.append(suffix); return new File(propertyFile.getParentFile(),filename.toString()); }  @Override File findTemplate(File propertyFile, ScanConfiguration config); @Override Locale getLocale(File propertyFile); @Override Map<Locale, File> findTranslations(File template, ScanConfiguration config); @Override File computeTranslationPath(File template, Locale templateLocale, Locale translationLocale); @Override boolean isBilingual(); @Override PropertyConverter createConverter(URI resource); @Override String[] getDefaultIncludes(); @Override String[] getDefaultExcludes(); @Override String getEncoding(); @Property(name=PropertyScanner.TYPE, value="PROPERTIES_ENCODED")
	 static final String TYPE; }
@Test public void testFindTemplate() { ScanConfiguration configuration = mock(ScanConfiguration.class); assertEquals("test.properties", getFixture().findTemplate(new File("test_de_DE.properties"), configuration).getName()); assertEquals("test.properties", getFixture().findTemplate(new File("test_de.properties"), configuration).getName()); }
@Test public void testFindTemplateWithMasterLocale() { ScanConfiguration configuration = mock(ScanConfiguration.class); when(configuration.getMasterLocale()).thenReturn("en_US"); assertEquals("test_en_US.properties", getFixture().findTemplate(new File("test_de_DE.properties"), configuration).getName()); assertEquals("test_en_US.properties", getFixture().findTemplate(new File("test_de_US.properties"), configuration).getName()); }