texlive[50699] Master/texmf-dist: babel (1apr19)

commits+karl at tug.org commits+karl at tug.org
Mon Apr 1 23:10:44 CEST 2019


Revision: 50699
          http://tug.org/svn/texlive?view=revision&revision=50699
Author:   karl
Date:     2019-04-01 23:10:44 +0200 (Mon, 01 Apr 2019)
Log Message:
-----------
babel (1apr19)

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-bidi-basic-r.lua
    trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
    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/locale/ar/babel-ar-DZ.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-MA.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-SY.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/fa/babel-fa.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/he/babel-he.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/hi/babel-hi.ini
    trunk/Master/texmf-dist/tex/generic/babel/luababel.def
    trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
    trunk/Master/texmf-dist/tex/generic/babel/switch.def
    trunk/Master/texmf-dist/tex/generic/babel/xebabel.def

Modified: trunk/Master/texmf-dist/doc/latex/babel/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/README.md	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/doc/latex/babel/README.md	2019-04-01 21:10:44 UTC (rev 50699)
@@ -1,4 +1,4 @@
-## Babel 3.27
+## Babel 3.28
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages.  Many
@@ -51,6 +51,12 @@
 ### Latest changes
 
 ```
+3.28 -   Fixes - wrong dir after math, in math inside tabular, in weak L
+         inside R inside L, and in boxes inside math.
+       - \babelfont now takes into account \defaultfontfeatures. This
+         is a potential source of backwards incompatibilities, but
+         very likely the risks are very low, and it is, I think, the
+         expected behavior.
 3.27   - Preliminary support for bidi (by Vafa Khalighi) with xetex.
        - Fix for 3.23 - \ensureascii was redefined even when not 
          necessary.
@@ -119,5 +125,5 @@
 ```
 
 Javier Bezos
-2018/11/13
+2019/04/01
 

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	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2019-04-01 21:10:44 UTC (rev 50699)
@@ -31,7 +31,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2018/11/13 v3.27 The Babel package]
+\ProvidesFile{babel.dtx}[2019/04/01 v3.28 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -362,6 +362,15 @@
 \usepackage[_main=english_,dutch]{babel}
 \end{verbatim}
 
+\begin{note}
+Some classes load \babel{} with a hardcoded language option. Sometimes,
+the main language could be overridden with something like that before
+|\documentclass|:
+\begin{verbatim}
+\PassOptionsToPackage{main=english}{babel}
+\end{verbatim}
+\end{note}
+
 \begin{warning}
   Languages may be set as global and as package option at the same
   time, but in such a case you should set explicitly the main language
@@ -380,7 +389,7 @@
   want to use some of the language selectors described below.
 \end{warning}
 
-To switch the language there are two basic macros, decribed below in
+To switch the language there are two basic macros, described below in
 detail: |\selectlanguage| is used for blocks of text, while
 |\foreignlanguage| is for chunks of text inside paragraphs.
 
@@ -969,7 +978,7 @@
 
 \Describe{KeepShorthandsActive}{}
 Tells babel not to deactivate shorthands after loading a language
-file, so that they are also availabe in the preamble.
+file, so that they are also available in the preamble.
 
 \Describe{activeacute}{} For some languages \babel\ supports this
 options to set |'| as a shorthand in case it is not done by default.
@@ -1855,7 +1864,7 @@
 
 |\babelfont| can be used to implicitly define a new font family. Just
 write its name instead of |rm|, |sf| or |tt|. This is the preferred way
-to select fonts in addition to the three basic ones.
+to select fonts in addition to the three basic families.
 
 \begin{example}
   Here is how to do it:
@@ -1877,13 +1886,17 @@
   |dev2| (\luatex{} does not detect automatically the correct 
   script\footnote{And even with the correct code some fonts could be 
   rendered incorrectly by \textsf{fontspec}, so double check the 
-  results. \xetex{} fares better, but some font are still problematic.}).
+  results. \xetex{} fares better, but some font are still
+  problematic.}). You may also pass some options to \textsf{fontspec}:
+  with |silent|, the warnings about unavailable scripts or languages
+  are not shown (they are only really useful when the document format
+  is being set up).
 \end{note}
 
 \begin{note}
-  Directionality is a property affecting margins, intentation, column
+  Directionality is a property affecting margins, indentation, column
   order, etc., not just text. Therefore, it is under the direct
-  control of the language, which appplies both the script and the
+  control of the language, which applies both the script and the
   direction to the text. As a consequence, there is no need to set
   \texttt{Script} when declaring a font (nor \texttt{Language}). In
   fact, it is even discouraged.
@@ -1954,16 +1967,28 @@
 \end{itemize}
 
 \begin{note}
-  These macros (|\captions|\m{lang}, |\extras|\m{lang}) may be redefined, but
-  must not be used as such -- they just pass information to \babel{},
-  which executes them in the proper context.
+  These macros (|\captions|\m{lang}, |\extras|\m{lang}) may be
+  redefined, but \textit{must not} be used as such -- they just pass
+  information to \babel{}, which executes them in the proper context.
 \end{note}
 
+Another way to modify a language loaded as a package or class option
+is by means of |\babelprovide|, described below in depth. So,
+something like:
+\begin{verbatim}
+\usepackage[danish]{babel}
+\babelprovide[captions=da,hyphenrules=nohyphenation]{danish}
+\end{verbatim}
+first loads |danish.ldf|, and then redefines the captions for
+\texttt{danish} (as provided by the |ini| file) and prevents
+hyphenation. The rest of the language definitions are not touched.
+
 \subsection{Creating a language}
 
-\New{3.10} And what if there is no style for your language or none
-fits your needs? You may then define quickly a language with the
-help of the following macro in the preamble.
+\New{3.10} And what if there is no style for your language or none fits
+your needs? You may then define quickly a language with the help of the
+following macro in the preamble (which may be used to modify an
+existing language, too, as explained in the previous subsection).
 
 \Describe{\babelprovide}{\oarg{options}\marg{language-name}}
 
@@ -2054,7 +2079,7 @@
 \babelprovide[hyphenrules=+]{neo}
 \babelpatterns[neo]{a1 e1 i1 o1 u1}
 \end{verbatim}
-In other engines it just supresses hyphenation (because the pattern
+In other engines it just suppresses hyphenation (because the pattern
 list is empty).
 
 \Describe{main}{} This valueless option makes the language the main
@@ -2080,14 +2105,15 @@
 cases.
 
 \Describe{mapfont=}{\texttt{direction}}
-Assigns the font for the writing direction of this language. More
-precisely, what |mapfont=direction| means is, ‘when a character has the
-same direction as the script for the “provided” language, then change
-its font to that set for this language’. There are 3 directions,
-following the bidi Unicode algorithm, namely, Arabic-like, Hebrew-like
-and left to right.\footnote{In future realeases an new value 
-(\texttt{script}) will be added.} So, there should be at most 3 
-directives of this kind.
+Assigns the font for the writing direction of this
+language.\footnote{There will be another value, \texttt{language}, not
+yet implemented.} More precisely, what |mapfont=direction| means is,
+‘when a character has the same direction as the script for the
+“provided” language, then change its font to that set for this
+language’. There are 3 directions, following the bidi Unicode
+algorithm, namely, Arabic-like, Hebrew-like and left to
+right.\footnote{In future releases an new value (\texttt{script}) will
+be added.} So, there should be at most 3 directives of this kind.
 
 \Describe{intraspace=}{\meta{base} \meta{shrink} \meta{stretch}}
 Sets the interword space for the writing system of the language, in em
@@ -2095,7 +2121,7 @@
 applied is that of the current text (more precisely, the previous 
 glyph). Currently used only in Southeast Asian scrips, like Thai.
 
-\Describe{intrapenalty}{\meta{penalty}}
+\Describe{intrapenalty=}{\meta{penalty}}
 Sets the interword penalty for the writing system of this language.
 Currently used only in Southeast Asian scrips, like Thai. Ignored if 0
 (which is the default value).
@@ -2174,13 +2200,13 @@
 \textit{explicit} or \textit{hard hyphens}, which in \TeX\ are
 entered as \verb|-|, and (2) \textit{optional} or \textit{soft
 hyphens}, which are entered as \verb|\-|. Strictly, a \textit{soft
-hyphen} is not a hyphen, but just a breaking oportunity or, in
+hyphen} is not a hyphen, but just a breaking opportunity or, in
 \TeX\ terms, a ``discretionary''; a \textit{hard hyphen} is a hyphen
-with a breaking oportunity after it. A further type is a
+with a breaking opportunity after it. A further type is a
 \textit{non-breaking hyphen}, a hyphen without a breaking
-oportunity.
+opportunity.
 
-In \TeX, \verb|-| and \verb|\-| forbid further breaking oportunities
+In \TeX, \verb|-| and \verb|\-| forbid further breaking opportunities
 in the word. This is the desired behavior very often, but not always,
 and therefore many languages provide shorthands for these
 cases. Unfortunately, this has not been done consistently: for
@@ -2187,7 +2213,7 @@
 example, \verb|"-| in Dutch, Portugese, Catalan or Danish is a hard
 hyphen, while in German, Spanish, Norwegian, Slovak or Russian is a
 soft hyphen. Furthermore, some of them even redefine |\-|, so that you
-cannot insert a soft hyphen without breaking oportunities in the rest
+cannot insert a soft hyphen without breaking opportunities in the rest
 of the word.
 
 Therefore, some macros are provide with a set of basic ``hyphens''
@@ -2290,7 +2316,7 @@
 |\textcyrillic|), but be aware they may also set the language to a
 certain default. Even the \babel{} core defined |\textlatin|, but is
 was somewhat buggy because in some cases it messed up encodings and
-fonts (for example, if the main latin encoding was |LY1|), and
+fonts (for example, if the main Latin encoding was |LY1|), and
 therefore it has been deprecated.\footnote{But still defined for
 backwards compatibility.}
 
@@ -2315,7 +2341,7 @@
 in some special cases when no Latin encoding is explicitly set).
 
 The foregoing rules (which are applied ``at begin document'') cover
-most of cases. No asumption is made on characters above
+most of cases. No assumption is made on characters above
 127, which may not follow the LICR conventions -- the goal is just
 to ensure most of the ASCII letters and symbols are the right ones.
 
@@ -2337,8 +2363,8 @@
   A basic stable version for other engines must wait very likely until
   (Northern) Winter. This applies to text, but \textbf{graphical}
   elements, including the |picture| environment and PDF or PS based
