Jump to content

Emby Translation


murxer83

Recommended Posts

murxer83

Hello I wanted to adapt my plugin to use the translation from the Emby server.
Is the language always used here, which is set in the Emby server?
I see how I can query the languages and how I then have to form the URL for the json.

/web/modules/common/strings/en-US.json?v=4.7.11.0


I wanted to let the individual users decide for themselves which language should be used.
What is the right way to query the default language?

Thanks

Link to comment
Share on other sites

Cheesegeezer
23 hours ago, murxer83 said:

Hello I wanted to adapt my plugin to use the translation from the Emby server.
Is the language always used here, which is set in the Emby server?
I see how I can query the languages and how I then have to form the URL for the json.

/web/modules/common/strings/en-US.json?v=4.7.11.0


I wanted to let the individual users decide for themselves which language should be used.
What is the right way to query the default language?

Thanks

2 ways to interrogate this.  

  1. is per user basis.  you can get the user Config by using the following api call
http://localhost:8096/emby/Users/{USERID}?api_key={AUTHToken}

In the configuration section of the returned Json you will get the AudioLanguagePreference that you can use

"Configuration": {
    "AudioLanguagePreference": "en",
    "PlayDefaultAudioTrack": true,
    "SubtitleLanguagePreference": "",
    "DisplayMissingEpisodes": false,
    "SubtitleMode": "Default",
    "EnableLocalPassword": true,
    "OrderedViews": [
      "21b2dac8e2e09d3f15b0dd69ae72792b",
      "4ff5fdc9ac2e53dad01716d3f5c53dad",
      "f137a2dd21bbc1b99aa5c0f6bf02a805",
      "e957f9042f99d8b3c9c0f7f4d81898b8",
      "28b5d5b8bef4bd1f1914503b5c11ac91"

Alternatively you can interrogate the Server Settings (configuration) which is really what the localized strings are used for 

http://localhost:8096/emby/System/Configuration?api_key={AuthToken}

and it will return the metadata language and CountryCode in amongst the Json

{
  "EnableUPnP": true,
  "PublicPort": 8096,
  "PublicHttpsPort": 8920,
  "HttpServerPortNumber": 8096,
  "HttpsPortNumber": 8920,
  "EnableHttps": false,
  "IsPortAuthorized": true,
  "AutoRunWebApp": false,
  "EnableRemoteAccess": true,
  "LogAllQueryTimes": false,
  "EnableCaseSensitiveItemIds": true,
  "MetadataPath": "",
  "MetadataNetworkPath": "",
  "PreferredMetadataLanguage": "en",
  "MetadataCountryCode": "GB",

So it's up to you which one to go for.

Hope that helps

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
murxer83

Hello, I have already added the possibility to select a language in the plugin. 
The plugin user can then decide for himself which language should be used.

image.thumb.png.d14b491dba7b3d92c394d9b56d09de3b.png

But it will take some time until this version goes online, more features will be added.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...