diff --git a/source/net/filebot/Language.java b/source/net/filebot/Language.java index 88af4637..86bf0897 100644 --- a/source/net/filebot/Language.java +++ b/source/net/filebot/Language.java @@ -23,13 +23,13 @@ public class Language implements Serializable { private final String iso_639_2B; // Language name - private final String name; + private final String[] names; - public Language(String iso_639_1, String iso_639_3, String iso_639_2B, String name) { + public Language(String iso_639_1, String iso_639_3, String iso_639_2B, String[] names) { this.iso_639_1 = iso_639_1; this.iso_639_3 = iso_639_3; this.iso_639_2B = iso_639_2B; - this.name = name; + this.names = names.clone(); } public String getCode() { @@ -49,7 +49,11 @@ public class Language implements Serializable { } public String getName() { - return name; + return names[0]; + } + + public List getNames() { + return unmodifiableList(asList(names)); } @Override @@ -62,19 +66,27 @@ public class Language implements Serializable { } public boolean matches(String code) { - return iso_639_1.equalsIgnoreCase(code) || iso_639_3.equalsIgnoreCase(code) || iso_639_2B.equalsIgnoreCase(code) || name.equalsIgnoreCase(code) || code.toLowerCase().contains(name.toLowerCase()); + if (iso_639_1.equalsIgnoreCase(code) || iso_639_3.equalsIgnoreCase(code) || iso_639_2B.equalsIgnoreCase(code)) { + return true; + } + for (String it : names) { + if (it.equalsIgnoreCase(code) || code.toLowerCase().contains(it.toLowerCase())) { + return true; + } + } + return false; } @Override public Language clone() { - return new Language(iso_639_1, iso_639_3, iso_639_2B, name); + return new Language(iso_639_1, iso_639_3, iso_639_2B, names); } public static final Comparator ALPHABETIC_ORDER = new Comparator() { @Override public int compare(Language o1, Language o2) { - return o1.name.compareToIgnoreCase(o2.name); + return o1.getName().compareToIgnoreCase(o2.getName()); } }; @@ -83,7 +95,7 @@ public class Language implements Serializable { try { String[] values = bundle.getString(code).split("\\t", 3); - return new Language(code, values[0], values[1], values[2]); + return new Language(code, values[0], values[1], values[2].split("\\t")); } catch (Exception e) { return null; } diff --git a/source/net/filebot/Language.properties b/source/net/filebot/Language.properties index bc3321bf..cfea5858 100644 --- a/source/net/filebot/Language.properties +++ b/source/net/filebot/Language.properties @@ -4,7 +4,7 @@ languages.common = en,de,fr,es,pt,ru,ja,zh sq: sqi alb Albanian ar: ara ara Arabic hy: hye arm Armenian -pb: pob pob Brazilian +pb: pob pob Brazilian Portuguese (BR) bg: bul bul Bulgarian ca: cat cat Catalan zh: zho chi Chinese diff --git a/source/net/filebot/ui/LanguageComboBoxModel.java b/source/net/filebot/ui/LanguageComboBoxModel.java index 58375d3c..940523b1 100644 --- a/source/net/filebot/ui/LanguageComboBoxModel.java +++ b/source/net/filebot/ui/LanguageComboBoxModel.java @@ -13,7 +13,7 @@ import net.filebot.Language; public class LanguageComboBoxModel extends AbstractListModel implements ComboBoxModel { - public static final Language ALL_LANGUAGES = new Language("undefined", "undefined", "undefined", "All Languages"); + public static final Language ALL_LANGUAGES = new Language("undefined", "undefined", "undefined", new String[] { "All Languages" }); private Language defaultLanguage; private Language selection;