plugin_pid = int(sys.argv)
language = xbmcplugin.getSetting(plugin_pid, "language")
# AUTODETECT LANGUAGE IF MISSING
# if not set, language will be read from system, where it uses english language name
# if it's one of supported language, I got localized name to adhere to addon language setting
# availables values ( Italiano, English, Polski, ... )
if language == "":
actual_locale = xbmc.getLanguage()
if actual_locale in locale_2_lang :
language = locale_2_lang[actual_locale]
language = "English"
print "JWORG: Auto setting locale to: " + language
xbmcplugin.setSetting(plugin_pid, "language", language)
After a first, fresh, clean, installation, in the addon_data dir there is no folder plugin.video.jworg, because no setting saved yet.
At every run, the plugin try to detect the locale choosen by the user. If there is no locale set, than for a small set of xmbc locale names I can match the plugin "stream content locale".
For example: if no locale set, if xmbc is set to "Italian" then I execute this to set to "Italiano",
xbmcplugin.setSetting(plugin_pid, "language", "Italiano")
This line of code is being executed, doesn't creeate any error in log file, but no addon_data .xml file is created. So when I open my addon config, I got for locale the first locale in list, and not the 'auto set' locale I've just set.
My setting.py row about locale
<setting id="language" type="labelenum" label="30002" values="Afrikaans|Deutsch|English|Español|Français|Ελληνική|Italiano|Magyar|Nederlands|Polski|Português" />
There is something else to do after call setSetting()?