texlive[57847] Master/texmf-dist: babel (22feb21)

commits+karl at tug.org commits+karl at tug.org
Mon Feb 22 22:54:37 CET 2021


Revision: 57847
          http://tug.org/svn/texlive?view=revision&revision=57847
Author:   karl
Date:     2021-02-22 22:54:37 +0100 (Mon, 22 Feb 2021)
Log Message:
-----------
babel (22feb21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/babel/README.md
    trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
    trunk/Master/texmf-dist/source/latex/babel/babel.dtx
    trunk/Master/texmf-dist/source/latex/babel/babel.ins
    trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
    trunk/Master/texmf-dist/source/latex/babel/locale.zip
    trunk/Master/texmf-dist/tex/generic/babel/babel.def
    trunk/Master/texmf-dist/tex/generic/babel/babel.sty
    trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
    trunk/Master/texmf-dist/tex/generic/babel/luababel.def
    trunk/Master/texmf-dist/tex/generic/babel/nil.ldf

Modified: trunk/Master/texmf-dist/doc/latex/babel/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/README.md	2021-02-22 21:53:32 UTC (rev 57846)
+++ trunk/Master/texmf-dist/doc/latex/babel/README.md	2021-02-22 21:54:37 UTC (rev 57847)
@@ -1,4 +1,4 @@
-## Babel 3.53
+## Babel 3.54
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages.  Many
@@ -7,9 +7,9 @@
 
 The latest stable version is available on <https://ctan.org/pkg/babel>.
 
-Changes in version 3.53 are described in:
+Changes in version 3.54 are described in:
 
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.53
+https://github.com/latex3/babel/wiki/What's-new-in-babel-3.54
 
 Included is a set of ini files for about 250 languages. 
 
@@ -43,6 +43,14 @@
 
 ### Latest changes
 ```
+3.54   2021-02-22
+       * RTL text inside \put (with pict2e) correctly rendered in
+         typical cases (lua, #98).
+       * Same for \tikz (lua).
+       * The main change in internal (loader of ini files refactored).
+       * Fixes:
+         - The tentative \foreignlanguage* stopped working.
+       
 3.53   2021-01-26
        * Extended \setlocalecaption to allow .template (related to
          #111).
@@ -55,6 +63,7 @@
            bidi in lua.
          - Parenthesis sometimes mirrored at the end of math with
            bidi=basic.
+See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.53
 
 3.52   2020-12-16
        * WARNING. If you need the style for Afrikaans you must update
@@ -69,7 +78,7 @@
          - Save size overflow with many \selectlanguage's (#109).
          - Albanian: fix a typo in contents name (#104)
          - Missing ‘Unused global option(s)’ warning (#110)
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.52
+See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.52
 
 3.51   2020-10-27
        * Common interface to (re)define captions (with
@@ -84,13 +93,13 @@
          - An error was raised with CJK and a null font (#99).
          - language.tag.bcp47 and tag.ini in \localeinfo didn't work
            (#102).
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.52
+See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.52
 
 3.50   2020-10-06
        * Fixes:
          - main=<language> stopped working in some cases (#96).
          - Footnotes were not \long with layout=footnotes.
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.50
+See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.50
 
 3.49   2020-10-03
        * BUG. This version has a severe bug with main= (fixed in 3.50).
@@ -99,7 +108,7 @@
        * frenchspacing is set with ini files.
        * Fixes:
          - layout.lists=off didn't work (#94)
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.49
+See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.49
 
 3.48   2020-09-01
        * New (tentative) tools to customize some labels (like chapters
@@ -110,7 +119,7 @@
          - \babelshorthand didn't work with some dialects (#91).
          - \selectlanguage and otherlanguage raised an error inside
            tabular.
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.48       
+See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.48       
 
 3.47   2020-07-13
        * Fixes:
@@ -121,7 +130,7 @@
        * New - \getlocaleproperty*, which doesn't raise an error.
        * Basic ini+tex templates for about 500 languages in the GitHub
          repository.
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.47
+See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.47
 
 3.46   2020-07-06
        * Languages can now be optionally selected with their BCP 47
@@ -137,29 +146,16 @@
          - Locale info was not loaded if the name had uppercase letters
            in some OSs (#80).
          - The [..|..] syntax in ini dates didn't recognize 'digits'.
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.46
+See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.46
 
 3.45   2020-06-10
-       * Minor fixes in Hindi, Ancient Greek, Macedonian.
-       * Improvements in Kurdish, Marathi.
-       * Alternative date formats with \localedate[calendar=...,
-         variant=...]{y}{m}{d} (note: no calendar computations, just
-         strings).
-       * \today is (again) case-aware.
-       * \localenumeral{digits}{..} and \localecounter{digits}{cntr}
-         for native digits.
-       * Fixes
-         - Improved handling of math with \babelposthyphenation and
-           \babelprehyphenation (it was ignoring too much).
-         - An error related to \bbl at foreign@x could be raised in some
-           rare cases.
 See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.45
 
 3.44   2020-05-13
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.44
+See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.44
 
 3.43   2020-04-28
-https://github.com/latex3/babel/wiki/What's-new-in-babel-3.43
+See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.43
 
 3.42   2020-03-22
 See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.42

Modified: trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2021-02-22 21:53:32 UTC (rev 57846)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2021-02-22 21:54:37 UTC (rev 57847)
@@ -31,7 +31,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2021/01/26 v3.53 The Babel package]
+\ProvidesFile{babel.dtx}[2021/02/22 v3.54 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -2408,12 +2408,11 @@
 warns you about what to do if there is a missing string. Very likely
 you will find alerts like that in the |log| file:
 \begin{verbatim}
-Package babel Warning: \mylangchaptername not set. Please, define it
-(babel)                after the language has been loaded (typically
-(babel)                in the preamble) with the help of
-(babel)                \setlocalecaption. An example is:
+Package babel Warning: \chaptername not set for 'mylang'. Please,
+(babel)                define it after the language has been loaded
+(babel)                (typically in the preamble) with:
 (babel)                \setlocalecaption{mylang}{chapter}{..}
-(babel)                Reported on input line 18.
+(babel)                Reported on input line 26.
 \end{verbatim}
 
 In most cases, you will only need to define a few macros. Note
@@ -3445,10 +3444,8 @@
 
 \item[graphics] modifies the |picture| environment so that the whole
 figure is L but the text is R. It \textit{does not} work with the
-standard |picture|, and \textit{pict2e} is required if you want sloped
-lines \textbf{(With recent versions of \LaTeX, this feature has
-stopped working)}. It attempts to do the same for \textsf{pgf/tikz}.
-Somewhat experimental. \New{3.32}.
+standard |picture|, and \textit{pict2e} is required. It attempts to do
+the same for \textsf{pgf/tikz}. Somewhat experimental. \New{3.32}.
 
 \item[extras] is used for miscellaneous readjustments which do not fit into
   the previous groups. Currently redefines in \luatex{} |\underline| and
@@ -4851,8 +4848,8 @@
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.53>>
-%<<date=2021/01/26>>
+%<<version=3.54>>
+%<<date=2021/02/22>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5274,7 +5271,7 @@
        Babel.debug = false }%
    \fi}
 <@Basic macros@>
-  % Temporarily repeat here the code for errors
+  % Temporarily repeat here the code for errors. TODO.
   \def\bbl at error#1#2{%
     \begingroup
       \def\\{\MessageBreak}%
@@ -5297,16 +5294,18 @@
       \def\\{\MessageBreak}%
       \PackageInfo{babel}{#1}%
     \endgroup}
-    \def\bbl at nocaption{\protect\bbl at nocaption@i}
+\def\bbl at nocaption{\protect\bbl at nocaption@i}
+% TODO - Wrong for \today !!! Must be a separate macro.
 \def\bbl at nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
   \global\@namedef{#2}{\textbf{?#1?}}%
   \@nameuse{#2}%
-  \bbl at warning{% TODO.
-    \@backslashchar#2 not set. Please, define it\\%
-    after the language has been loaded (typically\\%
-    in the preamble) with the help of\\%
-    \string\setlocalecaption. An example is:\\% 
-    \string\setlocalecaption{mylang}{chapter}{..}\\
+  \edef\bbl at tempa{#1}%
+  \bbl at sreplace\bbl at tempa{name}{}%
+  \bbl at warning{%
+    \@backslashchar#1 not set for '\languagename'. Please,\\%
+    define it after the language has been loaded\\%
+    (typically in the preamble) with\\% 
+    \string\setlocalecaption{\languagename}{\bbl at tempa}{..}\\%
     Reported}}
 \def\bbl at tentative{\protect\bbl at tentative@i}
 \def\bbl at tentative@i#1{%
@@ -7666,6 +7665,7 @@
 \def\bbl at foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par
   \begingroup
     {\par}%
+    \let\bbl at select@opts\@empty
     \let\BabelText\@firstofone
     \foreign at language{#1}%
     \bbl at usehooks{foreign*}{}%
@@ -7938,12 +7938,13 @@
 \def\bbl at nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
   \global\@namedef{#2}{\textbf{?#1?}}%
   \@nameuse{#2}%
-  \bbl at warning{%
-    \@backslashchar#2 not set. Please, define it\\%
-    after the language has been loaded (typically\\%
-    in the preamble) with the help of\\%
-    \string\setlocalecaption. An example is\\%
-    \string\setlocalecaption{mylang}{chapter}{..}\\
+  \edef\bbl at tempa{#1}%
+  \bbl at sreplace\bbl at tempa{name}{}%
+  \bbl at warning{% TODO.
+    \@backslashchar#1 not set for '\languagename'. Please,\\%
+    define it after the language has been loaded\\%
+    (typically in the preamble) with:\\% 
+    \string\setlocalecaption{\languagename}{\bbl at tempa}{..}\\%
     Reported}}
 \def\bbl at tentative{\protect\bbl at tentative@i}
 \def\bbl at tentative@i#1{%
@@ -9317,12 +9318,6 @@
 %    attribute being checked, and the third and fourth arguments are
 %    the true and false clauses.
 %
-%    First we need to find out if any attributes were set; if not we're
-%    done. Then we need to check the list of known attributes. When
-%    we're this far |\ifin@| has a value indicating if the attribute in
-%    question was set or not. Just to be safe the code to be executed
-%    is `thrown over the |\fi|'.
-%
 %    \begin{macrocode}
 \def\bbl at ifattributeset#1#2#3#4{%
   \ifx\bbl at known@attribs\@undefined
@@ -9334,8 +9329,7 @@
     \bbl at afterelse#3%
   \else
     \bbl at afterfi#4%
-  \fi
-  }
+  \fi}
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -9347,9 +9341,7 @@
 %    is known and the \TeX-code to be executed otherwise.
 %
 %    We first assume the attribute is unknown. Then we loop over the
