solenv/bin/uiex: more helpful error message for context issues

Change-Id: I82b092a18b2fa2bacef7a27ad4e79350b42bc1d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171711
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
This commit is contained in:
Ilmari Lauhakangas
2024-08-14 07:51:07 +02:00
parent 0f186fb79d
commit f8c9e602a1
+5 -1
View File
@@ -31,7 +31,11 @@ with open(ofile, "a") as output:
# l10ntools/source/localize.cxx will insert one entry for each stock per .po
if entry.msgctxt == "stock":
continue
keyid = entry.msgctxt + '|' + entry.msgid
try:
keyid = entry.msgctxt + '|' + entry.msgid
except Exception:
print(f"There is a problem with the translatable string labeled \"{entry.msgid}\". Likely no context attribute has been specified.")
sys.exit(2)
print('#. ' + polib.genKeyId(keyid), file=output)
for i, occurrence in enumerate(entry.occurrences):
entry.occurrences[i] = os.path.relpath(occurrence[0], os.environ['SRCDIR']), occurrence[1]