Skip to content

build(po): extend the --no-wrap catalog policy to the manpage .po files - #67

Merged
ngosang merged 2 commits into
amule-org:masterfrom
ngosang:feature/man_po
Jun 11, 2026
Merged

build(po): extend the --no-wrap catalog policy to the manpage .po files#67
ngosang merged 2 commits into
amule-org:masterfrom
ngosang:feature/man_po

Conversation

@ngosang

@ngosang ngosang commented Jun 11, 2026

Copy link
Copy Markdown
Member

Context

#59 adopted --no-wrap as the project-wide formatting policy for translation
catalogs, and f6012ff + 53a4b78 switched the tooling and normalised
po/amule.pot + po/*.po accordingly. However, the 10
docs/man/po/manpages-*.po were left behind: they were still width-wrapped at
~80 columns (62–68 multi-line entries each), despite 53a4b78's commit message
claiming they were "already in no-wrap-equivalent form".

The root cause (verified against the po4a 0.74 source): the --wrap-po no
option added to docs/man/po4a.config only affects files written by po4a's
internal PO writer — in this flow, just po/manpages.pot. The per-language
.po files are updated by po4a shelling out to GNU
msgmerge --previous --backup=none --update, which never receives any no-wrap
flag. On top of that, msgmerge --update treats a catalog as up-to-date when
only the wrapping differs and silently skips rewriting — the same pitfall
f6012ff documented and fixed for scripts/update-po.sh.

Changes

  1. docs/man/po4a.config: add --msgmerge-opt "--no-wrap" so that future
    content-changing merges performed by po4a write no-wrap output.

  2. One-shot normalisation of the 10 manpages-*.po, running the exact
    msgmerge invocation po4a now performs, but through a tempfile instead of
    --update (to defeat the formatting-only silent skip):

    cd docs/man
    for po in po/manpages-*.po; do
      msgmerge --previous --no-wrap "$po" po/manpages.pot \
        --output-file="$po.tmp" && mv "$po.tmp" "$po"
    done
    

Formatting-only: each wrapped msgid/msgstr collapses to a single line. From now
on, catalog diffs show real content changes instead of reflow noise, matching
the po/ catalogs and the Weblate configuration.

Verification

  • Content unchanged: per catalog, msgcat --no-wrap-normalised diff
    against the previous revision is empty; msgfmt --check --statistics is
    identical before/after (246 translated in de/es/fr/it/pt_BR/tr; 222
    translated + 7 fuzzy + 17 untranslated in hu/ro/ru/zh_TW).
  • Rendered manpages byte-identical: touch po/manpages-.po && po4a po4a.config leaves
    docs/man/
    .1.in and src/utils/**/*.1.in untouched —
    verified both locally and in a container replica of the CI manpages-sync
    environment (Ubuntu noble + Debian po4a 0.74-1 + the same Perl deps), so the
    i18n workflow stays green with no changes needed.
  • Idempotent: a po4a pass over the normalised catalogs does not rewrite
    them (only the volatile POT-Creation-Date in the pot, not committed).

ngosang added 2 commits June 11, 2026 04:38
f6012ff adopted --no-wrap as the project-wide catalog formatting
policy, but its po4a.config change (--wrap-po no) only covers the
files written by po4a's internal PO writer -- in this flow, just
po/manpages.pot. The per-language manpages-*.po are updated by po4a
shelling out to GNU msgmerge (--previous --backup=none --update),
which never sees any no-wrap flag, so any rewrite it performs comes
back width-wrapped.

--msgmerge-opt appends to the options po4a passes to msgmerge, so
future content-changing merges now write no-wrap output, keeping the
manpage catalogs aligned with the policy.

This alone does not reformat the already-wrapped manpages-*.po:
msgmerge --update treats a catalog as up-to-date when only wrapping
differs and silently skips rewriting (the same pitfall f6012ff
documented for scripts/update-po.sh). The one-shot normalisation
follows in the next commit.
Output of running, for each catalog, the same msgmerge invocation
po4a now performs after the previous commit, but through a tempfile
instead of --update (which silently skips rewriting when only the
wrapping differs):

    cd docs/man
    for po in po/manpages-*.po; do
      msgmerge --previous --no-wrap "$po" po/manpages.pot \
        --output-file="$po.tmp" && mv "$po.tmp" "$po"
    done

Formatting-only change: each wrapped msgid/msgstr collapses to a
single line. No translations gained or lost, no fuzzy or obsolete
markings introduced (msgfmt --statistics identical per catalog), and
a po4a render pass leaves docs/man/*.1.in / src/utils/**/*.1.in
byte-identical -- verified both locally and in a container replica
of the i18n.yml manpages-sync environment (noble + po4a 0.74-1).

This also corrects the record from 53a4b78, whose claim that the
manpages-*.po were "already in no-wrap-equivalent form" was wrong:
they were still width-wrapped at ~80 columns (62-68 multi-line
entries each), left behind because po4a updates them via msgmerge
--update, which never received a no-wrap flag and skips
formatting-only rewrites.
@ngosang
ngosang merged commit 4a6fe8c into amule-org:master Jun 11, 2026
10 checks passed
@ngosang
ngosang deleted the feature/man_po branch June 11, 2026 02:44
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