* force ISO3 letter-language code

This commit is contained in:
Reinhard Pointner 2012-02-15 06:16:32 +00:00
parent 5d5902cdfb
commit e654be95a5
2 changed files with 3 additions and 2 deletions

View File

@ -295,8 +295,8 @@ public class MediaBindingBean {
Locale languageSuffix = new ReleaseInfo().getLanguageSuffix(FileUtilities.getName(mediaFile)); Locale languageSuffix = new ReleaseInfo().getLanguageSuffix(FileUtilities.getName(mediaFile));
if (languageSuffix != null) if (languageSuffix != null)
return languageSuffix; return new Locale(languageSuffix.getISO3Language()); // force ISO3 letter-code
// require subtitle file // require subtitle file
if (!SUBTITLE_FILES.accept(mediaFile)) if (!SUBTITLE_FILES.accept(mediaFile))
return null; return null;

View File

@ -53,6 +53,7 @@ public class ReleaseInfo {
public Locale getLanguageSuffix(String name) { public Locale getLanguageSuffix(String name) {
// match locale identifier and lookup Locale object // match locale identifier and lookup Locale object
Map<String, Locale> languages = getLanguageMap(Locale.ENGLISH, Locale.getDefault()); Map<String, Locale> languages = getLanguageMap(Locale.ENGLISH, Locale.getDefault());
String lang = matchLast(getLanguageSuffixPattern(languages.keySet()), null, name); String lang = matchLast(getLanguageSuffixPattern(languages.keySet()), null, name);
if (lang == null) if (lang == null)
return null; return null;