Unverified Commit 5a406b06 authored by Eli Schwartz's avatar Eli Schwartz
Browse files

migrate from custom itstool to builtin msgfmt for creating translated XML

gettext upstream has supported this for a very long time (since 0.19.7
via commit b3c2a5a242c36fbbaa0c5b17f975d6c638598a23, released in 2015),
and itstool is (mostly) a legacy of the time before gettext had proper
support for these sorts of use cases.

This is similar to the state of intltool, which is described at
https://wiki.gnome.org/MigratingFromIntltoolToGettext

During the port from autotools to meson, the legacy use of itstool was
faithfully translated to meson in the only way possible: by jumping
through hoops to run ninja inside ninja in order to generate the .mo
files for itstool, because meson's i18n module used a flawed design and
there was no "real" target to create those files, only a .PHONY
run_target which other rules cannot depend on.

Although meson 0.60.0 added support for real targets for the built .mo
files, this changed the rules for output filenames, breaking the script.

But msgfmt does not care, and anyways...
parent d74a913c
Pipeline #458050 passed with stage
in 1 minute and 14 seconds
......@@ -9,7 +9,6 @@ variables:
glib2-devel
gettext
git
itstool
xmlto
findutils
gettext-devel
......@@ -34,4 +33,3 @@ build:meson:
paths:
- _build/meson-logs/*.txt
- _build/meson-dist/*.*
......@@ -19,7 +19,7 @@ $ ninja -v -C _build install
```
It requires the glib development package to be installed as well as
gettext and itstool.
gettext.
This database is translated at Transifex.
......
#!/bin/sh -e
src_root="$1"
build_root="$2"
${NINJA:-ninja} -C "${build_root}" shared-mime-info-gmo
itstool \
--its "${src_root}/data/its/shared-mime-info.its" \
--join "${src_root}/data/freedesktop.org.xml.in" \
-o "${build_root}/data/freedesktop.org.xml" \
"${build_root}/po/"*".gmo"
install_man('update-mime-database.1')
freedesktop_org_xml = custom_target('freedesktop.org.xml',
input : files(
'freedesktop.org.xml.in',
'its/shared-mime-info.its',
'its/shared-mime-info.loc',
),
freedesktop_org_xml = i18n.merge_file(
input: 'freedesktop.org.xml.in',
output: 'freedesktop.org.xml',
command: [
find_program('freedesktop_generate.sh'),
meson.source_root(),
meson.build_root()
],
data_dirs: '.',
po_dir: '../po',
type: 'xml',
install: true,
install_dir: get_option('datadir') / 'mime' / 'packages',
)
......
......@@ -20,7 +20,6 @@ config.set_quoted('VERSION', meson.project_version())
###############################################################################
# Find tools
itstool = find_program('itstool')
xmllint = find_program('xmllint')
xmlto = find_program('xmlto', required: false)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment