1

I'm working on my python script as I would like to change the language using xml when pressing on the enter button of the keyboard.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <strings>
        <string id="32000">Hello UK</string>
    </strings>

    <control type="label">
        <description>My hello label</description>
        <posx>20</posx>
        <posy>20</posy>
        <width>180</width>
        <height>248</height>
        <align>middle</align>
        <font>font12</font>
        <textcolor>white</textcolor>
        <visible>true</visible>
        <label>$LOCALIZE[SCRIPT32000]</label>
    </control>

Here is the python:

import xbmc
import xbmcgui
import xbmcaddon

#get actioncodes from keyboard.xml
ACTION_ENTER = 7

class MyClass(xbmcgui.WindowXML):
  def onAction(self, action):
    if action == ACTION_ENTER:
      if image1_enabled:
         my_hello_string = ADDON.getLocalizedString(32000)

I have got a problem with my python script, because when I press on the enter button, there are no text display on the screen. There are no error on the xbmc logs. I want to add the label to get the strings that I stored in xml to display the strings on the skins. Not sure if I have missing something?

1 Answers1

0

If that is your complete code, it looks like you're not doing anything with the class. You might need to add to the end of your Python code something like:

if __name__ == '__main__':
    w = MyClass("myclass.xml")
    w.doModal()
Matthew Trevor
  • 14,354
  • 6
  • 37
  • 50
  • It don't work. I can't be able to load the myclass.xml, it will only work if i store the strings in strings.po. Do you have any idea how i can load the strings.xml? –  Jan 23 '14 at 20:05