Problem with first attempt of localization
#1
I create in resources\language two folder, "English" and "Italian"
In both, I created strings.xml file

This is english file
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
    <string id="30001">Go to page</string>
    <string id="30002">Language</string>
    <string id="30003">Italian</string>
    <string id="30004">English</string>
    <string id="30005">General</string>
</strings>


The plugin code include this:
Code:
pluginPid    = int(sys.argv[1])
language     = xbmcplugin.getSetting(pluginPid, "language")
if language == "":
    language = "English"

Now ... I see the API doc
Code:
getLocalizedString(...)
    getLocalizedString(id) -- Returns an addon's localized 'unicode string'.
    
    id             : integer - id# for string you want to localize.
    
    *Note, You can use the above as keywords for arguments.
    
    example:
      - locstr = self.Addon.getLocalizedString(id=6)

I understand that I can get a localized string in this way

Code:
string = plugin.getLocalizedString(30001)

BUT ... how / where can I set the current language ?
I'm missing somethings like

Code:
plugin.setLocale("English")

---
Reply
#2
The language is probably inherited from XBMC's locale maybe?
Reply
#3
You can't read the current language from the add-on settings* - and there is also no need for: If you use getLocalizedString() you will get the string from the current XBMC language (with fallback to english).

* = Of course you can read whatever settings you define, but your add-on settings won't have any effect on the strings which getLocalizedString() will return. I would suggest removing language specific settings from the add-on.
My GitHub. My Add-ons:
Image
Reply

Logout Mark Read Team Forum Stats Members Help
Problem with first attempt of localization0