Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve build for translations and a couple fixes for German translation #164

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

TheOneric
Copy link

@TheOneric TheOneric commented May 1, 2023

Ports over new changes from arch1t3cht#52

In summary this does:

  • update dead links in aegisub.appdata.xml
  • switch from jq+xmlstarlet+intltool to just gettext for extracting and merging back translations from/into aegisub.appdata.xml
  • finally properly addresses shell portability of make_pot.sh (replacing my prior flawed attempt from 2020)
  • a few fixes for German translation

The changed line count may look daunting, but the vast majority just comes from running make_pot.sh once to fix up backslash escapes. Apart from the creation date string, this change can be easily reproduced by running make_pot.sh.

Afaict CMake doesn't have logic for merging back translations into the desktop file and no logic at all for appdata.xml? Therefor this only touches the configure+Make buildsystem. Since I’m not sure how gettext is canonically integrated into CMake and this is an unrelated preëxisting issue, I refrained from integrating appdata and desktop file translations into the CMake build.
Side note: In fact, I’m unable to successfully build with CMake. It (but not the configure+Make` build!) fails with:

src/libresrc/default_config.cpp:3:206: error: too many initializers for ‘const unsigned char [41]’
    3 | const unsigned char default_config_platform[] = {123,10,9,34,65,117,100,105,111,34,32,58,32,123,10,9,9,34,80,108,97,121,101,114,34,32,58,32,34,80,117,108,115,101,65,117,100,105,111,34,44,10,9,125,10,125,10};
      |                                                                                                                                                                                                              ^

EDIT: The Ubuntu-CMake build didn't suffer from this error and managed to get to building tests before being killed. MacOS build errors in CI (both Cmake and configure+Make) appear unrelated to this PR.

TheOneric added 6 commits May 1, 2023 23:12
Instead of intltool, xmlstarlet and jq. Mirrors what was done for
the desktop file in 186c983
and 0e29c8d.

gettext supports AppData files since 0.19.6 from 2015
and we already require 0.19.7 anyway.

Requires dropping the leading underscores previously
processed by intltool and adds the developer name "Aegisub Group"
as a new translateable string.
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.
Originally make_pot.sh expected 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 multiple
backslashes before piping to maybe_append. This substituion existed
to safely pass backslahes through maybe_append’s echo'ing.

As a bonus also improve quoting.

Prior commits, especially
  0fbcaea
  4aee271
  940181c
already tried to fix this and adjusted various parts to better work with
the shell at hand. The second listed commit even proclaimed it would
make the script POSIX compliant. This was not actually true, since I
left several instances of echo in place and forgot to adjust the amount
of backslash escaping. The latter was fixed (for XSI shells) in the
third commit.
While I’ll refrain from bold claims like "POSIX compliance" this time,
I can attest the new version gives identical results between dash and
bash at least.

Ported from: arch1t3cht@bc3358f
To account for backslash-escape fixes
in make_pot.sh from the preceding commit.
Implements suggestions by arch1t3cht.

Ported from: arch1t3cht@5b66d47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant