Subtitle language extensions: ISO 639-1 vs ISO 639-2

All your suggestions, requests and ideas for future development
Post Reply
Faber
Posts: 1
Joined: 29 Jan 2013, 12:13

Subtitle language extensions: ISO 639-1 vs ISO 639-2

Post by Faber »

Hi,

Currently downloaded subtitles are automatically named <basename>.<ISO 639-2 language>.<ext>, i.e. "moviename.eng.srt".

My mediaplayers (Popcorn Hour A-100 and A-110) does not recognize the language in ISO 639-2 format, but require it in ISO 639-1 format, i.e. "moviename.en.srt".

It also looks like ISO 639-1 is the standard elsewhere (I haven't been able to find anything but FileBot that uses ISO 639-2).

Does anyone else require ISO 639-2?

It is a simple fix to output ISO 639-1 instead:

Code: Select all

Index: SubtitleUtilities.java
===================================================================
--- SubtitleUtilities.java	(revision 1432)
+++ SubtitleUtilities.java	(working copy)
@@ -206,7 +206,7 @@
 		StringBuilder sb = new StringBuilder(name);
 		
 		if (languageName != null) {
-			String lang = Language.getISO3LanguageCodeByName(languageName);
+			String lang = Language.getLanguageByName(languageName).getCode();
 			
 			if (lang == null) {
 				// we probably won't get here, but just in case

Cheers,
Faber.
User avatar
rednoah
The Source
Posts: 22972
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Subtitle language extensions: ISO 639-1 vs ISO 639-2

Post by rednoah »

The 3-letter standard is better and has less issues (eg hi = hebrew or hearing-impaired) than the 2-letter one. Most HTPC software shouldn't have any issues with that anyway.

You can always fix things via renaming and using {lang.language} or using the "Filename Find & Replace script to fix things.

e.g.

Code: Select all

filebot -script fn:replace --def "e=.eng.srt" "r=.en.srt" /path/to/files
:idea: Please read the FAQ and How to Request Help.
Post Reply