[latex3-commits] [git/LaTeX3-latex3-babel] main: New: \localeinfo*. Variants and extensions in some ini’s. (4574fff)

Javier email at dante.de
Thu May 19 17:58:00 CEST 2022


Repository : https://github.com/latex3/babel
On branch  : main
Link       : https://github.com/latex3/babel/commit/4574fff56d69c6df65b6401418c0e9a44942c461

>---------------------------------------------------------------

commit 4574fff56d69c6df65b6401418c0e9a44942c461
Author: Javier <email at localhost>
Date:   Thu May 19 17:58:00 2022 +0200

    New: \localeinfo*. Variants and extensions in some ini’s.


>---------------------------------------------------------------

4574fff56d69c6df65b6401418c0e9a44942c461
 README.md                         |   8 +++-
 babel.dtx                         |  94 +++++++++++++++++++++++++++++++++-----
 babel.ins                         |   2 +-
 babel.pdf                         | Bin 858142 -> 860737 bytes
 bbcompat.dtx                      |   2 +-
 locale/de/babel-de-1901.ini       |   1 +
 locale/de/babel-de-1996.ini       |   1 +
 locale/de/babel-de-AT-1901.ini    |   1 +
 locale/de/babel-de-AT-1996.ini    |   1 +
 locale/de/babel-de-CH-1901.ini    |   3 +-
 locale/de/babel-de-CH-1996.ini    |   1 +
 locale/de/babel-de-CH.ini         |   2 -
 locale/en/babel-en-AU.ini         |   6 +--
 locale/en/babel-en-NZ.ini         |   6 +--
 locale/la/babel-la-x-classic.ini  |   1 +
 locale/la/babel-la-x-ecclesia.ini |   1 +
 locale/la/babel-la-x-medieval.ini |   1 +
 testfiles/tlb1841.tlg             |   4 ++
 testfiles/tlb3505.tlg             |   4 ++
 19 files changed, 113 insertions(+), 26 deletions(-)

diff --git a/README.md b/README.md
index 3e20b09..d1b18a0 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.75.2737
+## Babel 3.75.2742
 
 ''(Development.)''
 
@@ -53,11 +53,15 @@ respective authors.
          - Misplaced rule un diagbox (#43)
          - Caption names of 'chapter' and 'part' swapped in Chinese (#180).
          - Captions after numbers in Lithuanian.
+         - `hyphenrules` in the `ini` files for `en-AU` and
+           `en-NZ` where set to english instead of `ukenglish`.
        * The key `character`/`ranges` in `ini` files now sets the
-         corresponding Unicode script ranges (used by `onchar`).
+         corresponding Unicode script ranges (as used by `onchar`).
        * `\BabelEnsureInfo` is active by default, to make sure the BCP47
          codes are always available, as they may be required by the
          LaTeX kernel.
+       * `\localeinfo*` is like `\localeinfo` but expands to nothing if
+         unknown (fully expandable).
 
 3.74   2022-04-30
        * Fixes:
diff --git a/babel.dtx b/babel.dtx
index 30c9998..387e6f6 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2022/05/14 v3.75.2737 The Babel package]
+\ProvidesFile{babel.dtx}[2022/05/19 v3.75.2742 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -2886,7 +2886,8 @@ argument is the name of a language; the second and third arguments are
 the actions to take if the result of the test is true or false
 respectively.
 
-\Describe{\localeinfo}{\marg{field}}
+\Describe{\localeinfo}{%
+ \colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}{\marg{field}}}
 
 \New{3.38} If an |ini| file has been loaded for the current language,
 you may access the information stored in it. This macro is fully
@@ -2898,13 +2899,16 @@ expandable, and the available fields are:
 %%% activated because the bug in \languagename is far from trivial.
 \item[|tag.ini|] is the tag of the |ini| file (the way this
   file is identified in its name).
-\item[|tag.bcp47|] is the full BCP 47 tag (see the warning below).
+\item[|tag.bcp47|] is the full BCP 47 tag (see the warning below). This
+  is the value to be used for the ‘real' provided tag (\babel{} may
+  fill other fields if they are considered necessary).
 \item[|language.tag.bcp47|] is the BCP 47 language tag.
 \item[|tag.opentype|] is the tag used by OpenType (usually, but not
   always, the same as BCP 47).
 \item[|script.name|], as provided by the Unicode CLDR.
 \item[|script.tag.bcp47|] is the BCP 47 tag of the script
