Kodi Community Forum
Important addon devs: language file formatting (and more...) - 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)
--- Thread: Important addon devs: language file formatting (and more...) (/showthread.php?tid=332789)



addon devs: language file formatting (and more...) - ronie - 2018-06-13

over the years, several language format related changes have been made in kodi.
but since none of those changes were mandatory, many addons haven't been adjusted to them.

we'd like to ask you to make those changes to your addon as well, so we can phase out the old formats in the future.
to aid you in converting some bits and to pieces to the new format, there's an addon available that will get the job done for you:
script.language-convert-0.0.5.zip (python 2)
script.language-convert-0.1.3.zip (python 3)


this addon will make the following changes:

- in your addon.xml it will update all 'lang' attributes
example: <description lang="en"> to <description lang="en_GB">

- if you are using strings.xml language files, they will be converted to strings.po files

- language folder names will be converted to the current format *
example: English to resource.language.en_gb


PLEASE MAKE A BACKUP OF YOUR ADDON BEFORE RUNNING THIS SCRIPT!


* some addons include languages which are not supported by kodi, those language files will be removed by the addon


RE: addon devs: language file formatting (and more...) - User 325245 - 2018-06-15

Now all my addons don't display any text? kodi 17.6


RE: addon devs: language file formatting (and more...) - User 325245 - 2018-06-15

OK I think I found the reason - it generated lines like

msgctxt "

and it should be

msgctxt "#

D.


RE: addon devs: language file formatting (and more...) - ronie - 2018-06-15

thanx for the heads-up!
fixed in v0.0.2


RE: addon devs: language file formatting (and more...) - scott967 - 2018-06-16

In the gettext po file header, should the "language" entry conform to the ll_CC format?  It seems like just the two-letter ll is accepted.

scott s.
.


RE: addon devs: language file formatting (and more...) - ronie - 2018-06-16

(2018-06-16, 01:28)scott967 Wrote: In the gettext po file header, should the "language" entry conform to the ll_CC format?  It seems like just the two-letter ll is accepted.

scott s.
.
 both should work afaik...

the Estuary skin uses ll_CC for instance: https://github.com/xbmc/xbmc/blob/master/addons/skin.estuary/language/resource.language.be_by/strings.po#L16


RE: addon devs: language file formatting (and more...) - pkscout - 2018-07-16

What's the oldest version of Kodi that supports the newer language file format?  I'm just trying to figure out to which of the repo-script branches I need to submit updates and what minimum version of xbmc.addon I should list in the dependencies.  I did some Google searching, and I *think* the new format works as far back as Frodo, but I want to make sure.


RE: addon devs: language file formatting (and more...) - vl_maksime - 2018-07-16

New format supported since 15.x


RE: addon devs: language file formatting (and more...) - thent - 2019-06-15

Hey,
this doesn't seem to work with the Keymap Editor Addon which gives me an error on running:
Quote:2019-06-14 20:41:09.783 T:1086993280 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.TypeError'>
Error Contents: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/storage/.kodi/addons/script.language-convert/default.py", line 160, in <module>
Main()
File "/storage/.kodi/addons/script.language-convert/default.py", line 32, in __init__
self.updateFiles(langpath, folders, name, addonid, author)
File "/storage/.kodi/addons/script.language-convert/default.py", line 118, in updateFiles
text = parse.unescape(string.text)
File "/usr/lib/python2.7/HTMLParser.py", line 448, in unescape
TypeError: argument of type 'NoneType' is not iterable
-->End of Python script error report<--
Any ideas?
Thanks


RE: addon devs: language file formatting (and more...) - ronie - 2019-06-15

thanx for the report!
should be fixed in this version: script.language-convert-0.0.4.zip


RE: addon devs: language file formatting (and more...) - trogggy - 2019-06-15

(2019-06-15, 12:48)thent Wrote: Hey,
this doesn't seem to work with the Keymap Editor Addon which gives me an error on running:
Any ideas?
Thanks 
I had a similar error trying to change one of my own addons.  Turned out to be down to me having an empty string which throws an error.
The offending line here is:
'<string id="30001"></string>'
in addons/script.keymap/resources/language/English/strings.xml
Change that to:
'<string id="30001"> </string>'
and the conversion will run.
Whether that affects the addon I've no idea (though I'd be surprised).
I guess this is a bug, but maybe there's good reason for the behaviour.

edit: already fixed, never mind.


RE: addon devs: language file formatting (and more...) - thent - 2019-06-15

(2019-06-15, 13:04)ronie Wrote: thanx for the report!
should be fixed in this version: script.language-convert-0.0.4.zip

Works perfectly, thanks for your quick reply!


This forum uses Lukasz Tkacz MyBB addons.