vankasteelj / opensubtitles-uploader

Desktop app to upload subtitles to OpenSubtitles, using Node.JS and NWjs
http://vankasteelj.github.io/opensubtitles-uploader/index.html
GNU General Public License v3.0
86 stars 35 forks source link

Language detect #95

Closed afigamli closed 1 year ago

afigamli commented 2 years ago

Hi. I want to point out a bug in language auto-detect. It seems to me that you only use iso639-1 to detect the language. In Iceland (where I live) we use the .srt ending .ice.srt because some application seems to only uses iso639-2. 639-1 uses "is" but 639-2 uses "ice" or "isl" for Iceland. Both versions seem to be available in the autodetect language (node_modules\detect-lang\iso-639.json) However, the module trims out the first two letters in the code and only uses 639-1 which is "is" So if I use the ending .ice.srt it does not find the language but if I change it to .isl.srt it does.

In the Wikipedia site: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes you can find out what happens if you try two endings who is listed there ".arm.srt" and ".hye.srt" which is the two 639-2 code for the Armenian language. But if you use ".arm.srt" it returns the result Arabic which has the 639-1 code "ar"

Java is not my primary programming language so I was not able to find out for myself.

Br afigamli

vankasteelj commented 2 years ago

Thanks I'll check that out when I get time