Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot parse appdata ITS file #20

Open
muelli opened this issue Nov 14, 2017 · 1 comment
Open

Cannot parse appdata ITS file #20

muelli opened this issue Nov 14, 2017 · 1 comment

Comments

@muelli
Copy link

muelli commented Nov 14, 2017

This may well be a bug in the Appdata pages.
Currently, https://www.freedesktop.org/software/appstream/docs/sect-Quickstart-Translation.html states:

4.4.3. Translating using Itstool
You can also use Itstool for translation. In order to translate an XML file with it, you need an .its file with translation definitions. An appropriate file for AppStream upstream metadata of any kind can be found here:


​<its:rules
​ xmlns:its="http://www.w3.org/2005/11/its"
​ version="1.0">
​ <its:translateRule translate="no" selector="/component"/>
​ <its:translateRule translate="yes"
​ selector="/component/name | /component/summary |
​ /component/description | /component/screenshots/screenshot/caption | /component/developer_name"/>
​</its:rules>

When saving that file, I cannot use it with 2.0.2 nor 2.0.4:

✗>itstool --its=as-metainfo.its  /usr/share/appdata/eog.appdata.xml 
Traceback (most recent call last):
  File "/usr/bin/itstool", line 1477, in <module>
    doc.apply_its_file(itsfile, params=params)
  File "/usr/bin/itstool", line 729, in apply_its_file
    doc = libxml2.parseFile(filename)
  File "/usr/lib/python2.7/dist-packages/libxml2.py", line 1343, in parseFile
    if ret is None:raise parserError('xmlParseFile() failed')
libxml2.parserError: xmlParseFile() failed

I expected it to work fine.

@enz
Copy link

enz commented Feb 4, 2019

I run into the same problem and the problem occurs because lines in the example from the HTML page have an extra Unicode zero-width space (U+200B) at the beginning. If you remove those, it runs fine for me. Not sure why those characters exist in the documentation, it would be nice if copying/pasting the example would just work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants