JavaPropertyScanner extends AbstractPropertyScanner implements PropertyScanner { @Override public Map<Locale, File> findTranslations(File template, ScanConfiguration config) { Map<Locale, File> results = new HashMap<Locale, File>(); Pattern filePattern = buildPatternFrom(template.getName()); File folder = template.getParentFile(); File[] files = folder.listFiles(); if(files==null) return results; for (File file : files) { if(file.equals(template)) continue; Matcher matcher = filePattern.matcher(file.getName()); if(matcher.matches()) { String localeString = matcher.group(1).substring(1); Locale locale = (Locale) PropertiesFactory.eINSTANCE.createFromString(PropertiesPackage.Literals.LOCALE, localeString); results.put(locale, file); } } return results; }  @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 testFindTranslations() throws IOException { File file = mock(File.class); when(file.getName()).thenReturn("foo.properties"); when(file.getAbsolutePath()).thenReturn(new File("foo.properties").getAbsolutePath()); when(file.getCanonicalPath()).thenReturn(new File("foo.properties").getCanonicalPath()); when(file.getPath()).thenReturn(new File("foo.properties").getPath()); File parent = mock(File.class); when(file.getParentFile()).thenReturn(parent); File[] children = new File[]{new File("foo.properties"),new File("other_fr.properties"),new File("foo_de.properties"),new File("foo_en_US.properties")}; when(parent.listFiles()).thenReturn(children); Map<Locale, File> result = getFixture().findTranslations(file, mock(ScanConfiguration.class)); assertEquals(2, result.size()); assertEquals("foo_de.properties", result.get(new Locale("de")).getName()); assertEquals("foo_en_US.properties", result.get(new Locale("en","US")).getName()); }