summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Gaukler <development@maxgaukler.de>2019-05-31 10:54:28 +0000
committerMax Gaukler <development@maxgaukler.de>2019-06-01 08:23:55 +0000
commit71a2e7046cc8656c6f295752ecb607069a031672 (patch)
tree90ba7258effb31cdd5897824f6a8cbe3fc37b5ba
parentAllow rects be LPE like other primitives (diff)
downloadinkscape-71a2e7046cc8656c6f295752ecb607069a031672.tar.gz
inkscape-71a2e7046cc8656c6f295752ecb607069a031672.zip
Work around `xgettext --its` crash for old gettext versions
Change from `xgettext --its` to `GETTEXTDATADIR=.` and `*.loc` files Works around this bug in Debian stable: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891347 Fixes https://gitlab.com/inkscape/inkscape/issues/271
-rw-r--r--po/CMakeLists.txt14
-rw-r--r--po/its/units.loc9
2 files changed, 20 insertions, 3 deletions
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 80bb731d5..b8bcf66ab 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -33,14 +33,22 @@ if(UNIX)
add_custom_command(OUTPUT ${_potFile}
#COMMAND sh -c "${INTLTOOL-UPDATE} --pot --gettext-package=inkscape"
COMMAND touch ${_potFile}
+ # Due to a bug in old xgettext versions, we cannot use '--its='.
+ # Instead, we use GETTEXTDATADIR=. to refer to the po/its/*.its files.
+ # This requires a .loc file for each .its file. See po/its/units.loc for an example.
+ # See https://gitlab.com/inkscape/inkscape/issues/271 for details.
+ # This workaround is necessary for Debian 9, so roughly until ca 2021.
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -C -f POTFILES.src.in
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L Glade -f POTFILES.ui.in
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L Python -f POTFILES.py.in
- COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -f POTFILES.inx.in --from-code=UTF-8 --its its/inx.its
+ # the following uses po/its/inx.{loc, its}
+ COMMAND GETTEXTDATADIR=. ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -f POTFILES.inx.in --from-code=UTF-8
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L AppData ../org.inkscape.Inkscape.appdata.xml.in
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L Desktop ../org.inkscape.Inkscape.desktop.template
- COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} --its its/menus.its ../share/ui/menus.xml
- COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} --its its/units.its ../share/ui/units.xml
+ # the following uses po/its/menus.{loc, its}
+ COMMAND GETTEXTDATADIR=. ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} ../share/ui/menus.xml
+ # the following uses po/its/units.{loc, its}
+ COMMAND GETTEXTDATADIR=. ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} ../share/ui/units.xml
COMMENT "Extract translatable messages to ${_potFile}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
diff --git a/po/its/units.loc b/po/its/units.loc
new file mode 100644
index 000000000..26ea5e29c
--- /dev/null
+++ b/po/its/units.loc
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!-- This file links the .xml file to a corresponding .its file, which decides which parts of the XML will be translated -->
+<locatingRules>
+ <!-- the name of the locatingRule does not matter. The pattern specifies the filename, without directory name. (Wildcards are possible) -->
+ <locatingRule name="foobar" pattern="units.xml">
+ <!-- set 'localName' to the name of the main element in the XML file, and 'target' to the name of the .its file. -->
+ <documentRule localName="unitdefs" target="units.its"/>
+ </locatingRule>
+</locatingRules>