xbmc.getLanguage(..)
#1
Hi,

I tried to get the language for one of my addons so I can provide the API behind it with the correct language ID (based on RFC 3066). My settings are 'English (US)' and region is 'Central Europe' !?! WTF Smile
This will return 'en-DE' ..sorry, but this is none-sense. I'm dealing with RFC 3066 for more than 6 years now (I'm the developer of a Translation/Localization software of a german company for different formats and we translate in more than 40 languages).

RFC 3066 allows you a permutation of a language ID (ISO 639-1 and 2) plus a country ID (ISO 3166) + plus sub-tags. This allows a user to define the language + the dialect and worked for more than 15 years now.

So I tested a little bit and here are some other examples that won't end up correctly or are very confusing.

nl-BE is very common...but I can't select this kind of language...also Chines Simplified is zh-CHS and Traditional is zh-CHT (this is very special, but we have to deal with this every day).

Than I can select:
English => en-UK
English (US) => en-US
English (Australia) => en-AU
English (New Zealand) => en-NZ

but afterwards I can change the region?! In this case I can change 12h or 24h which has nothing to do with the region. If I select German as my language I can select a region, like Germany and so...that is correct. Here's something not right.
Don't get me wrong...that is not a huge problem...but this makes it very complicated to get the correct language ID especially if you want to use the current user settings for an addon. In my case the provider will return localized results if I could provide a correct language ID.

If I'm finished with the addon so far I would/could review the code in Kodi and maybe be at help to resolve this or maybe I'm getting something really wrong here, but on my end it doesn't fit with my experience. Maybe someone can enlighten me in this case?
Reply
#2
if i set my language to 'English (US)' and the region to 'Central Europe', i get the following results:

xbmc.getLanguage(): English (US)
xbmc.getLanguage(xbmc.ISO_639_1): en
xbmc.getLanguage(xbmc.ISO_639_2): eng

so what python code are you using exactly that will return 'en-DE' ?
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
I use

xbmc.getLanguage(xbmc.ISO_639_1, True)

This works since Gotham. This will append the region (see link). But central 'Central Europe' isn't a registered ISO 3166 country/region code and will return in my case (and some other non german users) 'DE' which is wrong. The effect on the addon is, that they get results which are for germany, but they are in the Netherlands (which would be en-NL and yes, this is valid based on RFC 3066).
Reply
#4
ok, here's where the issue comes from:
https://github.com/xbmc/xbmc/blob/master...o.xml#L122

i have to agree, the entire 'central europe' entry makes little sense to me.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
(2014-11-30, 22:28)ronie Wrote: ok, here's where the issue comes from:
https://github.com/xbmc/xbmc/blob/master...o.xml#L122

i have to agree, the entire 'central europe' entry makes little sense to me.

Okay...I see the problem Smile So the easiest fix would be to change 'Central Europe' to 'Germany' ? Which would also effect ('English (US)') This would at least respect the ISO 3166 for country codes Smile But this would also mean to add the other countries like the Netherlands (our neighbors which speak English very well Smile )

This has nothing to do with the initial problem of mine but I wan't to point out the discrepancy which I see in 'xbmc/language'. Please don't get me wrong, I don't want to point fingers and say this is all wrong or false what you are doing, because it's working somehow. But I provide an example where the current implementation for the language selection is some kind of failing.

The user can select 'English (US)' but after that the user can change the region to 'UK', 'Canada' even 'Australia' !?!? 'English (US)' should be (is!) by definition en-US. The language 'english' spoken in the 'US'. This is how RFC 3066 works.
Normally language IDs and country IDs haven't any kind of dependency, because the RFC 3066 allows a NxM (LanguageXCountry) permutation. The current implementation is 1xN permutation and that's where the discrepancy begins. All combinations of languages to countries are allowed (so we are dealing with it in our localization software).

Normally, if I see it correctly you can move the regions from 'English (New Zealand|Australia|US)' into 'English' to work with the current implementation and maybe optimize the language selection dialog. Just an idea.

Again, please don't get me wrong here....just a hint from my experience with language codes.

And as soon as I'm finished with the addon, I may checkout kodi and try to provide some kind of a patch or alternative solution. But first I could live and work with the replacement of 'Central Europe' Smile

And thanks for your time Smile
Reply
#6
Quote:So the easiest fix would be to change 'Central Europe' to 'Germany' ?
As non German i find that unacceptable Smile

I have my GUI set in English'(although i'm Dutch) and need to set it to Central Europe to get proper settings like Celsius and km/h and whatever. None of the alternatives makes any sense. This was the reason iirc Central Europe was added.

Montellese is working on some refactoring of these language settings which should make more sense.
https://github.com/xbmc/xbmc/pull/5561

Better work in that direction.
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
(2014-12-01, 12:03)Martijn Wrote:
Quote:So the easiest fix would be to change 'Central Europe' to 'Germany' ?
As non German i find that unacceptable Smile

I have my GUI set in English'(although i'm Dutch) and need to set it to Central Europe to get proper settings like Celsius and km/h and whatever. None of the alternatives makes any sense. This was the reason iirc Central Europe was added.

Montellese is working on some refactoring of these language settings which should make more sense.
https://github.com/xbmc/xbmc/pull/5561

Better work in that direction.

Yes...so you have to set 'English' in 'Netherlands' en-NL Wink RFC 3066 works for you. Is this a private/individual solution? It makes me a little sad, because there easy standards for that.

Again 'Central Europe' may work for you, but isn't working for me and some of the users testing the YouTube addon. 'Central Europe' isn't even an ISO 3166 code. It makes no sense (see also the example for English) Smile

So I have to fix this issue in the addon ? Smile
Reply
#8
No it's not a private/individual solution and we're not going to muck around by changing central europe to Germany.

If it's going to be change it needs to be changed the proper way. You can be sad about it but the program was never build around standards and now we are still facing the outfall from that. So for Helix it is how it is. For next version I suggest you work with Montellese to see how it can be handled properly. Split Language and regional settings. Once it's addonified we can push out updates for it whenever we want.
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
#9
(2014-12-01, 12:20)Martijn Wrote: No it's not a private/individual solution and we're not going to muck around by changing central europe to Germany.

If it's going to be change it needs to be changed the proper way. You can be sad about it but the program was never build around standards and now we are still facing the outfall from that. So for Helix it is how it is. For next version I suggest you work with Montellese to see how it can be handled properly. Split Language and regional settings. Once it's addonified we can push out updates for it whenever we want.

That's (finally) an answer Wink this sounds good and reasonable. I wouldn't even imagine to 'muck' this for Helix so close before the final release. This would be madness Smile

Thanks Martijn, I will contact Montellese to look into it.
Reply

Logout Mark Read Team Forum Stats Members Help
xbmc.getLanguage(..)0