Commit Graph

21 Commits

Author SHA1 Message Date
Oneric a6cf70ba59 po/make_pot: also update PO files
While meson already provides the aegisub-update-po target
for this exact purpose, it insists on also running meson’s
aegisub-pot target first, leading to missing translation strings.
2023-04-30 18:09:48 +02:00
Oneric bc3358fcfe po/make_pot: increase portability across shells
Base POSIX leaves the handling of backslahes in the operand
implementation defined. The XSI extension specifies several
escape sequences, like e.g. \n, which shall be transformed
upon printing.
Current make_pot.sh expects XSI behaviour and indeed e.g.
dash’s echo builtin implements this. echo builtins of other common
shells such as bash however, do not (by default). Avoid this portability
pitfall by just using printf at all relevant places. See:
  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html

This also allows us to stop substituting each backslash with four
backslashes before piping to maybe_append. This substituion existed
to safely pass backslahes through maybe_append’s two layers of echo.

Also improve quoting. For consistency prefer single-quote quoting over
shell backslash escapes. QUote the unguarded *.lua to ensure it will
continue to work if there happen to be any lua files in the scripts
working directory.

This supersedes commits from wangqr/Aegisub which adjusted quoting and
echo usage to work with different shells. This is more throughout and
doesn't introduce semi-broken intermediate states.
  0fbcaea871
  4aee271d03
  940181c7bc
(Note the second commit actually didn't manage to achieve the intended
portability, since several echo usages remained and it forgot to adjust
the backslash substitution, which was then fixed in the third commit.)
2023-04-30 17:46:20 +02:00
Oneric f417f6f1ad po/Make_pot: replace xmlstarelet+jq with gettext
gettext can deal with AppData (and other XML files)
since version 0.19.6 (2015). We already depend on gettext anyway so
let’s utilise this, to get rid of two build dependencies and simplify
the extraction logic.
This depends on the removal of underscore prefixes
as done in a prior commit.

After this the developer name "Aegisub Group"
is now also treated as a translateable string.
2023-04-30 17:40:55 +02:00
Oneric 6d9901ee3c po/make_pot: use gettext to process desktop file
gettext understands desktop files since 0.19 (2014),
so there’s no need for custom grep logic. This change
matches meson’s i18n which also uses gettext for this.

As a side efffect of this some long strings now get
broken into multiple lines (cosmetic only) and some
blank line gaps are normalised by gettext.

Cherry picks: 0e29c8d0e4
With fixups from: e98b7292f1
2023-04-30 17:38:28 +02:00
Oneric afa290ecfb po/make_pot: don't silently omit strings if utilities are missing
Instead abort the script on any errors, which
also helps detecting other unexpected errors.

Adopts parts of: 940181c7bc
  and 4aee271d03
2023-04-30 17:10:27 +02:00
Oneric 87d810254c po/make_pot: sort lua files in POT
find may output matching files in any order.
To avoid unnecessary changes between regeneration
sort its output. For C++ sources xgettext’s --sort-by-file
already has an equivalent effect. All other files are already
statically listed in a fixed order.

Adopts part of: 4aee271d03
2023-04-30 17:10:27 +02:00
Oneric 5c00368e85 build: consider all translation keywords for C++
And document which aprts are still missing.
The keyword list is are copied from make_pot.sh.
Sorting by file helps keeping future PO(T) update diffs small'ish
and is also done in wangqr’s PO-file update procedure. (POT file
generation also sorts, but by preapplying `LC_ALL=C sort` to the
file list instead of using xgettext’s sorting option.)

Without this, meson’s aegisub-pot missed the majority of translatable
strings from C++ sources. While this brings the target much closerto
make_pot.sh, the remaining strings aren't straigthforward to integrate
unfortunately. At the time of writing meson has no support for iss files
and make_pot.sh uses custom logic to select only specific strings
from Lua and JSON files.

Even after this commit, POT updates should
thus still continue to use make_pot.sh.
2023-04-30 17:10:24 +02:00
Oneric 8c35b1d642 Integrate appdata.xml into meson build
It used to be genrated and installed by the old custom build system,
but apparently got lost in switching to meson.

Rename to .in.in instead of .template.in, since i18n otherwise gets
utterly confused failing to recognise the file type and both erroring
out with "no ITS rules found" during merge_file and failing to extract
any translatable strings.
Also drop underscores which were previously processed by intltool.

This doesn't yet automatically replace the release version and date
in the appdata file, but neither did the old build.

Note: while this slightly improves the situation, meson’s aegisub-pot
target is still missing many strings. make_pot.sh should be used.
2023-04-30 03:09:56 +02:00
Oneric 66efa84eed Integrate desktop file translation into meson
meson’s i18n module get’s confused by .template and fails
to extract translatable strings, thus rename to in.in.

Note: while this slightly improves the situation, meson’s aegisub-pot
target is still missing many strings. make_pot.sh should be used.
2023-04-30 03:09:56 +02:00
Oneric 429455263f Fix generation and translation of desktop file
a91c4f70c3 switched processing of the
desktop file from intltool to gettext-backed i18n.merge_file and dropped
leading underscores which used to be processed by intltool.

However, this commit omitted dropping the underscore from Keywords,
resulting in this field being stripped from the installed version.

Furthermore, make_pot.sh was broken since it too relied on the
underscore meaning POT regeneration will now remove the desktop files
strings from translation files.
Since it was not added to po/POTFILES meson’s native aegisub-pot target
also doesn't add desktop file strings to the translation pool. Though,
this target still misses a lot of other strings as well and shouldn't be
used yet anyway.

This commit removes leftover underscores and reintegrates desktop file
strings into both make_pot.sh. Integration into aegisub-pot is done in a
follow-up commit.
2023-04-30 03:09:56 +02:00
scx 0418d0b5be Desktop file: make Keywords translatable 2019-09-22 19:16:23 -04:00
scx 7ea2c09afa make_pot.sh: Check presence of xmlstarlet and jq 2019-09-22 19:15:36 -04:00
scx c3a4a9122c Integrate AppData file with build system 2019-09-22 19:15:36 -04:00
Thomas Goyne 481f9e42a7 Fix the path to the desktop file in make_pot.sh 2014-06-27 11:20:03 -07:00
Thomas Goyne 37c02ae127 Replace wxString::Format with agi::format
It's modestly faster, significantly more type-safe, and doesn't assert
when there's too few arguments, which causes problems for plural forms.

Closes #1733.
2014-05-30 11:53:14 -07:00
Thomas Goyne 1049b2d140 Make the "Create a start menu icon" string translatable 2014-05-15 11:09:42 -07:00
Thomas Goyne d741c55725 Extract installer strings for translation 2014-05-15 10:09:32 -07:00
Thomas Goyne 4aa79925c1 Update version in make_pot.sh to 3.2 2014-03-12 09:40:40 -07:00
Thomas Goyne 6e12297313 Update string extraction for desktop file 2014-03-12 09:26:19 -07:00
Thomas Goyne 067450e04a Add wxPLURAL to the patterns extracted by make_pot.sh 2014-03-12 09:23:55 -07:00
Thomas Goyne 33a4a056a4 Move everything up a level since the root dir no longer has stuff 2014-03-11 12:14:57 -07:00