groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 32/33: [me]: Internationalize strings.


From: G. Branden Robinson
Subject: [groff] 32/33: [me]: Internationalize strings.
Date: Thu, 30 Dec 2021 00:46:50 -0500 (EST)

gbranden pushed a commit to branch temp-mail-fail
in repository groff.

commit 41c381d4774e722083f85ba05e39540b9d6a2caa
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Dec 27 18:16:26 2021 +1100

    [me]: Internationalize strings.
    
    * tmac/e.tmac (initialization): Introduce internal `_mo1`..`_mo12`,
      `_dw1`..`_dw7`, and `_td_format` strings (with English defaults).
      Define them outside of the new `ld` macro so that they can be
      overriden by localization packages.
    
      (ld) <dw, mo, td>: Populate via the above new strings.
    
    * tmac/trans.tmac: Stop defining `mo` and `dw`.  Instead, make them
      aliases of the new strings above.   Handle `wa` and `wc` similarly.
    
    This commit provokes a warning when the `meintro_fr.me` is processed:
            warning: macro 'french-appendix_string' not defined
    
    (It causes no changes to the rendered output because chapter and
    appendix headings are not used, nor is the `td` string.)
    
    This will be fixed in the next commit.
---
 ChangeLog       | 13 +++++++++++++
 tmac/e.tmac     | 47 ++++++++++++++++++++++++-----------------------
 tmac/trans.tmac | 40 +++++++++++++++++++++-------------------
 3 files changed, 58 insertions(+), 42 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1eabaaae..7d3f0856 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2021-12-27  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [me]: Internationalize strings.
+
+       * tmac/e.tmac (initialization): Introduce internal
+       `_mo1`..`_mo12`, `_dw1`..`_dw7`, and `_td_format` strings (with
+       English defaults).  Define them outside of the new `ld` macro so
+       that they can be overriden by localization packages.
+       (ld) <dw, mo, td>: Populate via the above new strings.
+       * tmac/trans.tmac: Stop defining `mo` and `dw`.  Instead, make
+       them aliases of the new strings above.   Handle `wa` and `wc`
+       similarly.
+
 2021-12-26  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [me]: Add `ld` macro to re-init date/l10n stuff.
diff --git a/tmac/e.tmac b/tmac/e.tmac
index 94ac8bf8..1221fccb 100644
--- a/tmac/e.tmac
+++ b/tmac/e.tmac
@@ -1945,37 +1945,38 @@
 ..
 .
 .\"            *** DATE AND LOCALIZATION ***
-.
-.de ld                 \" *** (re-)initialize date and localization
 .ds wa Appendix\"
 .ds wc Chapter\"
+.do ds _mo1 January\"
+.do ds _mo2 February\"
+.do ds _mo3 March\"
+.do ds _mo4 April\"
+.do ds _mo5 May\"
+.do ds _mo6 June\"
+.do ds _mo7 July\"
+.do ds _mo8 August\"
+.do ds _mo9 September\"
+.do ds _mo10 October\"
+.do ds _mo11 November\"
+.do ds _mo12 December\"
+.do ds _dw1 Sunday\"
+.do ds _dw2 Monday\"
+.do ds _dw3 Tuesday\"
+.do ds _dw4 Wednesday\"
+.do ds _dw5 Thursday\"
+.do ds _dw6 Friday\"
+.do ds _dw7 Saturday\"
+.do ds _td_format \\*(mo \\n(dy, \\n(y4\"
 .
+.de ld                 \" *** (re-)initialize date and localization
 .\" Work around troff `yr` register's y2k problem.
 .nr y2 \\n(yr%100
 .af y2 00
 .nr y4 \\n(yr+1900
 .
-.if \\n(mo=1 .ds mo January\"
-.if \\n(mo=2 .ds mo February\"
-.if \\n(mo=3 .ds mo March\"
-.if \\n(mo=4 .ds mo April\"
-.if \\n(mo=5 .ds mo May\"
-.if \\n(mo=6 .ds mo June\"
-.if \\n(mo=7 .ds mo July\"
-.if \\n(mo=8 .ds mo August\"
-.if \\n(mo=9 .ds mo September\"
-.if \\n(mo=10 .ds mo October\"
-.if \\n(mo=11 .ds mo November\"
-.if \\n(mo=12 .ds mo December\"
-.if \\n(dw=1 .ds dw Sunday\"
-.if \\n(dw=2 .ds dw Monday\"
-.if \\n(dw=3 .ds dw Tuesday\"
-.if \\n(dw=4 .ds dw Wednesday\"
-.if \\n(dw=5 .ds dw Thursday\"
-.if \\n(dw=6 .ds dw Friday\"
-.if \\n(dw=7 .ds dw Saturday\"
-.
-.ds td \\*(mo \\n(dy, \\n(y4\"
+.do ds dw \\*[_dw\\n(dw]
+.do ds mo \\*[_mo\\n(mo]
+.do ds td \\*[_td_format]
 ..
 .
 .ld
diff --git a/tmac/trans.tmac b/tmac/trans.tmac
index f79d7ed5..cab86624 100644
--- a/tmac/trans.tmac
+++ b/tmac/trans.tmac
@@ -105,25 +105,27 @@
 .
 .\" me package
 .if d @R \{\
-.      if \n[dw]=1 .als dw \*[locale]-sunday
-.      if \n[dw]=2 .als dw \*[locale]-monday
-.      if \n[dw]=3 .als dw \*[locale]-tuesday
-.      if \n[dw]=4 .als dw \*[locale]-wednesday
-.      if \n[dw]=5 .als dw \*[locale]-thursday
-.      if \n[dw]=6 .als dw \*[locale]-friday
-.      if \n[dw]=7 .als dw \*[locale]-saturday
-.      if \n[mo]=1 .als mo \*[locale]-january
-.      if \n[mo]=2 .als mo \*[locale]-february
-.      if \n[mo]=3 .als mo \*[locale]-march
-.      if \n[mo]=4 .als mo \*[locale]-april
-.      if \n[mo]=5 .als mo \*[locale]-may
-.      if \n[mo]=6 .als mo \*[locale]-june
-.      if \n[mo]=7 .als mo \*[locale]-july
-.      if \n[mo]=8 .als mo \*[locale]-august
-.      if \n[mo]=9 .als mo \*[locale]-september
-.      if \n[mo]=10 .als mo \*[locale]-october
-.      if \n[mo]=11 .als mo \*[locale]-november
-.      if \n[mo]=12 .als mo \*[locale]-december
+.      als wa \*[locale]-appendix_string
+.      als wc \*[locale]-chapter_string
+.      als _dw1 \*[locale]-sunday
+.      als _dw2 \*[locale]-monday
+.      als _dw3 \*[locale]-tuesday
+.      als _dw4 \*[locale]-wednesday
+.      als _dw5 \*[locale]-thursday
+.      als _dw6 \*[locale]-friday
+.      als _dw7 \*[locale]-saturday
+.      als _mo1 \*[locale]-january
+.      als _mo2 \*[locale]-february
+.      als _mo3 \*[locale]-march
+.      als _mo4 \*[locale]-april
+.      als _mo5 \*[locale]-may
+.      als _mo6 \*[locale]-june
+.      als _mo7 \*[locale]-july
+.      als _mo8 \*[locale]-august
+.      als _mo9 \*[locale]-september
+.      als _mo10 \*[locale]-october
+.      als _mo11 \*[locale]-november
+.      als _mo12 \*[locale]-december
 .\}
 .
 .\" mom package



reply via email to

[Prev in Thread] Current Thread [Next in Thread]