Hi all, I've been intrigued by the mm macros and while exploring their capabilities I wondered why some of the strings, e.g. for the table of contents or on on cover pages were still in English even though I passed -mden to groff when preparing the document.
That sparked my interest and I dug deeper only to find hard coded
strings and alias oddities--where, for example, Licon is an alias
of Captc and Captc is translated in de.tmac and mapped in trans.tmac,
but Licon still contains the initially set Captc value CONTENTS.
Wanting to use mm and produce documents for German readers,
I set out to see what changes were necessary in order to fully
support localisation in mm documents. Turns out only a few:
- Replace uses of groff <1.23 compatibility aliases, e.g. Licon, Lifg,
etc. with the their Cap counterpart, e.g. Captc, Capfg.
- Introduce strings for hard-coded text, namely subject, date, from,
Work Project No., File Case, and memorandum titles in cover pages
- Add aliases to trans.tmac for newly introduced strings, namely
Authors, Date, Subject
- Add German translations for newly introduced strings to de.tmac
Please find attached a patch containing aforementioned necessary
changes, a minimal working example for demonstration purposes, and
two PDF documents showing the mwe output before and after the patch
has been applied.
The before PDF shows that the section titles for abstract,
list of figures, list of tables, and list of exhibits are translated,
but the section title for the table of contents and the captions
for equations, exhibits, figures, and tables as well as other strings
like subject, date, and from on the cover pages aren't.
Hopefully other users of mm will find the patch useful.
To the best of my knowledge I've made the changes backwards compatible,
and would greatly appreciate if groff and mm users would offer their
insight, advice, and feedback.
Thanks
Alexis
—————
P.S: I'm using a groff built from the latest changeset; as of this
writing that is 2542eb3f2ef12be6696e0e305937f82f87549df5
from Fri Dec 5 07:02:13 2025 -0600 and have the following environment
variables set:
GROFF_ENCODING=utf-8
GROFF_TYPESETTER=pdf
P.P.S:
The attached PDF documents were created using:
groff -Tpdf -mm -mden -dmt=1 mwe-mm-cov-l10n.mm \
> mwe-mm-cov-l10n-after.pdf
To produce documents with other cover pages change the value of the
passed mt string to any number from 0 to 5. A string value will be
used as the memorandum title.
diff --git i/contrib/mm/m.tmac w/contrib/mm/m.tmac index 4181c195a..b31d208cd 100644 --- i/contrib/mm/m.tmac +++ w/contrib/mm/m.tmac @@ -2866 +2866 @@ exceeds depth of nested lists (\\n[li*lvl]) -.ds H1txt \\*[Licon] +.ds H1txt \\*[Captc] @@ -2898 +2898 @@ exceeds depth of nested lists (\\n[li*lvl]) -\\*[Licon] +\\*[Captc] @@ -3026,2 +3026,2 @@ exceeds depth of nested lists (\\n[li*lvl]) -.ds lix*label \\*[Li\\$1]\ \\*[lix*numb]\\*[lix*ds-form] -.if \\n[D]>=2 .tm \\*[Li\\$1] "\\$4" +.ds lix*label \\*[Cap\\$1]\ \\*[lix*numb]\\*[lix*ds-form] +.if \\n[D]>=2 .tm \\*[Cap\\$1] "\\$4" @@ -3030,3 +3030,3 @@ exceeds depth of nested lists (\\n[li*lvl]) -. if !0\\$6 .ds lix*label \\*[Li\\$1]\ \\$5\\*[lix*numb]\\*[lix*ds-form] -. if 0\\$6=1 .ds lix*label \\*[Li\\$1]\ \\*[lix*numb]\\$5\\*[lix*ds-form] -. if 0\\$6=2 .ds lix*label \\*[Li\\$1]\ \\$5\\*[lix*ds-form] +. if !0\\$6 .ds lix*label \\*[Cap\\$1]\ \\$5\\*[lix*numb]\\*[lix*ds-form] +. if 0\\$6=1 .ds lix*label \\*[Cap\\$1]\ \\*[lix*numb]\\$5\\*[lix*ds-form] +. if 0\\$6=2 .ds lix*label \\*[Cap\\$1]\ \\$5\\*[lix*ds-form] diff --git i/contrib/mm/mm/0.MT w/contrib/mm/mm/0.MT index 69883c0ef..2a3f777c1 100644 --- i/contrib/mm/mm/0.MT +++ w/contrib/mm/mm/0.MT @@ -40 +40 @@ http://savannah.gnu.org/bugs/?group=groff. -. nr cov*column4-hpos 4.65i \" date, author names, TM number +. if !r cov*column4-hpos .nr cov*column4-hpos 4.65i \" date, author names, TM number @@ -53,0 +54,5 @@ http://savannah.gnu.org/bugs/?group=groff. +.if !d Subject .ds Subject subject +.if !d Date .ds Date date +.if !d Authors .ds Authors from +.if !d cov*mt05-wpn .ds cov*mt05-wpn Work Project No. +.if !d cov*mt05-fc .ds cov*mt05-fc File Case @@ -75 +80 @@ http://savannah.gnu.org/bugs/?group=groff. -. nop Work Project No.\& \\*[cov*title-charge-case] +. nop \\*[cov*mt05-wpn]\& \\*[cov*title-charge-case] @@ -81 +86 @@ http://savannah.gnu.org/bugs/?group=groff. -. nop File Case \\*[cov*title-file-case] +. nop \\*[cov*mt05-fc] \\*[cov*title-file-case] @@ -258,3 +263,3 @@ http://savannah.gnu.org/bugs/?group=groff. -.ds cov*mt0-txt!1 TECHNICAL MEMORANDUM\" -.ds cov*mt0-txt!2 INTERNAL MEMORANDUM\" -.ds cov*mt0-txt!3 ADMINISTRATIVE MEMORANDUM\" +.if !d cov*mt0-txt!1 .ds cov*mt0-txt!1 TECHNICAL MEMORANDUM\" +.if !d cov*mt0-txt!2 .ds cov*mt0-txt!2 INTERNAL MEMORANDUM\" +.if !d cov*mt0-txt!3 .ds cov*mt0-txt!3 ADMINISTRATIVE MEMORANDUM\" @@ -275 +280 @@ http://savannah.gnu.org/bugs/?group=groff. -. cov@print-title subject +. cov@print-title \\*[Subject] @@ -281,2 +286,2 @@ http://savannah.gnu.org/bugs/?group=groff. -. cov@print-date date -. cov@print-authors from +. cov@print-date \\*[Date] +. cov@print-authors \\*[Authors] diff --git i/contrib/mm/mm/5.MT w/contrib/mm/mm/5.MT index 0179544d3..b54ddeac0 100644 --- i/contrib/mm/mm/5.MT +++ w/contrib/mm/mm/5.MT @@ -28,0 +29,2 @@ http://savannah.gnu.org/bugs/?group=groff. +.if !d cov*mt05-wpn .ds cov*mt05-wpn Work Project No. +.if !d cov*mt05-fc .ds cov*mt05-fc File Case @@ -43 +45 @@ http://savannah.gnu.org/bugs/?group=groff. -. nop Work Project No.\& \\*[cov*title-charge-case] +. nop \\*[cov*mt05-wpn]\& \\*[cov*title-charge-case] @@ -46 +48 @@ http://savannah.gnu.org/bugs/?group=groff. -.if d cov*title-file-case File Case \\*[cov*title-file-case] +.if d cov*title-file-case \\*[cov*mt05-fc] \\*[cov*title-file-case] diff --git i/tmac/de.tmac w/tmac/de.tmac index e015922dc..1630b6a15 100644 --- i/tmac/de.tmac +++ w/tmac/de.tmac @@ -52,0 +53 @@ +.ds \*[locale]-date Datum\" @@ -111,0 +113 @@ +.ds \*[locale]-subject Betreff\" @@ -135 +137,6 @@ -.if d PH \ +.if d PH \{\ +. ds cov*mt0-txt!1 TECHNISCHER BERICHT\" +. ds cov*mt0-txt!2 INTERNER BERICHT\" +. ds cov*mt0-txt!3 ADMINISTRATIVER BERICHT\" +. ds cov*mt05-fc Fallordner\" +. ds cov*mt05-wpn Arbeitsprojekt-Nr.\" @@ -136,0 +144 @@ +.\} diff --git i/tmac/trans.tmac w/tmac/trans.tmac index 23fb13ca8..806af8289 100644 --- i/tmac/trans.tmac +++ w/tmac/trans.tmac @@ -80,0 +81 @@ +. als Authors \*[locale]-attribute_string @@ -85,0 +87,2 @@ +. als Captc \*[locale]-toc +. als Date \*[locale]-date @@ -128,0 +132 @@ +. als Subject \*[locale]-subject
.ND 2025-12-05 .TL "1234-5" "5689-0" Minimal Working Example .if '5'\*[cov*mt-type]' .br for Localized mm Cover Pages .AU "J. Doe" JD Locality Department 123 455 .AS Minimal abstract .AE .TM 99-77-55 .MT \\*[mt] .H 1 "Minimal Headline" Minimal text. .EC "Minimal Equation Caption Example" .EX "Minimal Exhibit Caption Example" .FG "Minimal Figure Caption Example" .TB "Minimal Table Caption Example" .TC
mwe-mm-cov-l10n-before.pdf
Description: Adobe PDF document
mwe-mm-cov-l10n-after.pdf
Description: Adobe PDF document
