Kodi Community Forum

Full Version: Converting strings.xml to strings.po
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm converting my MCERemote addon to work with Python 3 but I've run into  problem with the strings. I've converted the code and used Ronie's script to convert the settings.xml and the addon works. But in the settings it isn't loading the strings. It should look like:

ImageImageImagehttp://swarchive.ratsauce.co.uk/XBMC/working.png

But instead it looks like:

http://swarchive.ratsauce.co.uk/XBMC/notworking.png

Everywhere there is a label="30109" (random number) the string doesn't load. I'm guessing the new settings format requires the strings to be in strings.po. Is there an easy way to convert my strings.xml to strings.po or do I have to just fire up my text editor and get down to it?
Ignore me!

A few regular expressions later and my string.po is all working :-)
had to apply the following patch:
--- default.py.orig    2022-04-29 23:50:06.665047205 +0200
+++ default.py    2022-04-29 23:55:14.703851407 +0200
@@ -4,6 +4,7 @@
 import codecs
 import xml.etree.ElementTree as etree
 from html.parser import HTMLParser
+import html
 import xbmcgui
 import xbmcaddon
 from kodilanguages import *
@@ -117,7 +118,7 @@
                 if not string.text:
                     continue
                 sid = string.get("id")
-                text = parse.unescape(string.text)
+                text = html.unescape(string.text)
                 engDict[sid] = text
             locale = LANGUAGE_NAMES["English"]
             plural = PLURAL_HEADERS["English"]
@@ -136,7 +137,7 @@
                     strDict = {}
                     for string in strings:
                         sid = string.get("id")
-                        text = parse.unescape(string.text)
+                        text = html.unescape(string.text)
                         strDict[sid] = text
                     locale = LANGUAGE_NAMES[folder]
                     plural = PLURAL_HEADERS[folder]