[latex3-commits] [latex3/babel] main: New error mechanism (with tags). (b488d60)

github at latex-project.org github at latex-project.org
Fri Jan 12 19:23:32 CET 2024


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

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

commit b488d60c6b12eefc664077666b4e207f90b63889
Author: Javier <email at localhost>
Date:   Fri Jan 12 19:23:32 2024 +0100

    New error mechanism (with tags).


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

b488d60c6b12eefc664077666b4e207f90b63889
 README.md      |   6 +-
 babel-code.pdf | Bin 642704 -> 646629 bytes
 babel.dtx      | 412 ++++++++++++++++++++++++++++++++++-----------------------
 babel.ins      |   3 +-
 babel.pdf      | Bin 419409 -> 419558 bytes
 bbcompat.dtx   |   2 +-
 6 files changed, 253 insertions(+), 170 deletions(-)

diff --git a/README.md b/README.md
index 55553c8..0649a00 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-## Babel 24.1
+## Babel 24.1.37776
 
-2024-01-07
+(dev)
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages. Many
@@ -48,6 +48,8 @@ respective authors.
 
 ### Summary of latest changes
 ```
+24.2 (dev)
+
 24.1 2024-01-07
      * New version numbering scheme.
      * New key in \babelprovide: interchar (xe).
diff --git a/babel-code.pdf b/babel-code.pdf
index d9b3837..7fb291b 100644
Binary files a/babel-code.pdf and b/babel-code.pdf differ
diff --git a/babel.dtx b/babel.dtx
index 4bf1f3e..ebfea61 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2024/01/07 v24.1 The Babel package]
+\ProvidesFile{babel.dtx}[2024/01/12 v24.1.37776 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -5695,8 +5695,8 @@ wouldn’t exist.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=24.1>>
-%<<date=2024/01/07>>
+%<<version=24.1.37776>>
+%<<date=2024/01/12>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -6142,11 +6142,12 @@ wouldn’t exist.
      \directlua{ Babel = Babel or {}
        Babel.debug = false }%
    \fi}
-\def\bbl at error#1#2{%
+\def\bbl at error#1{% Implicit #2#3#4
   \begingroup
-    \def\\{\MessageBreak}%
-    \PackageError{babel}{#1}{#2}%
-  \endgroup}
+    \catcode`\\=0 \catcode`\==12 \catcode`\`=12
+    \input errbabel.def
+  \endgroup
+  \bbl at error{#1}}
 \def\bbl at warning#1{%
   \begingroup
     \def\\{\MessageBreak}%
@@ -6344,12 +6345,7 @@ wouldn’t exist.
   \bbl at csarg\ifx{opt@#1}\@nnil
     \bbl at csarg\edef{opt@#1}{#2}%
   \else
-    \bbl at error
-     {Bad option '#1=#2'. Either you have misspelled the\\%
-      key or there is a previous setting of '#1'. Valid\\%
-      keys are, among others, 'shorthands', 'main', 'bidi',\\%
-      'strings', 'config', 'headfoot', 'safe', 'math'.}%
-     {See the manual for further details.}
+    \bbl at error{bad-package-option}{#1}{#2}{}%
   \fi}
 %    \end{macrocode}
 %
@@ -6658,11 +6654,7 @@ wouldn’t exist.
 %<-core>
 \def\bbl at provide@locale{%
   \ifx\babelprovide\@undefined
-    \bbl at error{For a language to be defined on the fly 'base'\\%
-               is not enough, and the whole package must be\\%
-               loaded. Either delete the 'base' option or\\%
-               request the languages explicitly}%
-              {See the manual for further details.}%
+    \bbl at error{base-on-the-fly}{}{}{}%
   \fi
   \let\bbl at auxname\languagename % Still necessary. TODO
   \bbl at ifunset{bbl at bcp@map@\languagename}{}% Move uplevel??
@@ -7413,10 +7405,7 @@ wouldn’t exist.
 % will use the concept of `locale':
 %
 %    \begin{macrocode}
-\providecommand\setlocale{%
-  \bbl at error
-    {Not yet available}%
-    {Find an armchair, sit down and wait}}
+\providecommand\setlocale{\bbl at error{not-yet-available}{}{}{}}
 \let\uselocale\setlocale
 \let\locale\setlocale
 \let\selectlocale\setlocale
@@ -7472,12 +7461,7 @@ wouldn’t exist.
     They might not work as expected and their behavior\\%
     could change in the future.\\%
     Reported}}
