How to get ISO-639 language code from XBMC
#1
There must be a way to get the ISO-639-1 2-letter language code for the XBMC language? The best API I have found is xbmc.getLanguage() which returns something like "English".
Reply
#2
i could make a script.module.language and put it in repo.
that way everyone could use that and saves them hacking around in each individual script themselves.
preferred would be and optional in the xbmc.getLanguage() where you define what type you want to retrieve.
0: full language
1: two letter code
2: three letter code
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#3
@Martijn:
If you want to develop such an add-on, feel free to copy some code from my iTunes Podcast Add-on.

But, personally I would prefer a core solution.
My GitHub. My Add-ons:
Image
Reply
#4
(2013-04-22, 09:52)sphere Wrote: @Martijn:
If you want to develop such an add-on, feel free to copy some code from my iTunes Podcast Add-on.

But, personally I would prefer a core solution.

i'd prefer a core solution to but for the time being.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#5
(2013-04-22, 09:54)Martijn Wrote: i'd prefer a core solution to but for the time being.

I could try it if no one else is working on that.
Reply
#6
(2013-04-22, 12:00)ace20022 Wrote:
(2013-04-22, 09:54)Martijn Wrote: i'd prefer a core solution to but for the time being.

I could try it if no one else is working on that.

yes please Smile
core also has these language codes internally so just need to bee hooked up.

however we will probably still require some 3rd party converter as you may also scrape the ISO codes from a site and want to display them as normal language string.
imo that shouldn't be of any core concern.
So if we could at least have the xbmc.getlanguage() to return one of those 3 options it would be great.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#7
(2013-04-22, 09:00)Martijn Wrote: preferred would be and optional in the xbmc.getLanguage() where you define what type you want to retrieve.
0: full language
1: two letter code
2: three letter code

This sounds great!
Would we get access to regionalized variants, e.g. pt-br, en-gb? I don't know if XBMC regionalizes at that granularity, but TED subtitles do (at least for pt-br Wink ).
Reply
#8
(2013-04-22, 12:37)Martijn Wrote: yes please Smile
core also has these language codes internally so just need to bee hooked up.

Done Wink

(2013-04-22, 13:39)moreginger Wrote: This sounds great!
Would we get access to regionalized variants, e.g. pt-br, en-gb? I don't know if XBMC regionalizes at that granularity, but TED subtitles do (at least for pt-br Wink ).

Is this really reasonable? Do you have a use case? If so I will dig a bit deeper.
Reply
#9
(2013-04-22, 14:13)ace20022 Wrote:
(2013-04-22, 13:39)moreginger Wrote: This sounds great!
Would we get access to regionalized variants, e.g. pt-br, en-gb? I don't know if XBMC regionalizes at that granularity, but TED subtitles do (at least for pt-br Wink ).

Is this really reasonable? Do you have a use case? If so I will dig a bit deeper.
If they aren't available then the following happens:

* Brazilian user selects XBMC language: Portuguese (Brazil) - assuming this is or will be possible.
* xbmc.getLanguage(...) returns 'pt'.
* Subtitles fetched in 'ordinary' Portuguese not 'pt-br'.

It's not exactly apocalyptic stuff (maybe Brazilians disagree Big Grin) but it would be nice.
Reply
#10
(2013-04-22, 09:52)sphere Wrote: @Martijn:
If you want to develop such an add-on, feel free to copy some code from my iTunes Podcast Add-on.

But, personally I would prefer a core solution.

Maybe an idea to just put it in xbmcswift?
At least for Frodo.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#11
Yes, when it gets merged and the API is stable me (or Jbel) will pre-port it into xbmcswift2 to have a seamless migration to Gotham later.
My GitHub. My Add-ons:
Image
Reply
#12
I mean instead of creating a separate module for it now already put it in swift. So for now let the module handle the converting of he code by putting the ISO table in it.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#13
Yes, that's also what I meant, it will be available in xbmcswift2 soon (before xbmc Gotham) - but to have a similar interface like the later available native solution I need to see it first Wink

Assumptive jbel doesn't say no Wink

EDIT: xbmcswift Issue
My GitHub. My Add-ons:
Image
Reply
#14
For testing
https://github.com/xbmc/xbmc/pull/2643


Since that only handles the xbmc.getLanguage we should as an extra also be able to convert two to three letter code and vice versa and also back to complete language string. That would still be a job of a module I guess
Like convert_language() with the option to define what you want to get back.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#15
(2013-04-22, 21:31)Martijn Wrote: For testing
https://github.com/xbmc/xbmc/pull/2643


Since that only handles the xbmc.getLanguage we should as an extra also be able to convert two to three letter code and vice versa and also back to complete language string. That would still be a job of a module I guess
Like convert_language() with the option to define what you want to get back.

I can add a conversion method to the core tomorrow if you like. I have that in mind since my language unification pr got merged. Since that point audio and sub languages get returned as 3char code.

(2013-04-22, 14:27)moreginger Wrote:
(2013-04-22, 14:13)ace20022 Wrote:
(2013-04-22, 13:39)moreginger Wrote: This sounds great!
Would we get access to regionalized variants, e.g. pt-br, en-gb? I don't know if XBMC regionalizes at that granularity, but TED subtitles do (at least for pt-br Wink ).

Is this really reasonable? Do you have a use case? If so I will dig a bit deeper.
If they aren't available then the following happens:

* Brazilian user selects XBMC language: Portuguese (Brazil) - assuming this is or will be possible.
* xbmc.getLanguage(...) returns 'pt'.
* Subtitles fetched in 'ordinary' Portuguese not 'pt-br'.

It's not exactly apocalyptic stuff (maybe Brazilians disagree Big Grin) but it would be nice.
Had a brief look, should be possible. @Martijn Shall I add a second bool param with default value false?
Reply

Logout Mark Read Team Forum Stats Members Help
How to get ISO-639 language code from XBMC0