fix alternative string-list representation in xcu

A alternative representation for string-list use <it> tag for each item of the list, for example:
https://github.com/LibreOffice/dictionaries/tree/master/tr_TR
This commit is contained in:
un-pogaz 2023-10-04 10:46:32 +02:00
parent 9551f021ec
commit a43d86a0af

View File

@ -45,6 +45,8 @@ def parse_xcu(raw, origin='%origin%'):
paths = [c.text.replace('%origin%', origin) for v in value for c in v.iterchildren('*') if c.text] paths = [c.text.replace('%origin%', origin) for v in value for c in v.iterchildren('*') if c.text]
aff, dic = paths if paths[0].endswith('.aff') else reversed(paths) aff, dic = paths if paths[0].endswith('.aff') else reversed(paths)
locales = ''.join(XPath('descendant::prop[@oor:name="Locales"]/value/text()')(node)).split() locales = ''.join(XPath('descendant::prop[@oor:name="Locales"]/value/text()')(node)).split()
if not locales:
locales = [str(item) for item in XPath('descendant::prop[@oor:name="Locales"]/value/it/text()')(node)]
ans[(dic, aff)] = locales ans[(dic, aff)] = locales
return ans return ans