Kodi Community Forum
Solved Formating menu text - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+---- Forum: Python 3 migration (https://forum.kodi.tv/forumdisplay.php?fid=281)
+---- Thread: Solved Formating menu text (/showthread.php?tid=364235)



Formating menu text - burekas - 2021-08-29

Hi,

I need some help with formating text.

In my old addon it was written like this:
json:
AddDir("[COLOR yellow][b]{0}[/b][/COLOR]".format(getLocaleString(30001)), "newList" , 20, os.path.join(iconsDir, "NewList.ico"), isFolder=False)

The color is good but the problem is with the bold tags, it shows it like this:
How can I fix this? in Kodi 17.6 it was ok.
Thanks.
Image


RE: Formating menu text - burekas - 2021-08-29

I found the problem, it was because the encoding issue in the getLocaleString function

Code:
def getLocaleString(id):
    return Addon.getLocalizedString(id).encode('utf-8')

After remove the .encode('utf-8'), it's ok now

Code:
def getLocaleString(id):
    return Addon.getLocalizedString(id)