@Test public void extractNames() { File en = new File( "/Users/abc/build/intlMountains/Applications/InternationalMountains.app/en.lproj/Localizable.strings"); File fr = new File( "/Users/abc/build/intlMountains/Applications/InternationalMountains.app/fr.lproj/Localizable.strings"); File zh = new File( "/Users/abc/build/intlMountains/Applications/InternationalMountains.app/zh-Hant.lproj/Localizable.strings"); File french = new File( "/Users/abc/build/intlMountains/Applications/InternationalMountains.app/French.lproj/Localizable.strings"); String enStr = LanguageDictionary.extractLanguageName(en); String frStr = LanguageDictionary.extractLanguageName(fr); String zhStr = LanguageDictionary.extractLanguageName(zh); String frenchStr = LanguageDictionary.extractLanguageName(french); Assert.assertEquals(enStr, "en"); Assert.assertEquals(frStr, "fr"); Assert.assertEquals(zhStr, "zh-Hant"); Assert.assertEquals(frenchStr, "French"); }
public static String extractLanguageName(File f) { String parent = f.getParentFile().getName(); return parent.replaceFirst(".lproj", ""); }
LanguageDictionary { public static String extractLanguageName(File f) { String parent = f.getParentFile().getName(); return parent.replaceFirst(".lproj", ""); } }
LanguageDictionary { public static String extractLanguageName(File f) { String parent = f.getParentFile().getName(); return parent.replaceFirst(".lproj", ""); } LanguageDictionary(String lprojName); }
LanguageDictionary { public static String extractLanguageName(File f) { String parent = f.getParentFile().getName(); return parent.replaceFirst(".lproj", ""); } 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 String extractLanguageName(File f) { String parent = f.getParentFile().getName(); return parent.replaceFirst(".lproj", ""); } 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; }