summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/babel/babel.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/babel.sty')
-rw-r--r--Master/texmf-dist/tex/generic/babel/babel.sty192
1 files changed, 54 insertions, 138 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/babel.sty b/Master/texmf-dist/tex/generic/babel/babel.sty
index abd887ba0e4..0eb07150d03 100644
--- a/Master/texmf-dist/tex/generic/babel/babel.sty
+++ b/Master/texmf-dist/tex/generic/babel/babel.sty
@@ -34,7 +34,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{babel}[2024/01/07 v24.1 The Babel package]
+\ProvidesPackage{babel}[2024/02/07 v24.2 The Babel package]
\@ifpackagewith{babel}{debug}
{\providecommand\bbl@trace[1]{\message{^^J[ #1 ]}}%
\let\bbl@debug\@firstofone
@@ -49,11 +49,12 @@
\directlua{ Babel = Babel or {}
Babel.debug = false }%
\fi}
-\def\bbl@error#1#2{%
+\def\bbl@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@error{#1}}
\def\bbl@warning#1{%
\begingroup
\def\\{\MessageBreak}%
@@ -387,12 +388,7 @@
\bbl@csarg\ifx{opt@#1}\@nnil
\bbl@csarg\edef{opt@#1}{#2}%
\else
- \bbl@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@error{bad-package-option}{#1}{#2}{}%
\fi}
\let\bbl@language@opts\@empty
\DeclareOption*{%
@@ -470,8 +466,8 @@
\expandafter\@secondoftwo
\fi}
\fi
-\def\bbl@version{24.1}
-\def\bbl@date{2024/01/07}
+\def\bbl@version{24.2}
+\def\bbl@date{2024/02/07}
\ifx\language\@undefined
\csname newcount\endcsname\language
\fi
@@ -553,11 +549,7 @@
\let\bbl@initoload\relax
\def\bbl@provide@locale{%
\ifx\babelprovide\@undefined
- \bbl@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@error{base-on-the-fly}{}{}{}%
\fi
\let\bbl@auxname\languagename % Still necessary. TODO
\bbl@ifunset{bbl@bcp@map@\languagename}{}% Move uplevel??
@@ -922,10 +914,7 @@
\fi
\ifx\originalTeX\@undefined\let\originalTeX\@empty\fi
\ifx\babel@beginsave\@undefined\let\babel@beginsave\relax\fi
-\providecommand\setlocale{%
- \bbl@error
- {Not yet available}%
- {Find an armchair, sit down and wait}}
+\providecommand\setlocale{\bbl@error{not-yet-available}{}{}{}}
\let\uselocale\setlocale
\let\locale\setlocale
\let\selectlocale\setlocale
@@ -953,12 +942,7 @@
They might not work as expected and their behavior\\%
could change in the future.\\%
Reported}}
-\def\@nolanerr#1{%
- \bbl@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@error{undefined-language}{#1}{}{}}
\def\@nopatterns#1{%
\bbl@warning
{No hyphenation patterns were preloaded for\\%
@@ -1442,10 +1426,7 @@
\initiate@active@char{#2}%
#1%
\bbl@activate{#2}}%
- {\bbl@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@error{shorthand-is-off}{}{#2}{}}}
\def\user@language@group{user@\language@group}
\def\bbl@set@user@generic#1#2{%
\bbl@ifunset{user@generic@active#1}%
@@ -1478,17 +1459,8 @@
\bbl@activate{#2}%
\fi
\fi}%
- {\bbl@error
- {Cannot declare a shorthand turned off (\string#2)}
- {Sorry, but you cannot use shorthands which have been\\%
- turned off in the package options}}}
-\def\@notshorthand#1{%
- \bbl@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}}
+ {\bbl@error{shorthand-is-off}{}{#2}{}}}
+\def\@notshorthand#1{\bbl@error{not-a-shorthand}{#1}{}{}}
\newcommand*\shorthandon[1]{\bbl@switch@sh\@ne#1\@nnil}
\DeclareRobustCommand*\shorthandoff{%
\@ifstar{\bbl@shorthandoff\tw@}{\bbl@shorthandoff\z@}}
@@ -1496,10 +1468,7 @@
\def\bbl@switch@sh#1#2{%
\ifx#2\@nnil\else
\bbl@ifunset{bbl@active@\string#2}%
- {\bbl@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@error{not-a-shorthand-b}{}{#2}{}}%
{\ifcase#1% off, on, off*
\catcode`#212\relax
\or
@@ -1601,9 +1570,7 @@
\fi}}}
\@onlypreamble\languageattribute
\newcommand*{\@attrerr}[2]{%
- \bbl@error
- {The attribute #2 is unknown for language #1.}%
- {Your command will be ignored, type <return> to proceed}}
+ \bbl@error{unknown-attribute}{#1}{#2}{}}
\def\bbl@declare@ttribute#1#2#3{%
\bbl@xin@{,#2,}{,\BabelModifiers,}%
\ifin@
@@ -1890,9 +1857,7 @@
\bbl@scswitch
\ifx\bbl@G\@empty
\def\SetString##1##2{%
- \bbl@error{Missing group for string \string##1}%
- {You must assign strings to some category, typically\\%
- captions or extras, but you set none}}%
+ \bbl@error{missing-group}{##1}{}{}}%
\fi
\ifx\@empty#1%
\bbl@usehooks{defaultcommands}{}%
@@ -2245,14 +2210,8 @@
\or
\input xebabel.def
\fi
-\providecommand\babelfont{%
- \bbl@error
- {This macro is available only in LuaLaTeX and XeLaTeX.}%
- {Consider switching to these engines.}}
-\providecommand\babelprehyphenation{%
- \bbl@error
- {This macro is available only in LuaLaTeX.}%
- {Consider switching to that engine.}}
+\providecommand\babelfont{\bbl@error@{only-lua-xe}{}{}{}}
+\providecommand\babelprehyphenation{\bbl@error{only-lua}{}{}{}}
\ifx\babelposthyphenation\@undefined
\let\babelposthyphenation\babelprehyphenation
\let\babelpatterns\babelprehyphenation
@@ -2286,9 +2245,7 @@
\bbl@renewinikey##1\@@{##2}%
\else
\bbl@csarg\ifx{KVP@##1}\@nnil\else
- \bbl@error
- {Unknown key '##1' in \string\babelprovide}%
- {See the manual for valid keys}%
+ \bbl@error{unknown-provide-key}{##1}{}{}%
\fi
\bbl@csarg\def{KVP@##1}{##2}%
\fi}%
@@ -2439,14 +2396,17 @@
\let\bbl@mapselect\relax
\edef\bbl@prefontid{\fontid\font}}%
\def\bbl@mapdir##1{%
- {\def\languagename{##1}%
- \let\bbl@ifrestoring\@firstoftwo % To avoid font warning
- \bbl@switchfont
- \ifnum\fontid\font>\z@ % A hack, for the pgf nullfont hack
- \directlua{
- Babel.locale_props[\the\csname bbl@id@@##1\endcsname]%
- ['/\bbl@prefontid'] = \fontid\font\space}%
- \fi}}%
+ \begingroup
+ \setbox\z@\hbox{% Force text mode
+ \def\languagename{##1}%
+ \let\bbl@ifrestoring\@firstoftwo % To avoid font warning
+ \bbl@switchfont
+ \ifnum\fontid\font>\z@ % A hack, for the pgf nullfont hack
+ \directlua{
+ Babel.locale_props[\the\csname bbl@id@@##1\endcsname]%
+ ['/\bbl@prefontid'] = \fontid\font\space}%
+ \fi}%
+ \endgroup}%
\fi
\bbl@exp{\\\bbl@add\\\bbl@mapselect{\\\bbl@mapdir{\languagename}}}%
\fi
@@ -2456,9 +2416,7 @@
% For bidi texts, to switch the font based on direction
\ifx\bbl@KVP@mapfont\@nnil\else
\bbl@ifsamestring{\bbl@KVP@mapfont}{direction}{}%
- {\bbl@error{Option '\bbl@KVP@mapfont' unknown for\\%
- mapfont. Use 'direction'.%
- {See the manual for details.}}}%
+ {\bbl@error{unknown-mapfont}{}{}{}}%
\bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
\bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}%
\ifx\bbl@mapselect\@undefined % TODO. See onchar.
@@ -2818,11 +2776,7 @@
\global\let\bbl@extend@ini\@gobble
\openin\bbl@readstream=babel-#1.ini
\ifeof\bbl@readstream
- \bbl@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@error{no-ini-file}{#1}{}{}%
\else
% == Store ini data in \bbl@inidata ==
\catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\&=12
@@ -3022,9 +2976,7 @@
\fi}}
\def\bbl@inikv@counters#1#2{%
\bbl@ifsamestring{#1}{digits}%
- {\bbl@error{The counter name 'digits' is reserved for mapping\\%
- decimal digits}%
- {Use another name.}}%
+ {\bbl@error{digits-is-reserved}{}{}{}}%
{}%
\def\bbl@tempc{#1}%
\bbl@trim@def{\bbl@tempb*}{#2}%
@@ -3268,10 +3220,7 @@
\else\ifnum#1<1000 \expandafter\@gobble\number#1 %
\else\ifnum#1<10000 \expandafter\@gobbletwo\number#1 %
\else
- \bbl@error
- {Currently two-digit years are restricted to the\\
- range 0-9999.}%
- {There is little you can do. Sorry.}%
+ \bbl@error{limit-two-digits}{}{}{}%
\fi\fi\fi\fi}}
\newcommand\BabelDateyyyy[1]{{\number#1}} % TODO - add leading 0
\newcommand\BabelDateU[1]{{\number#1}}%
@@ -3469,8 +3418,7 @@
\fi}%
{\bbl@cs{cntr@#1.F.\number#5#6#7#8@\languagename}}}
\def\bbl@alphnum@invalid#1{%
- \bbl@error{Alphabetic numeral too large (#1)}%
- {Currently this is the limit.}}
+ \bbl@error{alphabetic-too-large}{#1}{}{}}
\def\bbl@localeinfo#1#2{%
\bbl@ifunset{bbl@info@#2}{#1}%
{\bbl@ifunset{bbl@\csname bbl@info@#2\endcsname @\languagename}{#1}%
@@ -3480,10 +3428,7 @@
\bbl@afterelse\bbl@localeinfo{}%
\else
\bbl@localeinfo
- {\bbl@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@error{no-ini-info}{}{}{}}%
{#1}%
\fi}
\@namedef{bbl@info@tag.ini}{lini}
@@ -3515,9 +3460,7 @@
{\bbl@bcpdata@ii{#1#2#3#4#5#6}\languagename}}%
\def\bbl@bcpdata@ii#1#2{%
\bbl@ifunset{bbl@info@#1.tag.bcp47}%
- {\bbl@error{Unknown field '#1' in \string\BCPdata.\\%
- Perhaps you misspelled it.}%
- {See the manual for details.}}%
+ {\bbl@error{unknown-ini-field}{#1}{}{}}%
{\bbl@ifunset{bbl@\csname bbl@info@#1.tag.bcp47\endcsname @#2}{}%
{\bbl@cs{\csname bbl@info@#1.tag.bcp47\endcsname @#2}}}}
\fi
@@ -3588,11 +3531,7 @@
\def\bbl@getproperty@x#1#2#3{%
\bbl@getproperty@s{#1}{#2}{#3}%
\ifx#1\relax
- \bbl@error
- {Unknown key for locale '#2':\\%
- #3\\%
- \string#1 will be set to \relax}%
- {Perhaps you misspelled it.}%
+ \bbl@error{unknown-locale-key}{#1}{#2}{#3}%
\fi}
\let\bbl@ini@loaded\@empty
\newcommand\LocaleForEach{\bbl@foreach\bbl@ini@loaded}
@@ -3614,10 +3553,7 @@
\expandafter\expandafter\expandafter\@gobble
\fi
\fi
- {\bbl@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@error{adjust-only-vertical}{#1}{}{}}}% Gobbled if everything went ok.
\@namedef{bbl@ADJ@bidi.mirroring@on}{%
\bbl@adjust@lua{bidi}{mirroring_enabled=true}}
\@namedef{bbl@ADJ@bidi.mirroring@off}{%
@@ -3651,10 +3587,7 @@
#1%
\expandafter\@gobble
\fi
- {\bbl@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@error{layout-only-vertical}{}{}{}}}% Gobbled if everything went ok.
\@namedef{bbl@ADJ@layout.tabular@on}{%
\ifnum\bbl@tabular@mode=\tw@
\bbl@adjust@layout{\let\@tabular\bbl@NL@@tabular}%
@@ -3779,13 +3712,13 @@
\bbl@xin@{B}\bbl@opt@safe
\ifin@
\bbl@redefine\@citex[#1]#2{%
- \@safe@activestrue\edef\@tempa{#2}\@safe@activesfalse
- \org@@citex[#1]{\@tempa}}
+ \@safe@activestrue\edef\bbl@tempa{#2}\@safe@activesfalse
+ \org@@citex[#1]{\bbl@tempa}}
\AtBeginDocument{%
\@ifpackageloaded{natbib}{%
\def\@citex[#1][#2]#3{%
- \@safe@activestrue\edef\@tempa{#3}\@safe@activesfalse
- \org@@citex[#1][#2]{\@tempa}}%
+ \@safe@activestrue\edef\bbl@tempa{#3}\@safe@activesfalse
+ \org@@citex[#1][#2]{\bbl@tempa}}%
}{}}
\AtBeginDocument{%
\@ifpackageloaded{cite}{%
@@ -3990,11 +3923,7 @@
\ifodd\bbl@engine
\else % TODO. Move to txtbabel
\ifnum\bbl@bidimode>100 \ifnum\bbl@bidimode<200 % Any xe+lua bidi=
- \bbl@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@error{bidi-only-lua}{}{}{}%
\let\bbl@beforeforeign\leavevmode
\AtEndOfPackage{%
\EnableBabelHook{babel-bidi}%
@@ -4096,8 +4025,7 @@
\ifhmode
\ifnum\currentgrouplevel>\z@
\ifnum\currentgrouplevel=\bbl@dirlevel
- \bbl@error{Multiple bidi settings inside a group}%
- {I'll insert a new group, but expect wrong results.}%
+ \bbl@error{multiple-bidi}{}{}{}%
\bgroup\aftergroup#2\aftergroup\egroup
\else
\ifcase\currentgrouptype\or % 0 bottom
@@ -4188,29 +4116,22 @@
If it’s the main language, try adding `provide=*'\\%
to the babel package options}}%
{\let\bbl@tempa\empty}%
- \bbl@error{%
- Unknown option '\CurrentOption'. Either you misspelled it\\%
- or the language definition file \CurrentOption.ldf\\%
- was not found%
- \bbl@tempa}{%
- Valid options are, among others: shorthands=, KeepShorthandsActive,\\%
- activeacute, activegrave, noconfigs, safe=, main=, math=\\%
- headfoot=, strings=, config=, hyphenmap=, or a language name.}}}
+ \bbl@error{unknown-package-option}{}{}{}}}
\def\bbl@try@load@lang#1#2#3{%
\IfFileExists{\CurrentOption.ldf}%
{\bbl@load@language{\CurrentOption}}%
{#1\bbl@load@language{#2}#3}}
\DeclareOption{hebrew}{%
+ \ifcase\bbl@engine\or
+ \bbl@error{only-pdftex-lang}{hebrew}{luatex}{}%
+ \fi
\input{rlbabel.def}%
\bbl@load@language{hebrew}}
\DeclareOption{hungarian}{\bbl@try@load@lang{}{magyar}{}}
\DeclareOption{lowersorbian}{\bbl@try@load@lang{}{lsorbian}{}}
-\DeclareOption{northernsami}{\bbl@try@load@lang{}{samin}{}}
-\DeclareOption{nynorsk}{\bbl@try@load@lang{}{norsk}{}}
\DeclareOption{polutonikogreek}{%
\bbl@try@load@lang{}{greek}{\languageattribute{greek}{polutoniko}}}
\DeclareOption{russian}{\bbl@try@load@lang{}{russianb}{}}
-\DeclareOption{scottishgaelic}{\bbl@try@load@lang{}{scottish}{}}
\DeclareOption{ukrainian}{\bbl@try@load@lang{}{ukraineb}{}}
\DeclareOption{uppersorbian}{\bbl@try@load@lang{}{usorbian}{}}
\ifx\bbl@opt@config\@nnil
@@ -4225,9 +4146,7 @@
{\typeout{*************************************^^J%
* Local config file \bbl@opt@config.cfg used^^J%
*}}%
- {\bbl@error{%
- Local config file '\bbl@opt@config.cfg' not found}{%
- Perhaps you misspelled it.}}%
+ {\bbl@error{config-not-found}{}{}{}}%
\fi
\ifx\bbl@opt@main\@nnil
\ifnum\bbl@iniflag>\z@ % if all ldf's: set implicitly, no main pass
@@ -4332,10 +4251,7 @@
\fi
\bbl@exp{%
\\\AtBeginDocument{\\\bbl@usehooks@lang{/}{begindocument}{{}}}}%
-\def\AfterBabelLanguage{%
- \bbl@error
- {Too late for \string\AfterBabelLanguage}%
- {Languages have been loaded, so I can do nothing}}
+\def\AfterBabelLanguage{\bbl@error{late-after-babel}{}{}{}}
\ifx\bbl@main@language\@undefined
\bbl@info{%
You haven't specified a language as a class or package\\%