-  graphics, are not yet correctly handled. Also, indexes and the like 
-  are under study, as well as math.
+  graphics, are not yet correctly handled (far from trivial). Also,
+  indexes and the like are under study, as well as math.
 
   An effort is being made to avoid incompatibilities in the future
   (this one of the reason currently bidi must be explicitly requested
@@ -2406,7 +2432,7 @@
   mixed without explicit markup (the latter will be only necessary in
   some special cases where the Unicode algorithm fails). It is used much
   like |bidi=basic-r|, but with R text inside L text you may want to map
-  the font so that the correct features are in force. This is accomplised
+  the font so that the correct features are in force. This is accomplished
   with an option in |\babelprovide|, as illustrated:
     \begingroup
   % If you are looking at the code to see how it has been written, you
@@ -2469,7 +2495,7 @@
 
 \New{3.16} \textit{To be expanded}. Selects which layout elements are
 adapted in bidi documents, including some text elements. You may use
-several options with a comma-separated list (eg,
+several options with a dot-separated list (eg,
 |layout=counters.contents.sectioning|). This list will be expanded in
 future releases (tables, captions, etc.). Note not all options are
 required by all engines.
@@ -2526,7 +2552,7 @@
   future); ignored in \pdftex{} or \xetex{} (which will not support a
   similar option in the short term) \New{3.18},
 
-\item[extras] is used for miscelaneous readjustments which do not fit into
+\item[extras] is used for miscellaneous readjustments which do not fit into
   the previous groups. Currently redefines in \luatex{} |\underline| and
   |\LaTeX2e| \New{3.19}.
 \end{description}
@@ -2549,7 +2575,7 @@
 \end{verbatim}
 There are \textit{three} R blocks and \textit{two} L blocks, and the
 order is \textit{RTL B and still ltr 1 ltr text RTL A}. This is by
-design to provide the proper behaviour in the most usual cases — but if
+design to provide the proper behavior in the most usual cases — but if
 you need to use |\ref| in an L text inside R, the L text must be marked
 up explictly; for example:
 \begin{verbatim}
@@ -2625,7 +2651,7 @@
 Several language definition files use their own methods to set
 options. For example, \textsf{french} uses |\frenchsetup|,
 \textsf{magyar} (1.5) uses |\magyarOptions|; modifiers provided by
-|spanish| have no attribute counterparts. Macros settting
+|spanish| have no attribute counterparts. Macros setting
 options are also used (eg, |\ProsodicMarksOn| in \textsf{latin}).
 
 \subsection{Hooks}
@@ -2882,16 +2908,16 @@
 \subsection{Current and future work}
 
 Current work is focused on the so-called complex scripts in \luatex{}.
-In 8-bit engines, \babel{} provided a basic support for bidi text as part
-of the style for Hebrew, but it is somewhat unsatisfactory and
-internally replaces some hardwired commands by other hardwired
-commands (generic changes would be much better).
+In 8-bit engines, \babel{} provided a basic support for bidi text as
+part of the style for Hebrew, but it is somewhat unsatisfactory and
+internally replaces some hardwired commands by other hardwired commands
+(generic changes would be much better).
 
-It is possible now to typeset Arabic or Hebrew with numbers and L
-text.  Next on the roadmap are line breaking in Thai and the like,
-as well as “non-European” digits. Also on the roadmap are R layouts
-(lists, footnotes, tables, column order), page and section numbering,
-and maybe kashida justification.
+It is possible now to typeset Arabic or Hebrew with numbers and L text.
+Next on the roadmap are line breaking in Thai and the like. Also on the
+roadmap are better support for R layouts (lists, footnotes, tables,
+column order), page and section numbering, and maybe kashida
+justification.
 
 Useful additions would be, for example, time, currency, addresses and
 personal names.\footnote{See for example POSIX, ISO 14652 and the
@@ -2975,7 +3001,7 @@
 \TeX{} and most engines based on it (pdf\TeX, \xetex, $\epsilon$-\TeX,
 the main exception being \luatex) require hyphenation patterns to be
 preloaded when a format is created (eg, \LaTeX, Xe\LaTeX,
-pdf\LaTeX). \babel{} provides a tool which has become standand in many
+pdf\LaTeX). \babel{} provides a tool which has become standard in many
 distributions and based on a ``configuration file'' named
 \file{language.dat}. The exact way this file is used depends on the
 distribution, so please, read the documentation for the latter (note
@@ -3029,7 +3055,7 @@
 german:T1 hyphenT1.ger
 german hyphen.ger
 \end{verbatim}
-With the previous settings, if the enconding when the language is
+With the previous settings, if the encoding when the language is
 selected is |T1| then the patterns in \file{hyphenT1.ger} are
 used, but otherwise use those in \file{hyphen.ger} (note the encoding
 could be set in |\extras|\m{lang}).
@@ -3079,7 +3105,7 @@
 \item When a language definition file is loaded, it can define
   |\l@|\langvar\ to be a dialect of |\language0| when |\l@|\langvar\
   is undefined.
-\item Language names must be all lowercase. If an unknow language is
+\item Language names must be all lowercase. If an unknown language is
   selected, \babel{} will attempt setting it after lowercasing its
   name.
 \item The semantics of modifiers is not defined (on purpose). In
@@ -3197,7 +3223,7 @@
 |\righthyphenmin|. This macro will check whether these parameters
 were provided by the hyphenation file before it takes any action.
 If these values have been already set, this command is ignored
-(currenty, default pattern files do \textit{not} set them).
+(currently, default pattern files do \textit{not} set them).
 
 \DescribeMacro{\captions\langvar}
 The macro |\captions|\langvar\ defines the macros that
@@ -3324,6 +3350,23 @@
 \ldf at finish{<language>}
 \end{verbatim}
 
+\begin{note}
+  If for some reason you want to load a package in your style, you
+  should be aware it cannot be done directly in the \texttt{ldf} file,
+  but it can be delayed with |\AtEndOfPackage|. Macros from external
+  packages can be used \textit{inside} definitions in the \textsf{ldf}
+  itself (for example, |\extras<language>|), but if executed directly,
+  the code must be placed inside |\AtEndOfPackage|. A trivial example
+  illustrating these points is:
+\begin{verbatim}
+\AtEndOfPackage{%
+  \RequirePackage{dingbat}%       Delay package
+  \savebox{\myeye}{\eye}}%        And direct usage
+\newsavebox{\myeye}
+\newcommand\myanchor{\anchor}%    But OK inside command
+\end{verbatim}
+\end{note}
+
 \subsection{Support for active characters}
 
 In quite a number of language definition files, active characters are
@@ -3486,9 +3529,9 @@
 |\providecommand|).
 
 Encoding info is |charset=| followed by a charset, which if given sets
-how the strings should be traslated to the internal representation
+how the strings should be translated to the internal representation
 used by the engine, typically |utf8|, which is the only value
-supported currently (default is no traslations). Note |charset| is
+supported currently (default is no translations). Note |charset| is
 applied by \luatex{} and \xetex{} when reading the file, not when the
 macro or string is used in the document.
 
@@ -3507,7 +3550,7 @@
 blocks are set as default (internally, |?|). With |strings=encoded|
 strings are protected, but they are correctly expanded in
 |\MakeUppercase| and the like. If there is no key |strings|, string
-definitions are ignored, but |\SetCase|s are still honoured (in a
+definitions are ignored, but |\SetCase|s are still honored (in a
 |encoded| way).
 
 The \m{category} is either |captions|, |date| or |extras|. You must
@@ -3568,7 +3611,7 @@
 \end{verbatim}
 
 When used in |ldf| files, previous values of |\|\m{category}\m{language}
-are overriden, which means the old way to define strings still works
+are overridden, which means the old way to define strings still works
 and used by default (to be precise, is first set to undefined and then
 strings are added). However, when used in the preamble or in a
 package, new settings are added to the previous ones, if the language
@@ -3582,7 +3625,7 @@
 not done by default to prevent backward incompatibilities, but if you
 are creating a new language this version is better. It's up to
 the maintainers of the current languages to decide if using it is
-appropiate.\footnote{This replaces in 3.9g a short-lived
+appropriate.\footnote{This replaces in 3.9g a short-lived
 \texttt{\string\UseStrings} which has been removed because it did
 not work.}
 
@@ -3621,7 +3664,7 @@
 macros using the internal format of |\@uclclist| (eg,
 |\bb\BB\cc\CC|). The mandatory arguments take precedence over the
 optional one. This command, unlike |\SetString|, is executed always
-(even without |strings|), and it is intented for minor readjustments
+(even without |strings|), and it is intended for minor readjustments
 only.
 
 For example, as |T1| is the default case mapping in \LaTeX, we could
@@ -3874,8 +3917,8 @@
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.27>>
-%<<date=2018/11/13>>
+%<<version=3.28>>
+%<<date=2019/04/01>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -7778,9 +7821,8 @@
     {\bbl at ifblank{#1}%
       {\bbl at error
         {If you want to modify `#2' you must tell how in\\%
-         the optional argument. Currently there are three\\%
-         options: captions=lang-tag, hyphenrules=lang-list\\%
-         import=lang-tag}%
+         the optional argument. See the manual for the\\%
+         available options.}%
         {Use this macro as documented}}%
       {\bbl at provide@renew{#2}}}%
   % Post tasks
@@ -8080,9 +8122,9 @@
   \@nameuse{bbl at secpost@\bbl at section}%  ends previous section
   \def\bbl at section{#1}%
   \@nameuse{bbl at secpre@\bbl at section}%   starts current section
-  \bbl at ifunset{bbl at secline@#1}%
+  \bbl at ifunset{bbl at inikv@#1}%
     {\let\bbl at inireader\bbl at iniskip}%
-    {\bbl at exp{\let\\\bbl at inireader\<bbl at secline@#1>}}}
+    {\bbl at exp{\let\\\bbl at inireader\<bbl at inikv@#1>}}}
 %    \end{macrocode}
 %
 % Reads a key=val line and stores the trimmed val in
@@ -8114,7 +8156,7 @@
 % |identification| and |typography|.
 %
 %    \begin{macrocode}
-\let\bbl at secline@identification\bbl at inikv
+\let\bbl at inikv@identification\bbl at inikv
 \def\bbl at secpost@identification{%
   \bbl at exportkey{lname}{identification.name.english}{}%
   \bbl at exportkey{lbcp}{identification.tag.bcp47}{}%
@@ -8122,9 +8164,9 @@
   \bbl at exportkey{sname}{identification.script.name}{}%
   \bbl at exportkey{sbcp}{identification.script.tag.bcp47}{}%
   \bbl at exportkey{sotf}{identification.script.tag.opentype}{DFLT}}
-\let\bbl at secline@typography\bbl at inikv
-\let\bbl at secline@characters\bbl at inikv
-\let\bbl at secline@numbers\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 after@ini{%
   \bbl at exportkey{lfthm}{typography.lefthyphenmin}{2}%
   \bbl at exportkey{rgthm}{typography.righthyphenmin}{3}%
@@ -8153,21 +8195,17 @@
 %    \end{macrocode}
 %
 % Now |captions| and |captions.licr|, depending on the engine. And
-% also for dates. They rely on a few auxilary macros.
+% below also for dates. They rely on a few auxiliary macros. It is
+% expected the ini file provides the complete set in Unicode and LICR,
+% in that order.
 %
 %    \begin{macrocode}
 \ifcase\bbl at engine
-  \bbl at csarg\def{secline at captions.licr}#1=#2\@@{%
+  \bbl at csarg\def{inikv at captions.licr}#1=#2\@@{%
     \bbl at ini@captions at aux{#1}{#2}}
-  \bbl at csarg\def{secline at date.gregorian}#1=#2\@@{%       for defaults
-    \bbl at ini@dategreg#1...\relax{#2}}
-  \bbl at csarg\def{secline at date.gregorian.licr}#1=#2\@@{%  override
-    \bbl at ini@dategreg#1...\relax{#2}}
 \else
-  \def\bbl at secline@captions#1=#2\@@{%
+  \def\bbl at inikv@captions#1=#2\@@{%
     \bbl at ini@captions at aux{#1}{#2}}
-  \bbl at csarg\def{secline at date.gregorian}#1=#2\@@{%
-    \bbl at ini@dategreg#1...\relax{#2}}
 \fi
 %    \end{macrocode}
 %
@@ -8186,22 +8224,41 @@
 %    \end{macrocode}
 %
 % But dates are more complex. The full date format is stores in
-% |date.gregorian|, so we must read it in non-Unicode engines, too.
+% |date.gregorian|, so we must read it in non-Unicode engines, too
+% (saved months are just discarded when the LICR section is reached).
 %
+% TODO. Remove copypaste pattern.
+%
 % \changes{3.16}{2018/01/02}{Fix - dates were severely broken.}
+% \changes{3.28}{2019/04/01}{Start work on calendars.}
 %
 %    \begin{macrocode}
-\bbl at csarg\def{secpre at date.gregorian.licr}{%
-  \ifcase\bbl at engine\let\bbl at savedate\@empty\fi}
-\def\bbl at ini@dategreg#1.#2.#3.#4\relax#5{% TODO - ignore with 'captions'
+\bbl at csarg\def{inikv at date.gregorian}#1=#2\@@{%       for defaults
+  \bbl at inidate#1...\relax{#2}{}}
+\bbl at csarg\def{inikv at date.islamic}#1=#2\@@{%
+  \bbl at inidate#1...\relax{#2}{islamic}}
+\bbl at csarg\def{inikv at date.hebrew}#1=#2\@@{% 
+  \bbl at inidate#1...\relax{#2}{hebrew}}
+\bbl at csarg\def{inikv at date.persian}#1=#2\@@{%
+  \bbl at inidate#1...\relax{#2}{persian}}
+\bbl at csarg\def{inikv at date.indian}#1=#2\@@{% 
+  \bbl at inidate#1...\relax{#2}{indian}}
+\ifcase\bbl at engine
+  \bbl at csarg\def{inikv at date.gregorian.licr}#1=#2\@@{%  override
+    \bbl at inidate#1...\relax{#2}{}}
+  \bbl at csarg\def{secpre at date.gregorian.licr}{%           discard uni
+    \ifcase\bbl at engine\let\bbl at savedate\@empty\fi}
+\fi
+% eg: 1=months, 2=wide, 3=1, 4=dummy
+\def\bbl at inidate#1.#2.#3.#4\relax#5#6{% TODO - ignore with 'captions'
   \bbl at trim@def\bbl at tempa{#1.#2}%
-  \bbl at ifsamestring{\bbl at tempa}{months.wide}%
+  \bbl at ifsamestring{\bbl at tempa}{months.wide}%      to savedate
     {\bbl at trim@def\bbl at tempa{#3}%
      \bbl at trim\toks@{#5}%
      \bbl at exp{%
       \\\bbl at add\\\bbl at savedate{%
-        \\\SetString\<month\romannumeral\bbl at tempa name>{\the\toks@}}}}%
-    {\bbl at ifsamestring{\bbl at tempa}{date.long}%
+        \\\SetString\<month\romannumeral\bbl at tempa#6name>{\the\toks@}}}}%
+    {\bbl at ifsamestring{\bbl at tempa}{date.long}%     defined now
       {\bbl at trim@def\bbl at toreplace{#5}%
        \bbl at TG@@date
        \global\bbl at csarg\let{date@\languagename}\bbl at toreplace
@@ -8220,9 +8277,10 @@
 % Dates will require some macros for the basic formatting. They may be
 % redefined by language, so ``semi-public'' names (camel case) are
 % used. Oddly enough, the CLDR places particles like “de”
-% inconsistenly in either in the date or in the month name.
+% inconsistently in either in the date or in the month name.
 %
 %    \begin{macrocode}
+\let\bbl at calendar\@empty
 \newcommand\BabelDateSpace{\nobreakspace}
 \newcommand\BabelDateDot{.\@}
 \newcommand\BabelDated[1]{{\number#1}}
@@ -8230,7 +8288,7 @@
 \newcommand\BabelDateM[1]{{\number#1}}
 \newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}}
 \newcommand\BabelDateMMMM[1]{{%
-  \csname month\romannumeral#1name\endcsname}}%
+  \csname month\romannumeral#1\bbl at calendar name\endcsname}}%
 \newcommand\BabelDatey[1]{{\number#1}}%
 \newcommand\BabelDateyy[1]{{%
   \ifnum#1<10 0\number#1 %
@@ -9170,6 +9228,8 @@
 % \changes{3.15}{2017/10/30}{Use an attribute instead of tex language
 %    (reserved for hyphenation).}
 % \changes{3.15}{2017/10/30}{Store direction in @wdir@<lang>.}
+% \changes{3.28}{2019/04/01}{Dir in boxes within math and other
+%    contexts (passim).}
 %
 %    \begin{macrocode}
 \bbl at trace{Basic (internal) bidi support}
@@ -9205,6 +9265,7 @@
 \ifodd\bbl at engine  % luatex=1
   \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
   \DisableBabelHook{babel-bidi}
+  \chardef\bbl at thetextdir\z@
   \chardef\bbl at thepardir\z@
   \def\bbl at getluadir#1{%
     \directlua{
@@ -9225,12 +9286,24 @@
     \fi}
   \def\bbl at textdir#1{%
     \bbl at setluadir{text}\textdir{#1}% TODO - ?\linedir
+    \chardef\bbl at thetextdir#1\relax
     \setattribute\bbl at attr@dir{\numexpr\bbl at thepardir*3+#1}}
-  \def\bbl at pardir#1{\bbl at setluadir{par}\pardir{#1}%
+  \def\bbl at pardir#1{%
+    \bbl at setluadir{par}\pardir{#1}%
     \chardef\bbl at thepardir#1\relax}
   \def\bbl at bodydir{\bbl at setluadir{body}\bodydir}
   \def\bbl at pagedir{\bbl at setluadir{page}\pagedir}
   \def\bbl at dirparastext{\pardir\the\textdir\relax}%   %%%%
+  % Sadly, we have to deal with boxes in math with basic:
+  \def\bbl at mathboxdir{%
+    \ifcase\bbl at thetextdir\relax
+      \everyhbox{\bgroup\aftergroup\egroup\textdir TLT\relax}%
+    \else
+      \everyhbox{\bgroup\aftergroup\egroup\textdir TRT\relax}%
+    \fi}
+  % TODO - the same trick as bbl at severypar
+  \everymath{\bbl at mathboxdir}
+  \everydisplay{\bbl at mathboxdir}
 \else % pdftex=0, xetex=2
   \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
   \DisableBabelHook{babel-bidi}
@@ -9316,12 +9389,19 @@
 \fi
 %    \end{macrocode}
 %
-% A tool for weak L (mainly digits).
+% A tool for weak L (mainly digits). We also disable warnings with
+% \textsf{hyperref}.
 %
 % \changes{3.16}{2018/01/02}{New macro \cs{babelsublr}}
 %
 %    \begin{macrocode}
-  \DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl at textdir\z@#1}}
+\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl at textdir\z@#1}}
+\AtBeginDocument{%
+  \ifx\pdfstringdefDisableCommands\@undefined\else
+    \ifx\pdfstringdefDisableCommands\relax\else
+      \pdfstringdefDisableCommands{\let\babelsublr\@firstofone}%
+    \fi
+  \fi}
 %    \end{macrocode}
 %
 % \subsection{Local Language Configuration}
@@ -9613,16 +9693,17 @@
 %
 %  \begin{macro}{\bbl at set@language}
 %
-%    The macro |\bbl at set@language| takes care of switching the
-%    language environment \emph{and} of writing entries on the
-%    auxiliary files.  For historial reasons, language names can be
-%    either |language| of |\language|. To catch either form a trick is
-%    used, but unfortunately as a side effect the catcodes of letters
-%    in |\languagename| are not well defined. The list of auxiliary
-%    files can be extended by redefining |\BabelContentsFiles|, but
-%    make sure they are loaded inside a group (as |aux|, |toc|,
-%    |lof|, and |lot| do) or the last language of the document will
-%    remain active afterwards.
+%    The macro |\bbl at set@language| takes care of switching the language
+%    environment \emph{and} of writing entries on the auxiliary files.
+%    For historial reasons, language names can be either |language| of
+%    |\language|. To catch either form a trick is used, but
+%    unfortunately as a side effect the catcodes of letters in
+%    |\languagename| are messed up. This is a bug, but preserved for
+%    backwards compatibility. The list of auxiliary files can be
+%    extended by redefining |\BabelContentsFiles|, but make sure they
+%    are loaded inside a group (as |aux|, |toc|, |lof|, and |lot| do)
+%    or the last language of the document will remain active
+%    afterwards.
 %
 %    We also write a command to change the current language in the
 %    auxiliary files.
@@ -9640,11 +9721,12 @@
 %
 %    \begin{macrocode}
 \def\BabelContentsFiles{toc,lof,lot}
-\def\bbl at set@language#1{%
+\def\bbl at set@language#1{% from selectlanguage, pop@
   \edef\languagename{%
     \ifnum\escapechar=\expandafter`\string#1\@empty
     \else\string#1\@empty\fi}%
   \select at language{\languagename}%
+  % write to auxs
   \expandafter\ifx\csname date\languagename\endcsname\relax\else
     \if at filesw
       \protected at write\@auxout{}{\string\babel at aux{\languagename}{}}%
@@ -9651,8 +9733,10 @@
       \bbl at usehooks{write}{}%
     \fi
   \fi}
-\def\select at language#1{%
+\def\select at language#1{% from set@, babel at aux
+  % set hymap
   \ifnum\bbl at hymapsel=\@cclv\chardef\bbl at hymapsel4\relax\fi
+  % set name
   \edef\languagename{#1}%
   \bbl at fixname\languagename
   \bbl at iflanguage\languagename{%
@@ -9665,6 +9749,7 @@
          some cases, you may need to remove the aux file}%
         {You may proceed, but expect wrong results}%
     \else
+      % set type
       \let\bbl at select@type\z@
       \expandafter\bbl at switch\expandafter{\languagename}%
     \fi}}
@@ -9744,7 +9829,8 @@
 %
 %    \begin{macrocode}
 \newif\ifbbl at usedategroup
-\def\bbl at switch#1{%
+\def\bbl at switch#1{%  from select@, foreign@
+  % restore
   \originalTeX
   \expandafter\def\expandafter\originalTeX\expandafter{%
     \csname noextras#1\endcsname
@@ -9752,6 +9838,7 @@
     \babel at beginsave}%
   \bbl at usehooks{afterreset}{}%
   \languageshorthands{none}%
+  % switch captions, date
   \ifcase\bbl at select@type
     \ifhmode
       \hskip\z at skip % trick to ignore spaces
@@ -9762,19 +9849,27 @@
       \csname captions#1\endcsname\relax
       \csname date#1\endcsname\relax
     \fi
-  \else\ifbbl at usedategroup
-    \bbl at usedategroupfalse
-    \ifhmode
-      \hskip\z at skip % trick to ignore spaces
-      \csname date#1\endcsname\relax
-      \loop\ifdim\lastskip>\z@\unskip\repeat\unskip
-    \else
-      \csname date#1\endcsname\relax
+  \else
+    \ifbbl at usedategroup   % if \foreign... within \<lang>date
+      \bbl at usedategroupfalse
+      \ifhmode
+        \hskip\z at skip % trick to ignore spaces
+        \csname date#1\endcsname\relax
+        \loop\ifdim\lastskip>\z@\unskip\repeat\unskip
+      \else
+        \csname date#1\endcsname\relax
+      \fi
     \fi
-  \fi\fi
+  \fi
+  % switch extras
   \bbl at usehooks{beforeextras}{}%
   \csname extras#1\endcsname\relax
   \bbl at usehooks{afterextras}{}%
+  %  > babel-ensure
+  %  > babel-sh-<short>
+  %  > babel-bidi
+  %  > babel-fontspec
+  % hyphenation - case mapping
   \ifcase\bbl at opt@hyphenmap\or
     \def\BabelLower##1##2{\lccode##1=##2\relax}%
     \ifnum\bbl at hymapsel>4\else
@@ -9787,7 +9882,9 @@
     \fi
   \fi
   \global\let\bbl at hymapsel\@cclv
+  % hyphenation - patterns
   \bbl at patterns{#1}%
+  % hyphenation - mins
   \babel at savevariable\lefthyphenmin
   \babel at savevariable\righthyphenmin
   \expandafter\ifx\csname #1hyphenmins\endcsname\relax
@@ -9939,18 +10036,21 @@
 %
 %    \begin{macrocode}
 \def\foreign at language#1{%
+  % set name
   \edef\languagename{#1}%
   \bbl at fixname\languagename
   \bbl at iflanguage\languagename{%
     \expandafter\ifx\csname date\languagename\endcsname\relax
-      \bbl at warning
+      \bbl at warning   % TODO - why a warning, not an error?
         {Unknown language `#1'. Either you have\\%
          misspelled its name, it has not been installed,\\%
          or you requested it in a previous run. Fix its name,\\%
-         install it or just rerun the file, respectively.\\%
+         install it or just rerun the file, respectively. In\\%
+         some cases, you may need to remove the aux file.\\%
          I'll proceed, but expect wrong results.\\%
          Reported}%
     \fi
+    % set type
     \let\bbl at select@type\@ne
     \expandafter\bbl at switch\expandafter{\languagename}}}
 %    \end{macrocode}
@@ -9994,6 +10094,7 @@
       \edef\bbl at tempa{#1:\f at encoding}%
     \fi
   \@expandtwoargs\bbl at usehooks{patterns}{{#1}{\bbl at tempa}}%
+  %  > luatex
   \@ifundefined{bbl at hyphenation@}{}{% Can be \relax!
     \begingroup
       \bbl at xin@{,\number\language,}{,\bbl at hyphlist}%
@@ -10467,10 +10568,12 @@
   \expandafter\language\csname l@#1\endcsname
   \edef\languagename{#1}%
   \bbl at hook@everylanguage{#1}%
+  %  > luatex
   \bbl at get@enc#1::\@@@
   \begingroup
     \lefthyphenmin\m at ne
     \bbl at hook@loadpatterns{#2}%
+    %  > luatex
     \ifnum\lefthyphenmin=\m at ne
     \else
       \expandafter\xdef\csname #1hyphenmins\endcsname{%
@@ -10480,6 +10583,7 @@
   \def\bbl at tempa{#3}%
   \ifx\bbl at tempa\@empty\else
     \bbl at hook@loadexceptions{#3}%
+    %  > luatex
   \fi
   \let\bbl at elt\relax
   \edef\bbl at languages{%
@@ -10831,20 +10935,27 @@
 % |\bbl at mapselect| because |\selectfont| is called internally when a
 % font is defined.
 %
+% \changes{3.28}{2019/04/01}{\cs{babelfont} now based on
+%   \cs{newfontfamily}.}
+%
 %    \begin{macrocode}
 \def\bbl at font@set#1#2#3{% eg \bbl at rmdflt@lang \rmdefault \rmfamily
   \bbl at xin@{<>}{#1}%
   \ifin@
-    \bbl at exp{\\\bbl at fontspec@set\\#1\expandafter\@gobbletwo#1}%
+    \bbl at exp{\\\bbl at fontspec@set\\#1\expandafter\@gobbletwo#1\\#3}%
   \fi
   \bbl at exp{%
-    \def\\#2{#1}%        eg, \rmdefault{\bbl at rmdflt@lang}
+    \def\\#2{#1}%         eg, \rmdefault{\bbl at rmdflt@lang}
     \\\bbl at ifsamestring{#2}{\f at family}{\\#3\let\\\bbl at tempa\relax}{}}}
-\def\bbl at fontspec@set#1#2#3{% eg \bbl at rmdflt@lang fnt-opt fnt-nme
+%     TODO - next should be global?, but even local does its job. I'm
+%     still not sure -- must investigate:
+\def\bbl at fontspec@set#1#2#3#4{% eg \bbl at rmdflt@lang fnt-opt fnt-nme \xxfamily
   \let\bbl at tempe\bbl at mapselect
   \let\bbl at mapselect\relax
-  \bbl at exp{% TODO - should be global, but even local does its job
-        % I'm still not sure -- must investigate 
+  \let\bbl at temp@fam#4%       eg, '\rmfamily', to be restored below
+  \let#4\relax            %  So that can be used with \newfontfamily
+  \bbl at exp{% 
+    \let\\\bbl at temp@pfam\<\bbl at stripslash#4\space>% eg, '\rmfamily '
     \<keys_if_exist:nnF>{fontspec-opentype}%
         {Script/\bbl at cs{sname@\languagename}}%
       {\\\newfontscript{\bbl at cs{sname@\languagename}}%
@@ -10853,10 +10964,15 @@
         {Language/\bbl at cs{lname@\languagename}}%
       {\\\newfontlanguage{\bbl at cs{lname@\languagename}}%
         {\bbl at cs{lotf@\languagename}}}%
-    \<fontspec_set_family:Nnn>\\#1%
-      {\bbl at cs{lsys@\languagename},#2}}{#3}% ie \bbl at exp{..}{#3}
-  \let\bbl at mapselect\bbl at tempe
-  \bbl at toglobal#1}%
+    \\\newfontfamily\\#4%
+      [\bbl at cs{lsys@\languagename},#2]}{#3}% ie \bbl at exp{..}{#3}
+  \begingroup
+     #4%
+     \xdef#1{\f at family}%     eg, \bbl at rmdflt@lang{FreeSerif(0)}
+  \endgroup
+  \let#4\bbl at temp@fam
+  \bbl at exp{\let\<\bbl at stripslash#4\space>}\bbl at temp@pfam
+  \let\bbl at mapselect\bbl at tempe}%
 %    \end{macrocode}
 %
 % font at rst and famrst are only used when there is no global settings,
@@ -11746,9 +11862,9 @@
 \fi
 \ifx\bbl at opt@layout\@nnil\endinput\fi  % if no layout
 \ifx\bbl at beforeforeign\leavevmode % A poor test for bidi=
-  \def\bbl at nextfake#1{%
-    \mathdir\bodydir  % non-local, use always inside a group!
+  \def\bbl at nextfake#1{%  non-local changes - always inside a group!
     \bbl at exp{%
+      \mathdir\the\bodydir  
       #1%              Once entered in math, set boxes to restore values
       \everyvbox{%
         \the\everyvbox
@@ -18046,6 +18162,7 @@
 
   local new_dir = false
   local first_dir = false
+  local inmath = false
 
   local last_lr
 
@@ -18076,6 +18193,7 @@
         end
       end
       dir = dir or 'l'
+      if inmath then dir = ('TRT' == tex.mathdir) and 'r' or 'l' end
 %    \end{macrocode}
 %
 %      Next is based on the assumption babel sets the language AND
@@ -18128,12 +18246,14 @@
 %    \end{macrocode}
 %
 % Once finished the basic setup for glyphs, consider the two other
-% cases: dir node and the rest.
+% cases: dir node and the rest. 
 %
 %    \begin{macrocode}
-    elseif item.id == node.id'dir' then
+    elseif item.id == node.id'dir' and not inmath then
       new_dir = true
       dir = nil
+    elseif item.id == node.id'math' then
+      inmath = (item.subtype == 0)
     else
       dir = nil          -- Not a char
     end
@@ -18326,8 +18446,11 @@
   return head, new_state
 end
 
--- \hbox with an explicit dir can lead to wrong results
--- <R \hbox dir TLT{<R>}> and <L \hbox dir TRT{<L>}>
+-- TODO - \hbox with an explicit dir can lead to wrong results
+-- <R \hbox dir TLT{<R>}> and <L \hbox dir TRT{<L>}>. A small attempt
+-- was s made to improve the situation, but the problem is the 3-dir
+-- model in babel/Unicode and the 2-dir model in LuaTeX don't fit
+-- well.
 
 function Babel.bidi(head, ispar, hdir)
   local d   -- d is used mainly for computations in a loop
@@ -18336,6 +18459,7 @@
 
   local nodes = {}
   local outer_first = nil
+  local inmath = false
 
   local glue_d = nil
   local glue_i = nil
@@ -18354,9 +18478,14 @@
                  (temp == 2 and 'al')
   elseif ispar then            -- Or error? Shouldn't happen
     save_outer = ('TRT' == tex.pardir) and 'r' or 'l'
-  else
+  else                         -- Or error? Shouldn't happen
     save_outer = ('TRT' == hdir) and 'r' or 'l'
   end
+    -- when the callback is called, we are just _after_ the box,
+    -- and the textdir is that of the surrounding text
+  -- if not ispar and hdir ~= tex.textdir then 
+  --   save_outer = ('TRT' == hdir) and 'r' or 'l'
+  -- end
   local outer = save_outer
   local last = outer
   -- 'al' is only taken into account in the first, current loop
@@ -18395,6 +18524,7 @@
         end
       end
       d = d or 'l'
+      if inmath then d = ('TRT' == tex.mathdir) and 'r' or 'l' end
       d_font = d_font or d
 
       d_font = (d_font == 'l' and 0) or
@@ -18442,6 +18572,9 @@
       glue_d = d
       glue_i = item
       d = nil
+      
+    elseif item.id == node.id'math' then
+      inmath = (item.subtype == 0)
 
     else
       d = nil
@@ -18606,7 +18739,11 @@
       end
     else
       if d == 'an' or d == 'l' then
-        state.sim = state.sim or item
+        if nodes[q][3] then -- nil except after an explicit dir
+          state.sim = item  -- so we move sim 'inside' the group
+        else
+          state.sim = state.sim or item
+        end
         state.eim = item
       elseif d == 'r' and state.sim then
         head, state = insert_implicit(head, state, outer)

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.ins	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.ins	2019-04-01 21:10:44 UTC (rev 50699)
@@ -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{2018/11/13}
+\def\filedate{2019/04/01}
 \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	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2019-04-01 21:10:44 UTC (rev 50699)
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2018/11/13 v3.27]
+\ProvidesFile{bbcompat.dtx}[2019/04/01 v3.28]
 %</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-bidi-basic-r.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua	2019-04-01 21:10:44 UTC (rev 50699)
@@ -74,6 +74,7 @@
 
   local new_dir = false
   local first_dir = false
+  local inmath = false
 
   local last_lr
 
@@ -104,6 +105,7 @@
         end
       end
       dir = dir or 'l'
+      if inmath then dir = ('TRT' == tex.mathdir) and 'r' or 'l' end
       if new_dir then
         attr_dir = 0
         for at in node.traverse(item.attr) do
@@ -131,9 +133,11 @@
         if dir == 'et' or dir == 'es' then dir = 'on' end -- W6
         strong_lr = 'r'                                   -- W3
       end
-    elseif item.id == node.id'dir' then
+    elseif item.id == node.id'dir' and not inmath then
       new_dir = true
       dir = nil
+    elseif item.id == node.id'math' then
+      inmath = (item.subtype == 0)
     else
       dir = nil          -- Not a char
     end

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua	2019-04-01 21:10:44 UTC (rev 50699)
@@ -91,8 +91,11 @@
   return head, new_state
 end
 
--- \hbox with an explicit dir can lead to wrong results
--- <R \hbox dir TLT{<R>}> and <L \hbox dir TRT{<L>}>
+-- TODO - \hbox with an explicit dir can lead to wrong results
+-- <R \hbox dir TLT{<R>}> and <L \hbox dir TRT{<L>}>. A small attempt
+-- was s made to improve the situation, but the problem is the 3-dir
+-- model in babel/Unicode and the 2-dir model in LuaTeX don't fit
+-- well.
 
 function Babel.bidi(head, ispar, hdir)
   local d   -- d is used mainly for computations in a loop
@@ -101,6 +104,7 @@
 
   local nodes = {}
   local outer_first = nil
+  local inmath = false
 
   local glue_d = nil
   local glue_i = nil
@@ -119,9 +123,14 @@
                  (temp == 2 and 'al')
   elseif ispar then            -- Or error? Shouldn't happen
     save_outer = ('TRT' == tex.pardir) and 'r' or 'l'
-  else
+  else                         -- Or error? Shouldn't happen
     save_outer = ('TRT' == hdir) and 'r' or 'l'
   end
+    -- when the callback is called, we are just _after_ the box,
+    -- and the textdir is that of the surrounding text
+  -- if not ispar and hdir ~= tex.textdir then
+  --   save_outer = ('TRT' == hdir) and 'r' or 'l'
+  -- end
   local outer = save_outer
   local last = outer
   -- 'al' is only taken into account in the first, current loop
@@ -160,6 +169,7 @@
         end
       end
       d = d or 'l'
+      if inmath then d = ('TRT' == tex.mathdir) and 'r' or 'l' end
       d_font = d_font or d
 
       d_font = (d_font == 'l' and 0) or
@@ -208,6 +218,9 @@
       glue_i = item
       d = nil
 
+    elseif item.id == node.id'math' then
+      inmath = (item.subtype == 0)
+
     else
       d = nil
     end
@@ -371,7 +384,11 @@
       end
     else
       if d == 'an' or d == 'l' then
-        state.sim = state.sim or item
+        if nodes[q][3] then -- nil except after an explicit dir
+          state.sim = item  -- so we move sim 'inside' the group
+        else
+          state.sim = state.sim or item
+        end
         state.eim = item
       elseif d == 'r' and state.sim then
         head, state = insert_implicit(head, state, outer)

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.def	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.def	2019-04-01 21:10:44 UTC (rev 50699)
@@ -41,7 +41,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{babel.def}[2018/11/13 3.27 Babel common definitions]
+\ProvidesFile{babel.def}[2019/04/01 3.28 Babel common definitions]
 \ifx\AtBeginDocument\@undefined
   \input plain.def\relax
 \fi
@@ -1334,9 +1334,8 @@
     {\bbl at ifblank{#1}%
       {\bbl at error
         {If you want to modify `#2' you must tell how in\\%
-         the optional argument. Currently there are three\\%
-         options: captions=lang-tag, hyphenrules=lang-list\\%
-         import=lang-tag}%
+         the optional argument. See the manual for the\\%
+         available options.}%
         {Use this macro as documented}}%
       {\bbl at provide@renew{#2}}}%
   % Post tasks
@@ -1599,9 +1598,9 @@
   \@nameuse{bbl at secpost@\bbl at section}%  ends previous section
   \def\bbl at section{#1}%
   \@nameuse{bbl at secpre@\bbl at section}%   starts current section
-  \bbl at ifunset{bbl at secline@#1}%
+  \bbl at ifunset{bbl at inikv@#1}%
     {\let\bbl at inireader\bbl at iniskip}%
-    {\bbl at exp{\let\\\bbl at inireader\<bbl at secline@#1>}}}
+    {\bbl at exp{\let\\\bbl at inireader\<bbl at inikv@#1>}}}
 \def\bbl at inikv#1=#2\@@{%     key=value
   \bbl at trim@def\bbl at tempa{#1}%
   \bbl at trim\toks@{#2}%
@@ -1614,7 +1613,7 @@
      \else
        \bbl at exp{\global\let\<bbl@#1@\languagename>\<bbl@@kv@#2>}%
      \fi}}
-\let\bbl at secline@identification\bbl at inikv
+\let\bbl at inikv@identification\bbl at inikv
 \def\bbl at secpost@identification{%
   \bbl at exportkey{lname}{identification.name.english}{}%
   \bbl at exportkey{lbcp}{identification.tag.bcp47}{}%
@@ -1622,9 +1621,9 @@
   \bbl at exportkey{sname}{identification.script.name}{}%
   \bbl at exportkey{sbcp}{identification.script.tag.bcp47}{}%
   \bbl at exportkey{sotf}{identification.script.tag.opentype}{DFLT}}
-\let\bbl at secline@typography\bbl at inikv
-\let\bbl at secline@characters\bbl at inikv
-\let\bbl at secline@numbers\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 after@ini{%
   \bbl at exportkey{lfthm}{typography.lefthyphenmin}{2}%
   \bbl at exportkey{rgthm}{typography.righthyphenmin}{3}%
@@ -1651,17 +1650,11 @@
   \bbl at toglobal\bbl at savetoday
   \bbl at toglobal\bbl at savedate}
 \ifcase\bbl at engine
-  \bbl at csarg\def{secline at captions.licr}#1=#2\@@{%
+  \bbl at csarg\def{inikv at captions.licr}#1=#2\@@{%
     \bbl at ini@captions at aux{#1}{#2}}
-  \bbl at csarg\def{secline at date.gregorian}#1=#2\@@{%       for defaults
-    \bbl at ini@dategreg#1...\relax{#2}}
-  \bbl at csarg\def{secline at date.gregorian.licr}#1=#2\@@{%  override
-    \bbl at ini@dategreg#1...\relax{#2}}
 \else
-  \def\bbl at secline@captions#1=#2\@@{%
+  \def\bbl at inikv@captions#1=#2\@@{%
     \bbl at ini@captions at aux{#1}{#2}}
-  \bbl at csarg\def{secline at date.gregorian}#1=#2\@@{%
-    \bbl at ini@dategreg#1...\relax{#2}}
 \fi
 \def\bbl at ini@captions at aux#1#2{%
   \bbl at trim@def\bbl at tempa{#1}%
@@ -1672,17 +1665,31 @@
   \bbl at exp{%
     \\\bbl at add\\\bbl at savestrings{%
       \\\SetString\<\bbl at tempa name>{\the\toks@}}}}
-\bbl at csarg\def{secpre at date.gregorian.licr}{%
-  \ifcase\bbl at engine\let\bbl at savedate\@empty\fi}
-\def\bbl at ini@dategreg#1.#2.#3.#4\relax#5{% TODO - ignore with 'captions'
+\bbl at csarg\def{inikv at date.gregorian}#1=#2\@@{%       for defaults
+  \bbl at inidate#1...\relax{#2}{}}
+\bbl at csarg\def{inikv at date.islamic}#1=#2\@@{%
+  \bbl at inidate#1...\relax{#2}{islamic}}
+\bbl at csarg\def{inikv at date.hebrew}#1=#2\@@{%
+  \bbl at inidate#1...\relax{#2}{hebrew}}
+\bbl at csarg\def{inikv at date.persian}#1=#2\@@{%
+  \bbl at inidate#1...\relax{#2}{persian}}
+\bbl at csarg\def{inikv at date.indian}#1=#2\@@{%
+  \bbl at inidate#1...\relax{#2}{indian}}
+\ifcase\bbl at engine
+  \bbl at csarg\def{inikv at date.gregorian.licr}#1=#2\@@{%  override
+    \bbl at inidate#1...\relax{#2}{}}
+  \bbl at csarg\def{secpre at date.gregorian.licr}{%           discard uni
+    \ifcase\bbl at engine\let\bbl at savedate\@empty\fi}
+\fi
+\def\bbl at inidate#1.#2.#3.#4\relax#5#6{% TODO - ignore with 'captions'
   \bbl at trim@def\bbl at tempa{#1.#2}%
-  \bbl at ifsamestring{\bbl at tempa}{months.wide}%
+  \bbl at ifsamestring{\bbl at tempa}{months.wide}%      to savedate
     {\bbl at trim@def\bbl at tempa{#3}%
      \bbl at trim\toks@{#5}%
      \bbl at exp{%
       \\\bbl at add\\\bbl at savedate{%
-        \\\SetString\<month\romannumeral\bbl at tempa name>{\the\toks@}}}}%
-    {\bbl at ifsamestring{\bbl at tempa}{date.long}%
+        \\\SetString\<month\romannumeral\bbl at tempa#6name>{\the\toks@}}}}%
+    {\bbl at ifsamestring{\bbl at tempa}{date.long}%     defined now
       {\bbl at trim@def\bbl at toreplace{#5}%
        \bbl at TG@@date
        \global\bbl at csarg\let{date@\languagename}\bbl at toreplace
@@ -1696,6 +1703,7 @@
            \\\SetString\\\today{%
              \<\languagename date>{\\\the\year}{\\\the\month}{\\\the\day}}}}}}%
       {}}
+\let\bbl at calendar\@empty
 \newcommand\BabelDateSpace{\nobreakspace}
 \newcommand\BabelDateDot{.\@}
 \newcommand\BabelDated[1]{{\number#1}}
@@ -1703,7 +1711,7 @@
 \newcommand\BabelDateM[1]{{\number#1}}
 \newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}}
 \newcommand\BabelDateMMMM[1]{{%
-  \csname month\romannumeral#1name\endcsname}}%
+  \csname month\romannumeral#1\bbl at calendar name\endcsname}}%
 \newcommand\BabelDatey[1]{{\number#1}}%
 \newcommand\BabelDateyy[1]{{%
   \ifnum#1<10 0\number#1 %
@@ -2035,6 +2043,7 @@
 \ifodd\bbl at engine  % luatex=1
   \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
   \DisableBabelHook{babel-bidi}
+  \chardef\bbl at thetextdir\z@
   \chardef\bbl at thepardir\z@
   \def\bbl at getluadir#1{%
     \directlua{
@@ -2055,12 +2064,24 @@
     \fi}
   \def\bbl at textdir#1{%
     \bbl at setluadir{text}\textdir{#1}% TODO - ?\linedir
+    \chardef\bbl at thetextdir#1\relax
     \setattribute\bbl at attr@dir{\numexpr\bbl at thepardir*3+#1}}
-  \def\bbl at pardir#1{\bbl at setluadir{par}\pardir{#1}%
+  \def\bbl at pardir#1{%
+    \bbl at setluadir{par}\pardir{#1}%
     \chardef\bbl at thepardir#1\relax}
   \def\bbl at bodydir{\bbl at setluadir{body}\bodydir}
   \def\bbl at pagedir{\bbl at setluadir{page}\pagedir}
   \def\bbl at dirparastext{\pardir\the\textdir\relax}%   %%%%
+  % Sadly, we have to deal with boxes in math with basic:
+  \def\bbl at mathboxdir{%
+    \ifcase\bbl at thetextdir\relax
+      \everyhbox{\bgroup\aftergroup\egroup\textdir TLT\relax}%
+    \else
+      \everyhbox{\bgroup\aftergroup\egroup\textdir TRT\relax}%
+    \fi}
+  % TODO - the same trick as bbl at severypar
+  \everymath{\bbl at mathboxdir}
+  \everydisplay{\bbl at mathboxdir}
 \else % pdftex=0, xetex=2
   \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
   \DisableBabelHook{babel-bidi}
@@ -2133,7 +2154,13 @@
      \def\bbl at pardir#1{\ifcase#1\relax\setLR\else\setRL\fi}}
     {}%
 \fi
-  \DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl at textdir\z@#1}}
+\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl at textdir\z@#1}}
+\AtBeginDocument{%
+  \ifx\pdfstringdefDisableCommands\@undefined\else
+    \ifx\pdfstringdefDisableCommands\relax\else
+      \pdfstringdefDisableCommands{\let\babelsublr\@firstofone}%
+    \fi
+  \fi}
 \bbl at trace{Local Language Configuration}
 \ifx\loadlocalcfg\@undefined
   \@ifpackagewith{babel}{noconfigs}%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2019-04-01 21:10:44 UTC (rev 50699)
@@ -33,7 +33,7 @@
 %%
 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{babel}[2018/11/13 3.27 The Babel package]
+\ProvidesPackage{babel}[2019/04/01 3.28 The Babel package]
 \@ifpackagewith{babel}{debug}
   {\providecommand\bbl at trace[1]{\message{^^J[ #1 ]}}%
    \let\bbl at debug\@firstofone}

Modified: trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2019-04-01 21:10:44 UTC (rev 50699)
@@ -37,7 +37,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{hyphen.cfg}[2018/11/13 3.27 Babel hyphens]
+\ProvidesFile{hyphen.cfg}[2019/04/01 3.28 Babel hyphens]
 \xdef\bbl at format{\jobname}
 \ifx\AtBeginDocument\@undefined
   \def\@empty{}
@@ -93,10 +93,12 @@
   \expandafter\language\csname l@#1\endcsname
   \edef\languagename{#1}%
   \bbl at hook@everylanguage{#1}%
+  %  > luatex
   \bbl at get@enc#1::\@@@
   \begingroup
     \lefthyphenmin\m at ne
     \bbl at hook@loadpatterns{#2}%
+    %  > luatex
     \ifnum\lefthyphenmin=\m at ne
     \else
       \expandafter\xdef\csname #1hyphenmins\endcsname{%
@@ -106,6 +108,7 @@
   \def\bbl at tempa{#3}%
   \ifx\bbl at tempa\@empty\else
     \bbl at hook@loadexceptions{#3}%
+    %  > luatex
   \fi
   \let\bbl at elt\relax
   \edef\bbl at languages{%

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-DZ.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-DZ.ini	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-DZ.ini	2019-04-01 21:10:44 UTC (rev 50699)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.1
-date = 2018-02-05
+version = 1.2
+date = 2019-01-31
 name.local = العربية
 name.english = Arabic
 name.babel = arabic-dz
@@ -107,6 +107,32 @@
 dayPeriods.wide.am = ص
 dayPeriods.wide.pm = م
 
+[date.islamic]
+months.wide.1    = محرم
+months.wide.2    = صفر
+months.wide.3    = ربيع الأول
+months.wide.4    = ربيع الآخر
+months.wide.5    = جمادى الأولى
+months.wide.6    = جمادى الآخرة
+months.wide.7    = رجب
+months.wide.8    = شعبان
+months.wide.9    = رمضان
+months.wide.10   = شوال
+months.wide.11   = ذو القعدة
+months.wide.12   = ذو الحجة
+months.narrow.1  = ١
+months.narrow.2  = ٢
+months.narrow.3  = ٣
+months.narrow.4  = ٤
+months.narrow.5  = ٥
+months.narrow.6  = ٦
+months.narrow.7  = ٧
+months.narrow.8  = ٨
+months.narrow.9  = ٩
+months.narrow.10 = ١٠
+months.narrow.11 = ١١
+months.narrow.12 = ١٢
+
 [time.gregorian]
 time.medium = [h]:[mm]:[ss] [a]
 time.short = [h]:[mm] [a]

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-MA.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-MA.ini	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-MA.ini	2019-04-01 21:10:44 UTC (rev 50699)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.1
-date = 2018-02-05
+version = 1.2
+date = 2019-01-31
 name.local = العربية
 name.english = Arabic
 name.babel = arabic-ma
@@ -107,6 +107,32 @@
 dayPeriods.wide.am = ص
 dayPeriods.wide.pm = م
 
+[date.islamic]
+months.wide.1    = محرم
+months.wide.2    = صفر
+months.wide.3    = ربيع الأول
+months.wide.4    = ربيع الآخر
+months.wide.5    = جمادى الأولى
+months.wide.6    = جمادى الآخرة
+months.wide.7    = رجب
+months.wide.8    = شعبان
+months.wide.9    = رمضان
+months.wide.10   = شوال
+months.wide.11   = ذو القعدة
+months.wide.12   = ذو الحجة
+months.narrow.1  = ١
+months.narrow.2  = ٢
+months.narrow.3  = ٣
+months.narrow.4  = ٤
+months.narrow.5  = ٥
+months.narrow.6  = ٦
+months.narrow.7  = ٧
+months.narrow.8  = ٨
+months.narrow.9  = ٩
+months.narrow.10 = ١٠
+months.narrow.11 = ١١
+months.narrow.12 = ١٢
+
 [time.gregorian]
 time.medium = [HH]:[mm]:[ss]
 time.short = [HH]:[mm]

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-SY.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-SY.ini	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar-SY.ini	2019-04-01 21:10:44 UTC (rev 50699)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.1
-date = 2018-02-05
+version = 1.2
+date = 2019-01-31
 name.local = العربية
 name.english = Arabic
 name.babel = arabic-sy
@@ -105,6 +105,32 @@
 dayPeriods.wide.am = ص
 dayPeriods.wide.pm = م
 
+[date.islamic]
+months.wide.1    = محرم
+months.wide.2    = صفر
+months.wide.3    = ربيع الأول
+months.wide.4    = ربيع الآخر
+months.wide.5    = جمادى الأولى
+months.wide.6    = جمادى الآخرة
+months.wide.7    = رجب
+months.wide.8    = شعبان
+months.wide.9    = رمضان
+months.wide.10   = شوال
+months.wide.11   = ذو القعدة
+months.wide.12   = ذو الحجة
+months.narrow.1  = ١
+months.narrow.2  = ٢
+months.narrow.3  = ٣
+months.narrow.4  = ٤
+months.narrow.5  = ٥
+months.narrow.6  = ٦
+months.narrow.7  = ٧
+months.narrow.8  = ٨
+months.narrow.9  = ٩
+months.narrow.10 = ١٠
+months.narrow.11 = ١١
+months.narrow.12 = ١٢
+
 [time.gregorian]
 time.medium = [h]:[mm]:[ss] [a]
 time.short = [h]:[mm] [a]

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar.ini	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ar/babel-ar.ini	2019-04-01 21:10:44 UTC (rev 50699)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.1
-date = 2018-02-05
+version = 1.2
+date = 2019-01-31
 name.local = العربية
 name.english = Arabic
 name.babel = arabic
@@ -103,6 +103,32 @@
 dayPeriods.wide.am = ص
 dayPeriods.wide.pm = م
 
+[date.islamic]
+months.wide.1    = محرم
+months.wide.2    = صفر
+months.wide.3    = ربيع الأول
+months.wide.4    = ربيع الآخر
+months.wide.5    = جمادى الأولى
+months.wide.6    = جمادى الآخرة
+months.wide.7    = رجب
+months.wide.8    = شعبان
+months.wide.9    = رمضان
+months.wide.10   = شوال
+months.wide.11   = ذو القعدة
+months.wide.12   = ذو الحجة
+months.narrow.1  = ١
+months.narrow.2  = ٢
+months.narrow.3  = ٣
+months.narrow.4  = ٤
+months.narrow.5  = ٥
+months.narrow.6  = ٦
+months.narrow.7  = ٧
+months.narrow.8  = ٨
+months.narrow.9  = ٩
+months.narrow.10 = ١٠
+months.narrow.11 = ١١
+months.narrow.12 = ١٢
+
 [time.gregorian]
 time.medium = [h]:[mm]:[ss] [a]
 time.short = [h]:[mm] [a]

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/fa/babel-fa.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/fa/babel-fa.ini	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/fa/babel-fa.ini	2019-04-01 21:10:44 UTC (rev 50699)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.1
-date = 2018-04-11
+version = 1.2
+date = 2019-01-31
 name.local = فارسی
 name.english = Persian
 name.babel = persian
@@ -103,6 +103,32 @@
 dayPeriods.wide.am = قبل‌ازظهر
 dayPeriods.wide.pm = بعدازظهر
 
+[date.persian]
+months.wide.1     = فروردین
+months.wide.2     = اردیبهشت
+months.wide.3     = خرداد
+months.wide.4     = تیر
+months.wide.5     = مرداد
+months.wide.6     = شهریور
+months.wide.7     = مهر
+months.wide.8     = آبان
+months.wide.9     = آذر
+months.wide.10    = دی
+months.wide.11    = بهمن
+months.wide.12    = اسفند
+months.narrow.1   = ف
+months.narrow.2   = ا
+months.narrow.3   = خ
+months.narrow.4   = ت
+months.narrow.5   = م
+months.narrow.6   = ش
+months.narrow.7   = م
+months.narrow.8   = آ
+months.narrow.9   = آ
+months.narrow.10  = د
+months.narrow.11  = ب
+months.narrow.12  = ا
+
 [time.gregorian]
 time.medium = [H]:[mm]:[ss]
 time.short = [H]:[mm]

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/he/babel-he.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/he/babel-he.ini	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/he/babel-he.ini	2019-04-01 21:10:44 UTC (rev 50699)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.0
-date = 2017-09-01
+version = 1.1
+date = 2019-01-31
 name.local = עברית
 name.english = Hebrew
 name.babel = hebrew
@@ -140,6 +140,34 @@
 months.wide.11 = \hebnun\hebvav\hebbet\hebmem\hebbet\hebresh
 months.wide.12 = \hebdalet\hebtsadi\hebmem\hebbet\hebresh
 
+[date.hebrew]
+months.wide.1     = תשרי
+months.wide.2     = חשוון
+months.wide.3     = כסלו
+months.wide.4     = טבת
+months.wide.5     = שבט
+months.wide.6     = אדר א׳
+months.wide.7     = אדר
+months.wide.8     = ניסן
+months.wide.9     = אייר
+months.wide.10    = סיוון
+months.wide.11    = תמוז
+months.wide.12    = אב
+months.wide.13    = אלול
+months.narrow.1   = תש׳
+months.narrow.2   = חש׳
+months.narrow.3   = כס׳
+months.narrow.4   = טב׳
+months.narrow.5   = שב׳
+months.narrow.6   = א״א
+months.narrow.7   = אד׳
+months.narrow.8   = ני׳
+months.narrow.9   = אי׳
+months.narrow.10  = סי׳
+months.narrow.11  = תמ׳
+months.narrow.12  = אב
+months.narrow.13  = אל׳
+
 [time.gregorian]
 time.medium = [H]:[mm]:[ss]
 time.short = [H]:[mm]

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/hi/babel-hi.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/hi/babel-hi.ini	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/hi/babel-hi.ini	2019-04-01 21:10:44 UTC (rev 50699)
@@ -12,8 +12,8 @@
 
 [identification]
 charset = utf8
-version = 0.91
-date = 2017-04-10
+version = 1.0
+date = 2019-01-31
 name.local = हिन्दी
 name.english = Hindi
 name.babel = hindi
@@ -127,6 +127,32 @@
 dayPeriods.wide.am = पूर्वाह्न
 dayPeriods.wide.pm = अपराह्न
 
+[date.indian]
+months.wide.1    = चैत्र
+months.wide.2    = वैशाख
+months.wide.3    = ज्येष्ठ
+months.wide.4    = आषाढ़
+months.wide.5    = श्रावण
+months.wide.6    = भाद्रपद
+months.wide.7    = अश्विन
+months.wide.8    = कार्तिक
+months.wide.9    = अग्रहायण
+months.wide.10   = पौष
+months.wide.11   = माघ
+months.wide.12   = फाल्गुन
+months.narrow.1  = 1
+months.narrow.2  = 2
+months.narrow.3  = 3
+months.narrow.4  = 4
+months.narrow.5  = 5
+months.narrow.6  = 6
+months.narrow.7  = 7
+months.narrow.8  = 8
+months.narrow.9  = 9
+months.narrow.10 = 10
+months.narrow.11 = 11
+months.narrow.12 = 12
+
 [time.gregorian]
 time.medium = [h]:[mm]:[ss] [a]
 time.short = [h]:[mm] [a]
@@ -149,7 +175,7 @@
 auxiliary = [\u200C\u200D]
 exemplarCharacters = [\u093C ॐ \u0902 \u0901 ः अ आ इ ई उ ऊ ऋ ऌ ऍ ए ऐ ऑ ओ औ क ख ग घ ङ च छ ज झ ञ ट ठ ड ढ ण त थ द ध न प फ ब भ म य र ल ळ व श ष स ह ऽ ा ि ी \u0941 \u0942 \u0943 \u0944 \u0945 \u0947 \u0948 ॉ ो ौ \u094D]
 index = [अ आ इ ई उ ऊ ऋ ए ऐ ओ औ क ख ग घ ङ च छ ज झ ञ ट ठ ड ढ ण त थ द ध न प फ ब भ म य र ल व श ष स ह]
-punctuation = [। ॥ \\- , ; \\: ! ? . ‘ ’ “ ” ( ) \\[ \\] \\{ \\} ॰]
+punctuation = [\\- , ; \\: ! ? . ‘ ’ “ ” ( ) \\[ \\] \\{ \\} ॰]
 
 [numbers]
 defaultNumberingSystem = latn
@@ -171,4 +197,3 @@
 alph = 
 Alph = 
 ordinals = 
-

Modified: trunk/Master/texmf-dist/tex/generic/babel/luababel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2019-04-01 21:10:44 UTC (rev 50699)
@@ -475,16 +475,18 @@
 \def\bbl at font@set#1#2#3{% eg \bbl at rmdflt@lang \rmdefault \rmfamily
   \bbl at xin@{<>}{#1}%
   \ifin@
-    \bbl at exp{\\\bbl at fontspec@set\\#1\expandafter\@gobbletwo#1}%
+    \bbl at exp{\\\bbl at fontspec@set\\#1\expandafter\@gobbletwo#1\\#3}%
   \fi
   \bbl at exp{%
-    \def\\#2{#1}%        eg, \rmdefault{\bbl at rmdflt@lang}
+    \def\\#2{#1}%         eg, \rmdefault{\bbl at rmdflt@lang}
     \\\bbl at ifsamestring{#2}{\f at family}{\\#3\let\\\bbl at tempa\relax}{}}}
-\def\bbl at fontspec@set#1#2#3{% eg \bbl at rmdflt@lang fnt-opt fnt-nme
+\def\bbl at fontspec@set#1#2#3#4{% eg \bbl at rmdflt@lang fnt-opt fnt-nme \xxfamily
   \let\bbl at tempe\bbl at mapselect
   \let\bbl at mapselect\relax
-  \bbl at exp{% TODO - should be global, but even local does its job
-        % I'm still not sure -- must investigate
+  \let\bbl at temp@fam#4%       eg, '\rmfamily', to be restored below
+  \let#4\relax            %  So that can be used with \newfontfamily
+  \bbl at exp{%
+    \let\\\bbl at temp@pfam\<\bbl at stripslash#4\space>% eg, '\rmfamily '
     \<keys_if_exist:nnF>{fontspec-opentype}%
         {Script/\bbl at cs{sname@\languagename}}%
       {\\\newfontscript{\bbl at cs{sname@\languagename}}%
@@ -493,10 +495,15 @@
         {Language/\bbl at cs{lname@\languagename}}%
       {\\\newfontlanguage{\bbl at cs{lname@\languagename}}%
         {\bbl at cs{lotf@\languagename}}}%
-    \<fontspec_set_family:Nnn>\\#1%
-      {\bbl at cs{lsys@\languagename},#2}}{#3}% ie \bbl at exp{..}{#3}
-  \let\bbl at mapselect\bbl at tempe
-  \bbl at toglobal#1}%
+    \\\newfontfamily\\#4%
+      [\bbl at cs{lsys@\languagename},#2]}{#3}% ie \bbl at exp{..}{#3}
+  \begingroup
+     #4%
+     \xdef#1{\f at family}%     eg, \bbl at rmdflt@lang{FreeSerif(0)}
+  \endgroup
+  \let#4\bbl at temp@fam
+  \bbl at exp{\let\<\bbl at stripslash#4\space>}\bbl at temp@pfam
+  \let\bbl at mapselect\bbl at tempe}%
 \def\bbl at font@rst#1#2#3#4{%
   \bbl at csarg\def{famrst@#4}{\bbl at font@set{#1}#2#3}}
 \def\bbl at font@fams{rm,sf,tt}
@@ -549,9 +556,9 @@
 \fi
 \ifx\bbl at opt@layout\@nnil\endinput\fi  % if no layout
 \ifx\bbl at beforeforeign\leavevmode % A poor test for bidi=
-  \def\bbl at nextfake#1{%
-    \mathdir\bodydir  % non-local, use always inside a group!
+  \def\bbl at nextfake#1{%  non-local changes - always inside a group!
     \bbl at exp{%
+      \mathdir\the\bodydir
       #1%              Once entered in math, set boxes to restore values
       \everyvbox{%
         \the\everyvbox

Modified: trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2019-04-01 21:10:44 UTC (rev 50699)
@@ -32,7 +32,7 @@
 %% extension |.ins|) which are part of the distribution.
 %%
 
-\ProvidesLanguage{nil}[2018/11/13 3.27 Nil language]
+\ProvidesLanguage{nil}[2019/04/01 3.28 Nil language]
 \LdfInit{nil}{datenil}
 \ifx\l at nohyphenation\@undefined
    \@nopatterns{nil}

Modified: trunk/Master/texmf-dist/tex/generic/babel/switch.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/switch.def	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/switch.def	2019-04-01 21:10:44 UTC (rev 50699)
@@ -37,7 +37,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{switch.def}[2018/11/13 3.27 Babel switching mechanism]
+\ProvidesFile{switch.def}[2019/04/01 3.28 Babel switching mechanism]
 \ifx\AtBeginDocument\@undefined
   \input plain.def\relax
 \fi
@@ -58,8 +58,8 @@
   \countdef\last at language=19
   \def\addlanguage{\alloc at 9\language\chardef\@cclvi}
 \fi
-\def\bbl at version{3.27}
-\def\bbl at date{2018/11/13}
+\def\bbl at version{3.28}
+\def\bbl at date{2019/04/01}
 \def\adddialect#1#2{%
   \global\chardef#1#2\relax
   \bbl at usehooks{adddialect}{{#1}{#2}}%
@@ -115,11 +115,12 @@
   \aftergroup\bbl at pop@language
   \bbl at set@language{#1}}
 \def\BabelContentsFiles{toc,lof,lot}
-\def\bbl at set@language#1{%
+\def\bbl at set@language#1{% from selectlanguage, pop@
   \edef\languagename{%
     \ifnum\escapechar=\expandafter`\string#1\@empty
     \else\string#1\@empty\fi}%
   \select at language{\languagename}%
+  % write to auxs
   \expandafter\ifx\csname date\languagename\endcsname\relax\else
     \if at filesw
       \protected at write\@auxout{}{\string\babel at aux{\languagename}{}}%
@@ -126,8 +127,10 @@
       \bbl at usehooks{write}{}%
     \fi
   \fi}
-\def\select at language#1{%
+\def\select at language#1{% from set@, babel at aux
+  % set hymap
   \ifnum\bbl at hymapsel=\@cclv\chardef\bbl at hymapsel4\relax\fi
+  % set name
   \edef\languagename{#1}%
   \bbl at fixname\languagename
   \bbl at iflanguage\languagename{%
@@ -140,6 +143,7 @@
          some cases, you may need to remove the aux file}%
         {You may proceed, but expect wrong results}%
     \else
+      % set type
       \let\bbl at select@type\z@
       \expandafter\bbl at switch\expandafter{\languagename}%
     \fi}}
@@ -162,7 +166,8 @@
   \select at language{#1}}
 \let\select at language@x\select at language
 \newif\ifbbl at usedategroup
-\def\bbl at switch#1{%
+\def\bbl at switch#1{%  from select@, foreign@
+  % restore
   \originalTeX
   \expandafter\def\expandafter\originalTeX\expandafter{%
     \csname noextras#1\endcsname
@@ -170,6 +175,7 @@
     \babel at beginsave}%
   \bbl at usehooks{afterreset}{}%
   \languageshorthands{none}%
+  % switch captions, date
   \ifcase\bbl at select@type
     \ifhmode
       \hskip\z at skip % trick to ignore spaces
@@ -180,19 +186,27 @@
       \csname captions#1\endcsname\relax
       \csname date#1\endcsname\relax
     \fi
-  \else\ifbbl at usedategroup
-    \bbl at usedategroupfalse
-    \ifhmode
-      \hskip\z at skip % trick to ignore spaces
-      \csname date#1\endcsname\relax
-      \loop\ifdim\lastskip>\z@\unskip\repeat\unskip
-    \else
-      \csname date#1\endcsname\relax
+  \else
+    \ifbbl at usedategroup   % if \foreign... within \<lang>date
+      \bbl at usedategroupfalse
+      \ifhmode
+        \hskip\z at skip % trick to ignore spaces
+        \csname date#1\endcsname\relax
+        \loop\ifdim\lastskip>\z@\unskip\repeat\unskip
+      \else
+        \csname date#1\endcsname\relax
+      \fi
     \fi
-  \fi\fi
+  \fi
+  % switch extras
   \bbl at usehooks{beforeextras}{}%
   \csname extras#1\endcsname\relax
   \bbl at usehooks{afterextras}{}%
+  %  > babel-ensure
+  %  > babel-sh-<short>
+  %  > babel-bidi
+  %  > babel-fontspec
+  % hyphenation - case mapping
   \ifcase\bbl at opt@hyphenmap\or
     \def\BabelLower##1##2{\lccode##1=##2\relax}%
     \ifnum\bbl at hymapsel>4\else
@@ -205,7 +219,9 @@
     \fi
   \fi
   \global\let\bbl at hymapsel\@cclv
+  % hyphenation - patterns
   \bbl at patterns{#1}%
+  % hyphenation - mins
   \babel at savevariable\lefthyphenmin
   \babel at savevariable\righthyphenmin
   \expandafter\ifx\csname #1hyphenmins\endcsname\relax
@@ -249,18 +265,21 @@
     {\par}%
   \endgroup}
 \def\foreign at language#1{%
+  % set name
   \edef\languagename{#1}%
   \bbl at fixname\languagename
   \bbl at iflanguage\languagename{%
     \expandafter\ifx\csname date\languagename\endcsname\relax
-      \bbl at warning
+      \bbl at warning   % TODO - why a warning, not an error?
         {Unknown language `#1'. Either you have\\%
          misspelled its name, it has not been installed,\\%
          or you requested it in a previous run. Fix its name,\\%
-         install it or just rerun the file, respectively.\\%
+         install it or just rerun the file, respectively. In\\%
+         some cases, you may need to remove the aux file.\\%
          I'll proceed, but expect wrong results.\\%
          Reported}%
     \fi
+    % set type
     \let\bbl at select@type\@ne
     \expandafter\bbl at switch\expandafter{\languagename}}}
 \let\bbl at hyphlist\@empty
@@ -277,6 +296,7 @@
       \edef\bbl at tempa{#1:\f at encoding}%
     \fi
   \@expandtwoargs\bbl at usehooks{patterns}{{#1}{\bbl at tempa}}%
+  %  > luatex
   \@ifundefined{bbl at hyphenation@}{}{% Can be \relax!
     \begingroup
       \bbl at xin@{,\number\language,}{,\bbl at hyphlist}%

Modified: trunk/Master/texmf-dist/tex/generic/babel/xebabel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/xebabel.def	2019-04-01 21:09:08 UTC (rev 50698)
+++ trunk/Master/texmf-dist/tex/generic/babel/xebabel.def	2019-04-01 21:10:44 UTC (rev 50699)
@@ -149,16 +149,18 @@
 \def\bbl at font@set#1#2#3{% eg \bbl at rmdflt@lang \rmdefault \rmfamily
   \bbl at xin@{<>}{#1}%
   \ifin@
-    \bbl at exp{\\\bbl at fontspec@set\\#1\expandafter\@gobbletwo#1}%
+    \bbl at exp{\\\bbl at fontspec@set\\#1\expandafter\@gobbletwo#1\\#3}%
   \fi
   \bbl at exp{%
-    \def\\#2{#1}%        eg, \rmdefault{\bbl at rmdflt@lang}
+    \def\\#2{#1}%         eg, \rmdefault{\bbl at rmdflt@lang}
     \\\bbl at ifsamestring{#2}{\f at family}{\\#3\let\\\bbl at tempa\relax}{}}}
-\def\bbl at fontspec@set#1#2#3{% eg \bbl at rmdflt@lang fnt-opt fnt-nme
+\def\bbl at fontspec@set#1#2#3#4{% eg \bbl at rmdflt@lang fnt-opt fnt-nme \xxfamily
   \let\bbl at tempe\bbl at mapselect
   \let\bbl at mapselect\relax
-  \bbl at exp{% TODO - should be global, but even local does its job
-        % I'm still not sure -- must investigate
+  \let\bbl at temp@fam#4%       eg, '\rmfamily', to be restored below
+  \let#4\relax            %  So that can be used with \newfontfamily
+  \bbl at exp{%
+    \let\\\bbl at temp@pfam\<\bbl at stripslash#4\space>% eg, '\rmfamily '
     \<keys_if_exist:nnF>{fontspec-opentype}%
         {Script/\bbl at cs{sname@\languagename}}%
       {\\\newfontscript{\bbl at cs{sname@\languagename}}%
@@ -167,10 +169,15 @@
         {Language/\bbl at cs{lname@\languagename}}%
       {\\\newfontlanguage{\bbl at cs{lname@\languagename}}%
         {\bbl at cs{lotf@\languagename}}}%
-    \<fontspec_set_family:Nnn>\\#1%
-      {\bbl at cs{lsys@\languagename},#2}}{#3}% ie \bbl at exp{..}{#3}
-  \let\bbl at mapselect\bbl at tempe
-  \bbl at toglobal#1}%
+    \\\newfontfamily\\#4%
+      [\bbl at cs{lsys@\languagename},#2]}{#3}% ie \bbl at exp{..}{#3}
+  \begingroup
+     #4%
+     \xdef#1{\f at family}%     eg, \bbl at rmdflt@lang{FreeSerif(0)}
+  \endgroup
+  \let#4\bbl at temp@fam
+  \bbl at exp{\let\<\bbl at stripslash#4\space>}\bbl at temp@pfam
+  \let\bbl at mapselect\bbl at tempe}%
 \def\bbl at font@rst#1#2#3#4{%
   \bbl at csarg\def{famrst@#4}{\bbl at font@set{#1}#2#3}}
 \def\bbl at font@fams{rm,sf,tt}



More information about the tex-live-commits mailing list