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

Import German translation from wangqr #52

Merged
merged 16 commits into from
May 1, 2023

Conversation

TheOneric
Copy link

@TheOneric TheOneric commented Apr 22, 2023

The current meson integration for POT generation is incomplete and misses out a lot of strings. The last commit improves this for strings from C++ source files, but strings from other sources are still missing. For *.xml and *.desktop adding support might be as simple as renaming to .in.in instead of .template.in and dropping any extra underscores added for intltool. Re packages/desktop/aegisub.appdata.xml.template.in also see [issue creation pending].
For the remaining formats I have no idea what the best way to integrate them is.

For this PR’s POT and PO update, I therefore stuck with make_pot.sh and msgmerge. If you’d prefer keeping the changeset down, I can omit rebasing non-de PO files to the new POT version.

Cosmetic nit: it might be a good idea to unify the (original) message texts for ffms2 and bestsource’s keyframe and timecode indexing/scanning dialogue.

@TheOneric TheOneric marked this pull request as draft April 22, 2023 02:15
@TheOneric
Copy link
Author

TheOneric commented Apr 22, 2023

Found a way to make aegisub.appdata.xml build with i18n afterall and also discovered the existing .desktop integration is borked. The latter also affects the POT update here, so converted to draft. I’ll fix this up and add the desktop and appdata stuff to this PR later.

@TheOneric TheOneric marked this pull request as ready for review April 22, 2023 20:40
@TheOneric
Copy link
Author

TheOneric commented Apr 22, 2023

Fixed desktop file string extraction and added meson integration for desktop and appdata files + updating obsolete links in aegisub.appdata.xml. Should be ready for review.

Remaining future improvements for someone more familiar with meson i18n details and the build setup:

  • automatically replace release version and date in packages/desktop/aegisub.appdata.in.in
  • somehow wire up remaining translatable string sources to meson’s aegisub-pot target, so it can supersede make_pot.sh . This will require custom logic. See comment in po/meson.build, commit messages and make_pot.sh for details.

Force-pushed to amend a commit message and added a one-liner fix for brazilian portugese from wangqr’s fork. Checking against portugesian Portugese and a dictionary it seems correct. Afaict this is the only other translation addition or fix from wangqr/Aegisub not present here yet.
I just remembered there were some make_pot.sh changes not present here though. If make_pot.sh isn't replaced by full meson integration soon, it might be a good idea to pick them up.

po/de.po Outdated Show resolved Hide resolved
po/de.po Outdated Show resolved Hide resolved
po/de.po Outdated Show resolved Hide resolved
po/de.po Outdated Show resolved Hide resolved
po/de.po Show resolved Hide resolved
po/de.po Outdated Show resolved Hide resolved
@arch1t3cht
Copy link
Owner

Thanks a lot! This mostly LGTM except for a few corrections on the added German translations.

I did also update some of the bestsource messages (actually this was long overdue since some of them were carried over from back when it was still a proof-of-concept and never updated) in 0c057eb, though I still kept some of them. I replaced "Exacting" with "Indexing" and "Finding Keyframes and Timecodes..." with "Reading timecodes and frame/sample data" (this isn't strictly accurate since bestsource doesn't read samples here, but it probably still makes the most sense for the user), but I kept "Scanning" as it is since that is a separate step that (for now) needs to run every time the file is opened, as opposed to the Indexing step that only needs to happen once per file.

a91c4f7 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.
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.
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.
TheOneric and others added 12 commits April 30, 2023 17:10
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.
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: wangqr@4aee271
Instead abort the script on any errors, which
also helps detecting other unexpected errors.

Adopts parts of: wangqr@940181c
  and wangqr@4aee271
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: wangqr@0e29c8d
With fixups from: wangqr@e98b729
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.
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.
  wangqr@0fbcaea
  wangqr@4aee271
  wangqr@940181c
(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.)
Using make_pot.sh and
  msgmerge --no-fuzzy-matching --sort-by-file $i.po aegisub.pot
since meson’s aegisub-pot target are still not covering all
translatable strings yet.
This fixes a bunch of misspellings, borked C format strings and
increases translation coverage from 1288/1612 to 1516/1612
where still missing strings mostly don’t exists in wangqr’s build.

Original commit:
wangqr@98abe53
Implements suggestions by arch1t3cht.
pt_PT already uses the correct translation.
Cherry-picked-from: wangqr@d771fb2
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.
@TheOneric
Copy link
Author

TheOneric commented Apr 30, 2023

Thanks for the review! Translations are now fixed as suggested and rebased for the new BS source strings.
To make backporting to wangqr easier I split fixing existing translations from wangqr into a separate commit. As a bonus I found and fixed another mistake in the old 2013 translations (WahlenWählen).

New version now also includes other make_pot.sh improvements from wangqr and some new additional improvements. Some noteworthy points:

  • Using gettext for appdata added the developer name Aegisub group as a translateable string. I’m unsure if this should be treated as a proper noun and left as is, or localised. (Aegisub Group does suggest a higher degree of organisation and unity then actually exists in reality.)
  • Prior to gettext 0.21 (July 2020), msgmerge would reverse the order of commented strings. wangqr’s version of make_pot.sh always runs msgmerge twice for each updated language to workaround this issue. However, this workaround was added when there was no released version with a fix yet. At this point we might not really need to add this workaround here as well.

Future improvements not in scope of this PR:

  • automatically replace release version and date in packages/desktop/aegisub.appdata.xml.in and po/aegisub.pot
  • integrate extraction of the remaining translateable strings into the meson build (lua, iss, json) and drop make_pot.sh

New changes which can be backported to wangqr/Aegisub afterwards:

  • update appdata links
  • use gettext for appdata extraction (and merging; requires dropping underscores)
  • new fixes for German translation
  • proper shell portability

@arch1t3cht arch1t3cht merged commit a6cf70b into arch1t3cht:feature May 1, 2023
@arch1t3cht
Copy link
Owner

Thanks again! There was one more missing space in the VapourSynth description text, but I just fixed that myself.

@TheOneric TheOneric deleted the at_po-de branch May 1, 2023 16:12
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.

3 participants