2013-04-22, 23:58
I think the doxygen could use a reference to ISO-639 language code instead of 2 and 3 char tekst.
(2013-04-22, 23:13)ace20022 Wrote:sure.(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, 23:13)ace20022 Wrote:(2013-04-22, 14:27)moreginger Wrote:Had a brief look, should be possible. @Martijn Shall I add a second bool param with default value false?(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 ) but it would be nice.
(2013-04-24, 11:51)Martijn Wrote: sure.Done
something like xbmc.convertLanguage(foo, format)
put in anything (foo) and get the the requested format back (same options as getLanguage).
(2013-04-24, 11:51)Martijn Wrote: not sure i follow what you mean here
/**
* 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)
*/
getLanguage(1, True)
'pt-br'