pannal / Sub-Zero.bundle

Subtitles for Plex, as good you would expect them to be.
Other
1.76k stars 120 forks source link

Get the full country name/ ISO language name in the filename #459

Open barneh opened 6 years ago

barneh commented 6 years ago

Hi, Great work with the plugin! Is it possible to get an option to save the subtitle as ISO language name?

So what I mean is that instead of saving it as mediaFileName.en.srt, this option would save the file as mediaFileName.English.srt

pannal commented 6 years ago

Why would you want to do that? Using the 2-letter iso code is pretty standard.

pannal commented 6 years ago

Please answer, otherwise I'll close this soon :)

barneh commented 6 years ago

Hi, Sorry for late answer. Well I have the same argument as you... for me the ISO language is pretty standard for me. So I guess it coming down to what we think suits us best.

On the other hand I have look a little bit into the code, and have taken some notes for a Pull Request for this setting/ option request. The only thing is that I haven't found the exact location where the 2-letter ISO is "created". But from the little I have looked around in the code, I think it looks like a quite small change request!?!

pannal commented 6 years ago

The changes required wouldn't be too small, especially for the detection of existing subtitles - the saving isn't hard to change.

Another problem is, though, that SZ also has to handle stuff like pt-BR and sr-Latn (languages with country or script modifiers), which would be hard incorporate into the filename.

barneh commented 6 years ago

The changes required wouldn't be too small, especially for the detection of existing subtitles

Okay. You know the plugin better that I do, but could it just do a rename if an existing sub if detected?

Another problem is, though, that SZ also has to handle stuff like pt-BR and sr-Latn (languages with country or script modifiers), which would be hard incorporate into the filename.

Can you please fill me in here or give me an reference to an article about the problem? How is it done today?

pannal commented 6 years ago

Can you please fill me in here or give me an reference to an article about the problem? How is it done today?

The full IETF code is used, with the first part being the 2 letter ISO code (e.g. pt) and the second part after the dash is the modifier (script or country/flavor, e.g. cyrl or BR).

So we're looking at Videoname.Blah.sr-Latn.srt or Videoname.Bleh.pt-BR.srt.

It would be possible to substitute the 2-letter part for the english ISO language name, even with the modifiers in place.

barneh commented 6 years ago

Hi, I have taken some time to wonder about this, and I think the best way is to solve it as you write, change the 2-letter ISO to the English ISO language.

So the naming of the sub will become mediaFileName.Suriname-Latn.srt or mediaFileName.Portuguese-BR.srt

This means that the main language will be stated with a ISO language name (can I call it the main?)

What is the providers API giving back when it comes to ISO language? Is it the 2-letter or the ISO language?

pannal commented 6 years ago

The languages returned by the providers are automatically converted into a generic babelfish language object, that can be represented in any way one wants.

I can definitely do fullisoname-modifiers instead of iso2-modifiers. Not the highest priority, as we're currently in hotfixing mode, but it'll come soon.