-  used by this locale.
+  used by this locale. This is a required field for the fonts to be
+  correctly set up, and therefore it should be defined always.
 \item[|script.tag.opentype|] is the tag used by OpenType (usually,
   but not always, the same as BCP 47).
 \end{description}
@@ -2915,6 +2919,18 @@ expandable, and the available fields are:
   counterintuitive.
 \end{warning}
 
+\New{3.75} Sometimes, it comes in handy to be able to use |\localeinfo|
+in an expandable way even if something went wrong (for example, the
+locale currently active is undefined). For these cases, |localeinfo*|
+just returns an empty string instead of raising an error. Bear in mind
+that \babel{}, following the CLDR, may leave the region unset, which
+means |\getlanguageproperty*|, described below, is the preferred
+command, so that the existence of a field can be checked before. This
+also means building a string with the language and the region with
+|\localeinfo*{language.tab.bcp47}|\allowbreak |-|\allowbreak
+|\localeinfo*{region.tab.bcp47}| is not usually a good idea (because of
+the hyphen).
+
 \Describe{\getlocaleproperty}{%
   \colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}%
   \marg{macro}\marg{locale}\marg{property}}
@@ -5112,8 +5128,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.75.2737>>
-%<<date=2022/05/14>>
+%<<version=3.75.2742>>
+%<<date=2022/05/19>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -10252,6 +10268,10 @@ help from Bernd Raichle, for which I am grateful.
     \ifin@
       \bbl at ini@calendar{##1}%
     \fi
+    \in@{=identification/extension.}{=##1/##2}%
+    \ifin@
+      \bbl at ini@extension{##2}%
+    \fi
     \bbl at ifunset{bbl at inikv@##1}{}%
       {\csname bbl at inikv@##1\endcsname{##2}{##3}}}%
   \bbl at inidata}
@@ -10362,6 +10382,9 @@ help from Bernd Raichle, for which I am grateful.
 %
 \let\bbl at release@transforms\@empty
 %
+\def\bbl at ini@extension#1{}
+\let\bbl at moreinfo\@empty
+%
 \def\bbl at ini@exports#1{%
   % Identification always exported
   \bbl at iniwarning{}%
@@ -10384,6 +10407,9 @@ help from Bernd Raichle, for which I am grateful.
     {\csname bbl at esname@\languagename\endcsname}}%
   \bbl at exportkey{sbcp}{identification.script.tag.bcp47}{}%
   \bbl at exportkey{sotf}{identification.script.tag.opentype}{DFLT}%
+  \bbl at exportkey{rbcp}{identification.region.tag.bcp47}{}%
+  \bbl at exportkey{vbcp}{identification.variant.tag.bcp47}{}%
+  \bbl at moreinfo
   % Also maps bcp47 -> languagename
   \ifbbl at bcptoname
     \bbl at csarg\xdef{bcp at map@\bbl at cl{tbcp}}{\languagename}%
@@ -10952,13 +10978,21 @@ help from Bernd Raichle, for which I am grateful.
 % following macro just exposes it with a user command.
 %
 %    \begin{macrocode}
+\def\bbl at localeinfo#1#2{%
+  \bbl at ifunset{bbl at info@#2}{#1}%
+    {\bbl at ifunset{bbl@\csname bbl at info@#2\endcsname @\languagename}{#1}%
+      {\bbl at cs{\csname bbl at info@#2\endcsname @\languagename}}}}
 \newcommand\localeinfo[1]{%
-  \bbl at ifunset{bbl@\csname bbl at info@#1\endcsname @\languagename}%
-    {\bbl at error{I've found no info for the current locale.\\%
-                The corresponding ini file has not been loaded\\%
-                Perhaps it doesn't exist}%
-               {See the manual for details.}}%
-    {\bbl at cs{\csname bbl at info@#1\endcsname @\languagename}}}
+  \ifx*#1\@empty   % TODO. A bit hackish to make it expandable.
+    \bbl at afterelse\bbl at localeinfo{}%
+  \else
+    \bbl at localeinfo
+      {\bbl at error{I've found no info for the current locale.\\%
+                  The corresponding ini file has not been loaded\\%
+                  Perhaps it doesn't exist}%
+                 {See the manual for details.}}%
+      {#1}%
+  \fi}
 % \@namedef{bbl at info@name.locale}{lcname}
 \@namedef{bbl at info@tag.ini}{lini}
 \@namedef{bbl at info@name.english}{elname}
@@ -10970,6 +11004,9 @@ help from Bernd Raichle, for which I am grateful.
 \@namedef{bbl at info@script.name.opentype}{sname}
 \@namedef{bbl at info@script.tag.bcp47}{sbcp} 
 \@namedef{bbl at info@script.tag.opentype}{sotf}
+\@namedef{bbl at info@region.tag.bcp47}{rbcp}
+\@namedef{bbl at info@variant.tag.bcp47}{vbcp}
+% extensions are dealt with in a special way
 \let\bbl at ensureinfo\@gobble
 \newcommand\BabelEnsureInfo{%
   \ifx\InputIfFileExists\@undefined\else
@@ -22562,6 +22599,39 @@ Babel.cjk_breaks = {
 % \end{macro}
 % \end{macro}
 %
+% There is no locale file for this pseudo-language, so the
+% corresponding fields are defined here.
+%
+%    \begin{macrocode}
+\def\bbl at inidata@nil{%
+  \bbl at elt{identification}{tag.ini}{und}%
+  \bbl at elt{identification}{load.level}{0}%
+  \bbl at elt{identification}{charset}{utf8}%
+  \bbl at elt{identification}{version}{1.0}%
+  \bbl at elt{identification}{date}{2022-05-16}%
+  \bbl at elt{identification}{name.local}{nil}%
+  \bbl at elt{identification}{name.english}{nil}%
+  \bbl at elt{identification}{name.babel}{nil}%
+  \bbl at elt{identification}{tag.bcp47}{und}%
+  \bbl at elt{identification}{language.tag.bcp47}{und}%
+  \bbl at elt{identification}{tag.opentype}{dflt}%
+  \bbl at elt{identification}{script.name}{Latin}%
+  \bbl at elt{identification}{script.tag.bcp47}{Latn}%
+  \bbl at elt{identification}{script.tag.opentype}{DFLT}%
+  \bbl at elt{identification}{level}{1}%
+  \bbl at elt{identification}{encodings}{}%
+  \bbl at elt{identification}{derivate}{no}}
+\@namedef{bbl at tbcp@nil}{und}
+\@namedef{bbl at lbcp@nil}{und}
+\@namedef{bbl at lotf@nil}{dflt}
+\@namedef{bbl at elname@nil}{nil}
+\@namedef{bbl at lname@nil}{nil}
+\@namedef{bbl at esname@nil}{Latin}
+\@namedef{bbl at sname@nil}{Latin}
+\@namedef{bbl at sbcp@nil}{Latn}
+\@namedef{bbl at sotf@nil}{Latn}
+%    \end{macrocode}
+%
 %    The macro |\ldf at finish| takes care of looking for a
 %    configuration file, setting the main language to be switched on
 %    at |\begin{document}| and resetting the category code of
diff --git a/babel.ins b/babel.ins
index fab5ed7..3911901 100644
--- a/babel.ins
+++ b/babel.ins
@@ -26,7 +26,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension .ins) which are part of the distribution.
 %%
-\def\filedate{2022/05/14}
+\def\filedate{2022/05/19}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index 1ec5d2a..692228f 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index f6833db..24bfb1e 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/05/14 v3.75.2737]
+\ProvidesFile{bbcompat.dtx}[2022/05/19 v3.75.2742]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
diff --git a/locale/de/babel-de-1901.ini b/locale/de/babel-de-1901.ini
index 2243aab..87dffa1 100644
--- a/locale/de/babel-de-1901.ini
+++ b/locale/de/babel-de-1901.ini
@@ -23,6 +23,7 @@ tag.opentype = DEU
 script.name = Latin
 script.tag.bcp47 = Latn
 script.tag.opentype = latn
+variant.tag.bcp47 = 1901
 level = 1
 encodings = T1 OT1 LY1
 derivate = no
diff --git a/locale/de/babel-de-1996.ini b/locale/de/babel-de-1996.ini
index 87296f1..c421218 100644
--- a/locale/de/babel-de-1996.ini
+++ b/locale/de/babel-de-1996.ini
@@ -22,6 +22,7 @@ tag.opentype = DEU
 script.name = Latin
 script.tag.bcp47 = Latn
 script.tag.opentype = latn
+variant.tag.bcp47 = 1996
 level = 1
 encodings = T1 OT1 LY1
 derivate = no
diff --git a/locale/de/babel-de-AT-1901.ini b/locale/de/babel-de-AT-1901.ini
index 7d5ffa2..3502451 100644
--- a/locale/de/babel-de-AT-1901.ini
+++ b/locale/de/babel-de-AT-1901.ini
@@ -26,6 +26,7 @@ region.tag.bcp47 = AT
 script.name = Latin
 script.tag.bcp47 = Latn
 script.tag.opentype = latn
+variant.tag.bcp47 = 1901
 polyglossia.variant = austrian
 polyglossia.spelling = old
 level = 1
diff --git a/locale/de/babel-de-AT-1996.ini b/locale/de/babel-de-AT-1996.ini
index a4839f1..fc89811 100644
--- a/locale/de/babel-de-AT-1996.ini
+++ b/locale/de/babel-de-AT-1996.ini
@@ -26,6 +26,7 @@ region.tag.bcp47 = AT
 script.name = Latin
 script.tag.bcp47 = Latn
 script.tag.opentype = latn
+variant.tag.bcp47 = 1996
 polyglossia.variant = austrian
 polyglossia.spelling = new
 level = 1
diff --git a/locale/de/babel-de-CH-1901.ini b/locale/de/babel-de-CH-1901.ini
index f23225f..b354fd6 100644
--- a/locale/de/babel-de-CH-1901.ini
+++ b/locale/de/babel-de-CH-1901.ini
@@ -17,8 +17,6 @@ name.local = Deutsch
 name.english = German
 name.babel = german-switzerland german-ch nswissgerman
 name.polyglossia = german
-; The following conflicts with gsw:
-name.babel.C = swissgerman
 tag.bcp47 = de-CH-1901
 language.tag.bcp47 = de
 tag.opentype = DEU
@@ -28,6 +26,7 @@ region.tag.bcp47 = CH
 script.name = Latin
 script.tag.bcp47 = Latn
 script.tag.opentype = latn
+variant.tag.bcp47 = 1901
 polyglossia.variant = swiss
 polyglossia.spelling = old
 level = 1
diff --git a/locale/de/babel-de-CH-1996.ini b/locale/de/babel-de-CH-1996.ini
index 3f8df2a..50fb5bd 100644
--- a/locale/de/babel-de-CH-1996.ini
+++ b/locale/de/babel-de-CH-1996.ini
@@ -28,6 +28,7 @@ region.tag.bcp47 = CH
 script.name = Latin
 script.tag.bcp47 = Latn
 script.tag.opentype = latn
+variant.tag.bcp47 = 1996
 polyglossia.variant = swiss
 polyglossia.spelling = new
 level = 1
diff --git a/locale/de/babel-de-CH.ini b/locale/de/babel-de-CH.ini
index 4b93e76..672200b 100644
--- a/locale/de/babel-de-CH.ini
+++ b/locale/de/babel-de-CH.ini
@@ -17,8 +17,6 @@ name.local = Deutsch
 name.english = German
 name.babel = german-switzerland german-ch nswissgerman
 name.polyglossia = german
-; The following conflicts with gsw:
-name.babel.C = swissgerman
 tag.bcp47 = de-CH
 language.tag.bcp47 = de
 tag.opentype = DEU
diff --git a/locale/en/babel-en-AU.ini b/locale/en/babel-en-AU.ini
index e6a8f90..bbef7b2 100644
--- a/locale/en/babel-en-AU.ini
+++ b/locale/en/babel-en-AU.ini
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.3
-date = 2021-09-29
+version = 1.4
+date = 2022-05-17
 name.local = English
 name.english = English
 name.babel = english-australia english-au australian
@@ -150,7 +150,7 @@ time.short = [h]:[mm] [a]
 
 [typography]
 frenchspacing = no
-hyphenrules = english
+hyphenrules = ukenglish
 lefthyphenmin = 2
 righthyphenmin = 3
 hyphenchar = 
diff --git a/locale/en/babel-en-NZ.ini b/locale/en/babel-en-NZ.ini
index 78280c2..8ac9d3d 100644
--- a/locale/en/babel-en-NZ.ini
+++ b/locale/en/babel-en-NZ.ini
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.3
-date = 2021-09-29
+version = 1.4
+date = 2022-05-17
 name.local = English
 name.english = English
 name.babel = english-newzealand english-nz newzealand
@@ -150,7 +150,7 @@ time.short = [h]:[mm] [a]
 
 [typography]
 frenchspacing = no
-hyphenrules = english
+hyphenrules = ukenglish
 lefthyphenmin = 2
 righthyphenmin = 3
 hyphenchar = 
diff --git a/locale/la/babel-la-x-classic.ini b/locale/la/babel-la-x-classic.ini
index a6cf087..94aa8ff 100644
--- a/locale/la/babel-la-x-classic.ini
+++ b/locale/la/babel-la-x-classic.ini
@@ -20,6 +20,7 @@ tag.opentype = LAT
 script.name = Latin
 script.tag.bcp47 = Latn
 script.tag.opentype = latn
+extension.x.tag.bcp47 = classic
 level = 1
 encodings = T1 OT1 LY1
 derivate = no
diff --git a/locale/la/babel-la-x-ecclesia.ini b/locale/la/babel-la-x-ecclesia.ini
index de282f1..4c351e9 100644
--- a/locale/la/babel-la-x-ecclesia.ini
+++ b/locale/la/babel-la-x-ecclesia.ini
@@ -20,6 +20,7 @@ tag.opentype = LAT
 script.name = Latin
 script.tag.bcp47 = Latn
 script.tag.opentype = latn
+extension.x.tag.bcp47 = ecclesia
 level = 1
 encodings = T1 OT1 LY1
 derivate = no
diff --git a/locale/la/babel-la-x-medieval.ini b/locale/la/babel-la-x-medieval.ini
index c2a3fe3..3b45e5b 100644
--- a/locale/la/babel-la-x-medieval.ini
+++ b/locale/la/babel-la-x-medieval.ini
@@ -20,6 +20,7 @@ tag.opentype = LAT
 script.name = Latin
 script.tag.bcp47 = Latn
 script.tag.opentype = latn
+extension.x.tag.bcp47 = medieval
 level = 1
 encodings = T1 OT1 LY1
 derivate = no
diff --git a/testfiles/tlb1841.tlg b/testfiles/tlb1841.tlg
index 27aea0f..2cb606b 100644
--- a/testfiles/tlb1841.tlg
+++ b/testfiles/tlb1841.tlg
@@ -6,6 +6,10 @@ Main Class: article
     Options: a4paper,12pt
 Package: babel
     Options: french,english
+(../babel-french.tex
+Package babel Info: Importing font and identification data for french
+(babel)             from babel-fr.ini. Reported on input line ....
+)
 > \box...=
 \hbox(7.38097+0.0)x37.99127
 .\OT1/cmr/m/n/12 t
diff --git a/testfiles/tlb3505.tlg b/testfiles/tlb3505.tlg
index 72da327..515af60 100644
--- a/testfiles/tlb3505.tlg
+++ b/testfiles/tlb3505.tlg
@@ -39,6 +39,10 @@ l. ......tonikogreek}{>en >arq~h| >~hn <o l'ogoc.}}
 .\T1/cmr/m/n/10 !
 ! OK.
 l. ...\testit{Ah!}
+(../babel-french.tex
+Package babel Info: Importing font and identification data for french
+(babel)             from babel-fr.ini. Reported on input line ....
+)
 > \box...=
 \hbox(6.8872+0.0)x17.49573
 .\T1/cmr/m/n/10 A





More information about the latex3-commits mailing list.