-\def\@nolanerr#1{%
-  \bbl at error
-    {You haven't defined the language '#1' yet.\\%
-     Perhaps you misspelled it or your installation\\%
-     is not complete}%
-    {Your command will be ignored, type <return> to proceed}}
+\def\@nolanerr#1{\bbl at error{undefined-language}{#1}{}{}}
 \def\@nopatterns#1{%
   \bbl at warning
     {No hyphenation patterns were preloaded for\\%
@@ -8505,10 +8489,7 @@ wouldn’t exist.
      \initiate at active@char{#2}%
      #1%
      \bbl at activate{#2}}%
-    {\bbl at error
-       {I can't declare a shorthand turned off (\string#2)}
-       {Sorry, but you can't use shorthands which have been\\%
-        turned off in the package options}}}
+    {\bbl at error{shorthand-is-off}{}{#2}{}}}
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -8583,10 +8564,7 @@ wouldn’t exist.
          \bbl at activate{#2}%
        \fi
      \fi}%
-    {\bbl at error
-       {Cannot declare a shorthand turned off (\string#2)}
-       {Sorry, but you cannot use shorthands which have been\\%
-        turned off in the package options}}}
+    {\bbl at error{shorthand-is-off}{}{#2}{}}}
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -8594,13 +8572,7 @@ wouldn’t exist.
 %  \begin{macro}{\@notshorthand}
 %
 %    \begin{macrocode}
-\def\@notshorthand#1{%
-  \bbl at error{%
-    The character '\string #1' should be made a shorthand character;\\%
-    add the command \string\useshorthands\string{#1\string} to
-    the preamble.\\%
-    I will ignore your instruction}%
-   {You may proceed, but expect unexpected results}}
+\def\@notshorthand#1{\bbl at error{not-a-shorthand}{#1}{}{}}
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -8639,10 +8611,7 @@ wouldn’t exist.
 \def\bbl at switch@sh#1#2{%
   \ifx#2\@nnil\else
     \bbl at ifunset{bbl at active@\string#2}%
-      {\bbl at error
-         {I can't switch '\string#2' on or off--not a shorthand}%
-         {This character is not a shorthand. Maybe you made\\%
-          a typing mistake? I will ignore your instruction.}}%
+      {\bbl at error{not-a-shorthand-b}{}{#2}{}}%
       {\ifcase#1%   off, on, off*
          \catcode`#212\relax
        \or
@@ -8845,9 +8814,7 @@ wouldn’t exist.
 %
 %    \begin{macrocode}
 \newcommand*{\@attrerr}[2]{%
-  \bbl at error
-    {The attribute #2 is unknown for language #1.}%
-    {Your command will be ignored, type <return> to proceed}}
+  \bbl at error{unknown-attribute}{#1}{#2}{}}
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -9384,9 +9351,7 @@ wouldn’t exist.
   \bbl at scswitch
   \ifx\bbl at G\@empty
     \def\SetString##1##2{%
-      \bbl at error{Missing group for string \string##1}%
-        {You must assign strings to some category, typically\\%
-         captions or extras, but you set none}}%
+      \bbl at error{missing-group}{##1}{}{}}%
   \fi
   \ifx\@empty#1%
     \bbl at usehooks{defaultcommands}{}%
@@ -10180,14 +10145,8 @@ wouldn’t exist.
 \or
   \input xebabel.def
 \fi
-\providecommand\babelfont{%
-  \bbl at error
-    {This macro is available only in LuaLaTeX and XeLaTeX.}%
-    {Consider switching to these engines.}}
-\providecommand\babelprehyphenation{%
-  \bbl at error
-    {This macro is available only in LuaLaTeX.}%
-    {Consider switching to that engine.}}
+\providecommand\babelfont{\bbl at error@{only-lua-xe}{}{}{}}
+\providecommand\babelprehyphenation{\bbl at error{only-lua}{}{}{}}
 \ifx\babelposthyphenation\@undefined
   \let\babelposthyphenation\babelprehyphenation
   \let\babelpatterns\babelprehyphenation
@@ -10235,9 +10194,7 @@ wouldn’t exist.
       \bbl at renewinikey##1\@@{##2}%
     \else
       \bbl at csarg\ifx{KVP@##1}\@nnil\else
-        \bbl at error
-          {Unknown key '##1' in \string\babelprovide}%
-          {See the manual for valid keys}%
+        \bbl at error{unknown-provide-key}{##1}{}{}%
       \fi
       \bbl at csarg\def{KVP@##1}{##2}%
     \fi}%
@@ -10413,9 +10370,7 @@ wouldn’t exist.
   % For bidi texts, to switch the font based on direction
   \ifx\bbl at KVP@mapfont\@nnil\else
     \bbl at ifsamestring{\bbl at KVP@mapfont}{direction}{}%
-      {\bbl at error{Option '\bbl at KVP@mapfont' unknown for\\%
-                  mapfont. Use 'direction'.%
-                 {See the manual for details.}}}%
+      {\bbl at error{unknown-mapfont}{}{}{}}%
     \bbl at ifunset{bbl at lsys@\languagename}{\bbl at provide@lsys{\languagename}}{}%
     \bbl at ifunset{bbl at wdir@\languagename}{\bbl at provide@dirs{\languagename}}{}%
     \ifx\bbl at mapselect\@undefined % TODO. See onchar.
@@ -10825,11 +10780,7 @@ wouldn’t exist.
   \global\let\bbl at extend@ini\@gobble
   \openin\bbl at readstream=babel-#1.ini
   \ifeof\bbl at readstream
-    \bbl at error
-      {There is no ini file for the requested language\\%
-       (#1: \languagename). Perhaps you misspelled it or your\\%
-       installation is not complete.}%
-      {Fix the name or reinstall babel.}%
+    \bbl at error{no-ini-file}{#1}{}{}%
   \else
     % == Store ini data in \bbl at inidata ==
     \catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\&=12
@@ -11100,9 +11051,7 @@ wouldn’t exist.
 %    \begin{macrocode}
 \def\bbl at inikv@counters#1#2{%
   \bbl at ifsamestring{#1}{digits}%
-    {\bbl at error{The counter name 'digits' is reserved for mapping\\%
-                decimal digits}%
-               {Use another name.}}%
+    {\bbl at error{digits-is-reserved}{}{}{}}%
     {}%
   \def\bbl at tempc{#1}%
   \bbl at trim@def{\bbl at tempb*}{#2}%
@@ -11393,10 +11342,7 @@ wouldn’t exist.
   \else\ifnum#1<1000 \expandafter\@gobble\number#1 %
   \else\ifnum#1<10000 \expandafter\@gobbletwo\number#1 %
   \else
-    \bbl at error
-      {Currently two-digit years are restricted to the\\
-       range 0-9999.}%
-      {There is little you can do. Sorry.}%
+    \bbl at error{limit-two-digits}{}{}{}%
   \fi\fi\fi\fi}}
 \newcommand\BabelDateyyyy[1]{{\number#1}} % TODO - add leading 0
 \newcommand\BabelDateU[1]{{\number#1}}%
@@ -11641,8 +11587,7 @@ wouldn’t exist.
      \fi}%
     {\bbl at cs{cntr@#1.F.\number#5#6#7#8@\languagename}}}
 \def\bbl at alphnum@invalid#1{%
-  \bbl at error{Alphabetic numeral too large (#1)}%
-    {Currently this is the limit.}}
+  \bbl at error{alphabetic-too-large}{#1}{}{}}
 %    \end{macrocode}
 %
 % The information in the identification section can be useful, so the
@@ -11658,10 +11603,7 @@ wouldn’t exist.
     \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.}}%
+      {\bbl at error{no-ini-info}{}{}{}}%
       {#1}%
   \fi}
 % \@namedef{bbl at info@name.locale}{lcname}
@@ -11704,9 +11646,7 @@ wouldn’t exist.
       {\bbl at bcpdata@ii{#1#2#3#4#5#6}\languagename}}%   
   \def\bbl at bcpdata@ii#1#2{%
     \bbl at ifunset{bbl at info@#1.tag.bcp47}%
-      {\bbl at error{Unknown field '#1' in \string\BCPdata.\\%
-                  Perhaps you misspelled it.}%
-                 {See the manual for details.}}%
+      {\bbl at error{unknown-ini-field}{#1}{}{}}%
       {\bbl at ifunset{bbl@\csname bbl at info@#1.tag.bcp47\endcsname @#2}{}%
         {\bbl at cs{\csname bbl at info@#1.tag.bcp47\endcsname @#2}}}}
 \fi
@@ -11799,11 +11739,7 @@ wouldn’t exist.
 \def\bbl at getproperty@x#1#2#3{%
   \bbl at getproperty@s{#1}{#2}{#3}%
   \ifx#1\relax
-    \bbl at error
-      {Unknown key for locale '#2':\\%
-       #3\\%
-       \string#1 will be set to \relax}%
-      {Perhaps you misspelled it.}%
+    \bbl at error{unknown-locale-key}{#1}{#2}{#3}%
   \fi}
 \let\bbl at ini@loaded\@empty
 \newcommand\LocaleForEach{\bbl at foreach\bbl at ini@loaded}
@@ -11834,10 +11770,7 @@ wouldn’t exist.
       \expandafter\expandafter\expandafter\@gobble
     \fi
   \fi      
-  {\bbl at error   % The error is gobbled if everything went ok.
-     {Currently, #1 related features can be adjusted only\\%
-      in the main vertical list.}%
-     {Maybe things change in the future, but this is what it is.}}}
+  {\bbl at error{adjust-only-vertical}{#1}{}{}}}% Gobbled if everything went ok. 
 \@namedef{bbl at ADJ@bidi.mirroring at on}{%
   \bbl at adjust@lua{bidi}{mirroring_enabled=true}}
 \@namedef{bbl at ADJ@bidi.mirroring at off}{%
@@ -11873,10 +11806,7 @@ wouldn’t exist.
     #1%
     \expandafter\@gobble
   \fi
-  {\bbl at error   % The error is gobbled if everything went ok.
-     {Currently, layout related features can be adjusted only\\%
-      in vertical mode.}%
-     {Maybe things change in the future, but this is what it is.}}}
+  {\bbl at error{layout-only-vertical}{}{}{}}}% Gobbled if everything went ok.
 \@namedef{bbl at ADJ@layout.tabular at on}{%
   \ifnum\bbl at tabular@mode=\tw@
     \bbl at adjust@layout{\let\@tabular\bbl at NL@@tabular}%
@@ -12640,11 +12570,7 @@ wouldn’t exist.
 \ifodd\bbl at engine
 \else % TODO. Move to txtbabel
   \ifnum\bbl at bidimode>100 \ifnum\bbl at bidimode<200 % Any xe+lua bidi=
-    \bbl at error
-      {The bidi method 'basic' is available only in\\%
-       luatex. I'll continue with 'bidi=default', so\\%
-       expect wrong results}%
-      {See the manual for further details.}%
+    \bbl at error{bidi-only-lua}{}{}{}%
     \let\bbl at beforeforeign\leavevmode
     \AtEndOfPackage{%
       \EnableBabelHook{babel-bidi}%
@@ -12760,8 +12686,7 @@ wouldn’t exist.
     \ifhmode
       \ifnum\currentgrouplevel>\z@
         \ifnum\currentgrouplevel=\bbl at dirlevel
-          \bbl at error{Multiple bidi settings inside a group}%
-            {I'll insert a new group, but expect wrong results.}%
+          \bbl at error{multiple-bidi}{}{}{}%
           \bgroup\aftergroup#2\aftergroup\egroup
         \else
           \ifcase\currentgrouptype\or % 0 bottom
@@ -12895,14 +12820,7 @@ wouldn’t exist.
          If it’s the main language, try adding `provide=*'\\%
          to the babel package options}}%
       {\let\bbl at tempa\empty}%
-     \bbl at error{%
-       Unknown option '\CurrentOption'. Either you misspelled it\\%
-       or the language definition file \CurrentOption.ldf\\%
-       was not found%
-       \bbl at tempa}{%
-       Valid options are, among others: shorthands=, KeepShorthandsActive,\\%
-       activeacute, activegrave, noconfigs, safe=, main=, math=\\%
-       headfoot=, strings=, config=, hyphenmap=, or a language name.}}}
+     \bbl at error{unknown-package-option}{}{}{}}}
 %    \end{macrocode}
 %
 % Now, we set a few language options whose names are different from
@@ -12952,9 +12870,7 @@ wouldn’t exist.
     {\typeout{*************************************^^J%
              * Local config file \bbl at opt@config.cfg used^^J%
              *}}%
-    {\bbl at error{%
-       Local config file '\bbl at opt@config.cfg' not found}{%
-       Perhaps you misspelled it.}}%
+    {\bbl at error{config-not-found}{}{}{}}%
 \fi
 %    \end{macrocode}
 %
@@ -13110,10 +13026,7 @@ wouldn’t exist.
 \fi
 \bbl at exp{% 
   \\\AtBeginDocument{\\\bbl at usehooks@lang{/}{begindocument}{{}}}}%
-\def\AfterBabelLanguage{%
-  \bbl at error
-    {Too late for \string\AfterBabelLanguage}%
-    {Languages have been loaded, so I can do nothing}}
+\def\AfterBabelLanguage{\bbl at error{late-after-babel}{}{}{}}
 %    \end{macrocode}
 %      
 % In order to catch the case where the user didn’t specify a
@@ -13158,6 +13071,197 @@ wouldn’t exist.
 \input babel.def
 \let\bbl at onlyswitch\@undefined
 %</kernel>
+%
+% \section{Error messages}
+%
+% They are loaded when |\bll at error| is first called. To save space, the
+% main code just identifies them with a tag, and messages are stored in
+% a separate file. Since it can be loaded anywhere, you make sure some
+% catcodes have the right value, although those for |\|, |`|, |^^M|,
+% |%| and |=| are reset before loading the file.
+%
+%<*errors>
+\catcode`\{=1  \catcode`\}=2  \catcode`\#=6
+\catcode`\:=12 \catcode`\,=12 \catcode`\.=12 \catcode`\-=12
+\catcode`\'=12 \catcode`\(=12 \catcode`\)=12 
+\catcode`\@=11 \catcode`\^=7
+%
+\ifx\MessageBreak\@undefined
+  \gdef\bbl at error@i#1#2{%
+    \begingroup
+      \newlinechar=`\^^J
+      \def\\{^^J(babel) }%
+      \errhelp{#2}\errmessage{\\#1}%
+    \endgroup}
+\else
+  \gdef\bbl at error@i#1#2{%
+    \begingroup
+      \def\\{\MessageBreak}%
+      \PackageError{babel}{#1}{#2}%
+    \endgroup}
+\fi
+\def\bbl at errmessage#1#2#3{%
+  \expandafter\gdef\csname bbl at err@#1\endcsname##1##2##3{%
+    \bbl at error@i{#2}{#3}}} 
+% Implicit #2#3#4:
+\gdef\bbl at error#1{\csname bbl at err@#1\endcsname}
+%
+\bbl at errmessage{not-yet-available}
+    {Not yet available}%
+    {Find an armchair, sit down and wait}
+\bbl at errmessage{bad-package-option}%
+   {Bad option '#1=#2'. Either you have misspelled the\\%
+    key or there is a previous setting of '#1'. Valid\\%
+    keys are, among others, 'shorthands', 'main', 'bidi',\\%
+    'strings', 'config', 'headfoot', 'safe', 'math'.}%
+   {See the manual for further details.}
+\bbl at errmessage{base-on-the-fly}
+   {For a language to be defined on the fly 'base'\\%
+    is not enough, and the whole package must be\\%
+    loaded. Either delete the 'base' option or\\%
+    request the languages explicitly}%
+   {See the manual for further details.}
+\bbl at errmessage{undefined-language}
+   {You haven't defined the language '#1' yet.\\%
+    Perhaps you misspelled it or your installation\\%
+    is not complete}%
+   {Your command will be ignored, type <return> to proceed}
+\bbl at errmessage{shorthand-is-off}
+   {I can't declare a shorthand turned off (\string#2)}
+   {Sorry, but you can't use shorthands which have been\\%
+    turned off in the package options}
+\bbl at errmessage{not-a-shorthand}
+   {The character '\string #1' should be made a shorthand character;\\%
+    add the command \string\useshorthands\string{#1\string} to
+    the preamble.\\%
+    I will ignore your instruction}%
+   {You may proceed, but expect unexpected results}
+\bbl at errmessage{not-a-shorthand-b}
+   {I can't switch '\string#2' on or off--not a shorthand}%
+   {This character is not a shorthand. Maybe you made\\%
+    a typing mistake? I will ignore your instruction.}
+\bbl at errmessage{unknown-attribute}
+   {The attribute #2 is unknown for language #1.}%
+   {Your command will be ignored, type <return> to proceed}
+\bbl at errmessage{missing-group}
+   {Missing group for string \string#1}%
+   {You must assign strings to some category, typically\\%
+    captions or extras, but you set none}
+\bbl at errmessage{only-lua-xe}
+   {This macro is available only in LuaLaTeX and XeLaTeX.}%
+   {Consider switching to these engines.}
+\bbl at errmessage{only-lua}
+   {This macro is available only in LuaLaTeX.}%
+   {Consider switching to that engine.}
+\bbl at errmessage{unknown-provide-key}
+   {Unknown key '#1' in \string\babelprovide}%
+   {See the manual for valid keys}%
+\bbl at errmessage{unknown-mapfont}
+   {Option '\bbl at KVP@mapfont' unknown for\\%
+    mapfont. Use 'direction'.}%
+   {See the manual for details.}
+\bbl at errmessage{no-ini-file}
+   {There is no ini file for the requested language\\%
+    (#1: \languagename). Perhaps you misspelled it or your\\%
+    installation is not complete.}%
+   {Fix the name or reinstall babel.}
+\bbl at errmessage{digits-is-reserved}
+   {The counter name 'digits' is reserved for mapping\\%
+    decimal digits}%
+   {Use another name.}
+\bbl at errmessage{limit-two-digits}
+   {Currently two-digit years are restricted to the\\
+    range 0-9999.}%
+   {There is little you can do. Sorry.}
+\bbl at errmessage{alphabetic-too-large}
+ {Alphabetic numeral too large (#1)}%
+ {Currently this is the limit.}
+\bbl at errmessage{no-ini-info}
+   {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 errmessage{unknown-ini-field}
+   {Unknown field '#1' in \string\BCPdata.\\%
+    Perhaps you misspelled it.}%
+   {See the manual for details.}
+\bbl at errmessage{unknown-locale-key}
+   {Unknown key for locale '#2':\\%
+    #3\\%
+    \string#1 will be set to \relax}%
+   {Perhaps you misspelled it.}%
+\bbl at errmessage{adjust-only-vertical}
+   {Currently, #1 related features can be adjusted only\\%
+    in the main vertical list.}%
+   {Maybe things change in the future, but this is what it is.}
+\bbl at errmessage{layout-only-vertical}
+   {Currently, layout related features can be adjusted only\\%
+    in vertical mode.}%
+   {Maybe things change in the future, but this is what it is.}
+\bbl at errmessage{bidi-only-lua}
+   {The bidi method 'basic' is available only in\\%
+    luatex. I'll continue with 'bidi=default', so\\%
+    expect wrong results}%
+   {See the manual for further details.}
+\bbl at errmessage{multiple-bidi}
+   {Multiple bidi settings inside a group}%
+   {I'll insert a new group, but expect wrong results.}
+\bbl at errmessage{unknown-package-option}
+   {Unknown option '\CurrentOption'. Either you misspelled it\\%
+    or the language definition file \CurrentOption.ldf\\%
+    was not found%
+    \bbl at tempa}
+   {Valid options are, among others: shorthands=, KeepShorthandsActive,\\%
+    activeacute, activegrave, noconfigs, safe=, main=, math=\\%
+    headfoot=, strings=, config=, hyphenmap=, or a language name.}
+\bbl at errmessage{config-not-found}
+   {Local config file '\bbl at opt@config.cfg' not found}%
+   {Perhaps you misspelled it.}
+\bbl at errmessage{late-after-babel}
+   {Too late for \string\AfterBabelLanguage}%
+   {Languages have been loaded, so I can do nothing}
+\bbl at errmessage{double-hyphens-class}
+   {Double hyphens aren't allowed in \string\babelcharclass\\%
+    because it's potentially ambiguous}%
+   {See the manual for further info}
+\bbl at errmessage{unknown-interchar}
+   {'#1' for '\languagename' cannot be enabled.\\%
+    Maybe there is a typo.}%
+   {See the manual for further details.}
+\bbl at errmessage{unknown-interchar-b}
+   {'#1' for '\languagename' cannot be disabled.\\%
+    Maybe there is a typo.}%
+   {See the manual for further details.}
+\bbl at errmessage{charproperty-only-vertical}
+   {\string\babelcharproperty\space can be used only in\\%
+    vertical mode (preamble or between paragraphs)}%
+   {See the manual for further info}
+\bbl at errmessage{unknown-char-property}
+   {No property named '#2'. Allowed values are\\%
+    direction (bc), mirror (bmg), and linebreak (lb)}%
+   {See the manual for further info}
+\bbl at errmessage{bad-transform-option}
+   {Bad option '#1' in a transform.\\%
+    I’ll ignore it but expect more errors}%
+   {See the manual for further info.}
+\bbl at errmessage{font-conflict-transforms}
+   {Transforms cannot be re-assigned to different\\%
+    fonts. The conflict is in '\bbl at kv@label'.\\%
+    Apply the same fonts or use a different label}%
+   {See the manual for further details.}
+\bbl at errmessage{transform-not-available}
+   {'#1' for '\languagename' cannot be enabled.\\%
+    Maybe there is a typo or it’s a font-dependent transform}%
+   {See the manual for further details.}
+\bbl at errmessage{transform-not-available-b}
+   {'#1' for '\languagename' cannot be disabled.\\%
+    Maybe there is a typo or it’s a font-dependent transform}%
+   {See the manual for further details.}
+\bbl at errmessage{year-out-range}
+   {Year out of range.\\%
+    The allowed range is #1}%
+   {See the manual for further details.}
+%</errors>
 %<*patterns>
 %    \end{macrocode}
 %
@@ -13386,7 +13490,7 @@ wouldn’t exist.
   \def\bbl at usehooks##1##2{}% TODO. Temporary!!
   \def\setlocale{%
     \errhelp{Find an armchair, sit down and wait}%
-    \errmessage{Not yet available}}%
+    \errmessage{(babel) Not yet available}}%
   \let\uselocale\setlocale
   \let\locale\setlocale
   \let\selectlocale\setlocale
@@ -14023,9 +14127,7 @@ wouldn’t exist.
   \else\ifnum\count@=\z@
     \bbl at charclass{-}%
   \else
-    \bbl at error{Double hyphens aren't allowed in \string\babelcharclass\\%
-               because it's potentially ambiguous}%
-              {See the manual for further info}%
+    \bbl at error{double-hyphens-class}{}{}{}%
   \fi\fi}
 %    \end{macrocode}
 %
@@ -14059,17 +14161,11 @@ wouldn’t exist.
               @#3@#4@#2 \@empty\endcsname}}}}
 \DeclareRobustCommand\enablelocaleinterchar[1]{%
   \bbl at ifunset{bbl at ic@#1@\languagename}%
-    {\bbl at error
-       {'#1' for '\languagename' cannot be enabled.\\%
-        Maybe there is a typo.}%
-       {See the manual for further details.}}% 
+    {\bbl at error{unknown-interchar}{#1}{}{}}% 
     {\bbl at csarg\let{ic@#1@\languagename}\@firstofone}}
 \DeclareRobustCommand\disablelocaleinterchar[1]{%
   \bbl at ifunset{bbl at ic@#1@\languagename}%
-    {\bbl at error
-       {'#1' for '\languagename' cannot be disabled.\\%
-        Maybe there is a typo.}%
-       {See the manual for further details.}}% 
+    {\bbl at error{unknown-interchar-b}{#1}{}{}}% 
     {\bbl at csarg\let{ic@#1@\languagename}\@gobble}}
 %</xetex>
 %    \end{macrocode}
@@ -15330,16 +15426,12 @@ end
   \ifvmode
     \expandafter\bbl at chprop
   \else 
-    \bbl at error{\string\babelcharproperty\space can be used only in\\%
-               vertical mode (preamble or between paragraphs)}%
-              {See the manual for further info}%
+    \bbl at error{charproperty-only-vertical}{}{}{}%
   \fi}
 \newcommand\bbl at chprop[3][\the\count@]{%
   \@tempcnta=#1\relax
-  \bbl at ifunset{bbl at chprop@#2}%
-    {\bbl at error{No property named '#2'. Allowed values are\\%
-                direction (bc), mirror (bmg), and linebreak (lb)}%
-               {See the manual for further info}}%
+  \bbl at ifunset{bbl at chprop@#2}% {unknown-char-property}
+    {\bbl at error{unknown-char-property}{}{#2}{}}%
     {}%
   \loop
     \bbl at cs{chprop@#2}{#3}%
@@ -15443,10 +15535,7 @@ end
         \in@{,####1,}{,nil,step,data,remove,insert,string,no,pre,&%
             no,post,penalty,kashida,space,spacefactor,}&%
         \ifin@\else
-          \bbl at error
-           {Bad option '####1' in a transform.\\&%
-            I’ll ignore it but expect more errors}&%
-           {See the manual for further info.}&%
+          \bbl at error{bad-transform-option}{####1}{}{}&%
         \fi}}&% 
     \let\bbl at kv@attribute\relax
     \let\bbl at kv@label\relax
@@ -15463,11 +15552,7 @@ end
           \bbl at ifsamestring{#3,\bbl at kv@label}{##1,##2}&%
             {\bbl at ifsamestring{\bbl at kv@fonts}{##3}&%
                {\count@\@ne}&%
-               {\bbl at error
-                 {Transforms cannot be re-assigned to different\\&%
-                  fonts. The conflict is in '\bbl at kv@label'.\\&%
-                  Apply the same fonts or use a different label}&%
-                 {See the manual for further details.}}}&%
+               {\bbl at error{font-conflict-transforms}{}{}{}}}&%
             {}}&%
         \bbl at transfont@list
         \ifnum\count@=\z@
@@ -15556,17 +15641,11 @@ end
       {}}}
 \DeclareRobustCommand\enablelocaletransform[1]{%
   \bbl at ifunset{bbl at ATR@#1@\languagename @}%
-    {\bbl at error
-       {'#1' for '\languagename' cannot be enabled.\\%
-        Maybe there is a typo or it’s a font-dependent transform}%
-       {See the manual for further details.}}% 
+    {\bbl at error{transform-not-available}{#1}{}{}}%
     {\bbl at csarg\setattribute{ATR@#1@\languagename @}\@ne}}
 \DeclareRobustCommand\disablelocaletransform[1]{%
   \bbl at ifunset{bbl at ATR@#1@\languagename @}%
-    {\bbl at error
-       {'#1' for '\languagename' cannot be disabled.\\%
-        Maybe there is a typo or it’s a font-dependent transform}%
-       {See the manual for further details.}}% 
+    {\bbl at error{transform-not-available-b}{#1}{}{}}% 
     {\bbl at csarg\unsetattribute{ATR@#1@\languagename @}}}
 \def\bbl at activateposthyphen{%
   \let\bbl at activateposthyphen\relax
@@ -24126,7 +24205,7 @@ Babel.cjk_breaks = {
   \ifnum#2>2014 \ifnum#2<2038
     \bbl at afterfi\expandafter\@gobble
   \fi\fi
-    {\bbl at error{Year~out~of~range}{The~allowed~range~is~2014-2038}}%
+    {\bbl at error{year-out-range}{2014-2038}{}{}}%
   \edef\bbl at tempd{\fp_eval:n{ % (Julian) day
     \bbl at cs@jd{#2}{#3}{#4} + 0.5 - 2400000 #1}}%
   \count@\@ne
@@ -24437,7 +24516,7 @@ Babel.cjk_breaks = {
   \ifnum\bbl at tempa>2012 \ifnum\bbl at tempa<2051
     \bbl at afterfi\expandafter\@gobble
   \fi\fi
-    {\bbl at error{Year~out~of~range}{The~allowed~range~is~2013-2050}}%
+    {\bbl at error{year-out-range}{2013-2050}{}{}}%
   \bbl at xin@{\bbl at tempa}{\bbl at cs@firstjal at xx}%
   \ifin@\def\bbl at tempe{20}\else\def\bbl at tempe{21}\fi
   \edef\bbl at tempc{\fp_eval:n{\bbl at cs@jd{\bbl at tempa}{#2}{#3}+.5}}% current
@@ -24736,12 +24815,13 @@ Babel.cjk_breaks = {
   \ifx#2\@empty\else\expandafter\zap at space\fi
   #2}
 \let\bbl at trace\@gobble
-\def\bbl at error#1#2{%
+\def\bbl at error#1{% Implicit #2#3#4
   \begingroup
-    \newlinechar=`\^^J
-    \def\\{^^J(babel) }%
-    \errhelp{#2}\errmessage{\\#1}%
-  \endgroup}
+    \catcode`\\=0   \catcode`\==12 \catcode`\`=12
+    \catcode`\^^M=5 \catcode`\%=14
+    \input errbabel.def
+  \endgroup
+  \bbl at error{#1}}
 \def\bbl at warning#1{%
   \begingroup
     \newlinechar=`\^^J
diff --git a/babel.ins b/babel.ins
index 5c80152..169b071 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{2024/01/07}
+\def\filedate{2024/01/12}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
@@ -161,6 +161,7 @@
           \file{switch.def}{\from{babel.dtx}{kernel}}
           \file{hyphen.cfg}{\from{babel.dtx}{patterns}}
           \file{nil.ldf}{\from{babel.dtx}{nil}}
+          \file{errbabel.def}{\from{babel.dtx}{errors}}
           \file{babel-ca-buddhist.tex}{\from{babel.dtx}{ca-buddhist}}
           \file{babel-ca-coptic.tex}{\from{babel.dtx}{ca-coptic}}
           \file{babel-ca-ethiopic.tex}{\from{babel.dtx}{ca-ethiopic}}
diff --git a/babel.pdf b/babel.pdf
index b28a330..e9d0bfc 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index e1de136..a2c82de 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2024/01/07 v24.1]
+\ProvidesFile{bbcompat.dtx}[2024/01/12 v24.1.37776]
 %</dtx>
 %
 %% File 'bbcompat.dtx'





More information about the latex3-commits mailing list.