How to get ISO-639 language code from XBMC
#16
I think the doxygen could use a reference to ISO-639 language code instead of 2 and 3 char tekst.
Reply
#17
(2013-04-22, 09:00)Martijn Wrote: 2: three letter code

ISO 639-2/T or ISO 639-2/B ?
Or maybe ISO 639-3?
Big Grin
Reply
#18
(2013-04-22, 23:13)ace20022 Wrote:
(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.

sure.
something like xbmc.convertLanguage(foo, format)
put in anything (foo) and get the the requested format back (same options as getLanguage).

(2013-04-22, 23:13)ace20022 Wrote:
(2013-04-22, 14:27)moreginger Wrote:
(2013-04-22, 14:13)ace20022 Wrote: 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?

not sure i follow what you mean here
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
#19
(2013-04-24, 11:51)Martijn Wrote: sure.
something like xbmc.convertLanguage(foo, format)
put in anything (foo) and get the the requested format back (same options as getLanguage).
Done Wink

(2013-04-24, 11:51)Martijn Wrote: not sure i follow what you mean here

I've added a commit to the pr that extends the getLanguage method to the following:
Code:
/**
* getLanguage([format], [region]) -- Returns the active language as a string.
*
* format: [opt] format of the returned language string
* 0: full language name in English (default)
* 1: two letter code as defined in ISO 639-1
* 2: three letter code as defined in ISO 639-2/T or ISO 639-2/B
*
* region: [opt] append "-region" to the returned language string
*
* example:
* - language = xbmc.getLanguage(0)
*/

With that moreginger's request can be handled: if xbmc's language is set to Portuguese (Brazil) and an addon calls, e.g.,
Code:
getLanguage(1, True)
, xbmc will return
Code:
'pt-br'
Reply
#20
Sorry for diggering out this old thread. Is there a chance to determine the charset with the xbmc.getlanguage property (or determine the charset othwerwise)? I need this for an email client within a script to set the right charset for mail transmission (i.e. ISO-8859-1 for correct transmission for german umlauts).

_BJ1
Reply

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