pannal / Sub-Zero.bundle

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

Translate Sub-Zero #458

Open morpheus133 opened 6 years ago

morpheus133 commented 6 years ago

Hi, Is it planned to make translatable? Usually people use subtitle because they Dont understand English...

Onyl 3 thing needed:

def Start():
    HTTP.CacheTime = 0
    HTTP.Headers['User-agent'] = OS_PLEX_USERAGENT

    loc = GetLanguage()

    if Core.storage.file_exists(Core.storage.abs_path(
        Core.storage.join_path(
            Core.bundle_path,
            'Contents',
            'Strings',
            '%s.json' % loc
        )
    )):
        Locale.DefaultLocale = loc
    else:
        Locale.DefaultLocale = 'en-us'
...

def GetLanguage():
    return str(locale.getdefaultlocale()[0]).split('_')[0]

I can help with the implementation if needed.

pannal commented 6 years ago

It's planned, yes, but there's an issue with translatable setting strings and Plex Web, which doesn't set the correct X-Plex-Language attribute when sending requests to plugins - at least last time I checked.

Once that issue is resolved, the translation implementation should be pretty straight forward, as everything already is implemented inside the PMS framework.

What do you need that specific locale setting for, exactly?

morpheus133 commented 6 years ago

What is this issue? I create one solution what seems to working: https://github.com/morpheus133/Sub-Zero.bundle/tree/translatesupporttest

I create two language: alpha and beta (Just add "alpha" and "beta" to each string ) And one new options where we can change the language. It seems working. (Maybe a better solution to use plex config language as deafult, but I dont find it in API where to get it.)

alpha: image

beta: image

pannal commented 6 years ago

Yeah I know that that's forcable. The issue is, that the language should be automatically changed depending on the user's Plex Web language setting.

There's an internal issue open for Plex Web, that it should pass the X-Plex-Language header.

pannal commented 6 years ago

We will be using POEditor.com for SZ's translation. Join here: http://v.ht/szi18n