Localization question

I'm trying to understand how localization works on channels to be able to translate some channels and to be able to code channels with proper localization.

 

I understand that when I need to output a string that I want to make translatable I must use the L function in the code. I understand that in the Strings folder there are json files for each language being en.json the default one.

 

All looks great. But now I go into Strings folder in youtube channel code and I copy the en.json file to create my language json file with the translations. I exit Plex Media Server and run it again. I go into youtube channel and all text is still in english.

 

So I don't know what is happening. If it is the channel that needs code to set the locale, why I can't see any channel that has that code? Most, if not all, channels use L function and has the Strings folder but no code to set locale. Then I can only imply that is not the channel code who has to set the locale. Besides looking the API I don't see any function to set locale.

 

Then it must be the Plex Media Server the one that sets locale. But if I look into channel log I can see it sets locale to default en-US though I'm not from USA. Plex web has an option to set the language but the channels are all in english.

 

So, what am I missing? Where does Windows Plex Media Server gets its locale setting from?

That is a good question...

It used to be that PMS would auto-detect your location and select locale/language based on the that. The default was usually US-English. There have been issues with the auto-detection in the past and manually selecting region in the Channel Directory settings was necessary for a number of users to see the proper selection of channels in the store. I thought that the Channel Directory localization code was also responsible for language-localization in channels. However, in my quick tests, that does not seem to be the case. I'll have to see if I can track down an answer on this. It's possible that you've identified a bug or perhaps things have changed and I just don't know the new method.

You're right that creating an appropriately named .json file in the "Strings" directory of the plugin is the correct path to localizing the channel. As long as the JSON is properly formatted and there are localized strings for all the L("")-enclosed strings in the channel, then it should work assuming that the channel knows what language you want to use.

Apparently, the locale setting for channels is not handled by the Media Server but rather by the individual client. In theory that allows multiple clients connecting to the same PMS to have different localization. Setting the language for your client should cause the plugin to use the appropriate localized strings.

Apparently, the locale setting for channels is not handled by the Media Server but rather by the individual client. In theory that allows multiple clients connecting to the same PMS to have different localization. Setting the language for your client should cause the plugin to use the appropriate localized strings.

Strange because if I review the channels log the locale (default en-US) is set on server start (nothing to do with clients) and on clients requests -which I suppose would be the only way the clients could send the locale to the server- I can't see anything about locale on logs. But maybe is something that is not logged.

So to investigate more and if it is so, can you point out for example where is that code on Plex Web client that sets locale on requests to server? I would like to investigate further.

I have Plex Web configured on a different language than en-US and everything is in my language on Plex Web client except channel that are all of them in english even when I make translations to my language.

The same happens with Plex Home Theater. I have it correctly configured in my language and it shows everything in my language except channels.

So if is the clients that has to set the locale, those two clients aren't doing it. And the 3rd client I use has not even a language setting if I recall correctly.

So this looks very very strange for me.

Strange because if I review the channels log the locale (default en-US) is set on server start (nothing to do with clients) and on clients requests -which I suppose would be the only way the clients could send the locale to the server- I can't see anything about locale on logs. But maybe is something that is not logged.

My bad, that's not true, the locale is set when the client starts the channel.

This is a log from a channel started from Plex Web client:

2014-05-28 23:25:27,052 (83c) :  DEBUG (core:437) - Starting localization component.
2014-05-28 23:25:27,052 (83c) :  INFO (localization:408) - Setting the default locale to en-us

My Plex Web client is configured in different language than en-us but anyway when I start the channel locale is set to en-us.

You have officially identified a bug which affects multiple apps in the Plex ecosystem :o . Thanks for the heads-up and tracking it down. I've notified the Plex team and the necessary changes should start showing up in new builds as time goes on. As usual with Plex development, there is no ETA for a release date on any of the fixes.

This is an old thread, and I don't know if this was the issue manfer was seeing

..but the symptoms sound exactly like a problem I found the solution for recently, so I thought I'd log it for others to use .

My symptoms were as described above: the channel would keep ignoring my translations and language settings.

What eventually turned out to be wrong in my case was that I wrote my localization like this:

TITLE = L("My channel title")

def MainMenu():
dir=ObjectContainer(title1 = TITLE)

return dir

This causes the L() macro to be evaluated at channel load, which is happening in a system context (=> default locale en-us used)

Instead, I rewrote as follows:

def MainMenu():
    TITLE = L("My channel title")
    dir=ObjectContainer(title1 = TITLE)
    ...
    return dir 

This now works as expected (at least my iPad gives me localized texts).

Why? Because now the L() macro now is evaluated in the context of a user request (=> the users locale is used)

Hope this helps others!

This is an old thread, and I don't know if this was the issue manfer was seeing
 
..but the symptoms sound exactly like a problem I found the solution for recently, so I thought I'd log it for others to use .
 
 
My symptoms were as described above: the channel would keep ignoring my translations and language settings.
 
What eventually turned out to be wrong in my case was that I wrote my localization like this:

TITLE = L("My channel title")def MainMenu():    dir=ObjectContainer(title1 = TITLE)    ...    return dir
This causes the L() macro to be evaluated at channel load, which is happening in a system context (=> default locale en-us used)
 
Instead, I rewrote as follows:
def MainMenu():    TITLE = L("My channel title")    dir=ObjectContainer(title1 = TITLE)    ...    return dir 
This now works as expected (at least my iPad gives me localized texts).
 
Why? Because now the L() macro now is evaluated in the context of a user request (=> the users locale is used)
 
Hope this helps others!
Not the problem in my case. Still not localization working for me.

The only clients I have used are Plex Web, Plex Home Theater and Plex for Samsung TV. None is able to show localized strings in channels. Always displaying en-us strings.

My Plex Server is installed in Windows OS.

It would be very useful if you can try in your working environtment if Plex Web Client (which is installed with the Plex Server itself) shows translations too or if it is only your iPad Plex client the one that can show correct translations.

It is possible that the problem is just on Windows and any *NIX system (or maybe just the Server installed in a *NIX system) can show proper localization.

Thanks

From what I've figured out a while back, PMS detects the language from the X-Plex-Language header. Plex Home Theater for Windows (the client I use) does send this field, although in a way I didn't expect.

I've just checked my channel with Plex Web using browser dev tools, it seems to use ordinary XHRs to navigate the channels and turns out it didn't send the above header. But it did send the standard Accept-Language header with the correct value.

Looks like Plex Framework could use some refinement in its localization logic.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.