@Test public void reflectionOnProjectToFindLanguageFiles2() { File app = new File(SampleApps.getUICatalogFile()); List<File> languageFiles = LanguageDictionary.getL10NFiles(app); Assert.assertEquals(languageFiles.size(), 1); }
public static List<File> getL10NFiles(File aut) { List<File> res = new ArrayList<>(); File[] files = aut.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.getName().endsWith("lproj"); } }); for (File f : files) { File[] all = f.listFiles(); if (all != null) { for (File potential : all) { String file = potential.getName(); if (file.endsWith(".strings") && !file.endsWith("InfoPlist.strings")) { res.add(potential); } } } } return res; }
LanguageDictionary { public static List<File> getL10NFiles(File aut) { List<File> res = new ArrayList<>(); File[] files = aut.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.getName().endsWith("lproj"); } }); for (File f : files) { File[] all = f.listFiles(); if (all != null) { for (File potential : all) { String file = potential.getName(); if (file.endsWith(".strings") && !file.endsWith("InfoPlist.strings")) { res.add(potential); } } } } return res; } }
LanguageDictionary { public static List<File> getL10NFiles(File aut) { List<File> res = new ArrayList<>(); File[] files = aut.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.getName().endsWith("lproj"); } }); for (File f : files) { File[] all = f.listFiles(); if (all != null) { for (File potential : all) { String file = potential.getName(); if (file.endsWith(".strings") && !file.endsWith("InfoPlist.strings")) { res.add(potential); } } } } return res; } LanguageDictionary(String lprojName); }
LanguageDictionary { public static List<File> getL10NFiles(File aut) { List<File> res = new ArrayList<>(); File[] files = aut.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.getName().endsWith("lproj"); } }); for (File f : files) { File[] all = f.listFiles(); if (all != null) { for (File potential : all) { String file = potential.getName(); if (file.endsWith(".strings") && !file.endsWith("InfoPlist.strings")) { res.add(potential); } } } } return res; } LanguageDictionary(String lprojName); static LanguageDictionary createFromFile(File f); JSONObject readContentFromBinaryFile(File binaryFile); void addJSONContent(JSONObject content); static List<File> getL10NFiles(File aut); static String extractLanguageName(File f); ImmutableList<ContentResult> getPotentialMatches(String string); boolean match(String content, String originalText); static String getRegexPattern(String original); AppleLanguage getLanguage(); @Override int hashCode(); @Override boolean equals(Object obj); String translate(ContentResult res); String getContentForKey(String key); }
LanguageDictionary { public static List<File> getL10NFiles(File aut) { List<File> res = new ArrayList<>(); File[] files = aut.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.getName().endsWith("lproj"); } }); for (File f : files) { File[] all = f.listFiles(); if (all != null) { for (File potential : all) { String file = potential.getName(); if (file.endsWith(".strings") && !file.endsWith("InfoPlist.strings")) { res.add(potential); } } } } return res; } LanguageDictionary(String lprojName); static LanguageDictionary createFromFile(File f); JSONObject readContentFromBinaryFile(File binaryFile); void addJSONContent(JSONObject content); static List<File> getL10NFiles(File aut); static String extractLanguageName(File f); ImmutableList<ContentResult> getPotentialMatches(String string); boolean match(String content, String originalText); static String getRegexPattern(String original); AppleLanguage getLanguage(); @Override int hashCode(); @Override boolean equals(Object obj); String translate(ContentResult res); String getContentForKey(String key); static final Form form; static final Pattern specifierPattern; }