-%    list of known attributes, trying to find a match. When a match is
-%    found the definition of |\bbl at tempa| is changed. Finally we
-%    execute |\bbl at tempa|.
+%    list of known attributes, trying to find a match. 
 %
 %    \begin{macrocode}
 \def\bbl at ifknown@ttrib#1#2{%
@@ -9360,8 +9352,7 @@
       \let\bbl at tempa\@firstoftwo
     \else
     \fi}%
-  \bbl at tempa
-}
+  \bbl at tempa}
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -9451,7 +9442,10 @@
 % Some languages need to have |\frenchspacing| in effect. Others
 % don't want that. The command |\bbl at frenchspacing| switches it on
 % when it isn't already in effect and |\bbl at nonfrenchspacing|
-% switches it off if necessary.
+% switches it off if necessary. A more refined way to switch the
+% catcodes is done with |ini| files. Here an auxiliary macro is
+% defined, but the main part is in |\babelprovide|. This new method
+% should be ideally the default one.
 %
 %    \begin{macrocode}
 \def\bbl at frenchspacing{%
@@ -9462,7 +9456,6 @@
     \let\bbl at nonfrenchspacing\nonfrenchspacing
   \fi}
 \let\bbl at nonfrenchspacing\nonfrenchspacing
-%
 \let\bbl at elt\relax
 \edef\bbl at fs@chars{%
   \bbl at elt{\string.}\@m{3000}\bbl at elt{\string?}\@m{3000}%
@@ -9503,7 +9496,7 @@
 %
 % \subsection{Hyphens}
 %
-%  \begin{macro}{\babelhyphenation}
+% \begin{macro}{\babelhyphenation}
 %
 % This macro saves hyphenation exceptions. Two macros are used to
 % store them: |\bbl at hyphenation@| for the global ones and
@@ -9534,7 +9527,7 @@
         \bbl at iflanguage\bbl at tempa{%
           \bbl at csarg\protected at edef{hyphenation@\bbl at tempa}{%
             \bbl at ifunset{bbl at hyphenation@\bbl at tempa}%
-              \@empty
+              {}%
               {\csname bbl at hyphenation@\bbl at tempa\endcsname\space}%
             #2}}}%
     \fi}}
@@ -10667,6 +10660,7 @@
   \let\bbl at KVP@Alph\@nil
   \let\bbl at KVP@labels\@nil
   \bbl at csarg\let{KVP at labels*}\@nil
+  \global\let\bbl at inidata\@empty
   \bbl at forkv{#1}{%  TODO - error handling
     \in@{/}{##1}%
     \ifin@
@@ -10732,7 +10726,8 @@
   % ==
   % At this point all parameters are defined if 'import'. Now we
   % execute some code depending on them. But what about if nothing was
-  % imported? We just set the very basic parameters.
+  % imported? We just set the basic parameters, but still loading the
+  % whole ini file.
   \bbl at load@basic{#2}%
   % == script, language ==
   % Override the values from ini or defines them
@@ -10974,12 +10969,10 @@
       \expandafter\bbl at tempb\bbl at captionslist\@empty
     \else
       \ifx\bbl at initoload\relax
-        \bbl at read@ini{\bbl at KVP@captions}0%  Here letters cat = 11
+        \bbl at read@ini{\bbl at KVP@captions}2%  % Here letters cat = 11
       \else
-        \bbl at read@ini{\bbl at initoload}0%  Here all letters cat = 11
+        \bbl at read@ini{\bbl at initoload}2%     % Same
       \fi
-      \bbl at after@ini
-      \bbl at savestrings
     \fi
   \StartBabelCommands*{#1}{date}%
     \ifx\bbl at KVP@import\@nil
@@ -11031,9 +11024,7 @@
 \def\bbl at provide@renew#1{%
   \ifx\bbl at KVP@captions\@nil\else
     \StartBabelCommands*{#1}{captions}%
-      \bbl at read@ini{\bbl at KVP@captions}0%   Here all letters cat = 11
-      \bbl at after@ini
-      \bbl at savestrings
+      \bbl at read@ini{\bbl at KVP@captions}2%   % Here all letters cat = 11
     \EndBabelCommands
  \fi
  \ifx\bbl at KVP@import\@nil\else
@@ -11046,24 +11037,18 @@
   \ifx\bbl at lbkflag\@empty
     \bbl at provide@hyphens{#1}%
   \fi}
+%    \end{macrocode}
+%
 % Load the basic parameters (ids, typography, counters, and a few
 % more), while captions and dates are left out. But it may happen some
 % data has been loaded before automatically, so we first discard the
 % saved values.
-\def\bbl at linebreak@export{%
-  \bbl at exportkey{lnbrk}{typography.linebreaking}{h}%
-  \bbl at exportkey{hyphr}{typography.hyphenrules}{}%
-  \bbl at exportkey{lfthm}{typography.lefthyphenmin}{2}%
-  \bbl at exportkey{rgthm}{typography.righthyphenmin}{3}%         
-  \bbl at exportkey{prehc}{typography.prehyphenchar}{}%
-  \bbl at exportkey{hyotl}{typography.hyphenate.other.locale}{}%
-  \bbl at exportkey{hyots}{typography.hyphenate.other.script}{}%
-  \bbl at exportkey{intsp}{typography.intraspace}{}%
-  \bbl at exportkey{chrng}{characters.ranges}{}}
+%
+%    \begin{macrocode}
 \def\bbl at load@basic#1{%
   \bbl at ifunset{bbl at inidata@\languagename}{}%
     {\getlocaleproperty\bbl at tempa{\languagename}{identification/load.level}%
-     \ifcase\bbl at tempa\else
+     \ifcase\bbl at tempa
        \bbl at csarg\let{lname@\languagename}\relax
      \fi}%
   \bbl at ifunset{bbl at lname@#1}% 
@@ -11071,10 +11056,7 @@
        \begingroup
          \let\bbl at ini@captions at aux\@gobbletwo
          \def\bbl at inidate ####1.####2.####3.####4\relax ####5####6{}%
-         \bbl at read@ini{##1}0%
-         \bbl at linebreak@export
-         \bbl at exportkey{dgnat}{numbers.digits.native}{}%
-         \bbl at exportkey{frspc}{typography.frenchspacing}{u}% unset
+         \bbl at read@ini{##1}1%
          \ifx\bbl at initoload\relax\endinput\fi
        \endgroup}%
      \begingroup       % boxed, to avoid extra spaces:
@@ -11126,14 +11108,10 @@
     {\bbl at exp{\\\adddialect\<l@#1>\bbl at tempa}}}% found in opt list or ini
 %    \end{macrocode}
 %
-% The reader of |ini| files. There are 3 possible cases: a section name
-% (in the form |[...]|), a comment (starting with |;|) and a
-% key/value pair.
+% The reader of |babel-...tex| files. We reset temporarily some
+% catcodes.
 %
 %    \begin{macrocode}
-\ifx\bbl at readstream\@undefined
-  \csname newread\endcsname\bbl at readstream
-\fi
 \def\bbl at input@texini#1{%
   \bbl at bsphack
     \bbl at exp{%
@@ -11145,20 +11123,51 @@
       \catcode`\\\{=\the\catcode`\{\relax
       \catcode`\\\}=\the\catcode`\}\relax}%
   \bbl at esphack}
-\def\bbl at inipreread#1=#2\@@{%
-  \bbl at trim@def\bbl at tempa{#1}% Redundant below !!
+%    \end{macrocode}
+%
+% The following macros read and store |ini| files (but don't process
+% them). For each line, there are 3 possible actions: ignore if starts
+% with |;|, switch section if starts with |[|, and store otherwise.
+% There are used in the first step of |\bbl at read@ini|.
+%
+%    \begin{macrocode}
+\def\bbl at iniline#1\bbl at iniline{%
+  \@ifnextchar[\bbl at inisect{\@ifnextchar;\bbl at iniskip\bbl at inistore}#1\@@}% ]
+\def\bbl at inisect[#1]#2\@@{\def\bbl at section{#1}}% 
+\def\bbl at iniskip#1\@@{}%      if starts with ;
+\def\bbl at inistore#1=#2\@@{%      full (default)
+  \bbl at trim@def\bbl at tempa{#1}%
   \bbl at trim\toks@{#2}%
-  % Move trims here ??
   \bbl at ifunset{bbl at KVP@\bbl at section/\bbl at tempa}%
     {\bbl at exp{%
-       \\\g at addto@macro\\\bbl at inidata{%
-         \\\bbl at elt{\bbl at section}{\bbl at tempa}{\the\toks@}}}%
-     \expandafter\bbl at inireader\bbl at tempa=#2\@@}%
+      \\\g at addto@macro\\\bbl at inidata{%
+        \\\bbl at elt{\bbl at section}{\bbl at tempa}{\the\toks@}}}}%
     {}}%
-\def\bbl at fetch@ini#1#2{%
-  \bbl at exp{\def\\\bbl at inidata{%
-    \\\bbl at elt{identification}{tag.ini}{#1}%
-    \\\bbl at elt{identification}{load.level}{#2}}}%
+\def\bbl at inistore@min#1=#2\@@{%  minimal (maybe set in \bbl at read@ini)
+  \bbl at trim@def\bbl at tempa{#1}%
+  \bbl at trim\toks@{#2}%
+  \bbl at xin@{.identification.}{.\bbl at section.}%
+  \ifin@
+    \bbl at exp{\\\g at addto@macro\\\bbl at inidata{%
+      \\\bbl at elt{identification}{\bbl at tempa}{\the\toks@}}}%
+  \fi}%
+%    \end{macrocode}
+%
+% Now, the ‘main loop’, which \textbf{**must be executed inside a
+% group**}. At this point, |\bbl at inidata| may contain data declared in
+% |\babelprovide|, with ‘slashed’ keys. There are 3 steps: first read
+% the ini file and store it; then traverse the stored values, and
+% process some groups if required (date, captions, labels, counters);
+% finally, ‘export’ some values by defining global macros
+% (identification, typography, characters, numbers). The second
+% argument is 0 when called to read the minimal data for fonts; with
+% |\babelprovide| it's either 1 or 2.
+%
+%    \begin{macrocode}
+\ifx\bbl at readstream\@undefined
+  \csname newread\endcsname\bbl at readstream
+\fi
+\def\bbl at read@ini#1#2{%
   \openin\bbl at readstream=babel-#1.ini
   \ifeof\bbl at readstream
     \bbl at error
@@ -11167,12 +11176,20 @@
        is not complete.}%
       {Fix the name or reinstall babel.}%
   \else
+    % Store ini data in \bbl at inidata
     \catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\&=12
     \catcode`\;=12 \catcode`\|=12 \catcode`\%=14 \catcode`\-=12
     \bbl at info{Importing
-                \ifcase#2 \or font and identification \or basic \fi
-                data for \languagename\\%
+                \ifcase#2font and identification \or basic \fi
+                 data for \languagename\\%
               from babel-#1.ini. Reported}%
+    \ifnum#2=\z@
+      \global\let\bbl at inidata\@empty
+      \let\bbl at inistore\bbl at inistore@min    % Remember it's local
+    \fi
+    \def\bbl at section{identification}%
+    \bbl at exp{\\\bbl at inistore tag.ini=#1\\\@@}%
+    \bbl at inistore load.level=#2\@@
     \loop
     \if T\ifeof\bbl at readstream F\fi T\relax % Trick, because inside \loop
       \endlinechar\m at ne
@@ -11182,95 +11199,70 @@
         \expandafter\bbl at iniline\bbl at line\bbl at iniline
       \fi
     \repeat
+    % Process stored data
+    \bbl at csarg\xdef{lini@\languagename}{#1}%
+    \let\bbl at savestrings\@empty
+    \let\bbl at savetoday\@empty
+    \let\bbl at savedate\@empty
+    \def\bbl at elt##1##2##3{%
+      \def\bbl at section{##1}%
+      \in@{=date.}{=##1}% Find a better place
+      \ifin@
+        \bbl at ini@calendar{##1}%
+      \fi
+      \global\bbl at csarg\let{bbl at KVP@##1/##2}\relax
+      \bbl at ifunset{bbl at inikv@##1}{}%
+        {\csname bbl at inikv@##1\endcsname{##2}{##3}}}%
+    \bbl at inidata
+    % 'Export' data
+    \bbl at ini@exports{#2}%
+    \global\bbl at csarg\let{inidata@\languagename}\bbl at inidata
+    \global\let\bbl at inidata\@empty
+    \bbl at exp{\\\bbl at add@list\\\bbl at ini@loaded{\languagename}}%
+    \bbl at toglobal\bbl at ini@loaded
   \fi}
-\def\bbl at read@ini#1#2{%
-  \bbl at csarg\xdef{lini@\languagename}{#1}%
-  \let\bbl at section\@empty
-  \let\bbl at savestrings\@empty
-  \let\bbl at savetoday\@empty
-  \let\bbl at savedate\@empty
-  \let\bbl at inireader\bbl at iniskip
-  \bbl at fetch@ini{#1}{#2}%
-  \bbl at foreach\bbl at renewlist{%
-    \bbl at ifunset{bbl at renew@##1}{}{\bbl at inisec[##1]\@@}}%
-  \global\let\bbl at renewlist\@empty
-  % Ends last section. See \bbl at inisec
-  \def\bbl at elt##1##2{\bbl at inireader##1=##2\@@}%
-  \bbl at cs{renew@\bbl at section}%
-  \global\bbl at csarg\let{renew@\bbl at section}\relax
-  \bbl at cs{secpost@\bbl at section}%  
-  \bbl at csarg{\global\expandafter\let}{inidata@\languagename}\bbl at inidata
-  \bbl at exp{\\\bbl at add@list\\\bbl at ini@loaded{\languagename}}%
-  \bbl at toglobal\bbl at ini@loaded}
-\def\bbl at iniline#1\bbl at iniline{%
-  \@ifnextchar[\bbl at inisec{\@ifnextchar;\bbl at iniskip\bbl at inipreread}#1\@@}% ]
 %    \end{macrocode}
 %
-% The special cases for comment lines and sections are handled by the
-% two following commands. In sections, we provide the posibility to
-% take extra actions at the end or at the start. By default, key=val
-% pairs are ignored. The |secpost| ``hook'' is used only by
-% `identification', while |secpre| only by |date.gregorian.licr|.
+% A somewhat hackish tool to handle calendar sections. To be improved.
 %
 %    \begin{macrocode}
-\def\bbl at iniskip#1\@@{}%      if starts with ;
-\def\bbl at inisec[#1]#2\@@{%    if starts with opening bracket
-  \def\bbl at elt##1##2{%
-    \expandafter\toks@\expandafter{%
-      \expandafter{\bbl at section}{##1}{##2}}%
-    \bbl at exp{%
-      \\\g at addto@macro\\\bbl at inidata{\\\bbl at elt\the\toks@}}%
-    \bbl at inireader##1=##2\@@}%
-  \bbl at cs{renew@\bbl at section}%
-  \global\bbl at csarg\let{renew@\bbl at section}\relax
-  \bbl at cs{secpost@\bbl at section}%
-  % The previous code belongs to the previous section.
-  % --------------------------
-  % Now start the current one.
-  \in@{=date.}{=#1}%
-  \ifin@
-    \lowercase{\def\bbl at tempa{=#1=}}%
-    \bbl at replace\bbl at tempa{=date.gregorian}{}%
-    \bbl at replace\bbl at tempa{=date.}{}%
-    \in@{.licr=}{#1=}%
-    \ifin@
-      \ifcase\bbl at engine
-        \bbl at replace\bbl at tempa{.licr=}{}%
-      \else
-        \let\bbl at tempa\relax
-      \fi
-    \fi
-    \ifx\bbl at tempa\relax\else
-      \bbl at replace\bbl at tempa{=}{}%
-      \bbl at exp{%
-        \def\<bbl at inikv@#1>####1=####2\\\@@{% 
-          \\\bbl at inidate####1...\relax{####2}{\bbl at tempa}}}%
-    \fi
-  \fi
-  \def\bbl at section{#1}% 
-  \def\bbl at elt##1##2{%
-    \@namedef{bbl at KVP@#1/##1}{}}%
-  \bbl at cs{renew@#1}%
-  \bbl at cs{secpre@#1}%  pre-section `hook'
-  \bbl at ifunset{bbl at inikv@#1}%
-    {\let\bbl at inireader\bbl at iniskip}%
-    {\bbl at exp{\let\\\bbl at inireader\<bbl at inikv@#1>}}}
-\let\bbl at renewlist\@empty
-\def\bbl at renewinikey#1/#2\@@#3{%
-  \bbl at ifunset{bbl at renew@#1}%
-    {\bbl at add@list\bbl at renewlist{#1}}%
-    {}%
-  \bbl at csarg\bbl at add{renew@#1}{\bbl at elt{#2}{#3}}}
+\def\bbl at ini@calendar#1{%
+ \lowercase{\def\bbl at tempa{=#1=}}%
+ \bbl at replace\bbl at tempa{=date.gregorian}{}%
+ \bbl at replace\bbl at tempa{=date.}{}%
+ \in@{.licr=}{#1=}%
+ \ifin@
+   \ifcase\bbl at engine
+     \bbl at replace\bbl at tempa{.licr=}{}%
+   \else
+     \let\bbl at tempa\relax
+   \fi
+ \fi
+ \ifx\bbl at tempa\relax\else
+   \bbl at replace\bbl at tempa{=}{}%
+   \bbl at exp{%
+     \def\<bbl at inikv@#1>####1####2{% 
+       \\\bbl at inidate####1...\relax{####2}{\bbl at tempa}}}%
+ \fi}
 %    \end{macrocode}
 %
-% Reads a key=val line and stores the trimmed val in
-% |\bbl@@kv@<section>.<key>|.
+% A key with a slash in |\babelprovide| replaces the value in the |ini|
+% file (which is ignored altogether). The mechanism is simple (but
+% suboptimal): add the data to the |ini| one (at this point the |ini|
+% file has not yet been read), and define a dummy macro. When the |ini|
+% file is read, just skip the corresponding key and reset the macro (in
+% |\bbl at inistore| above).
+% 
 %
 %    \begin{macrocode}
-\def\bbl at inikv#1=#2\@@{%     key=value
-  \bbl at trim@def\bbl at tempa{#1}%
-  \bbl at trim\toks@{#2}%
-  \bbl at csarg\edef{@kv@\bbl at section.\bbl at tempa}{\the\toks@}}
+\def\bbl at renewinikey#1/#2\@@#3{%
+  \edef\bbl at tempa{\zap at space #1 \@empty}%   section
+  \edef\bbl at tempb{\zap at space #2 \@empty}%   key
+  \bbl at trim\toks@{#3}%                      value
+  \bbl at exp{%
+    \global\let\<bbl at KVP@\bbl at tempa/\bbl at tempb>\\\@empty % just a flag
+    \\\g at addto@macro\\\bbl at inidata{%
+       \\\bbl at elt{\bbl at tempa}{\bbl at tempb}{\the\toks@}}}}%
 %    \end{macrocode}
 %
 % The previous assignments are local, so we need to export them. If
@@ -11289,7 +11281,7 @@
 %
 % Key-value pairs are treated differently depending on the section in
 % the |ini| file. The following macros are the readers for
-% |identification| and |typography|. Note |\bbl at secpost@identification|
+% |identification| and |typography|. Note |\bbl at ini@exports|
 % is called always (via |\bbl at inisec|), while |\bbl at after@ini| must be
 % called explicitly after |\bbl at read@ini| if necessary.
 %
@@ -11301,8 +11293,8 @@
        \bbl at cs{@kv at identification.warning#1}\\%
        Reported }}}
 %
-\let\bbl at inikv@identification\bbl at inikv
-\def\bbl at secpost@identification{%
+\def\bbl at ini@exports#1{%
+  % Identification always exported
   \bbl at iniwarning{}%
   \ifcase\bbl at engine
     \bbl at iniwarning{.pdflatex}%
@@ -11322,15 +11314,46 @@
     {\csname bbl at esname@\languagename\endcsname}}%
   \bbl at exportkey{sbcp}{identification.script.tag.bcp47}{}%
   \bbl at exportkey{sotf}{identification.script.tag.opentype}{DFLT}%
+  % Also maps bcp47 -> languagename
   \ifbbl at bcptoname
     \bbl at csarg\xdef{bcp at map@\bbl at cl{tbcp}}{\languagename}%
+  \fi
+  % Conditional
+  \ifnum#1>\z@         % 0 = only info, 1, 2 = basic, (re)new
+    \bbl at exportkey{lnbrk}{typography.linebreaking}{h}%
+    \bbl at exportkey{hyphr}{typography.hyphenrules}{}%
+    \bbl at exportkey{lfthm}{typography.lefthyphenmin}{2}%
+    \bbl at exportkey{rgthm}{typography.righthyphenmin}{3}%         
+    \bbl at exportkey{prehc}{typography.prehyphenchar}{}%
+    \bbl at exportkey{hyotl}{typography.hyphenate.other.locale}{}%
+    \bbl at exportkey{hyots}{typography.hyphenate.other.script}{}%
+    \bbl at exportkey{intsp}{typography.intraspace}{}%
+    \bbl at exportkey{chrng}{characters.ranges}{}%
+    \bbl at exportkey{dgnat}{numbers.digits.native}{}%
+    \bbl at exportkey{frspc}{typography.frenchspacing}{u}%
+    \ifnum#1=\tw@           % only (re)new
+      \bbl at exportkey{rqtex}{identification.require.babel}{}%
+      \bbl at toglobal\bbl at savetoday
+      \bbl at toglobal\bbl at savedate
+      \bbl at savestrings
+    \fi
   \fi}
 %    \end{macrocode}
 %
+% A shared handler for key=val lines to be stored in
+% |\bbl@@kv@<section>.<key>|.
+%
+%    \begin{macrocode}
+\def\bbl at inikv#1#2{%     key=value
+  \toks@{#2}%            This hides #'s from ini values
+  \bbl at csarg\edef{@kv@\bbl at section.#1}{\the\toks@}}
+%    \end{macrocode}
+%
 % By default, the following sections are just read. Actions are taken
 % later.
 %
 %    \begin{macrocode}
+\let\bbl at inikv@identification\bbl at inikv
 \let\bbl at inikv@typography\bbl at inikv
 \let\bbl at inikv@characters\bbl at inikv
 \let\bbl at inikv@numbers\bbl at inikv
@@ -11342,7 +11365,7 @@
 % the ‘units’. 
 %
 %    \begin{macrocode}
-\def\bbl at inikv@counters#1=#2\@@{%
+\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}%
@@ -11365,13 +11388,6 @@
     \expandafter\bbl at buildifcase\bbl at tempb* \\ % Space after \\
     \bbl at csarg{\global\expandafter\let}{cntr@#1@\languagename}\bbl at tempa
   \fi}
-\def\bbl at after@ini{%
-  \bbl at linebreak@export
-  \bbl at exportkey{dgnat}{numbers.digits.native}{}%
-  \bbl at exportkey{rqtex}{identification.require.babel}{}%
-  \bbl at exportkey{frspc}{typography.frenchspacing}{u}% unset
-  \bbl at toglobal\bbl at savetoday
-  \bbl at toglobal\bbl at savedate}
 %    \end{macrocode}
 %
 % Now |captions| and |captions.licr|, depending on the engine. And
@@ -11381,10 +11397,10 @@
 %
 %    \begin{macrocode}
 \ifcase\bbl at engine
-  \bbl at csarg\def{inikv at captions.licr}#1=#2\@@{%
+  \bbl at csarg\def{inikv at captions.licr}#1#2{%
     \bbl at ini@captions at aux{#1}{#2}}
 \else
-  \def\bbl at inikv@captions#1=#2\@@{%
+  \def\bbl at inikv@captions#1#2{%
     \bbl at ini@captions at aux{#1}{#2}}
 \fi
 %    \end{macrocode}
@@ -11445,7 +11461,7 @@
   \bbl at ifunset{bbl at map@#1@\languagename}%
     {\@nameuse{#1}}%
     {\@nameuse{bbl at map@#1@\languagename}}}
-\def\bbl at inikv@labels#1=#2\@@{%
+\def\bbl at inikv@labels#1#2{%
   \in@{.map}{#1}%
   \ifin@
     \ifx\bbl at KVP@labels\@nil\else
@@ -11665,7 +11681,7 @@
 %    \begin{macrocode}
 \def\bbl at provide@lsys#1{%
   \bbl at ifunset{bbl at lname@#1}%
-    {\bbl at ini@basic{#1}}%
+    {\bbl at load@info{#1}}%
     {}%
   \bbl at csarg\let{lsys@#1}\@empty
   \bbl at ifunset{bbl at sname@#1}{\bbl at csarg\gdef{sname@#1}{Default}}{}%
@@ -11717,14 +11733,13 @@
 % must be enabled. This means we must make sure a few characters are
 % not active. The |ini| is not read directly, but with a proxy |tex|
 % file named as the language (which means any code in it must be
-% skipped, too.
+% skipped, too).
 %
 %    \begin{macrocode}
-\def\bbl at ini@basic#1{%
+\def\bbl at load@info#1{%
   \def\BabelBeforeIni##1##2{%
     \begingroup
-      \bbl at add\bbl at secpost@identification{\closein\bbl at readstream }%
-      \bbl at read@ini{##1}1%    
+      \bbl at read@ini{##1}0%
       \endinput          % babel- .tex may contain onlypreamble's
     \endgroup}%            boxed, to avoid extra spaces:
   {\bbl at input@texini{#1}}}
@@ -11850,7 +11865,7 @@
 \newcommand\BabelEnsureInfo{%
   \ifx\InputIfFileExists\@undefined\else
     \def\bbl at ensureinfo##1{%
-      \bbl at ifunset{bbl at lname@##1}{\bbl at ini@basic{##1}}{}}%
+      \bbl at ifunset{bbl at lname@##1}{\bbl at load@info{##1}}{}}%
   \fi
   \bbl at foreach\bbl at loaded{{%
     \def\languagename{##1}%
@@ -13373,7 +13388,7 @@
   \let\bbl at cjkintraspace\relax
   \directlua{
     Babel = Babel or {}
-    require'babel-data-cjk.lua'
+    require('babel-data-cjk.lua')
     Babel.cjk_enabled = true
     function Babel.cjk_linebreak(head)
       local GLYPH = node.id'glyph'
@@ -14276,21 +14291,86 @@
      \ifcase\bbl at thetextdir
        \let\bbl at pictresetdir\relax
      \else
-       \bodydir TLT
+       \ifcase#1\bodydir TLT  % Remember this sets the inner boxes
+         \or\textdir TLT
+         \else\bodydir TLT \textdir TLT
+       \fi
        % \(text|par)dir required in pgf:
        \def\bbl at pictresetdir{\bodydir TRT\pardir TRT\textdir TRT\relax}%
      \fi}%
    \ifx\AddToHook\@undefined\else
-     \AddToHook{env/picture/begin}{\bbl at pictsetdir\z@}%
+     \AddToHook{env/picture/begin}{\bbl at pictsetdir\tw@}%
+     \directlua{
+       Babel.get_picture_dir = true
+       Babel.picture_has_bidi = 0
+       function Babel.picture_dir (head)
+         if not Babel.get_picture_dir then return head end
+         for item in node.traverse(head) do
+           if item.id == node.id'glyph' then
+             local itemchar = item.char
+             % TODO. Copypaste pattern from Babel.bidi (-r)
+             local chardata = Babel.characters[itemchar]
+             local dir = chardata and chardata.d or nil
+             if not dir then
+               for nn, et in ipairs(Babel.ranges) do
+                 if itemchar < et[1] then
+                   break
+                 elseif itemchar <= et[2] then
+                   dir = et[3]
+                   break
+                 end
+               end
+             end
+             if dir and (dir == 'al' or dir == 'r') then
+               Babel.picture_has_bidi = 1
+             end
+           end
+         end
+         return head
+       end
+       luatexbase.add_to_callback("hpack_filter", Babel.picture_dir,
+         "Babel.picture_dir")
+     }%
+   \AtBeginDocument{%
+     \long\def\put(#1,#2)#3{%
+       \@killglue 
+       % Try:
+       \ifx\bbl at pictresetdir\relax
+         \def\bbl at tempc{0}%
+       \else
+         \directlua{
+           Babel.get_picture_dir = true
+           Babel.picture_has_bidi = 0
+         }%
+         \setbox\z@\hb at xt@\z@{%
+           \@defaultunitsset\@tempdimc{#1}\unitlength
+           \kern\@tempdimc
+           #3\hss}%
+         \edef\bbl at tempc{\directlua{tex.print(Babel.picture_has_bidi)}}%
+       \fi
+       % Do:
+       \@defaultunitsset\@tempdimc{#2}\unitlength
+       \raise\@tempdimc\hb at xt@\z@{%
+         \@defaultunitsset\@tempdimc{#1}\unitlength
+         \kern\@tempdimc
+         {\ifnum\bbl at tempc>\z@\bbl at pictresetdir\fi#3}\hss}% 
+       \ignorespaces}%
+       \MakeRobust\put}%
    \fi
    \AtBeginDocument
      {\ifx\tikz at atbegin@node\@undefined\else
         \let\bbl at OL@pgfpicture\pgfpicture
         \bbl at sreplace\pgfpicture{\pgfpicturetrue}%
-          {\bbl at pictsetdir\@ne\pgfpicturetrue}%
-        \bbl at add\pgfsys at beginpicture{\bbl at pictsetdir\@ne}%
+          {\bbl at pictsetdir\z@\pgfpicturetrue}%
+        \bbl at add\pgfsys at beginpicture{\bbl at pictsetdir\z@}%
         \bbl at add\tikz at atbegin@node{\bbl at pictresetdir}%
-      \fi}}
+        \bbl at sreplace\tikz{\begingroup}%
+          {\begingroup\bbl at pictsetdir\tw@}%
+      \fi
+      \ifx\AddToHook\@undefined\else
+        \AddToHook{env/tcolorbox/begin}{\bbl at pictsetdir\@ne}%
+      \fi
+      }}
   {}
 %    \end{macrocode}
 %

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.ins	2021-02-22 21:53:32 UTC (rev 57846)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.ins	2021-02-22 21:54:37 UTC (rev 57847)
@@ -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{2021/01/26}
+\def\filedate{2021/02/22}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 

Modified: trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2021-02-22 21:53:32 UTC (rev 57846)
+++ trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2021-02-22 21:54:37 UTC (rev 57847)
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2021/01/26 v3.53]
+\ProvidesFile{bbcompat.dtx}[2021/02/22 v3.54]
 %</dtx>
 %
 %% File 'bbcompat.dtx'

Modified: trunk/Master/texmf-dist/source/latex/babel/locale.zip
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.def	2021-02-22 21:53:32 UTC (rev 57846)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.def	2021-02-22 21:54:37 UTC (rev 57847)
@@ -39,7 +39,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{babel.def}[2021/01/26 3.53 Babel common definitions]
+\ProvidesFile{babel.def}[2021/02/22 3.54 Babel common definitions]
 \ifx\AtBeginDocument\@undefined  % TODO. change test.
     % == Code for plain ==
 \def\@empty{}
@@ -397,8 +397,8 @@
 \fi
 \countdef\last at language=19  % TODO. why? remove?
 \def\addlanguage{\csname newlanguage\endcsname}
-\def\bbl at version{3.53}
-\def\bbl at date{2021/01/26}
+\def\bbl at version{3.54}
+\def\bbl at date{2021/02/22}
 \def\adddialect#1#2{%
   \global\chardef#1#2\relax
   \bbl at usehooks{adddialect}{{#1}{#2}}%
@@ -735,6 +735,7 @@
 \def\bbl at foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par
   \begingroup
     {\par}%
+    \let\bbl at select@opts\@empty
     \let\BabelText\@firstofone
     \foreign at language{#1}%
     \bbl at usehooks{foreign*}{}%
@@ -871,12 +872,13 @@
 \def\bbl at nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
   \global\@namedef{#2}{\textbf{?#1?}}%
   \@nameuse{#2}%
-  \bbl at warning{%
-    \@backslashchar#2 not set. Please, define it\\%
-    after the language has been loaded (typically\\%
-    in the preamble) with the help of\\%
-    \string\setlocalecaption. An example is\\%
-    \string\setlocalecaption{mylang}{chapter}{..}\\
+  \edef\bbl at tempa{#1}%
+  \bbl at sreplace\bbl at tempa{name}{}%
+  \bbl at warning{% TODO.
+    \@backslashchar#1 not set for '\languagename'. Please,\\%
+    define it after the language has been loaded\\%
+    (typically in the preamble) with:\\%
+    \string\setlocalecaption{\languagename}{\bbl at tempa}{..}\\%
     Reported}}
 \def\bbl at tentative{\protect\bbl at tentative@i}
 \def\bbl at tentative@i#1{%
@@ -1687,8 +1689,7 @@
     \bbl at afterelse#3%
   \else
     \bbl at afterfi#4%
-  \fi
-  }
+  \fi}
 \def\bbl at ifknown@ttrib#1#2{%
   \let\bbl at tempa\@secondoftwo
   \bbl at loopx\bbl at tempb{#2}{%
@@ -1697,8 +1698,7 @@
       \let\bbl at tempa\@firstoftwo
     \else
     \fi}%
-  \bbl at tempa
-}
+  \bbl at tempa}
 \def\bbl at clear@ttribs{%
   \ifx\bbl at attributes\@undefined\else
     \bbl at loopx\bbl at tempa{\bbl at attributes}{%
@@ -1772,7 +1772,7 @@
         \bbl at iflanguage\bbl at tempa{%
           \bbl at csarg\protected at edef{hyphenation@\bbl at tempa}{%
             \bbl at ifunset{bbl at hyphenation@\bbl at tempa}%
-              \@empty
+              {}%
               {\csname bbl at hyphenation@\bbl at tempa\endcsname\space}%
             #2}}}%
     \fi}}
@@ -2339,6 +2339,7 @@
   \let\bbl at KVP@Alph\@nil
   \let\bbl at KVP@labels\@nil
   \bbl at csarg\let{KVP at labels*}\@nil
+  \global\let\bbl at inidata\@empty
   \bbl at forkv{#1}{%  TODO - error handling
     \in@{/}{##1}%
     \ifin@
@@ -2404,7 +2405,8 @@
   % ==
   % At this point all parameters are defined if 'import'. Now we
   % execute some code depending on them. But what about if nothing was
-  % imported? We just set the very basic parameters.
+  % imported? We just set the basic parameters, but still loading the
+  % whole ini file.
   \bbl at load@basic{#2}%
   % == script, language ==
   % Override the values from ini or defines them
@@ -2641,12 +2643,10 @@
       \expandafter\bbl at tempb\bbl at captionslist\@empty
     \else
       \ifx\bbl at initoload\relax
-        \bbl at read@ini{\bbl at KVP@captions}0%  Here letters cat = 11
+        \bbl at read@ini{\bbl at KVP@captions}2%  % Here letters cat = 11
       \else
-        \bbl at read@ini{\bbl at initoload}0%  Here all letters cat = 11
+        \bbl at read@ini{\bbl at initoload}2%     % Same
       \fi
-      \bbl at after@ini
-      \bbl at savestrings
     \fi
   \StartBabelCommands*{#1}{date}%
     \ifx\bbl at KVP@import\@nil
@@ -2696,9 +2696,7 @@
 \def\bbl at provide@renew#1{%
   \ifx\bbl at KVP@captions\@nil\else
     \StartBabelCommands*{#1}{captions}%
-      \bbl at read@ini{\bbl at KVP@captions}0%   Here all letters cat = 11
-      \bbl at after@ini
-      \bbl at savestrings
+      \bbl at read@ini{\bbl at KVP@captions}2%   % Here all letters cat = 11
     \EndBabelCommands
  \fi
  \ifx\bbl at KVP@import\@nil\else
@@ -2711,20 +2709,10 @@
   \ifx\bbl at lbkflag\@empty
     \bbl at provide@hyphens{#1}%
   \fi}
-\def\bbl at linebreak@export{%
-  \bbl at exportkey{lnbrk}{typography.linebreaking}{h}%
-  \bbl at exportkey{hyphr}{typography.hyphenrules}{}%
-  \bbl at exportkey{lfthm}{typography.lefthyphenmin}{2}%
-  \bbl at exportkey{rgthm}{typography.righthyphenmin}{3}%
-  \bbl at exportkey{prehc}{typography.prehyphenchar}{}%
-  \bbl at exportkey{hyotl}{typography.hyphenate.other.locale}{}%
-  \bbl at exportkey{hyots}{typography.hyphenate.other.script}{}%
-  \bbl at exportkey{intsp}{typography.intraspace}{}%
-  \bbl at exportkey{chrng}{characters.ranges}{}}
 \def\bbl at load@basic#1{%
   \bbl at ifunset{bbl at inidata@\languagename}{}%
     {\getlocaleproperty\bbl at tempa{\languagename}{identification/load.level}%
-     \ifcase\bbl at tempa\else
+     \ifcase\bbl at tempa
        \bbl at csarg\let{lname@\languagename}\relax
      \fi}%
   \bbl at ifunset{bbl at lname@#1}%
@@ -2732,10 +2720,7 @@
        \begingroup
          \let\bbl at ini@captions at aux\@gobbletwo
          \def\bbl at inidate ####1.####2.####3.####4\relax ####5####6{}%
-         \bbl at read@ini{##1}0%
-         \bbl at linebreak@export
-         \bbl at exportkey{dgnat}{numbers.digits.native}{}%
-         \bbl at exportkey{frspc}{typography.frenchspacing}{u}% unset
+         \bbl at read@ini{##1}1%
          \ifx\bbl at initoload\relax\endinput\fi
        \endgroup}%
      \begingroup       % boxed, to avoid extra spaces:
@@ -2780,9 +2765,6 @@
        {\bbl at exp{\\\adddialect\<l@#1>\language}}%
        {}}%                      so, l@<lang> is ok - nothing to do
     {\bbl at exp{\\\adddialect\<l@#1>\bbl at tempa}}}% found in opt list or ini
-\ifx\bbl at readstream\@undefined
-  \csname newread\endcsname\bbl at readstream
-\fi
 \def\bbl at input@texini#1{%
   \bbl at bsphack
     \bbl at exp{%
@@ -2794,20 +2776,30 @@
       \catcode`\\\{=\the\catcode`\{\relax
       \catcode`\\\}=\the\catcode`\}\relax}%
   \bbl at esphack}
-\def\bbl at inipreread#1=#2\@@{%
-  \bbl at trim@def\bbl at tempa{#1}% Redundant below !!
+\def\bbl at iniline#1\bbl at iniline{%
+  \@ifnextchar[\bbl at inisect{\@ifnextchar;\bbl at iniskip\bbl at inistore}#1\@@}% ]
+\def\bbl at inisect[#1]#2\@@{\def\bbl at section{#1}}%
+\def\bbl at iniskip#1\@@{}%      if starts with ;
+\def\bbl at inistore#1=#2\@@{%      full (default)
+  \bbl at trim@def\bbl at tempa{#1}%
   \bbl at trim\toks@{#2}%
-  % Move trims here ??
   \bbl at ifunset{bbl at KVP@\bbl at section/\bbl at tempa}%
     {\bbl at exp{%
-       \\\g at addto@macro\\\bbl at inidata{%
-         \\\bbl at elt{\bbl at section}{\bbl at tempa}{\the\toks@}}}%
-     \expandafter\bbl at inireader\bbl at tempa=#2\@@}%
+      \\\g at addto@macro\\\bbl at inidata{%
+        \\\bbl at elt{\bbl at section}{\bbl at tempa}{\the\toks@}}}}%
     {}}%
-\def\bbl at fetch@ini#1#2{%
-  \bbl at exp{\def\\\bbl at inidata{%
-    \\\bbl at elt{identification}{tag.ini}{#1}%
-    \\\bbl at elt{identification}{load.level}{#2}}}%
+\def\bbl at inistore@min#1=#2\@@{%  minimal (maybe set in \bbl at read@ini)
+  \bbl at trim@def\bbl at tempa{#1}%
+  \bbl at trim\toks@{#2}%
+  \bbl at xin@{.identification.}{.\bbl at section.}%
+  \ifin@
+    \bbl at exp{\\\g at addto@macro\\\bbl at inidata{%
+      \\\bbl at elt{identification}{\bbl at tempa}{\the\toks@}}}%
+  \fi}%
+\ifx\bbl at readstream\@undefined
+  \csname newread\endcsname\bbl at readstream
+\fi
+\def\bbl at read@ini#1#2{%
   \openin\bbl at readstream=babel-#1.ini
   \ifeof\bbl at readstream
     \bbl at error
@@ -2816,12 +2808,20 @@
        is not complete.}%
       {Fix the name or reinstall babel.}%
   \else
+    % Store ini data in \bbl at inidata
     \catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\&=12
     \catcode`\;=12 \catcode`\|=12 \catcode`\%=14 \catcode`\-=12
     \bbl at info{Importing
-                \ifcase#2 \or font and identification \or basic \fi
-                data for \languagename\\%
+                \ifcase#2font and identification \or basic \fi
+                 data for \languagename\\%
               from babel-#1.ini. Reported}%
+    \ifnum#2=\z@
+      \global\let\bbl at inidata\@empty
+      \let\bbl at inistore\bbl at inistore@min    % Remember it's local
+    \fi
+    \def\bbl at section{identification}%
+    \bbl at exp{\\\bbl at inistore tag.ini=#1\\\@@}%
+    \bbl at inistore load.level=#2\@@
     \loop
     \if T\ifeof\bbl at readstream F\fi T\relax % Trick, because inside \loop
       \endlinechar\m at ne
@@ -2831,80 +2831,54 @@
         \expandafter\bbl at iniline\bbl at line\bbl at iniline
       \fi
     \repeat
+    % Process stored data
+    \bbl at csarg\xdef{lini@\languagename}{#1}%
+    \let\bbl at savestrings\@empty
+    \let\bbl at savetoday\@empty
+    \let\bbl at savedate\@empty
+    \def\bbl at elt##1##2##3{%
+      \def\bbl at section{##1}%
+      \in@{=date.}{=##1}% Find a better place
+      \ifin@
+        \bbl at ini@calendar{##1}%
+      \fi
+      \global\bbl at csarg\let{bbl at KVP@##1/##2}\relax
+      \bbl at ifunset{bbl at inikv@##1}{}%
+        {\csname bbl at inikv@##1\endcsname{##2}{##3}}}%
+    \bbl at inidata
+    % 'Export' data
+    \bbl at ini@exports{#2}%
+    \global\bbl at csarg\let{inidata@\languagename}\bbl at inidata
+    \global\let\bbl at inidata\@empty
+    \bbl at exp{\\\bbl at add@list\\\bbl at ini@loaded{\languagename}}%
+    \bbl at toglobal\bbl at ini@loaded
   \fi}
-\def\bbl at read@ini#1#2{%
-  \bbl at csarg\xdef{lini@\languagename}{#1}%
-  \let\bbl at section\@empty
-  \let\bbl at savestrings\@empty
-  \let\bbl at savetoday\@empty
-  \let\bbl at savedate\@empty
-  \let\bbl at inireader\bbl at iniskip
-  \bbl at fetch@ini{#1}{#2}%
-  \bbl at foreach\bbl at renewlist{%
-    \bbl at ifunset{bbl at renew@##1}{}{\bbl at inisec[##1]\@@}}%
-  \global\let\bbl at renewlist\@empty
-  % Ends last section. See \bbl at inisec
-  \def\bbl at elt##1##2{\bbl at inireader##1=##2\@@}%
-  \bbl at cs{renew@\bbl at section}%
-  \global\bbl at csarg\let{renew@\bbl at section}\relax
-  \bbl at cs{secpost@\bbl at section}%
-  \bbl at csarg{\global\expandafter\let}{inidata@\languagename}\bbl at inidata
-  \bbl at exp{\\\bbl at add@list\\\bbl at ini@loaded{\languagename}}%
-  \bbl at toglobal\bbl at ini@loaded}
-\def\bbl at iniline#1\bbl at iniline{%
-  \@ifnextchar[\bbl at inisec{\@ifnextchar;\bbl at iniskip\bbl at inipreread}#1\@@}% ]
-\def\bbl at iniskip#1\@@{}%      if starts with ;
-\def\bbl at inisec[#1]#2\@@{%    if starts with opening bracket
-  \def\bbl at elt##1##2{%
-    \expandafter\toks@\expandafter{%
-      \expandafter{\bbl at section}{##1}{##2}}%
-    \bbl at exp{%
-      \\\g at addto@macro\\\bbl at inidata{\\\bbl at elt\the\toks@}}%
-    \bbl at inireader##1=##2\@@}%
-  \bbl at cs{renew@\bbl at section}%
-  \global\bbl at csarg\let{renew@\bbl at section}\relax
-  \bbl at cs{secpost@\bbl at section}%
-  % The previous code belongs to the previous section.
-  % --------------------------
-  % Now start the current one.
-  \in@{=date.}{=#1}%
-  \ifin@
-    \lowercase{\def\bbl at tempa{=#1=}}%
-    \bbl at replace\bbl at tempa{=date.gregorian}{}%
-    \bbl at replace\bbl at tempa{=date.}{}%
-    \in@{.licr=}{#1=}%
-    \ifin@
-      \ifcase\bbl at engine
-        \bbl at replace\bbl at tempa{.licr=}{}%
-      \else
-        \let\bbl at tempa\relax
-      \fi
-    \fi
-    \ifx\bbl at tempa\relax\else
-      \bbl at replace\bbl at tempa{=}{}%
-      \bbl at exp{%
-        \def\<bbl at inikv@#1>####1=####2\\\@@{%
-          \\\bbl at inidate####1...\relax{####2}{\bbl at tempa}}}%
-    \fi
-  \fi
-  \def\bbl at section{#1}%
-  \def\bbl at elt##1##2{%
-    \@namedef{bbl at KVP@#1/##1}{}}%
-  \bbl at cs{renew@#1}%
-  \bbl at cs{secpre@#1}%  pre-section `hook'
-  \bbl at ifunset{bbl at inikv@#1}%
-    {\let\bbl at inireader\bbl at iniskip}%
-    {\bbl at exp{\let\\\bbl at inireader\<bbl at inikv@#1>}}}
-\let\bbl at renewlist\@empty
+\def\bbl at ini@calendar#1{%
+ \lowercase{\def\bbl at tempa{=#1=}}%
+ \bbl at replace\bbl at tempa{=date.gregorian}{}%
+ \bbl at replace\bbl at tempa{=date.}{}%
+ \in@{.licr=}{#1=}%
+ \ifin@
+   \ifcase\bbl at engine
+     \bbl at replace\bbl at tempa{.licr=}{}%
+   \else
+     \let\bbl at tempa\relax
+   \fi
+ \fi
+ \ifx\bbl at tempa\relax\else
+   \bbl at replace\bbl at tempa{=}{}%
+   \bbl at exp{%
+     \def\<bbl at inikv@#1>####1####2{%
+       \\\bbl at inidate####1...\relax{####2}{\bbl at tempa}}}%
+ \fi}
 \def\bbl at renewinikey#1/#2\@@#3{%
-  \bbl at ifunset{bbl at renew@#1}%
-    {\bbl at add@list\bbl at renewlist{#1}}%
-    {}%
-  \bbl at csarg\bbl at add{renew@#1}{\bbl at elt{#2}{#3}}}
-\def\bbl at inikv#1=#2\@@{%     key=value
-  \bbl at trim@def\bbl at tempa{#1}%
-  \bbl at trim\toks@{#2}%
-  \bbl at csarg\edef{@kv@\bbl at section.\bbl at tempa}{\the\toks@}}
+  \edef\bbl at tempa{\zap at space #1 \@empty}%   section
+  \edef\bbl at tempb{\zap at space #2 \@empty}%   key
+  \bbl at trim\toks@{#3}%                      value
+  \bbl at exp{%
+    \global\let\<bbl at KVP@\bbl at tempa/\bbl at tempb>\\\@empty % just a flag
+    \\\g at addto@macro\\\bbl at inidata{%
+       \\\bbl at elt{\bbl at tempa}{\bbl at tempb}{\the\toks@}}}}%
 \def\bbl at exportkey#1#2#3{%
   \bbl at ifunset{bbl@@kv@#2}%
     {\bbl at csarg\gdef{#1@\languagename}{#3}}%
@@ -2919,8 +2893,8 @@
        From babel-\bbl at cs{lini@\languagename}.ini:\\%
        \bbl at cs{@kv at identification.warning#1}\\%
        Reported }}}
-\let\bbl at inikv@identification\bbl at inikv
-\def\bbl at secpost@identification{%
+\def\bbl at ini@exports#1{%
+  % Identification always exported
   \bbl at iniwarning{}%
   \ifcase\bbl at engine
     \bbl at iniwarning{.pdflatex}%
@@ -2940,13 +2914,38 @@
     {\csname bbl at esname@\languagename\endcsname}}%
   \bbl at exportkey{sbcp}{identification.script.tag.bcp47}{}%
   \bbl at exportkey{sotf}{identification.script.tag.opentype}{DFLT}%
+  % Also maps bcp47 -> languagename
   \ifbbl at bcptoname
     \bbl at csarg\xdef{bcp at map@\bbl at cl{tbcp}}{\languagename}%
+  \fi
+  % Conditional
+  \ifnum#1>\z@         % 0 = only info, 1, 2 = basic, (re)new
+    \bbl at exportkey{lnbrk}{typography.linebreaking}{h}%
+    \bbl at exportkey{hyphr}{typography.hyphenrules}{}%
+    \bbl at exportkey{lfthm}{typography.lefthyphenmin}{2}%
+    \bbl at exportkey{rgthm}{typography.righthyphenmin}{3}%
+    \bbl at exportkey{prehc}{typography.prehyphenchar}{}%
+    \bbl at exportkey{hyotl}{typography.hyphenate.other.locale}{}%
+    \bbl at exportkey{hyots}{typography.hyphenate.other.script}{}%
+    \bbl at exportkey{intsp}{typography.intraspace}{}%
+    \bbl at exportkey{chrng}{characters.ranges}{}%
+    \bbl at exportkey{dgnat}{numbers.digits.native}{}%
+    \bbl at exportkey{frspc}{typography.frenchspacing}{u}%
+    \ifnum#1=\tw@           % only (re)new
+      \bbl at exportkey{rqtex}{identification.require.babel}{}%
+      \bbl at toglobal\bbl at savetoday
+      \bbl at toglobal\bbl at savedate
+      \bbl at savestrings
+    \fi
   \fi}
+\def\bbl at inikv#1#2{%     key=value
+  \toks@{#2}%            This hides #'s from ini values
+  \bbl at csarg\edef{@kv@\bbl at section.#1}{\the\toks@}}
+\let\bbl at inikv@identification\bbl at inikv
 \let\bbl at inikv@typography\bbl at inikv
 \let\bbl at inikv@characters\bbl at inikv
 \let\bbl at inikv@numbers\bbl at inikv
-\def\bbl at inikv@counters#1=#2\@@{%
+\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}%
@@ -2969,18 +2968,11 @@
     \expandafter\bbl at buildifcase\bbl at tempb* \\ % Space after \\
     \bbl at csarg{\global\expandafter\let}{cntr@#1@\languagename}\bbl at tempa
   \fi}
-\def\bbl at after@ini{%
-  \bbl at linebreak@export
-  \bbl at exportkey{dgnat}{numbers.digits.native}{}%
-  \bbl at exportkey{rqtex}{identification.require.babel}{}%
-  \bbl at exportkey{frspc}{typography.frenchspacing}{u}% unset
-  \bbl at toglobal\bbl at savetoday
-  \bbl at toglobal\bbl at savedate}
 \ifcase\bbl at engine
-  \bbl at csarg\def{inikv at captions.licr}#1=#2\@@{%
+  \bbl at csarg\def{inikv at captions.licr}#1#2{%
     \bbl at ini@captions at aux{#1}{#2}}
 \else
-  \def\bbl at inikv@captions#1=#2\@@{%
+  \def\bbl at inikv@captions#1#2{%
     \bbl at ini@captions at aux{#1}{#2}}
 \fi
 \def\bbl at ini@captions at template#1#2{% string language tempa=capt-name
@@ -3030,7 +3022,7 @@
   \bbl at ifunset{bbl at map@#1@\languagename}%
     {\@nameuse{#1}}%
     {\@nameuse{bbl at map@#1@\languagename}}}
-\def\bbl at inikv@labels#1=#2\@@{%
+\def\bbl at inikv@labels#1#2{%
   \in@{.map}{#1}%
   \ifin@
     \ifx\bbl at KVP@labels\@nil\else
@@ -3218,7 +3210,7 @@
 \def\bbl at xdatecntr[#1|#2]{\localenumeral{#2}{#1}}
 \def\bbl at provide@lsys#1{%
   \bbl at ifunset{bbl at lname@#1}%
-    {\bbl at ini@basic{#1}}%
+    {\bbl at load@info{#1}}%
     {}%
   \bbl at csarg\let{lsys@#1}\@empty
   \bbl at ifunset{bbl at sname@#1}{\bbl at csarg\gdef{sname@#1}{Default}}{}%
@@ -3262,11 +3254,10 @@
      \fi}%
     {\hyphenchar\font\defaulthyphenchar}}
   % \fi}
-\def\bbl at ini@basic#1{%
+\def\bbl at load@info#1{%
   \def\BabelBeforeIni##1##2{%
     \begingroup
-      \bbl at add\bbl at secpost@identification{\closein\bbl at readstream }%
-      \bbl at read@ini{##1}1%
+      \bbl at read@ini{##1}0%
       \endinput          % babel- .tex may contain onlypreamble's
     \endgroup}%            boxed, to avoid extra spaces:
   {\bbl at input@texini{#1}}}
@@ -3360,7 +3351,7 @@
 \newcommand\BabelEnsureInfo{%
   \ifx\InputIfFileExists\@undefined\else
     \def\bbl at ensureinfo##1{%
-      \bbl at ifunset{bbl at lname@##1}{\bbl at ini@basic{##1}}{}}%
+      \bbl at ifunset{bbl at lname@##1}{\bbl at load@info{##1}}{}}%
   \fi
   \bbl at foreach\bbl at loaded{{%
     \def\languagename{##1}%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2021-02-22 21:53:32 UTC (rev 57846)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2021-02-22 21:54:37 UTC (rev 57847)
@@ -33,7 +33,7 @@
 %%
 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{babel}[2021/01/26 3.53 The Babel package]
+\ProvidesPackage{babel}[2021/02/22 3.54 The Babel package]
 \@ifpackagewith{babel}{debug}
   {\providecommand\bbl at trace[1]{\message{^^J[ #1 ]}}%
    \let\bbl at debug\@firstofone
@@ -216,7 +216,7 @@
   \else
     \expandafter\@firstofone
   \fi}
-  % Temporarily repeat here the code for errors
+  % Temporarily repeat here the code for errors. TODO.
   \def\bbl at error#1#2{%
     \begingroup
       \def\\{\MessageBreak}%
@@ -239,16 +239,17 @@
       \def\\{\MessageBreak}%
       \PackageInfo{babel}{#1}%
     \endgroup}
-    \def\bbl at nocaption{\protect\bbl at nocaption@i}
+\def\bbl at nocaption{\protect\bbl at nocaption@i}
 \def\bbl at nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
   \global\@namedef{#2}{\textbf{?#1?}}%
   \@nameuse{#2}%
-  \bbl at warning{% TODO.
-    \@backslashchar#2 not set. Please, define it\\%
-    after the language has been loaded (typically\\%
-    in the preamble) with the help of\\%
-    \string\setlocalecaption. An example is:\\%
-    \string\setlocalecaption{mylang}{chapter}{..}\\
+  \edef\bbl at tempa{#1}%
+  \bbl at sreplace\bbl at tempa{name}{}%
+  \bbl at warning{%
+    \@backslashchar#1 not set for '\languagename'. Please,\\%
+    define it after the language has been loaded\\%
+    (typically in the preamble) with\\%
+    \string\setlocalecaption{\languagename}{\bbl at tempa}{..}\\%
     Reported}}
 \def\bbl at tentative{\protect\bbl at tentative@i}
 \def\bbl at tentative@i#1{%

Modified: trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2021-02-22 21:53:32 UTC (rev 57846)
+++ trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2021-02-22 21:54:37 UTC (rev 57847)
@@ -37,10 +37,10 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{hyphen.cfg}[2021/01/26 3.53 Babel hyphens]
+\ProvidesFile{hyphen.cfg}[2021/02/22 3.54 Babel hyphens]
 \xdef\bbl at format{\jobname}
-\def\bbl at version{3.53}
-\def\bbl at date{2021/01/26}
+\def\bbl at version{3.54}
+\def\bbl at date{2021/02/22}
 \ifx\AtBeginDocument\@undefined
   \def\@empty{}
   \let\orig at dump\dump

Modified: trunk/Master/texmf-dist/tex/generic/babel/luababel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2021-02-22 21:53:32 UTC (rev 57846)
+++ trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2021-02-22 21:54:37 UTC (rev 57847)
@@ -417,7 +417,7 @@
   \let\bbl at cjkintraspace\relax
   \directlua{
     Babel = Babel or {}
-    require'babel-data-cjk.lua'
+    require('babel-data-cjk.lua')
     Babel.cjk_enabled = true
     function Babel.cjk_linebreak(head)
       local GLYPH = node.id'glyph'
@@ -1413,21 +1413,86 @@
      \ifcase\bbl at thetextdir
        \let\bbl at pictresetdir\relax
      \else
-       \bodydir TLT
+       \ifcase#1\bodydir TLT  % Remember this sets the inner boxes
+         \or\textdir TLT
+         \else\bodydir TLT \textdir TLT
+       \fi
        % \(text|par)dir required in pgf:
        \def\bbl at pictresetdir{\bodydir TRT\pardir TRT\textdir TRT\relax}%
      \fi}%
    \ifx\AddToHook\@undefined\else
-     \AddToHook{env/picture/begin}{\bbl at pictsetdir\z@}%
+     \AddToHook{env/picture/begin}{\bbl at pictsetdir\tw@}%
+     \directlua{
+       Babel.get_picture_dir = true
+       Babel.picture_has_bidi = 0
+       function Babel.picture_dir (head)
+         if not Babel.get_picture_dir then return head end
+         for item in node.traverse(head) do
+           if item.id == node.id'glyph' then
+             local itemchar = item.char
+             % TODO. Copypaste pattern from Babel.bidi (-r)
+             local chardata = Babel.characters[itemchar]
+             local dir = chardata and chardata.d or nil
+             if not dir then
+               for nn, et in ipairs(Babel.ranges) do
+                 if itemchar < et[1] then
+                   break
+                 elseif itemchar <= et[2] then
+                   dir = et[3]
+                   break
+                 end
+               end
+             end
+             if dir and (dir == 'al' or dir == 'r') then
+               Babel.picture_has_bidi = 1
+             end
+           end
+         end
+         return head
+       end
+       luatexbase.add_to_callback("hpack_filter", Babel.picture_dir,
+         "Babel.picture_dir")
+     }%
+   \AtBeginDocument{%
+     \long\def\put(#1,#2)#3{%
+       \@killglue
+       % Try:
+       \ifx\bbl at pictresetdir\relax
+         \def\bbl at tempc{0}%
+       \else
+         \directlua{
+           Babel.get_picture_dir = true
+           Babel.picture_has_bidi = 0
+         }%
+         \setbox\z@\hb at xt@\z@{%
+           \@defaultunitsset\@tempdimc{#1}\unitlength
+           \kern\@tempdimc
+           #3\hss}%
+         \edef\bbl at tempc{\directlua{tex.print(Babel.picture_has_bidi)}}%
+       \fi
+       % Do:
+       \@defaultunitsset\@tempdimc{#2}\unitlength
+       \raise\@tempdimc\hb at xt@\z@{%
+         \@defaultunitsset\@tempdimc{#1}\unitlength
+         \kern\@tempdimc
+         {\ifnum\bbl at tempc>\z@\bbl at pictresetdir\fi#3}\hss}%
+       \ignorespaces}%
+       \MakeRobust\put}%
    \fi
    \AtBeginDocument
      {\ifx\tikz at atbegin@node\@undefined\else
         \let\bbl at OL@pgfpicture\pgfpicture
         \bbl at sreplace\pgfpicture{\pgfpicturetrue}%
-          {\bbl at pictsetdir\@ne\pgfpicturetrue}%
-        \bbl at add\pgfsys at beginpicture{\bbl at pictsetdir\@ne}%
+          {\bbl at pictsetdir\z@\pgfpicturetrue}%
+        \bbl at add\pgfsys at beginpicture{\bbl at pictsetdir\z@}%
         \bbl at add\tikz at atbegin@node{\bbl at pictresetdir}%
-      \fi}}
+        \bbl at sreplace\tikz{\begingroup}%
+          {\begingroup\bbl at pictsetdir\tw@}%
+      \fi
+      \ifx\AddToHook\@undefined\else
+        \AddToHook{env/tcolorbox/begin}{\bbl at pictsetdir\@ne}%
+      \fi
+      }}
   {}
 \IfBabelLayout{counters}%
   {\let\bbl at OL@@textsuperscript\@textsuperscript

Modified: trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2021-02-22 21:53:32 UTC (rev 57846)
+++ trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2021-02-22 21:54:37 UTC (rev 57847)
@@ -32,7 +32,7 @@
 %% extension |.ins|) which are part of the distribution.
 %%
 
-\ProvidesLanguage{nil}[2021/01/26 3.53 Nil language]
+\ProvidesLanguage{nil}[2021/02/22 3.54 Nil language]
 \LdfInit{nil}{datenil}
 \ifx\l at nil\@undefined
   \newlanguage\l at nil



More information about the tex-live-commits mailing list.