texlive[46210] Master/texmf-dist: babel (4jan18)

commits+karl at tug.org commits+karl at tug.org
Fri Jan 5 00:39:46 CET 2018


Revision: 46210
          http://tug.org/svn/texlive?view=revision&revision=46210
Author:   karl
Date:     2018-01-05 00:39:46 +0100 (Fri, 05 Jan 2018)
Log Message:
-----------
babel (4jan18)

Modified Paths:
--------------
    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.def
    trunk/Master/texmf-dist/tex/generic/babel/babel.sty
    trunk/Master/texmf-dist/tex/generic/babel/francais.sty
    trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
    trunk/Master/texmf-dist/tex/generic/babel/locale/az/babel-azerbaijani-cyrl.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/az/babel-azerbaijani-latn.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/bs/babel-bosnian-cyrl.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/bs/babel-bosnian-latn.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-austrian.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-german-at.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-german-ch.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-nswissgerman.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-swissgerman.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/dsb/babel-lsorbian.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-american.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-australian.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-british.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-canadian.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-au.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-ca.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-gb.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-nz.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-us.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-newzealand.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-ukenglish.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-usenglish.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/es/babel-mexican.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/es/babel-spanish-mx.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-be.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-ca.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-ch.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-lu.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/ha/babel-hausa-gh.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/ha/babel-hausa-ne.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/hsb/babel-usorbian.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/ms/babel-malay-bn.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/ms/babel-malay-sg.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-norsk.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/nn/babel-nynorsk.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/pa/babel-punjabi-arab.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/pa/babel-punjabi-guru.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-brazilian.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-portuguese-br.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-portuguese-pt.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/ru/babel-ru.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/se/babel-samin.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/shi/babel-tachelhit-latn.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/shi/babel-tachelhit-tfng.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/sl/babel-slovene.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-ba.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-me.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-xk.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-ba.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-me.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-xk.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-arab.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-cyrl.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-latn.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/vai/babel-vai-latn.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/vai/babel-vai-vaii.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/vi/babel-vietnam.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-hk.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-mo.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-sg.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant-hk.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant-mo.tex
    trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant.tex
    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

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/babel/README.md
    trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/babel/CONTRIB
    trunk/Master/texmf-dist/doc/latex/babel/README

Deleted: trunk/Master/texmf-dist/doc/latex/babel/CONTRIB
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/CONTRIB	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/doc/latex/babel/CONTRIB	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,38 +0,0 @@
-Guidelines for contributed languages
-------------------------------------
-
-Now language files are "outsourced" and are located in a separate
-directory, so that they are contributed directly to CTAN (please, do
-not send to me language styles just to upload them to CTAN):
-
-/macros/latex/contrib/babel-contrib
-
-Of course, placing your style files in this directory is not mandatory,
-but if you want to do it, here are a few guidelines.
-
-- Do not hesitate stating on the file heads you are the author and the
-  maintainer, if you actually are. There is no need to state the babel
-  maintainer(s) as authors if they have not contributed significantly
-  to your language files. 
-- Fonts are not strictly part of a language, so they are best placed
-  in the corresponding TeX tree. This includes not only tfm, vf, ps1,
-  otf, mf files and the like, but also fd ones.
-- Font and input encodings are usually best placed in the
-  corresponding tree, too, but sometimes they belong more naturally to
-  the babel style.  Note you may also need to define a LICR.
-- Babel ldf files may just interface a framework, as it happens often
-  with Oriental languages/scripts. This framework is best placed in its
-  own directory.
-- And do not forget providing a manual (as a stand-alone PDF document).
-
-The following page provides a starting point:
-
-http://www.texnia.com/incubator.html
-
-If your need further assistance and technical advice in the
-development of language styles, I am willing to help you.  And of
-course, you can make any suggestion you like.
-
-------------
-Javier Bezos
-2016/01/07

Deleted: trunk/Master/texmf-dist/doc/latex/babel/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/README	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/doc/latex/babel/README	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,103 +0,0 @@
-Babel 3.15
-----------
-
-This package manages culturally-determined typographical (and other)
-rules, and hyphenation patterns for a wide range of languages.  Many
-language styles work with pdflatex, as well as with xelatex and
-lualatex out of the box.  A few even work with plain formats.
-
-Version 3.9a fixed lots of bugs and added some new features, intended
-mainly to make it compatible somehow with Unicode engines. Some bugs
-have not been fixed to avoid backward incompatibilities, but they have
-been documented. Most of the new features (like package options) were
-intended to overcome issues in previous releases without changing
-significantly the behaviour of Babel.
-
-Current development is focused on Unicode engines (XeTeX and LuaTeX).
-New features related to font selection, bidi writing and the like will
-be added incrementally. Versions numbers drop the letter and now 3.10,
-3.11, etc., will be used instead. So, 3.9t is the last in the former
-series.
-
-Included is a set of ini files for about 200 languages). 
-
-Languages are not part of the Babel core any more; in particular, it
-shall be no longer necessary to synchronize Babel core releases with
-releases of Babel language files. See CONTRIB for further details
-about contributing a language. You may also create an ini file or
-improve the existing ones -- it's a trivial task (no programming
-skills required at all), but don't hesitate to ask for help.
-
-The best way to install and/or update it is with the help of package
-managers.
-
-Changes are described in babel.pdf with the label "New <version>". The
-manual has been expanded to include some tips and tricks, but it will
-be improved in next releases.
-
-Please, report bugs and suggestions to:
-
-http://latex-project.org/bugs-upload.html
-
-You may also report them to the author more informally on:
-
-http://www.texnia.com/contact.html
-
-Bugs related to specific languages are best reported to their
-respective authors.
-
-Recent changes
---------------
-
-3.15  - New command \babelfont (in Unicode engines) to define
-        language/script dependent fonts. Related to it, new
-        keys (script, language) in \babelprovide.
-      - A common mistake is to leave some space(s) in \captions<lang>,
-        which go to the document. Now babel removes them.
-      - Fix - Error with hyphenrules in \babelprovide in some cases.
-      - Fix - \hyphenrules doesn't set \languagename any more (which
-        was against the documented behavior),
-	
-3.14  - R text (Hebrew-like) and AL text (Arabic-like) in luatex, with
-        "European" and "Arabic" numbers, mirroring and unmarked L text.
-      - Fix - `import' ignored `hyphenrules' in ini files.
-
-3.13  - Existing ldf files takes priority over declared options with
-        \DeclareOption (except hebrew).
-      - With a few exceptions, ini files have reached version 1.0.
-      - New key `import' for \babelprovide, which also defines dates. 
-
-[3.12 - No real changes in the babel core. Just a few technical changes
-        related to the files.]
-
-3.11  - Fix - error when version in format and of package
-        didn't match.
-      - Now switch.def is loaded always.
-      - First steps in bidi writing.
-
-3.10  - New versioning
-      - New macro - \babelprovide
-
-3.9t  - Part of the code for 3.10 ss has been "back-ported" to this
-        release, but they are only internal changes.
-      - Fix - with \babelhyphen{soft} the hyphen could vanish.
-      - English, Indonesian and Malay "dialects" now rely on the proxy
-        files provided by these languages (eg, american.ldf, melayu.ldf).
-	If you upgrade babel, you MUST upgrade those languages, too.
-	
-3.9s  - Bug fix - extra spaces with \babelensure
-
-3.9r  - The three main dtx files now share version numbers.
-      - bbunicode - Fixed a line break at \cs{foreignlanguage} with
-        unloaded patterns. Also added \babelcatcodetablenum, just in
-	case.
-	
-3.9q  - base now reads patterns in lua
-      - Some minor changes for luatex
-
-*** Babel 3.9o and 3.9p are deprecated ***
-
-------------
-Javier Bezos
-2017/11/03
-

Added: trunk/Master/texmf-dist/doc/latex/babel/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/babel/README.md	2018-01-04 23:39:46 UTC (rev 46210)
@@ -0,0 +1,111 @@
+## Babel 3.16
+
+This package manages culturally-determined typographical (and other)
+rules, and hyphenation patterns for a wide range of languages.  Many
+language styles work with pdflatex, as well as with xelatex and
+lualatex out of the box.  A few even work with plain formats.
+
+The latest stable version is available on <https://ctan.org/pkg/babel>.
+
+Version 3.9a fixed lots of bugs and added some new features, intended
+mainly to make it compatible somehow with Unicode engines. Some bugs
+have not been fixed to avoid backward incompatibilities, but they have
+been documented. Most of the new features (like package options) were
+intended to overcome issues in previous releases without changing
+significantly the behaviour of Babel.
+
+Current development is focused on Unicode engines (XeTeX and LuaTeX).
+New features related to font selection, bidi writing and the like will
+be added incrementally. Versions numbers drop the letter and now 3.10,
+3.11, etc., will be used instead. So, 3.9t is the last in the former
+series.
+
+Included is a set of ini files for about 200 languages.
+
+Languages are not part of the Babel core any more; in particular, it
+shall be no longer necessary to synchronize Babel core releases with
+releases of Babel language files. See CONTRIB for further details
+about contributing a language. You may also create an ini file or
+improve the existing ones -- it's a trivial task (no programming
+skills required at all), but don't hesitate to ask for help.
+
+The best way to install and/or update it is with the help of package
+managers.
+
+Changes are described in babel.pdf with the label "New <version>". The
+manual has been expanded to include some tips and tricks, but it will
+be improved in next releases.
+
+### Reporting Bugs
+
+If you wish to report a problem or bug in any of these packages please
+use the
+[Issue Tracker for LaTeX2e on GitHub](https://github.com/latex3/latex2e/issues)
+and follow the guidelines that pop up if you press the `New issue`
+button.
+
+In particular, to check that you are really seeing a bug, please write
+a short, self-contained document that shows the problem. This should
+include the `latexbug` package, which will warn if your test file is
+not suitable for one or the other reason. See the
+[CONTRIBUTING guide](https://github.com/latex3/latex2e/blob/master/CONTRIBUTING.md)
+for further details, or if you need to obtain the `latexbug` package.
+
+If the bug turns out to be with third-party software then please
+contact the developer, and not us!
+
+You may also report them to the author more informally on:
+
+   http://www.texnia.com/contact.html
+
+Bugs related to specific languages are best reported to their
+respective authors.
+
+### New
+
+```
+3.16   - New package option layout for bidi documents.
+       - Quotes in TU encoding
+       - Fix - \<language>date did not work correctly
+       - Fix - with some languages (eg, british), using
+         \babelfont raised an error.
+
+3.15  - New command \babelfont (in Unicode engines) to define
+        language/script dependent fonts. Related to it, new
+        keys (script, language) in \babelprovide.
+      - A common mistake is to leave some space(s) in \captions<lang>,
+        which go to the document. Now babel removes them.
+      - Fix - Error with hyphenrules in \babelprovide in some cases.
+      - Fix - \hyphenrules doesn't set \languagename any more (which
+        was against the documented behavior),
+	
+3.14  - R text (Hebrew-like) and AL text (Arabic-like) in luatex, with
+        "European" and "Arabic" numbers, mirroring and unmarked L text.
+      - Fix - `import' ignored `hyphenrules' in ini files.
+
+3.13  - Existing ldf files takes priority over declared options with
+        \DeclareOption (except hebrew).
+      - With a few exceptions, ini files have reached version 1.0.
+      - New key `import' for \babelprovide, which also defines dates. 
+
+[3.12 - Internal.]
+
+3.11  - Fix - error when version in format and of package
+        didn't match.
+      - Now switch.def is loaded always.
+      - First steps in bidi writing.
+
+3.10  - New versioning
+      - New macro - \babelprovide
+
+3.9t  - Part of the code for 3.10 ss has been "back-ported" to this
+        release, but they are only internal changes.
+      - Fix - with \babelhyphen{soft} the hyphen could vanish.
+      - English, Indonesian and Malay "dialects" now rely on the proxy
+        files provided by these languages (eg, american.ldf, melayu.ldf).
+        If you upgrade babel, you MUST upgrade those languages, too.
+```
+
+Javier Bezos
+2018-01-04
+


Property changes on: trunk/Master/texmf-dist/doc/latex/babel/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
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	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2018-01-04 23:39:46 UTC (rev 46210)
@@ -31,13 +31,13 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2017/11/03 v3.15 The Babel package]
+\ProvidesFile{babel.dtx}[2018/01/04 v3.16 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
-\setmainfont[Scale=.89]{DejaVu Serif}
-\setsansfont[Scale=.87]{DejaVu Sans}
-\setmonofont[Scale=.87]{DejaVu Sans Mono}
+\setmainfont[Scale=.88]{Noto Serif}
+\setsansfont[Scale=.88]{Noto Sans}
+\setmonofont[Scale=.88,FakeStretch=.95]{Noto Mono}
 \raggedright
 \addtolength{\textwidth}{25pt}
 \addtolength{\textheight}{3.5cm}
@@ -47,6 +47,7 @@
 \newcommand*\babel{\textsf{babel}}
 \newcommand*\Babel{\textsf{Babel}}
 \newcommand*\xetex{\textsf{xetex}}
+\newcommand*\pdftex{\textsf{pdftex}}
 \newcommand*\luatex{\textsf{luatex}}
 \newcommand*\nb[1]{}
 \newcommand*\m[1]{\mbox{$\langle$\normalfont\itshape#1\/$\rangle$}}
@@ -54,7 +55,7 @@
   \meta{language}\texttt{,}\meta{language}\texttt{,}...}
 \newcommand*\langvar{\m{lang}}
 \newcommand*\Lopt[1]{\textsf{#1}}
-\newcommand*\Lenv[1]{\textsf{#1}}
+\newcommand*\Lenv[1]{\texttt{#1}}
 \newcommand*\menv[1]{\char`\{#1\char`\}}
 \newcommand*\Eenv[1]{%
   \quad\ldots\quad   
@@ -223,12 +224,24 @@
 
 \part{User guide}
 
-This user guide focuses on \LaTeX. There are also some notes on its
-use with Plain \TeX.
+\begin{itemize}
+\item This user guide focuses on \LaTeX. There are also some notes on
+  its use with Plain \TeX.
 
-If you are interested in the \TeX{} multilingual support, please join the
-\textsf{kadingira} list on \texttt{http://tug.org/mailman/listinfo/kadingira}.
+\item  Changes and new features with relation to version 3.8 are
+  highlighted with \New{X.XX}\hspace{-.5em}. The most recent features
+  could be still unstable. Please, report any issues you find.
 
+\item If you are interested in the \TeX{} multilingual support, please
+  join the \textsf{kadingira} list on
+  \texttt{http://tug.org/mailman/listinfo/kadingira}.  You can follow
+  the development of \babel{} on
+  \texttt{https://github.com/latex3/latex2e/tree/master/required/babel}
+  (which provides some sample files, too).
+
+\item  See section \ref{contribute} for contributing a language.
+\end{itemize}
+
 \section{The user interface}\label{U-I}
 
 \subsection{Monolingual documents}
@@ -381,7 +394,8 @@
 The Latin script is covered by default in current \LaTeX{} (provided
 the document encoding is UTF-8), because the font loader is preloaded
 and the font is switched to |lmroman|. Other scripts require loading
-\textsf{fontspec}.
+\textsf{fontspec}. You may want to set the font attributes with
+\textsf{fontspec}, too.
 
 \begin{example}
   The following bilingual, single script document in UTF-8 encoding
@@ -492,7 +506,7 @@
 \subsection{Basic language selectors}
 
 This section describes the commands to be used in the document to
-switch the language in multilingual document. In most cases, only the
+switch the language in multilingual documents. In most cases, only the
 two basic macros |\selectlanguage| and |\foreignlanguage| are
 necessary. The environments |otherlanguage|, |otherlanguage*| and
 |hyphenrules| are auxiliary, and described in the next section.
@@ -1035,49 +1049,16 @@
   really useful, but who knows.}
 \end{description}
 
-\Describe{bidi=}{\texttt{default} $\string|$ \texttt{basic-r}}
+\Describe{bidi=}{}
 
 \New{3.14} Selects the bidi algorithm to be used in \luatex{} and
-\xetex{}. With |default| the bidi mechanism is just activated (by default
-it is not), but every change must by marked up. In \xetex{} this is
-the only option. In \luatex, |basic-r|, provides a simple and fast
-method for R text, which handles numbers and unmarked L text within an
-R context.
+\xetex{}. See sec.~\ref{bidi}.
 
-\begin{example}
-The following text comes from the Arabic Wikipedia (article about
-Arabia). Copy-pasting some text from the Wikipedia is a good way to
-test this feature, which will be improved in the future. Remember
-|basic-r| is available in \luatex{} only.
-  \begingroup
-% If you are looking at the code to see how it has been written, you
-% will be disappointed :-). The following example is built ad hoc to
-% emulate the final result to avoid dependencies, and therefore it's
-% not "real" code.
-\setmonofont[Scale=.87,Script=Arabic]{DejaVu Sans Mono} \catcode`@=13
-\def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TLT \else
-\bgroup\textdir TRT \pardir TRT \fi}
-\begin{verbatim}
-\documentclass{article}
+\Describe{layout=}{}
 
-\usepackage[nil, _bidi=basic-r_]{babel}
+\New{3.16} Selects which layout elements are adapted in bidi
+documents. See sec.~\ref{bidi}.
 
-_\babelprovide[import=ar, main]{arabic}_
-
-\babelfont{rm}{FreeSerif}
-
-\begin{document}
-
- at 9وقد عرفت شبه جزيرة العرب طيلة العصر الهيليني )الاغريقي( بـ
- at 1Arabia@0 أو @1Aravia at 0 )بالاغريقية @1Αραβία@0(، استخدم الرومان ثلاث
-بادئات بـ@1“Arabia”@0 على ثلاث مناطق من شبه الجزيرة العربية، إلا أنها
-حقيقةً كانت أكبر مما تعرف عليه اليوم.
-
- at 0\end{document}
-\end{verbatim}
-\endgroup
-\end{example}
-
 \subsection{The \texttt{base} option}
 
 With this package option \babel{} just loads some basic macros (those
@@ -1229,6 +1210,11 @@
 \tag{fi} Finnish\hascapu\hascapl
 \tag{fil} Filipino
 \tag{fo} Faroese
+\tag{fr} French\hascapu\hascapl
+\tag{fr-BE} French\hascapu\hascapl
+\tag{fr-CA} French\hascapu\hascapl
+\tag{fr-CH} French\hascapu\hascapl
+\tag{fr-LU} French\hascapu\hascapl
 \tag{fur} Friulian\hascapu\hascapl
 \tag{fy} Western Frisian
 \tag{ga} Irish\hascapu\hascapl
@@ -1409,7 +1395,7 @@
 \hrule
 \bigskip
 
-In some context (currently |\babelfont|) an \textsc{ini} file may be
+In some contexts (currently |\babelfont|) an \texttt{ini} file may be
 loaded by its name. Here is the list of the names currently
 supported. With these languages, |\babelfont| loads (if not done
 before) the language and script names (even if the language is defined
@@ -1734,9 +1720,10 @@
 
 \subsection{Selecting fonts}
 
-\New{3.15} Babel provides a high level interface on top of |fontspec| to select
-fonts. There is no need to load \textsf{fontspec} explicitly --
-\babel{} does it for you with the first |\babelfont|.
+\New{3.15} Babel provides a high level interface on top of |fontspec|
+to select fonts. There is no need to load \textsf{fontspec} explicitly
+-- \babel{} does it for you with the first |\babelfont|.\footnote{See
+also the package \textsf{combofont} for a complementary approach.}
 
 \Describe\babelfont{\oarg{language-list}\marg{font-family}%
   \oarg{font-options}\marg{font-name}}
@@ -1752,7 +1739,7 @@
 may set a font for a script -- just precede its name (lowercase) with
 a star (eg, |*devanagari|).
 
-\Babel{} takes care the font language and the font script when
+\Babel{} takes care of the font language and the font script when
 languages are selected (as well as the writing direction); see the
 recognized languages above. In most cases, you will not need
 \textit{font-options}, which is the same as in \textsf{fontspec}, but
@@ -1774,7 +1761,7 @@
 \begin{verbatim}
 \documentclass{article}
 
-\usepackage[swedish]{babel}
+\usepackage[swedish, bidi=default]{babel}
 
 \babelprovide[import=he]{hebrew}
 
@@ -1805,10 +1792,22 @@
 \begin{verbatim}
 \babelfont{kai}{FandolKai}
 \end{verbatim}
-Now, |\kaifamily| and |\kaidefault| are at your disposal.
+  Now, |\kaifamily| and |\kaidefault|, as well as |\textkai| are at
+  your disposal.
 \end{example}
 
 \begin{note}
+  You may load \textsf{fontspec} explicitly. For example:
+\begin{verbatim}
+\usepackage{fontspec}
+\newfontscript{Devanagari}{deva}
+\babelfont[hindi]{rm}{Shobhika}
+\end{verbatim}
+  This makes sure the OpenType script for Devanagari is |deva| and not
+  |dev2|.
+\end{note}
+
+\begin{note}
   Directionality is a property affecting margins, intentation, column
   order, etc., not just text. Therefore, it is under the direct
   control of the language, which appplies both the script and the
@@ -1820,7 +1819,7 @@
 \begin{note}
   |\fontspec| is not touched at all, only the preset font families
   (|rm|, |sf|, |tt|, and the like). If a language is switched when an
-  \textit{ad hoc} font is active, or you select the font it with this
+  \textit{ad hoc} font is active, or you select the font with this
   command, neither the script nor the language are passed. You must
   add them by hand. This is by design, for several reasons (for
   example, each font has its own set of features and a generic setting
@@ -1945,8 +1944,8 @@
 
 Besides |\today|, there is a |\<language>date| macro with three
 arguments: year, month and day numbers. In fact, |\today| calls
-|\<language>today| which in turn calls
-|\<language>date{\year}{\month}{\day}|.
+|\<language>today|, which in turn calls
+|\<language>date{\the\year}{\the\month}{\the\day}|.
 
 \Describe{captions=}{\meta{language-tag}}
 Loads only the strings. For example:
@@ -2024,90 +2023,6 @@
   \textsf{iflang} instead of |\iflanguage| if possible.
 \end{warning}
 
-\subsection{Hooks}
-
-\New{3.9a} A hook is a piece of code to be executed at certain
-events. Some hooks are predefined when \luatex{} and \xetex{} are
-used.
-
-\Describe\AddBabelHook{\marg{name}\marg{event}\marg{code}}
-
-The same name can be applied to several events.  Hooks may be enabled
-and disabled for all defined events with
-|\EnableBabelHook|\marg{name}, |\DisableBabelHook|\marg{name}. Names
-containing the string |babel| are reserved (they are used, for
-example, by |\useshortands*| to add a hook for the event
-|afterextras|).
-
-Current events are the following; in some of them you can use one to
-three \TeX{} parameters (|#1|, |#2|, |#3|), with the meaning given:
-\begin{description}
-\renewcommand\makelabel[1]{%
-  \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
-\itemsep=-\parskip
-\item[adddialect] (language name, dialect name) Used by
-  \file{luababel.def} to load the patterns if not preloaded.
-\item[patterns] (language name, language with encoding) Executed just
-  after the |\language| has been set. The second argument has the
-  patterns name actually selected (in the form of either |lang:ENC| or
-  |lang|).
-\item[hyphenation] (language name, language with encoding) Executed
-  locally just before exceptions given in |\babelhyphenation| are
-  actually set.
-\item[defaultcommands] Used (locally) in |\StartBabelCommands|.
-\item[encodedcommands] (input, font encodings) Used (locally) in
-  |\StartBabelCommands|. Both \xetex{} and \luatex{} make sure the
-  encoded text is read correctly.
-\item[stopcommands] Used to reset the the above, if necessary.
-\item[write] This event comes just after the switching commands are
-  written to the |aux| file.
-\item[beforeextras] Just before executing |\extras|\m{language}. This
-  event and the next one should not contain language-dependent code
-  (for that, add it to |\extras|\m{language}).
-\item[afterextras] Just after executing |\extras|\m{language}. For
-  example, the following deactivates shorthands in all languages:
-\begin{verbatim}
-\AddBabelHook{noshort}{afterextras}{\languageshorthands{none}}
-\end{verbatim}
-\item[stringprocess] Instead of a parameter, you can manipulate the
-  macro |\BabelString| containing the string to be defined with
-  |\SetString|. For example, to use an expanded version of the string
-  in the definition, write:
-\begin{verbatim}
-\AddBabelHook{myhook}{stringprocess}{%
-  \protected at edef\BabelString{\BabelString}}
-\end{verbatim}
-\item[initiateactive] (char as active, char as other, original char)
-  \New{3.9i} Executed just after a shorthand has been `initiated'. The three
-  parameters are the same character with different catcodes: active,
-  other (|\string|'ed) and the original one.
-\item[afterreset] \New{3.9i} Executed when selecting a language just after
-  |\originalTeX| is run and reset to its base value, before executing
-  |\captions|\m{language} and |\date|\m{language}.
-\end{description}
-
-Four events are used in \file{hyphen.cfg}, which are handled in a
-quite different way for efficiency reasons -- unlike the precedent
-ones, they only have a single hook and replace a default definition. 
-\begin{description}
-\renewcommand\makelabel[1]{%
-  \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
-\itemsep=-\parskip
-\item[everylanguage] (language) Executed before every language patterns are loaded.
-\item[loadkernel] (file) By default loads |switch.def|. It can be used
-  to load a different version of this files or to load nothing.
-\item[loadpatterns] (patterns file) Loads the patterns file. Used by
-  \file{luababel.def}.
-\item[loadexceptions] (exceptions file) Loads the exceptions
-  file. Used by \file{luababel.def}.
-\end{description}
-
-\Describe\BabelContentsFiles{}
-\New{3.9a} This macro contains a list of ``toc'' types which
-require a command to switch the language. Its default value is
-|toc,lof,lot|, but you may redefine it with |\renewcommand| (it's up
-to you to make sure no toc type is duplicated).
-
 \subsection{Hyphenation tools}
 
 \Describe\babelhyphen{%
@@ -2126,14 +2041,14 @@
 oportunity.
 
 In \TeX, \verb|-| and \verb|\-| forbid further breaking oportunities
-in the word. This is the desired behaviour very often, but not
-always, and therefore many languages provide shorthands for these
+in the word. This is the desired behaviour very often, but not always,
+and therefore many languages provide shorthands for these
 cases. Unfortunately, this has not been done consistently: for
-example, in Dutch, Portugese, Catalan or Danish, \verb|"-| is a hard
-hyphen, while in German, Spanish, Norwegian, Slovak or Russian, it
-is a soft hyphen. Furthermore, some of them even redefine |\-|, so
-that you cannot insert a soft hyphen without breaking oportunities
-in the rest of the word.
+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
+of the word.
 
 Therefore, some macros are provide with a set of basic ``hyphens''
 which can be used by themselves, to define a user shorthand, or even
@@ -2222,8 +2137,7 @@
 situation either. So, a font suited for Vietnamese is not necessarily
 suited for, say, the romanization of Indic languages, and the fact it
 contains glyphs for Modern Greek does not mean it includes them for
-Classic Greek. As to directionality, it poses special challenges
-because it also affects individual characters and layout elements.}
+Classic Greek.}
 
 Some languages sharing the same script define macros to switch it (eg,
 |\textcyrillic|), but be aware they may also set the language to a
@@ -2233,13 +2147,6 @@
 therefore it has been deprecated.\footnote{But still defined for
 backwards compatibility.}
 
-No macros to select the writing direction are provided, either --
-writing direction is intrinsic to each script and therefore it is best
-set by the language (which could be a dummy one). Furthermore, there
-are in fact two right-to-left modes, depending on the language, which
-differ in the way `weak' numeric characters are ordered (eg, Arabic
-\%123 \textit{vs} Hebrew 123\%).
-
 \Describe{\ensureascii}{\marg{text}}
 
 \New{3.9i} This macro makes sure \m{text} is typeset with a
@@ -2264,6 +2171,129 @@
 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.
 
+\subsection{Selecting directions}
+\label{bidi}
+
+No macros to select the writing direction are provided, either --
+writing direction is intrinsic to each script and therefore it is best
+set by the language (which could be a dummy one). Furthermore, there
+are in fact two right-to-left modes, depending on the language, which
+differ in the way `weak' numeric characters are ordered (eg, Arabic
+\%123 \textit{vs} Hebrew 123\%).
+
+\begin{warning}
+  Setting bidi text has many subtleties (see for example
+  <https://www.w3.org/TR/html-bidi/>). This means the \babel{} bidi
+  code may take some time before it is truly stable. An effort is
+  being made to avoid incompatibilities in the future (this one of the
+  reason currently bidi must be explicitly requested as a package
+  option, with a certain bidi model).
+\end{warning}
+
+There are some package options controlling bidi writing.
+
+\Describe{bidi=}{\texttt{default} $\string|$ \texttt{basic-r}}
+
+\New{3.14} Selects the bidi algorithm to be used. With |default| the
+bidi mechanism is just activated (by default it is not), but every
+change must by marked up. In \xetex{} and \pdftex{} this is the only
+option. In \luatex, |basic-r| provides a simple and fast method for R
+text, which handles numbers and unmarked L text within an R context.
+
+\begin{example}
+  The following text comes from the Arabic Wikipedia (article about
+  Arabia). Copy-pasting some text from the Wikipedia is a good way to
+  test this feature, which will be improved in the future. Remember
+  |basic-r| is available in \luatex{} only.\footnote{At the time of
+  this writing some Arabic fonts are not rendered correctly by the
+  default \luatex{} font loader, with misplaced kerns inside some
+  words, so double check the resulting text. It seems a fix is on the
+  way.}
+  \begingroup
+% If you are looking at the code to see how it has been written, you
+% will be disappointed :-). The following example is built ad hoc to
+% emulate the final result to avoid dependencies, and therefore it's
+% not "real" code.
+\setmonofont[Scale=.87,Script=Arabic]{DejaVu Sans Mono} \catcode`@=13
+\def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TLT \else
+\bgroup\textdir TRT \pardir TRT \fi}
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage[nil, _bidi=basic-r_]{babel}
+
+_\babelprovide[import=ar, main]{arabic}_
+
+\babelfont{rm}{FreeSerif}
+
+\begin{document}
+
+ at 9وقد عرفت شبه جزيرة العرب طيلة العصر الهيليني )الاغريقي( بـ
+ at 1Arabia@0 أو @1Aravia at 0 )بالاغريقية @1Αραβία@0(، استخدم الرومان ثلاث
+بادئات بـ@1“Arabia”@0 على ثلاث مناطق من شبه الجزيرة العربية، إلا أنها
+حقيقةً كانت أكبر مما تعرف عليه اليوم.
+
+ at 0\end{document}
+\end{verbatim}
+\endgroup
+\end{example}
+
+\Describe{layout=}{\texttt{sectioning} $\string|$
+                   \texttt{counters}  $\string|$
+                   \texttt{lists}  $\string|$
+                   \texttt{contents}  $\string|$
+                   \texttt{columns}}
+
+\New{3.16} Selects which layout elements are adapted in bidi
+documents. This list will be expanded in future releases (footnotes,
+tables, etc.). \textit{To be expanded}. Note some options are not
+required in \luatex{}.
+
+\begin{description}
+\renewcommand\makelabel[1]{%
+  \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
+\itemsep=-\parskip
+\item[sectioning] makes sure the sectioning macros are typeset in the
+  main language, but with the title text in the current language (see
+  below for further details);
+\item[counters] required in all engines to reorder correctly section
+  numbers and the like (eg, \m{subsection}.\m{section}); required in
+  \xetex{} and \pdftex{} for counters in general, as well as in \luatex{}
+  with |bidi=default|;
+\item[lists]  required in \xetex{} and \pdftex{}, but only in
+  multilingual documents in \luatex{};
+\item[contents] required in \xetex{} and \pdftex{}; in \luatex{} 
+  toc entries are R by default;
+\item[columns] required in \xetex{} and \pdftex{} to reverse the
+  column order (currently only the standard two column mode); in
+  \luatex{} they are R by default (including \textsf{multicol}).
+\end{description}
+
+\Describe{\babelsublr}{\marg{lr-text}}
+
+However, digits in \pdftex{} must be marked up explicitly (unlike
+\luatex{} with |bidi=basic-r| and, usually, \xetex{}). Mainly for it
+(although available in all engines, because it can be useful), this
+command is provided to set \marg{lr-text} in L mode. It's mainly
+intended for what Unicode calls weak characters, because words are
+best set with the corresponding language. For this reason, there is
+no |rl| counterpart.
+
+\Describe{\BabelPatchSection}{\marg{section-name}}
+
+Mainly for bidi text, but it could be useful in other
+cases. |\BabelPatchSection| and the corresponding option
+|layout=sectioning| takes a more logical approach (at least in many
+cases) because it applies the global language to the section format
+(including the |\chaptername| in |\chapter|), while the section text
+is still the current language. The latter is passed to tocs and marks,
+too, and with |sectioning| in |layout| they both reset the “global”
+language to the main one, while the text uses the “local”
+language. With |layout=sectioning| all the standard sectioning
+commands are redefined, but with this command you can set them
+individually if necessary (but note then tocs and marks are not
+touched).
+
 \subsection{Language attributes}
 
 \DescribeMacro{\languageattribute}
@@ -2284,6 +2314,90 @@
 |spanish| have no attribute counterparts. Macros settting
 options are also used (eg, |\ProsodicMarksOn| in \textsf{latin}).
 
+\subsection{Hooks}
+
+\New{3.9a} A hook is a piece of code to be executed at certain
+events. Some hooks are predefined when \luatex{} and \xetex{} are
+used.
+
+\Describe\AddBabelHook{\marg{name}\marg{event}\marg{code}}
+
+The same name can be applied to several events.  Hooks may be enabled
+and disabled for all defined events with
+|\EnableBabelHook|\marg{name}, |\DisableBabelHook|\marg{name}. Names
+containing the string |babel| are reserved (they are used, for
+example, by |\useshortands*| to add a hook for the event
+|afterextras|).
+
+Current events are the following; in some of them you can use one to
+three \TeX{} parameters (|#1|, |#2|, |#3|), with the meaning given:
+\begin{description}
+\renewcommand\makelabel[1]{%
+  \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
+\itemsep=-\parskip
+\item[adddialect] (language name, dialect name) Used by
+  \file{luababel.def} to load the patterns if not preloaded.
+\item[patterns] (language name, language with encoding) Executed just
+  after the |\language| has been set. The second argument has the
+  patterns name actually selected (in the form of either |lang:ENC| or
+  |lang|).
+\item[hyphenation] (language name, language with encoding) Executed
+  locally just before exceptions given in |\babelhyphenation| are
+  actually set.
+\item[defaultcommands] Used (locally) in |\StartBabelCommands|.
+\item[encodedcommands] (input, font encodings) Used (locally) in
+  |\StartBabelCommands|. Both \xetex{} and \luatex{} make sure the
+  encoded text is read correctly.
+\item[stopcommands] Used to reset the the above, if necessary.
+\item[write] This event comes just after the switching commands are
+  written to the |aux| file.
+\item[beforeextras] Just before executing |\extras|\m{language}. This
+  event and the next one should not contain language-dependent code
+  (for that, add it to |\extras|\m{language}).
+\item[afterextras] Just after executing |\extras|\m{language}. For
+  example, the following deactivates shorthands in all languages:
+\begin{verbatim}
+\AddBabelHook{noshort}{afterextras}{\languageshorthands{none}}
+\end{verbatim}
+\item[stringprocess] Instead of a parameter, you can manipulate the
+  macro |\BabelString| containing the string to be defined with
+  |\SetString|. For example, to use an expanded version of the string
+  in the definition, write:
+\begin{verbatim}
+\AddBabelHook{myhook}{stringprocess}{%
+  \protected at edef\BabelString{\BabelString}}
+\end{verbatim}
+\item[initiateactive] (char as active, char as other, original char)
+  \New{3.9i} Executed just after a shorthand has been `initiated'. The three
+  parameters are the same character with different catcodes: active,
+  other (|\string|'ed) and the original one.
+\item[afterreset] \New{3.9i} Executed when selecting a language just after
+  |\originalTeX| is run and reset to its base value, before executing
+  |\captions|\m{language} and |\date|\m{language}.
+\end{description}
+
+Four events are used in \file{hyphen.cfg}, which are handled in a
+quite different way for efficiency reasons -- unlike the precedent
+ones, they only have a single hook and replace a default definition. 
+\begin{description}
+\renewcommand\makelabel[1]{%
+  \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
+\itemsep=-\parskip
+\item[everylanguage] (language) Executed before every language patterns are loaded.
+\item[loadkernel] (file) By default loads |switch.def|. It can be used
+  to load a different version of this files or to load nothing.
+\item[loadpatterns] (patterns file) Loads the patterns file. Used by
+  \file{luababel.def}.
+\item[loadexceptions] (exceptions file) Loads the exceptions
+  file. Used by \file{luababel.def}.
+\end{description}
+
+\Describe\BabelContentsFiles{}
+\New{3.9a} This macro contains a list of ``toc'' types 
+requiring a command to switch the language. Its default value is
+|toc,lof,lot|, but you may redefine it with |\renewcommand| (it's up
+to you to make sure no toc type is duplicated).
+
 \subsection{Languages supported by \babel}
 
 In the following table most of the languages supported by \babel\ are
@@ -2708,6 +2822,40 @@
 files you think can be useful. A PDF and a ``readme'' are strongly
 recommended.
 
+\subsection{Guidelines for contributed languages}
+\label{contribute}
+
+Now language files are “outsourced” and are located in a separate
+directory (\texttt{/macros/latex/contrib/babel-contrib}), so that they
+are contributed directly to CTAN (please, do not send to me language
+styles just to upload them to CTAN).
+
+Of course, placing your style files in this directory is not mandatory,
+but if you want to do it, here are a few guidelines.
+
+\begin{itemize}
+\item Do not hesitate stating on the file heads you are the author and the
+  maintainer, if you actually are. There is no need to state the babel
+  maintainer(s) as authors if they have not contributed significantly
+  to your language files. 
+\item Fonts are not strictly part of a language, so they are best placed
+  in the corresponding TeX tree. This includes not only \texttt{tfm}, \texttt{vf}, \texttt{ps1},
+  \texttt{otf}, \texttt{mf} files and the like, but also \texttt{fd} ones.
+\item Font and input encodings are usually best placed in the
+  corresponding tree, too, but sometimes they belong more naturally to
+  the babel style.  Note you may also need to define a LICR.
+\item \Babel{} ldf files may just interface a framework, as it happens often
+  with Oriental languages/scripts. This framework is best placed in its
+  own directory.
+\end{itemize}
+
+The following page provides a starting point:
+\texttt{http://www.texnia.com/incubator.html}.
+
+If your need further assistance and technical advice in the
+development of language styles, I am willing to help you.  And of
+course, you can make any suggestion you like.
+
 \subsection{Basic macros}
 
 In the core of the \babel{} system, several macros are defined for use
@@ -3175,7 +3323,7 @@
 only.
 
 For example, as |T1| is the default case mapping in \LaTeX, we could
-set for Turkish: % :-( Seem to be a bug in listings. Fixed with &&.
+set for Turkish:
 \begin{verbatim}
 \StartBabelCommands{turkish}{}[ot1enc, fontenc=OT1]
 \SetCase
@@ -3419,8 +3567,8 @@
 %    little bit of literate programming.
 %
 %    \begin{macrocode}
-%<<version=3.15>>
-%<<date=2017/11/03>>
+%<<version=3.16>>
+%<<date=2018/01/04>>
 %    \end{macrocode}
 %
 % \section{Tools}
@@ -3875,23 +4023,25 @@
     \fi}%
   \bbl at languages
 \fi
-\@ifpackagewith{babel}{bidi=basic-r}{% must go before any \DeclareOption
-  \let\bbl at beforeforeign\leavevmode
-  \AtEndOfPackage{\EnableBabelHook{babel-bidi}}%
-  \RequirePackage{luatexbase}%
-  \directlua{
-    require('babel-bidi.lua')
-    require('babel-bidi-basic-r.lua')
-    luatexbase.add_to_callback('pre_linebreak_filter',
-      Babel.pre_otfload,
-      'Babel.pre_otfload',
-      luatexbase.priority_in_callback('pre_linebreak_filter',
-        'luaotfload.node_processor') or nil)
-    luatexbase.add_to_callback('hpack_filter',
-      Babel.pre_otfload,
-      'Babel.pre_otfload',
-      luatexbase.priority_in_callback('hpack_filter',
-        'luaotfload.node_processor') or nil)}}{}
+\ifodd\bbl at engine
+  \@ifpackagewith{babel}{bidi=basic-r}{% must go before any \DeclareOption
+    \let\bbl at beforeforeign\leavevmode
+    \AtEndOfPackage{\EnableBabelHook{babel-bidi}}%
+    \RequirePackage{luatexbase}%
+    \directlua{
+      require('babel-bidi.lua')
+      require('babel-bidi-basic-r.lua')
+      luatexbase.add_to_callback('pre_linebreak_filter',
+        Babel.pre_otfload,
+        'Babel.pre_otfload',
+        luatexbase.priority_in_callback('pre_linebreak_filter',
+          'luaotfload.node_processor') or nil)
+      luatexbase.add_to_callback('hpack_filter',
+        Babel.pre_otfload,
+        'Babel.pre_otfload',
+        luatexbase.priority_in_callback('hpack_filter',
+          'luaotfload.node_processor') or nil)}}{}
+\fi
 %    \end{macrocode}
 %
 % Now the \texttt{base} option. With it we can define (and load, with
@@ -3922,7 +4072,7 @@
 %    and assigned to |\BabelModifiers| at |\bbl at load@language|; when
 %    no modifiers have been given, the former is |\relax|. How
 %    modifiers are handled are left to language styles; they can use
-%    |\in@|, loop them with |\@for| or load |keyval|, for example).
+%    |\in@|, loop them with |\@for| or load |keyval|, for example.
 %
 % \changes{babel~3.9e}{2013/04/15}{Bug fixed - a dot was added in
 %    key=value pairs}
@@ -3947,11 +4097,11 @@
 \expandafter\let\csname opt at babel.sty\endcsname\bbl at tempc
 %    \end{macrocode}
 %
-%    The next option tells \babel\ to leave shorthand characters
-%    active at the end of processing the package. This is \emph{not}
-%    the default as it can cause problems with other packages, but for
-%    those who want to use the shorthand characters in the preamble of
-%    their documents this can help.
+% The next option tells \babel\ to leave shorthand characters active
+% at the end of processing the package. This is \emph{not} the default
+% as it can cause problems with other packages, but for those who want
+% to use the shorthand characters in the preamble of their documents
+% this can help.
 %
 % \changes{babel~3.9a}{2012/08/14}{Implemented the \texttt{noconfigs}
 %    option}
@@ -3987,6 +4137,7 @@
 \let\bbl at opt@config\@nnil
 \let\bbl at opt@main\@nnil
 \let\bbl at opt@headfoot\@nnil
+\let\bbl at opt@layout\@nnil
 %    \end{macrocode}
 %
 % The following tool is defined temporarily to store the values of
@@ -4001,15 +4152,15 @@
       Bad option `#1=#2'. Either you have misspelled the\\%
       key or there is a previous setting of `#1'}{%
       Valid keys are `shorthands', `config', `strings', `main',\\%
-      `headfoot', `safe', `math'}
+      `headfoot', `safe', `math', among others.}
   \fi}
 %    \end{macrocode}
 %
-%    Now the option list is processed, taking into account only
-%    currently declared options (including those declared with a |=|),
-%    and |<key>=<value>| options (the former take precedence). 
-%    Unrecognized options are saved in |\bbl at language@opts|, because
-%    they are language options. 
+% Now the option list is processed, taking into account only currently
+% declared options (including those declared with a |=|), and
+% |<key>=<value>| options (the former take precedence).  Unrecognized
+% options are saved in |\bbl at language@opts|, because they are language
+% options.
 %
 %    \begin{macrocode}
 \let\bbl at language@opts\@empty
@@ -4120,6 +4271,26 @@
 \fi
 %    \end{macrocode}
 %
+% For |layout| an auxiliary macro is provided, available for packages
+% and language styles.
+%
+% \changes{babel~3.16}{2018/01/02}{Added the basic layout stuff and the
+%  macro \cs{IfBabelLayout}}
+%
+%    \begin{macrocode}
+\ifx\bbl at opt@layout\@nnil
+  \newcommand\IfBabelLayout[3]{#3}%
+\else
+  \newcommand\IfBabelLayout[1]{%
+    \@expandtwoargs\in@{.#1.}{.\bbl at opt@layout.}%
+    \ifin@
+      \expandafter\@firstoftwo
+    \else
+      \expandafter\@secondoftwo
+    \fi}
+\fi
+%    \end{macrocode}
+%
 % \subsection{Language options}
 %
 % \changes{babel~3.9a}{2012/06/15}{Rewritten the loading mechanism, so
@@ -4816,11 +4987,13 @@
 %    \end{macrocode}
 %
 %    We also have to make sure that some code gets executed at the
-%    beginning of the document.
+%    beginning of the document. Languages does not set |\pagedir|, so
+%    we set here for the whole document to the main |\bodydir|. 
 %
 %    \begin{macrocode}
 \AtBeginDocument{%
-  \expandafter\selectlanguage\expandafter{\bbl at main@language}}
+  \expandafter\selectlanguage\expandafter{\bbl at main@language}%
+  \ifcase\bbl at engine\or\pagedir\bodydir\fi}  % TODO - a better place
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -6879,7 +7052,13 @@
 %
 %    Shorthands are provided for a number of different quotation
 %    marks, which make them usable both outside and inside mathmode.
+%    They are defined with |\ProvideTextCommandDefault|, but this is
+%    very likely not required because their definitions are based on
+%    encoding dependent macros.
 %
+% \changes{babel~3.16}{2018/01/02}{Adapted to TU and refactored -
+%  redundant code.}
+%
 %  \begin{macro}{\glq}
 %  \begin{macro}{\grq}
 %
@@ -6889,11 +7068,8 @@
 %    The `german' single quotes.
 %
 %    \begin{macrocode}
-\ProvideTextCommand{\glq}{OT1}{%
+\ProvideTextCommandDefault{\glq}{%
   \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
-\ProvideTextCommand{\glq}{T1}{%
-  \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
-\ProvideTextCommandDefault{\glq}{\UseTextSymbol{OT1}\glq}
 %    \end{macrocode}
 %
 %    The definition of |\grq| depends on the fontencoding. With
@@ -6902,10 +7078,12 @@
 %    \begin{macrocode}
 \ProvideTextCommand{\grq}{T1}{%
   \textormath{\textquoteleft}{\mbox{\textquoteleft}}}
+\ProvideTextCommand{\grq}{TU}{%
+  \textormath{\textquoteleft}{\mbox{\textquoteleft}}}
 \ProvideTextCommand{\grq}{OT1}{%
-  \save at sf@q{\kern-.0125em%
-  \textormath{\textquoteleft}{\mbox{\textquoteleft}}%
-  \kern.07em\relax}}
+  \save at sf@q{\kern-.0125em
+    \textormath{\textquoteleft}{\mbox{\textquoteleft}}%
+    \kern.07em\relax}}
 \ProvideTextCommandDefault{\grq}{\UseTextSymbol{OT1}\grq}
 %    \end{macrocode}
 %
@@ -6921,23 +7099,22 @@
 %    The `german' double quotes.
 %
 %    \begin{macrocode}
-\ProvideTextCommand{\glqq}{OT1}{%
+\ProvideTextCommandDefault{\glqq}{%
   \textormath{\quotedblbase}{\mbox{\quotedblbase}}}
-\ProvideTextCommand{\glqq}{T1}{%
-  \textormath{\quotedblbase}{\mbox{\quotedblbase}}}
-\ProvideTextCommandDefault{\glqq}{\UseTextSymbol{OT1}\glqq}
 %    \end{macrocode}
 %
-%    The definition of |\grqq| depends on the % fontencoding. With
+%    The definition of |\grqq| depends on the fontencoding. With
 %    \texttt{T1} encoding no extra kerning is needed.
 %
 %    \begin{macrocode}
 \ProvideTextCommand{\grqq}{T1}{%
   \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
+\ProvideTextCommand{\grqq}{TU}{%
+  \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
 \ProvideTextCommand{\grqq}{OT1}{%
-  \save at sf@q{\kern-.07em%
-  \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
-  \kern.07em\relax}}
+  \save at sf@q{\kern-.07em
+    \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
+    \kern.07em\relax}}
 \ProvideTextCommandDefault{\grqq}{\UseTextSymbol{OT1}\grqq}
 %    \end{macrocode}
 %
@@ -6953,19 +7130,10 @@
 %    The `french' single guillemets.
 %
 %    \begin{macrocode}
-\ProvideTextCommand{\flq}{OT1}{%
+\ProvideTextCommandDefault{\flq}{%
   \textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
-\ProvideTextCommand{\flq}{T1}{%
-  \textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
-\ProvideTextCommandDefault{\flq}{\UseTextSymbol{OT1}\flq}
-%    \end{macrocode}
-%    
-%    \begin{macrocode}
-\ProvideTextCommand{\frq}{OT1}{%
+\ProvideTextCommandDefault{\frq}{%
   \textormath{\guilsinglright}{\mbox{\guilsinglright}}}
-\ProvideTextCommand{\frq}{T1}{%
-  \textormath{\guilsinglright}{\mbox{\guilsinglright}}}
-\ProvideTextCommandDefault{\frq}{\UseTextSymbol{OT1}\frq}
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -6980,19 +7148,10 @@
 %    The `french' double guillemets.
 %
 %    \begin{macrocode}
-\ProvideTextCommand{\flqq}{OT1}{%
+\ProvideTextCommandDefault{\flqq}{%
   \textormath{\guillemotleft}{\mbox{\guillemotleft}}}
-\ProvideTextCommand{\flqq}{T1}{%
-  \textormath{\guillemotleft}{\mbox{\guillemotleft}}}
-\ProvideTextCommandDefault{\flqq}{\UseTextSymbol{OT1}\flqq}
-%    \end{macrocode}
-%    
-%    \begin{macrocode}
-\ProvideTextCommand{\frqq}{OT1}{%
+\ProvideTextCommandDefault{\frqq}{%
   \textormath{\guillemotright}{\mbox{\guillemotright}}}
-\ProvideTextCommand{\frqq}{T1}{%
-  \textormath{\guillemotright}{\mbox{\guillemotright}}}
-\ProvideTextCommandDefault{\frqq}{\UseTextSymbol{OT1}\frqq}
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -7119,10 +7278,52 @@
 \main at language{english}
 %    \end{macrocode}
 %
+% \subsection{Layout}
+%
+% \textbf{Work in progress}.
+%
+% Layout is mainly intended to set bidi documents, but there is at
+% least a tool useful in general.
+%
+%    \begin{macrocode}
+\providecommand\IfBabelLayout[3]{#3}%
+\newcommand\BabelPatchSection[1]{%
+  \@ifundefined{#1}{}{%
+    \bbl at exp{\let\<bbl at ss@#1>\<#1>}%
+    \@namedef{#1}{%
+      \@ifstar{\bbl at presec@s{#1}}%
+              {\@dblarg{\bbl at presec@x{#1}}}}}}
+\def\bbl at presec@x#1[#2]#3{%
+  \bbl at exp{%
+    \\\select at language@x{\bbl at main@language}%
+    \\\@nameuse{bbl at ss@#1}%
+      [\\\foreignlanguage{\languagename}{\unexpanded{#2}}]%
+      {\\\foreignlanguage{\languagename}{\unexpanded{#3}}}%
+    \\\select at language@x{\languagename}}}
+\def\bbl at presec@s#1#2{%
+  \bbl at exp{%
+    \\\select at language@x{\bbl at main@language}%
+    \\\@nameuse{bbl at ss@#1}*%
+      {\\\foreignlanguage{\languagename}{\unexpanded{#2}}}%
+    \\\select at language@x{\languagename}}}
+\IfBabelLayout{sectioning}%   at begin document ???
+  {\BabelPatchSection{part}%
+   \BabelPatchSection{chapter}%
+   \BabelPatchSection{section}%
+   \BabelPatchSection{subsection}%
+   \BabelPatchSection{subsubsection}%
+   \BabelPatchSection{paragraph}%
+   \BabelPatchSection{subparagraph}%
+   \def\babel at toc#1{%
+     \select at language@x{\bbl at main@language}}}{}
+%    \end{macrocode}
+%
 %    Now we load definition files for engines.
 %
 %    \begin{macrocode}
-\ifcase\bbl at engine\or
+\ifcase\bbl at engine
+  \input txtbabel.def
+\or
   \input luababel.def
 \or
   \input xebabel.def
@@ -7168,6 +7369,8 @@
 % \changes{3.13}{2017/08/30}{Added \cs{import}, which also reads
 % dates. Some refactoring in the ini reader.}
 % \changes{3.15}{2017/10/30}{New keys script, language}
+% \changes{3.16}{2018/01/02}{Make sure ensuring works even before
+%  the language is selected}
 %
 %
 %    \begin{macrocode}
@@ -7196,6 +7399,12 @@
         {Use this macro as documented}}%
       {\bbl at provide@renew{#2}}}%
   \bbl at exp{\\\babelensure[exclude=\\\today]{#2}}%
+  \bbl at ifunset{bbl at ensure@\languagename}%
+    {\bbl at exp{%
+      \\\DeclareRobustCommand\<bbl at ensure@\languagename>[1]{%
+        \\\foreignlanguage{\languagename}%
+        {####1}}}}%
+    {}%
   \ifx\bbl at KVP@script\@nil\else
     \bbl at csarg\edef{sname@#2}{\bbl at KVP@script}%
   \fi
@@ -7317,10 +7526,10 @@
     \let\bbl at inireader\bbl at iniskip
     \bbl at info{Importing data from babel-#1.ini for \languagename}%
     \loop
+    \if T\ifeof1F\fi T\relax % Trick, because inside \loop
       \endlinechar\m at ne
       \read1 to \bbl at line
       \endlinechar`\^^M
-    \if T\ifeof1F\fi T\relax % Trick, because inside \loop
       \ifx\bbl at line\@empty\else
         \expandafter\bbl at iniline\bbl at line\bbl at iniline
       \fi
@@ -7434,6 +7643,8 @@
 %
 % But dates are more complex. The full date format is stores in
 % |date.gregorian|, so we must read it in non-Unicode engines, too.
+%
+% \changes{3.16}{2018/01/02}{Fix - dates were severely broken.}
 %      
 %    \begin{macrocode}
 \bbl at csarg\def{secpre at date.gregorian.licr}{%
@@ -7451,12 +7662,14 @@
        \bbl at TG@@date
        \global\bbl at csarg\let{date@\languagename}\bbl at toreplace
        \bbl at exp{%
-         \gdef\<\languagename date>####1####2####3{%
+         \gdef\<\languagename date>{\\\protect\<\languagename date >}%
+         \gdef\<\languagename date >####1####2####3{%
+           \\\bbl at usedategrouptrue
            \<bbl at ensure@\languagename>{%
              \<bbl at date@\languagename>{####1}{####2}{####3}}}%
          \\\bbl at add\\\bbl at savetoday{%
            \\\SetString\\\today{%
-             \<\languagename date>{\year}{\month}{\day}}}}}}%
+             \<\languagename date>{\\\the\year}{\\\the\month}{\\\the\day}}}}}}%
       {}}
 %    \end{macrocode}
 %
@@ -7466,7 +7679,7 @@
 % inconsistenly in either in the date or in the month name.
 %
 %    \begin{macrocode}
-\newcommand\BabelDateSpace{\nobreakspace{}}
+\newcommand\BabelDateSpace{\nobreakspace}
 \newcommand\BabelDateDot{.\@}
 \newcommand\BabelDated[1]{{\number#1}}
 \newcommand\BabelDatedd[1]{{\ifnum#1<10 0\fi\number#1}}
@@ -7473,7 +7686,7 @@
 \newcommand\BabelDateM[1]{{\number#1}}
 \newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}}
 \newcommand\BabelDateMMMM[1]{{%
-  \csname month\romannumeral\month name\endcsname}}%
+  \csname month\romannumeral#1name\endcsname}}%
 \newcommand\BabelDatey[1]{{\number#1}}%
 \newcommand\BabelDateyy[1]{{%
   \ifnum#1<10 0\number#1 %
@@ -7505,6 +7718,49 @@
   \bbl at replace@finish at iii\bbl at toreplace}
 %    \end{macrocode}
 %
+% Language and Script values to be used when defining a font or
+% setting the direction are set with the following macros.
+%
+%    \begin{macrocode}
+\def\bbl at provide@lsys#1{%
+  \bbl at ifunset{bbl at lname@#1}%
+    {\bbl at ini@ids{#1}}%
+    {}%
+  \bbl at csarg\let{lsys@#1}\@empty
+  \bbl at ifunset{bbl at sname@#1}{\bbl at csarg\gdef{sname@#1}{Default}}{}%
+  \bbl at ifunset{bbl at sotf#1}{\bbl at csarg\gdef{sotf@#1}{DFLT}}{}%
+  \bbl at csarg\bbl at add@list{lsys@#1}{Script=\bbl at cs{sname@#1}}%
+  \bbl at ifunset{bbl at lname@#1}{}%
+    {\bbl at csarg\bbl at add@list{lsys@#1}{Language=\bbl at cs{lname@#1}}}%
+  \bbl at csarg\bbl at toglobal{lsys@#1}}%
+ %  \bbl at exp{% TODO - should be global
+ %    \<keys_if_exist:nnF>{fontspec-opentype/Script}{\bbl at cs{sname@#1}}%
+ %      {\\\newfontscript{\bbl at cs{sname@#1}}{\bbl at cs{sotf@#1}}}% 
+ %    \<keys_if_exist:nnF>{fontspec-opentype/Language}{\bbl at cs{lname@#1}}%
+ %      {\\\newfontlanguage{\bbl at cs{lname@#1}}{\bbl at cs{lotf@#1}}}}}
+%    \end{macrocode}
+% 
+% The following |ini| reader ignores everything but the
+% |identification| section. It is called when a font is defined (ie,
+% when the language is first selected) to know which script/language
+% 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.
+%
+% \changes{3.16}{2018/01/02}{Load ids inside a box, to prevent extra
+% spaces.}
+%
+%    \begin{macrocode}
+\def\bbl at ini@ids#1{%
+  \def\BabelBeforeIni##1##2{%
+    \begingroup
+      \bbl at add\bbl at secpost@identification{\closein1 }%
+      \catcode`\[=12 \catcode`\]=12 \catcode`\==12 
+      \bbl at read@ini{##1}%
+    \endgroup}%           boxed, to avoid extra spaces:
+  {\setbox\z@\hbox{\InputIfFileExists{babel-#1.tex}{}{}}}}
+%    \end{macrocode}
+%
 % \subsection{Cross referencing macros}
 %
 %    The \LaTeX\ book states:
@@ -7860,13 +8116,20 @@
 %    \cs{@safe at activestrue} is in effect.
 %
 %    \begin{macrocode}
-\bbl at redefine\markright#1{%
-  \bbl at ifblank{#1}%
-    {\org at markright{}}%
-    {\toks@{#1}%
-     \bbl at exp{%
-       \\\org at markright{\\\protect\\\foreignlanguage{\languagename}%
-         {\\\protect\\\bbl at restore@actives\the\toks@}}}}}
+\IfBabelLayout{sectioning}
+  {\ifx\bbl at opt@headfoot\@nnil
+     \g at addto@macro\@resetactivechars{%
+       \set at typeset@protect                  
+       \expandafter\select at language@x\expandafter{\bbl at main@language}%
+       \let\protect\noexpand}%
+   \fi}
+  {\bbl at redefine\markright#1{%
+     \bbl at ifblank{#1}%
+       {\org at markright{}}%
+       {\toks@{#1}%
+        \bbl at exp{%
+          \\\org at markright{\\\protect\\\foreignlanguage{\languagename}%
+            {\\\protect\\\bbl at restore@actives\the\toks@}}}}}
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -7891,32 +8154,32 @@
 %    3826)} 
 %
 %    \begin{macrocode}
-\ifx\@mkboth\markboth
-  \def\bbl at tempc{\let\@mkboth\markboth}
-\else
-  \def\bbl at tempc{}
-\fi
+   \ifx\@mkboth\markboth
+     \def\bbl at tempc{\let\@mkboth\markboth}
+   \else
+     \def\bbl at tempc{}
+   \fi
 %    \end{macrocode}
 %
 %    Now we can start the new definition of |\markboth|
 %
 %    \begin{macrocode}
-\bbl at redefine\markboth#1#2{%
-  \protected at edef\bbl at tempb##1{%
-    \protect\foreignlanguage{\languagename}{\protect\bbl at restore@actives##1}}%
-  \bbl at ifblank{#1}%
-    {\toks@{}}%
-    {\toks@\expandafter{\bbl at tempb{#1}}}%
-  \bbl at ifblank{#2}%
-    {\@temptokena{}}%
-    {\@temptokena\expandafter{\bbl at tempb{#2}}}%
-  \bbl at exp{\\\org at markboth{\the\toks@}{\the\@temptokena}}}
+   \bbl at redefine\markboth#1#2{%
+     \protected at edef\bbl at tempb##1{%
+       \protect\foreignlanguage{\languagename}{\protect\bbl at restore@actives##1}}%
+     \bbl at ifblank{#1}%
+       {\toks@{}}%
+       {\toks@\expandafter{\bbl at tempb{#1}}}%
+     \bbl at ifblank{#2}%
+       {\@temptokena{}}%
+       {\@temptokena\expandafter{\bbl at tempb{#2}}}%
+     \bbl at exp{\\\org at markboth{\the\toks@}{\the\@temptokena}}}
 %    \end{macrocode}
 %
 %    and copy it to |\@mkboth| if necessary.
 %
 %    \begin{macrocode}
-\bbl at tempc
+   \bbl at tempc}  % end \IfBabelLayout
 %    \end{macrocode}
 %
 %  \end{macro}
@@ -8322,8 +8585,9 @@
 %      set left-to-right and right-to-left page layouts. As Lua\TeX-ja
 %      shows, vertical typesetting is posible, too. Its main drawback
 %      is font handling is often considered to be less mature than
-%      \xetex.\footnote{Although in my [JBL] experience problems are
-%      in fact minimal.}
+%      \xetex{}, mainly in Indic scripts (but there are steps to make
+%      HarfBuzz, the \xetex{} font engine, available in \luatex{}; see
+%      <https://github.com/tatzetwerk/luatex-harfbuzz>).
 %    \end{itemize}
 %
 % \changes{3.15}{2017/10/30}{Use an attribute instead of tex language
@@ -8330,7 +8594,6 @@
 %    (reserved for hyphenation).}
 % \changes{3.15}{2017/10/30}{Store direction in @wdir@<lang>.}
 %
-%
 %    \begin{macrocode}
 \def\bbl at alscripts{,Arabic,Syriac,Thaana,}
 \def\bbl at rscripts{%
@@ -8352,17 +8615,16 @@
     \global\bbl at csarg\chardef{wdir@#1}\z@
   \fi}
 \def\bbl at switchdir{%
+  \bbl at ifunset{bbl at lsys@\languagename}{\bbl at provide@lsys{\languagename}}{}%
   \bbl at ifunset{bbl at wdir@\languagename}{\bbl at provide@dirs{\languagename}}{}%
   \bbl at exp{\\\bbl at setdirs\bbl at cs{wdir@\languagename}}}
 \def\bbl at setdirs#1{% TODO - math
   \ifcase\bbl at select@type % TODO - strictly, not the right test
-    \bbl at pagedir{#1}%
     \bbl at bodydir{#1}%
     \bbl at pardir{#1}%
   \fi
   \bbl at textdir{#1}}
-\ifcase\bbl at engine
-\or
+\ifodd\bbl at engine  % luatex=1
   \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
   \DisableBabelHook{babel-bidi}
   \def\bbl at getluadir#1{%
@@ -8389,7 +8651,7 @@
   \def\bbl at bodydir{\bbl at setdir{body}\bodydir}
   \def\bbl at pagedir{\bbl at setdir{page}\pagedir}
   \def\bbl at dirparastext{\pardir\the\textdir\relax}%   %%%%
-\or
+\else % pdftex=0, xetex=2
   \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
   \DisableBabelHook{babel-bidi}
   \newcount\bbl at dirlevel
@@ -8440,17 +8702,21 @@
 % The following command is executed only if there is a right-to-left
 % script (once). It activates the |\everypar| hack for \xetex, to
 % properly handle the par direction. Note text and par dirs are
-% decoupled.
+% decoupled to some extent (although not completely).
 %
+% \changes{3.16}{2018/01/02}{Fix - the direction prevented the removal
+%   of the indent to be re-placed}
+%
 %    \begin{macrocode}
   \def\bbl at xebidipar{%
     \let\bbl at xebidipar\relax 
     \TeXXeTstate\@ne
     \def\bbl at xeeverypar{%
-      \ifcase\bbl at thepardir\else
-        {\setbox\z@\lastbox\beginR\box\z@}%
-      \fi
-      \ifcase\bbl at thetextdir\else\beginR\fi}%
+      \ifcase\bbl at thepardir
+        \ifcase\bbl at thetextdir\else\beginR\fi
+      \else
+        {\setbox\z@\lastbox\beginR\box\z@}% 
+      \fi}%
     \let\bbl at severypar\everypar
     \newtoks\everypar
     \everypar=\bbl at severypar
@@ -8457,7 +8723,15 @@
     \bbl at severypar{\bbl at xeeverypar\the\everypar}}
 \fi
 %    \end{macrocode}
+%  
+% A tool for weak L (mainly digits).
 %
+% \changes{3.16}{2018/01/02}{New macro \cs{babelsublr}}
+%
+%    \begin{macrocode}
+\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl at textdir\z@#1}}
+%    \end{macrocode}
+%
 % \subsection{Local Language Configuration}
 %
 %  \begin{macro}{\loadlocalcfg}
@@ -8766,6 +9040,8 @@
 % \changes{babel~3.9a}{2013/03/08}{Don't write to aux if language is
 %    unknown}
 % \changes{babel~3.9h}{2013/11/20}{Error with a more helpful text }
+% \changes{babel~3.16}{2018/01/02}{New mechanism to pass the language
+% to aux, toc, etc.}
 %
 %    \begin{macrocode}
 \def\BabelContentsFiles{toc,lof,lot}
@@ -8776,9 +9052,7 @@
   \select at language{\languagename}%
   \expandafter\ifx\csname date\languagename\endcsname\relax\else
     \if at filesw
-      \protected at write\@auxout{}{\string\select at language{\languagename}}%
-      \bbl at foreach\BabelContentsFiles{%
-        \addtocontents{##1}{\xstring\select at language{\languagename}}}%
+      \protected at write\@auxout{}{\string\babel at aux{\languagename}{}}%
       \bbl at usehooks{write}{}%
     \fi
   \fi}
@@ -8798,6 +9072,12 @@
       \let\bbl at select@type\z@
       \expandafter\bbl at switch\expandafter{\languagename}%
     \fi}}
+\def\babel at aux#1#2{%
+  \select at language{#1}%
+  \bbl at foreach\BabelContentsFiles{%
+    \@writefile{##1}{\babel at toc{#1}{#2}}}} %% TODO - ok in plain?
+\def\babel at toc#1#2{%
+  \select at language{#1}}
 %    \end{macrocode}
 %    
 % A bit of optimization. Select in heads/foots the language only if
@@ -8857,6 +9137,7 @@
 % \changes{3.15}{2017/10/30}{Remove spaces inside captions and date.}
 %
 %    \begin{macrocode}
+\newif\ifbbl at usedategroup
 \def\bbl at switch#1{%
   \originalTeX
   \expandafter\def\expandafter\originalTeX\expandafter{%
@@ -8875,7 +9156,16 @@
       \csname captions#1\endcsname\relax
       \csname date#1\endcsname\relax
     \fi
-  \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
+    \fi
+  \fi\fi
   \bbl at usehooks{beforeextras}{}%
   \csname extras#1\endcsname\relax
   \bbl at usehooks{afterextras}{}%
@@ -9803,18 +10093,33 @@
 %
 %    \begin{macrocode}
 %<<*More package options>>
-\DeclareOption{bidi=basic-r}%
-  {\newattribute\bbl at attr@dir
-   \let\bbl at beforeforeign\leavevmode
-   \AtEndOfPackage{\EnableBabelHook{babel-bidi}}}
+\ifodd\bbl at engine
+  \DeclareOption{bidi=basic-r}%
+    {\let\bbl at beforeforeign\leavevmode
+     \newattribute\bbl at attr@dir
+     \bbl at exp{\output{\bodydir\pagedir\the\output}}%
+     \AtEndOfPackage{\EnableBabelHook{babel-bidi}}}
+\else
+  \DeclareOption{bidi=basic-r}%
+    {\bbl at error
+      {The bidi method `basic-r' is available only in\\%
+       luatex. I'll continue with `bidi=default', so\\%
+       expect wrong results}%
+      {See the manual for further details.}%
+    \let\bbl at beforeforeign\leavevmode
+    \AtEndOfPackage{%
+      \EnableBabelHook{babel-bidi}%
+      \bbl at xebidipar}}
+\fi
 \DeclareOption{bidi=default}%
   {\let\bbl at beforeforeign\leavevmode
-   \ifcase\bbl at engine\or
+   \ifodd\bbl at engine
      \newattribute\bbl at attr@dir
+     \bbl at exp{\output{\bodydir\pagedir\the\output}}%
    \fi
    \AtEndOfPackage{%
      \EnableBabelHook{babel-bidi}%
-     \ifcase\bbl at engine\or\or
+     \ifodd\bbl at engine\else
        \bbl at xebidipar
      \fi}}
 %<</More package options>>
@@ -9919,47 +10224,6 @@
   \bbl at toglobal#1}%
 %    \end{macrocode}
 % 
-% Language and Script values to be used when defining a font are set
-% with the following macros. 
-%
-%    \begin{macrocode}
-\def\bbl at provide@lsys#1{%
-  \bbl at ifunset{bbl at lname@#1}%
-    {\bbl at ini@ids{#1}}%
-    {}%
-  \bbl at csarg\let{lsys@#1}\@empty
-  \bbl at ifunset{bbl at sname@#1}{\bbl at csarg\gdef{sname@#1}{Default}}{}%
-  \bbl at ifunset{bbl at sotf#1}{\bbl at csarg\gdef{sotf@#1}{DFLT}}{}%
-  \bbl at csarg\bbl at add@list{lsys@#1}{Script=\bbl at cs{sname@#1}}%
-  \bbl at ifunset{bbl at lname@#1}{}%
-    {\bbl at csarg\bbl at add@list{lsys@#1}{Language=\bbl at cs{lname@#1}}}%
-  \bbl at csarg\bbl at toglobal{lsys@#1}}%
- %  \bbl at exp{% TODO - should be global
- %    \<keys_if_exist:nnF>{fontspec-opentype/Script}{\bbl at cs{sname@#1}}%
- %      {\\\newfontscript{\bbl at cs{sname@#1}}{\bbl at cs{sotf@#1}}}% 
- %    \<keys_if_exist:nnF>{fontspec-opentype/Language}{\bbl at cs{lname@#1}}%
- %      {\\\newfontlanguage{\bbl at cs{lname@#1}}{\bbl at cs{lotf@#1}}}}}
-%    \end{macrocode}
-% 
-% The following |ini| reader ignores everything but the
-% |identification| section. It is called when a font is defined (ie,
-% when the language is first selected) to know which script/language
-% 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.
-%
-%    \begin{macrocode}
-\def\bbl at ini@ids#1{%
-  \def\BabelBeforeIni##1##2{%
-    \begingroup
-      \bbl at add\bbl at secpost@identification{%
-        \def\bbl at iniline########1\bbl at iniline{}}%
-      \catcode`\[=12 \catcode`\]=12 \catcode`\==12 
-      \bbl at read@ini{##1}%
-    \endgroup}
-  \InputIfFileExists{babel-#1.tex}{}{}}
-%    \end{macrocode}
-%
 % font at rst and famrst are only used when there is no global settings,
 % to save and restore de previous families. Not really necessary, but
 % done for optimization.
@@ -10101,9 +10365,168 @@
 \AddBabelHook{babel-fontspec}{afterextras}{\bbl at switchfont}
 \DisableBabelHook{babel-fontspec}
 <@Font selection@>
+\input txtbabel.def
 %</xetex>
 %    \end{macrocode}
 %
+% \subsection{Layout}
+%
+% \changes{babel~3.16}{2018/01/02}{Option layout - first available options:
+% sectioning, counters, lists, columns, contents}
+%
+% In progress.
+%
+% Unfortunately, for proper support for \xetex{} lots of macros and
+% packages must be patched somehow. At least at this stage, \babel{}
+% will not do it and therefore a package similar to \textsf{bidi} will
+% be required. Any help in making \babel{} and \textsf{bidi}
+% collaborate will be welcome. Note as well, elements like headlines
+% and margins can be modified easily with packages like
+% \textsf{fancyhdr}, \textsf{typearea} or \textsf{titleps}, and
+% \textsf{geometry}.
+%
+% |\bbl at startskip| and |\bbl at endskip| are available to package
+% authors. Thanks to the \TeX{} expansion mechanism the following
+% constructs are valid: |\adim\bbl at startskip|,
+% |\advance\bbl at startskip\adim|, |\bbl at startskip\adim|.
+%
+% Consider |txtbabel| as a shorthand for \textit{tex--xet babel},
+% which the bidi model in both \pdftex{} and \xetex{}. 
+%
+%    \begin{macrocode}
+%<*texxet>
+\ifx\bbl at opt@layout\@nnil\endinput\fi  % No layout
+\def\bbl at startskip{\ifcase\bbl at thepardir\leftskip\else\rightskip\fi}
+\def\bbl at endskip{\ifcase\bbl at thepardir\rightskip\else\leftskip\fi}
+\ifx\bbl at beforeforeign\leavevmode % A poor test for bidi=
+  \def\@hangfrom#1{%
+    \setbox\@tempboxa\hbox{{#1}}%
+    \hangindent\ifcase\bbl at thepardir\wd\@tempboxa\else-\wd\@tempboxa\fi
+    \noindent\box\@tempboxa}
+  \def\raggedright{%
+    \let\\\@centercr
+    \bbl at startskip\z at skip
+    \@rightskip\@flushglue
+    \bbl at endskip\@rightskip
+    \parindent\z@
+    \parfillskip\bbl at startskip}
+  \def\raggedleft{%
+    \let\\\@centercr
+    \bbl at startskip\@flushglue
+    \bbl at endskip\z at skip
+    \parindent\z@
+    \parfillskip\bbl at endskip}
+\fi
+\IfBabelLayout{lists}
+  {\def\list#1#2{%
+    \ifnum \@listdepth >5\relax
+      \@toodeep
+    \else
+      \global\advance\@listdepth\@ne
+    \fi
+    \rightmargin\z@
+    \listparindent\z@
+    \itemindent\z@
+    \csname @list\romannumeral\the\@listdepth\endcsname
+    \def\@itemlabel{#1}%
+    \let\makelabel\@mklab
+    \@nmbrlistfalse
+    #2\relax
+    \@trivlist
+    \parskip\parsep
+    \parindent\listparindent
+    \advance\linewidth-\rightmargin
+    \advance\linewidth-\leftmargin
+    \advance\@totalleftmargin
+      \ifcase\bbl at thepardir\leftmargin\else\rightmargin\fi
+    \parshape\@ne\@totalleftmargin\linewidth
+    \ignorespaces}%
+  \def\labelenumii{)\theenumii(}%
+  \def\p at enumiii{\p at enumii)\theenumii(}}
+  {}
+\IfBabelLayout{contents}
+  {\def\@dottedtocline#1#2#3#4#5{%
+     \ifnum#1>\c at tocdepth\else
+       \vskip \z@ \@plus.2\p@
+       {\bbl at startskip#2\relax
+        \bbl at endskip\@tocrmarg
+        \parfillskip-\bbl at endskip
+        \parindent#2\relax
+        \@afterindenttrue
+        \interlinepenalty\@M
+        \leavevmode
+        \@tempdima#3\relax
+        \advance\bbl at startskip\@tempdima
+        \null\nobreak\hskip-\bbl at startskip
+        {#4}\nobreak
+        \leaders\hbox{%
+          $\m at th\mkern\@dotsep mu\hbox{.}\mkern\@dotsep mu$}%
+          \hfill\nobreak
+          \hb at xt@\@pnumwidth{\hfil\normalfont\normalcolor#5}%
+          \par}%
+     \fi}}
+  {}
+\IfBabelLayout{columns}
+  {\def\@outputdblcol{%
+     \if at firstcolumn
+       \global\@firstcolumnfalse
+       \global\setbox\@leftcolumn\copy\@outputbox
+       \splitmaxdepth\maxdimen
+       \vbadness\maxdimen
+       \setbox\@outputbox\vbox{\unvbox\@outputbox\unskip}%
+       \setbox\@outputbox\vsplit\@outputbox to\maxdimen
+       \toks@\expandafter{\topmark}%
+       \xdef\@firstcoltopmark{\the\toks@}%
+       \toks@\expandafter{\splitfirstmark}%
+       \xdef\@firstcolfirstmark{\the\toks@}%
+       \ifx\@firstcolfirstmark\@empty
+         \global\let\@setmarks\relax
+       \else
+         \gdef\@setmarks{%
+           \let\firstmark\@firstcolfirstmark
+           \let\topmark\@firstcoltopmark}%
+       \fi
+     \else
+       \global\@firstcolumntrue
+       \setbox\@outputbox\vbox{%
+         \hb at xt@\textwidth{%
+           \hskip\columnwidth
+           \hfil
+           {\normalcolor\vrule \@width\columnseprule}%
+           \hfil
+           \hb at xt@\columnwidth{\box\@leftcolumn \hss}%
+           \hskip-\textwidth
+           \hb at xt@\columnwidth{\box\@outputbox \hss}%
+           \hskip\columnsep
+           \hskip\columnwidth}}%
+       \@combinedblfloats
+       \@setmarks
+       \@outputpage
+       \begingroup
+         \@dblfloatplacement
+         \@startdblcolumn
+         \@whilesw\if at fcolmade \fi{\@outputpage
+         \@startdblcolumn}%
+       \endgroup
+     \fi}}%
+  {}
+%    \end{macrocode}
+%
+%      Implicitly reverses sectioning labels in bidi=basic-r, because
+%      the full stop is not in contact with L numbers any more. A
+%      think there must be a better way.
+%
+%    \begin{macrocode}
+\IfBabelLayout{counters}%  Global or language dependent? At begin doc?
+  {\let\bbl at latinarabic=\@arabic
+   \def\@arabic#1{\babelsublr{\bbl at latinarabic#1}}%
+   \let\bbl at asciiroman=\@roman
+   \def\@roman#1{\babelsublr{\ensureascii{\bbl at asciiroman#1}}}%
+   \let\bbl at asciiRoman=\@Roman
+   \def\@Roman#1{\babelsublr{\ensureascii{\bbl at asciiRoman#1}}}}{}
+%</texxet>
+%    \end{macrocode}
+%
 % \subsection{LuaTeX}
 %
 % The new loader for luatex is based solely on |language.dat|, which
@@ -10473,16 +10896,93 @@
 \AddBabelHook{babel-fontspec}{afterextras}{\bbl at switchfont}
 \DisableBabelHook{babel-fontspec}
 <@Font selection@>
+%    \end{macrocode}
+%
+% \subsection{Layout}
+%
+% \textbf{Work in progress}.
+%
+% Unlike \xetex{}, \luatex{} requires only minimal changes for
+% right-to-left layouts, particularly in monolingual documents (the
+% engine itself reverses boxes -- including column order or headings
+% --, margins, etc.) and with |bidi=basic-r|, without having to patch
+% almost any macro where text direction is relevant.
+%
+% |\@hangfrom| is useful in many contexts and it is redefined always
+% with the |layout| option. 
+%
+% There are, however, a number of issues when the text direction is
+% not the same as the box direction (as set by |\bodydir|), and when
+% |\parbox| and |\hangindent| are involved. Fortunately, latest
+% releases of \luatex{} simplify a lot the solution with |\shapemode|.
+%
+%    \begin{macrocode}
+\ifx\bbl at opt@layout\@nnil\endinput\fi  % if no layout
+\ifx\bbl at beforeforeign\leavevmode % A poor test for bidi=
+  \def\@hangfrom#1{%
+    \setbox\@tempboxa\hbox{{#1}}%
+    \hangindent\wd\@tempboxa
+    \ifnum\bbl at getluadir{page}=\bbl at getluadir{par}\else
+      \shapemode\@ne
+    \fi
+    \noindent\box\@tempboxa}
+\fi
+\IfBabelLayout{lists}
+  {\def\list#1#2{%
+     \ifnum \@listdepth >5\relax
+       \@toodeep
+     \else
+       \global\advance\@listdepth\@ne
+     \fi
+     \rightmargin\z@
+     \listparindent\z@
+     \itemindent\z@
+     \csname @list\romannumeral\the\@listdepth\endcsname
+     \def\@itemlabel{#1}%
+     \let\makelabel\@mklab
+     \@nmbrlistfalse
+     #2\relax
+     \@trivlist
+     \parskip\parsep
+     \parindent\listparindent
+     \advance\linewidth -\rightmargin
+     \advance\linewidth -\leftmargin
+     \advance\@totalleftmargin \leftmargin
+     \parshape \@ne
+     \@totalleftmargin \linewidth
+     \ifnum\bbl at getluadir{page}=\bbl at getluadir{par}\else
+       \shapemode\tw@
+     \fi
+     \ignorespaces}}
+  {}
+%    \end{macrocode}
+%
+%      Implicitly reverses sectioning labels in bidi=basic-r, because
+%      the full stop is not in contact with L numbers any more. I
+%      think there must be a better way. Assumes |bidi=basic-r|, but
+%      there are some additional readjustments for |bidi=default|.
+%
+%    \begin{macrocode}
+\IfBabelLayout{counters}%  Global or language dependent? At begin doc?
+  {\let\bbl at latinarabic=\@arabic
+   \def\@arabic#1{\babelsublr{\bbl at latinarabic#1}}%
+   \@ifpackagewith{babel}{bidi=default}
+     {\let\bbl at asciiroman=\@roman
+      \def\@roman#1{\babelsublr{\ensureascii{\bbl at asciiroman#1}}}%
+      \let\bbl at asciiRoman=\@Roman
+      \def\@Roman#1{\babelsublr{\ensureascii{\bbl at asciiRoman#1}}}%
+      \def\labelenumii{)\theenumii(}%
+      \def\p at enumiii{\p at enumii)\theenumii(}}}{}
 %</luatex>
 %    \end{macrocode}
 %
-%    \section{Bidi support in \luatex}
+% \subsection{Auto bidi with \texttt{basic-r}}
 %
 % \changes{3.14}{2017/09/30}{LuaTeX - support for R/AL texts - basic-r}
 %
-% \textbf{Work in progress}. The file \textsf{babel-bidi.lua}
-% currently only contains data. It's a large and boring file and it's
-% not shown here. See the generated file.
+% The file \textsf{babel-bidi.lua} currently only contains data. It is
+% a large and boring file and it's not shown here. See the generated
+% file.
 %\iffalse
 %    \begin{macrocode}
 %<*bidi> 
@@ -16690,7 +17190,6 @@
             attr_dir = at.value
           end
         end
-        texio.write_nl(attr_dir)
         if attr_dir == 1 then
           strong = 'r'
         elseif attr_dir == 2 then
@@ -16702,6 +17201,7 @@
         outer = strong_lr
         new_dir = false
       end
+
       if dir == 'nsm' then dir = strong end             -- W1
 %    \end{macrocode}
 %

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.ins	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.ins	2018-01-04 23:39:46 UTC (rev 46210)
@@ -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{2017/11/03}
+\def\filedate{2018/01/04}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
@@ -137,6 +137,7 @@
           \file{nil.ldf}{\from{babel.dtx}{nil}}
           \file{xebabel.def}{\from{babel.dtx}{xetex}}
           \file{luababel.def}{\from{babel.dtx}{luatex}}
+          \file{txtbabel.def}{\from{babel.dtx}{texxet}}
           }
 
 % Support for plain users

Modified: trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2018-01-04 23:39:46 UTC (rev 46210)
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2017/11/03 v3.15]
+\ProvidesFile{bbcompat.dtx}[2018/01/04 v3.16]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
@@ -185,9 +185,8 @@
 %<+estonian>\input estonian.ldf\relax
 %<+finnish>\def\CurrentOption{finnish}
 %<+finnish>\input finnish.ldf\relax
-%<+francais>\def\CurrentOption{francais}
-%<+french>\def\CurrentOption{french}
-%<+francais|french>\input frenchb.ldf\relax
+%<+francais>\def\CurrentOption{french}
+%<+francais>\input french.ldf\relax
 %<+galician>\def\CurrentOption{galician}
 %<+galician>\input galician.ldf\relax
 %<+austrian>\def\CurrentOption{austrian}

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	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel-bidi-basic-r.lua	2018-01-04 23:39:46 UTC (rev 46210)
@@ -91,7 +91,6 @@
             attr_dir = at.value
           end
         end
-        texio.write_nl(attr_dir)
         if attr_dir == 1 then
           strong = 'r'
         elseif attr_dir == 2 then
@@ -103,6 +102,7 @@
         outer = strong_lr
         new_dir = false
       end
+
       if dir == 'nsm' then dir = strong end             -- W1
       dir_real = dir               -- We need dir_real to set strong below
       if dir == 'al' then dir = 'r' end -- W3

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.def	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.def	2018-01-04 23:39:46 UTC (rev 46210)
@@ -40,7 +40,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{babel.def}[2017/11/03 3.15 Babel common definitions]
+\ProvidesFile{babel.def}[2018/01/04 3.16 Babel common definitions]
 \ifx\AtBeginDocument\@undefined
   \input plain.def\relax
 \fi
@@ -358,7 +358,8 @@
   \let\languagename\bbl at main@language
   \bbl at patterns{\languagename}}
 \AtBeginDocument{%
-  \expandafter\selectlanguage\expandafter{\bbl at main@language}}
+  \expandafter\selectlanguage\expandafter{\bbl at main@language}%
+  \ifcase\bbl at engine\or\pagedir\bodydir\fi}  % TODO - a better place
 \def\select at language@x#1{%
   \ifcase\bbl at select@type
     \bbl at ifsamestring\languagename{#1}{}{\select at language{#1}}%
@@ -1156,50 +1157,36 @@
   \UseTextSymbol{OT1}{\DJ}}
 \DeclareTextCommand{\SS}{OT1}{SS}
 \ProvideTextCommandDefault{\SS}{\UseTextSymbol{OT1}{\SS}}
-\ProvideTextCommand{\glq}{OT1}{%
+\ProvideTextCommandDefault{\glq}{%
   \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
-\ProvideTextCommand{\glq}{T1}{%
-  \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
-\ProvideTextCommandDefault{\glq}{\UseTextSymbol{OT1}\glq}
 \ProvideTextCommand{\grq}{T1}{%
   \textormath{\textquoteleft}{\mbox{\textquoteleft}}}
+\ProvideTextCommand{\grq}{TU}{%
+  \textormath{\textquoteleft}{\mbox{\textquoteleft}}}
 \ProvideTextCommand{\grq}{OT1}{%
-  \save at sf@q{\kern-.0125em%
-  \textormath{\textquoteleft}{\mbox{\textquoteleft}}%
-  \kern.07em\relax}}
+  \save at sf@q{\kern-.0125em
+    \textormath{\textquoteleft}{\mbox{\textquoteleft}}%
+    \kern.07em\relax}}
 \ProvideTextCommandDefault{\grq}{\UseTextSymbol{OT1}\grq}
-\ProvideTextCommand{\glqq}{OT1}{%
+\ProvideTextCommandDefault{\glqq}{%
   \textormath{\quotedblbase}{\mbox{\quotedblbase}}}
-\ProvideTextCommand{\glqq}{T1}{%
-  \textormath{\quotedblbase}{\mbox{\quotedblbase}}}
-\ProvideTextCommandDefault{\glqq}{\UseTextSymbol{OT1}\glqq}
 \ProvideTextCommand{\grqq}{T1}{%
   \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
+\ProvideTextCommand{\grqq}{TU}{%
+  \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
 \ProvideTextCommand{\grqq}{OT1}{%
-  \save at sf@q{\kern-.07em%
-  \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
-  \kern.07em\relax}}
+  \save at sf@q{\kern-.07em
+    \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
+    \kern.07em\relax}}
 \ProvideTextCommandDefault{\grqq}{\UseTextSymbol{OT1}\grqq}
-\ProvideTextCommand{\flq}{OT1}{%
+\ProvideTextCommandDefault{\flq}{%
   \textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
-\ProvideTextCommand{\flq}{T1}{%
-  \textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
-\ProvideTextCommandDefault{\flq}{\UseTextSymbol{OT1}\flq}
-\ProvideTextCommand{\frq}{OT1}{%
+\ProvideTextCommandDefault{\frq}{%
   \textormath{\guilsinglright}{\mbox{\guilsinglright}}}
-\ProvideTextCommand{\frq}{T1}{%
-  \textormath{\guilsinglright}{\mbox{\guilsinglright}}}
-\ProvideTextCommandDefault{\frq}{\UseTextSymbol{OT1}\frq}
-\ProvideTextCommand{\flqq}{OT1}{%
+\ProvideTextCommandDefault{\flqq}{%
   \textormath{\guillemotleft}{\mbox{\guillemotleft}}}
-\ProvideTextCommand{\flqq}{T1}{%
-  \textormath{\guillemotleft}{\mbox{\guillemotleft}}}
-\ProvideTextCommandDefault{\flqq}{\UseTextSymbol{OT1}\flqq}
-\ProvideTextCommand{\frqq}{OT1}{%
+\ProvideTextCommandDefault{\frqq}{%
   \textormath{\guillemotright}{\mbox{\guillemotright}}}
-\ProvideTextCommand{\frqq}{T1}{%
-  \textormath{\guillemotright}{\mbox{\guillemotright}}}
-\ProvideTextCommandDefault{\frqq}{\UseTextSymbol{OT1}\frqq}
 \def\umlauthigh{%
   \def\bbl at umlauta##1{\leavevmode\bgroup%
       \expandafter\accent\csname\f at encoding dqpos\endcsname
@@ -1240,7 +1227,39 @@
   \chardef\l at english\z@
 \fi
 \main at language{english}
-\ifcase\bbl at engine\or
+\providecommand\IfBabelLayout[3]{#3}%
+\newcommand\BabelPatchSection[1]{%
+  \@ifundefined{#1}{}{%
+    \bbl at exp{\let\<bbl at ss@#1>\<#1>}%
+    \@namedef{#1}{%
+      \@ifstar{\bbl at presec@s{#1}}%
+              {\@dblarg{\bbl at presec@x{#1}}}}}}
+\def\bbl at presec@x#1[#2]#3{%
+  \bbl at exp{%
+    \\\select at language@x{\bbl at main@language}%
+    \\\@nameuse{bbl at ss@#1}%
+      [\\\foreignlanguage{\languagename}{\unexpanded{#2}}]%
+      {\\\foreignlanguage{\languagename}{\unexpanded{#3}}}%
+    \\\select at language@x{\languagename}}}
+\def\bbl at presec@s#1#2{%
+  \bbl at exp{%
+    \\\select at language@x{\bbl at main@language}%
+    \\\@nameuse{bbl at ss@#1}*%
+      {\\\foreignlanguage{\languagename}{\unexpanded{#2}}}%
+    \\\select at language@x{\languagename}}}
+\IfBabelLayout{sectioning}%   at begin document ???
+  {\BabelPatchSection{part}%
+   \BabelPatchSection{chapter}%
+   \BabelPatchSection{section}%
+   \BabelPatchSection{subsection}%
+   \BabelPatchSection{subsubsection}%
+   \BabelPatchSection{paragraph}%
+   \BabelPatchSection{subparagraph}%
+   \def\babel at toc#1{%
+     \select at language@x{\bbl at main@language}}}{}
+\ifcase\bbl at engine
+  \input txtbabel.def
+\or
   \input luababel.def
 \or
   \input xebabel.def
@@ -1279,6 +1298,12 @@
         {Use this macro as documented}}%
       {\bbl at provide@renew{#2}}}%
   \bbl at exp{\\\babelensure[exclude=\\\today]{#2}}%
+  \bbl at ifunset{bbl at ensure@\languagename}%
+    {\bbl at exp{%
+      \\\DeclareRobustCommand\<bbl at ensure@\languagename>[1]{%
+        \\\foreignlanguage{\languagename}%
+        {####1}}}}%
+    {}%
   \ifx\bbl at KVP@script\@nil\else
     \bbl at csarg\edef{sname@#2}{\bbl at KVP@script}%
   \fi
@@ -1380,10 +1405,10 @@
     \let\bbl at inireader\bbl at iniskip
     \bbl at info{Importing data from babel-#1.ini for \languagename}%
     \loop
+    \if T\ifeof1F\fi T\relax % Trick, because inside \loop
       \endlinechar\m at ne
       \read1 to \bbl at line
       \endlinechar`\^^M
-    \if T\ifeof1F\fi T\relax % Trick, because inside \loop
       \ifx\bbl at line\@empty\else
         \expandafter\bbl at iniline\bbl at line\bbl at iniline
       \fi
@@ -1470,14 +1495,16 @@
        \bbl at TG@@date
        \global\bbl at csarg\let{date@\languagename}\bbl at toreplace
        \bbl at exp{%
-         \gdef\<\languagename date>####1####2####3{%
+         \gdef\<\languagename date>{\\\protect\<\languagename date >}%
+         \gdef\<\languagename date >####1####2####3{%
+           \\\bbl at usedategrouptrue
            \<bbl at ensure@\languagename>{%
              \<bbl at date@\languagename>{####1}{####2}{####3}}}%
          \\\bbl at add\\\bbl at savetoday{%
            \\\SetString\\\today{%
-             \<\languagename date>{\year}{\month}{\day}}}}}}%
+             \<\languagename date>{\\\the\year}{\\\the\month}{\\\the\day}}}}}}%
       {}}
-\newcommand\BabelDateSpace{\nobreakspace{}}
+\newcommand\BabelDateSpace{\nobreakspace}
 \newcommand\BabelDateDot{.\@}
 \newcommand\BabelDated[1]{{\number#1}}
 \newcommand\BabelDatedd[1]{{\ifnum#1<10 0\fi\number#1}}
@@ -1484,7 +1511,7 @@
 \newcommand\BabelDateM[1]{{\number#1}}
 \newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}}
 \newcommand\BabelDateMMMM[1]{{%
-  \csname month\romannumeral\month name\endcsname}}%
+  \csname month\romannumeral#1name\endcsname}}%
 \newcommand\BabelDatey[1]{{\number#1}}%
 \newcommand\BabelDateyy[1]{{%
   \ifnum#1<10 0\number#1 %
@@ -1512,6 +1539,30 @@
   \bbl at replace\bbl at toreplace{[yy]}{\BabelDateyy{####1}}%
   \bbl at replace\bbl at toreplace{[yyyy]}{\BabelDateyyyy{####1}}%
   \bbl at replace@finish at iii\bbl at toreplace}
+\def\bbl at provide@lsys#1{%
+  \bbl at ifunset{bbl at lname@#1}%
+    {\bbl at ini@ids{#1}}%
+    {}%
+  \bbl at csarg\let{lsys@#1}\@empty
+  \bbl at ifunset{bbl at sname@#1}{\bbl at csarg\gdef{sname@#1}{Default}}{}%
+  \bbl at ifunset{bbl at sotf#1}{\bbl at csarg\gdef{sotf@#1}{DFLT}}{}%
+  \bbl at csarg\bbl at add@list{lsys@#1}{Script=\bbl at cs{sname@#1}}%
+  \bbl at ifunset{bbl at lname@#1}{}%
+    {\bbl at csarg\bbl at add@list{lsys@#1}{Language=\bbl at cs{lname@#1}}}%
+  \bbl at csarg\bbl at toglobal{lsys@#1}}%
+ %  \bbl at exp{% TODO - should be global
+ %    \<keys_if_exist:nnF>{fontspec-opentype/Script}{\bbl at cs{sname@#1}}%
+ %      {\\\newfontscript{\bbl at cs{sname@#1}}{\bbl at cs{sotf@#1}}}%
+ %    \<keys_if_exist:nnF>{fontspec-opentype/Language}{\bbl at cs{lname@#1}}%
+ %      {\\\newfontlanguage{\bbl at cs{lname@#1}}{\bbl at cs{lotf@#1}}}}}
+\def\bbl at ini@ids#1{%
+  \def\BabelBeforeIni##1##2{%
+    \begingroup
+      \bbl at add\bbl at secpost@identification{\closein1 }%
+      \catcode`\[=12 \catcode`\]=12 \catcode`\==12
+      \bbl at read@ini{##1}%
+    \endgroup}%           boxed, to avoid extra spaces:
+  {\setbox\z@\hbox{\InputIfFileExists{babel-#1.tex}{}{}}}}
 \ifx\bbl at opt@safe\@empty\else
   \def\@newl at bel#1#2#3{%
    {\@safe at activestrue
@@ -1589,29 +1640,36 @@
   \let\org at bibcite\bibcite
   \let\org@@bibitem\@bibitem
 \fi
-\bbl at redefine\markright#1{%
-  \bbl at ifblank{#1}%
-    {\org at markright{}}%
-    {\toks@{#1}%
-     \bbl at exp{%
-       \\\org at markright{\\\protect\\\foreignlanguage{\languagename}%
-         {\\\protect\\\bbl at restore@actives\the\toks@}}}}}
-\ifx\@mkboth\markboth
-  \def\bbl at tempc{\let\@mkboth\markboth}
-\else
-  \def\bbl at tempc{}
-\fi
-\bbl at redefine\markboth#1#2{%
-  \protected at edef\bbl at tempb##1{%
-    \protect\foreignlanguage{\languagename}{\protect\bbl at restore@actives##1}}%
-  \bbl at ifblank{#1}%
-    {\toks@{}}%
-    {\toks@\expandafter{\bbl at tempb{#1}}}%
-  \bbl at ifblank{#2}%
-    {\@temptokena{}}%
-    {\@temptokena\expandafter{\bbl at tempb{#2}}}%
-  \bbl at exp{\\\org at markboth{\the\toks@}{\the\@temptokena}}}
-\bbl at tempc
+\IfBabelLayout{sectioning}
+  {\ifx\bbl at opt@headfoot\@nnil
+     \g at addto@macro\@resetactivechars{%
+       \set at typeset@protect
+       \expandafter\select at language@x\expandafter{\bbl at main@language}%
+       \let\protect\noexpand}%
+   \fi}
+  {\bbl at redefine\markright#1{%
+     \bbl at ifblank{#1}%
+       {\org at markright{}}%
+       {\toks@{#1}%
+        \bbl at exp{%
+          \\\org at markright{\\\protect\\\foreignlanguage{\languagename}%
+            {\\\protect\\\bbl at restore@actives\the\toks@}}}}}
+   \ifx\@mkboth\markboth
+     \def\bbl at tempc{\let\@mkboth\markboth}
+   \else
+     \def\bbl at tempc{}
+   \fi
+   \bbl at redefine\markboth#1#2{%
+     \protected at edef\bbl at tempb##1{%
+       \protect\foreignlanguage{\languagename}{\protect\bbl at restore@actives##1}}%
+     \bbl at ifblank{#1}%
+       {\toks@{}}%
+       {\toks@\expandafter{\bbl at tempb{#1}}}%
+     \bbl at ifblank{#2}%
+       {\@temptokena{}}%
+       {\@temptokena\expandafter{\bbl at tempb{#2}}}%
+     \bbl at exp{\\\org at markboth{\the\toks@}{\the\@temptokena}}}
+   \bbl at tempc}  % end \IfBabelLayout
 \bbl at xin@{R}\bbl at opt@safe
 \ifin@
   \AtBeginDocument{%
@@ -1760,17 +1818,16 @@
     \global\bbl at csarg\chardef{wdir@#1}\z@
   \fi}
 \def\bbl at switchdir{%
+  \bbl at ifunset{bbl at lsys@\languagename}{\bbl at provide@lsys{\languagename}}{}%
   \bbl at ifunset{bbl at wdir@\languagename}{\bbl at provide@dirs{\languagename}}{}%
   \bbl at exp{\\\bbl at setdirs\bbl at cs{wdir@\languagename}}}
 \def\bbl at setdirs#1{% TODO - math
   \ifcase\bbl at select@type % TODO - strictly, not the right test
-    \bbl at pagedir{#1}%
     \bbl at bodydir{#1}%
     \bbl at pardir{#1}%
   \fi
   \bbl at textdir{#1}}
-\ifcase\bbl at engine
-\or
+\ifodd\bbl at engine  % luatex=1
   \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
   \DisableBabelHook{babel-bidi}
   \def\bbl at getluadir#1{%
@@ -1797,7 +1854,7 @@
   \def\bbl at bodydir{\bbl at setdir{body}\bodydir}
   \def\bbl at pagedir{\bbl at setdir{page}\pagedir}
   \def\bbl at dirparastext{\pardir\the\textdir\relax}%   %%%%
-\or
+\else % pdftex=0, xetex=2
   \AddBabelHook{babel-bidi}{afterextras}{\bbl at switchdir}
   \DisableBabelHook{babel-bidi}
   \newcount\bbl at dirlevel
@@ -1847,15 +1904,17 @@
     \let\bbl at xebidipar\relax
     \TeXXeTstate\@ne
     \def\bbl at xeeverypar{%
-      \ifcase\bbl at thepardir\else
+      \ifcase\bbl at thepardir
+        \ifcase\bbl at thetextdir\else\beginR\fi
+      \else
         {\setbox\z@\lastbox\beginR\box\z@}%
-      \fi
-      \ifcase\bbl at thetextdir\else\beginR\fi}%
+      \fi}%
     \let\bbl at severypar\everypar
     \newtoks\everypar
     \everypar=\bbl at severypar
     \bbl at severypar{\bbl at xeeverypar\the\everypar}}
 \fi
+\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl at textdir\z@#1}}
 \ifx\loadlocalcfg\@undefined
   \@ifpackagewith{babel}{noconfigs}%
     {\let\loadlocalcfg\@gobble}%

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2018-01-04 23:39:46 UTC (rev 46210)
@@ -32,7 +32,7 @@
 %% extension |.ins|) which are part of the distribution.
 %%
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{babel}[2017/11/03 3.15 The Babel package]
+\ProvidesPackage{babel}[2018/01/04 3.16 The Babel package]
 \@ifpackagewith{babel}{debug}
   {\let\bbl at debug\@firstofone}
   {\let\bbl at debug\@gobble}
@@ -179,23 +179,25 @@
     \fi}%
   \bbl at languages
 \fi
-\@ifpackagewith{babel}{bidi=basic-r}{% must go before any \DeclareOption
-  \let\bbl at beforeforeign\leavevmode
-  \AtEndOfPackage{\EnableBabelHook{babel-bidi}}%
-  \RequirePackage{luatexbase}%
-  \directlua{
-    require('babel-bidi.lua')
-    require('babel-bidi-basic-r.lua')
-    luatexbase.add_to_callback('pre_linebreak_filter',
-      Babel.pre_otfload,
-      'Babel.pre_otfload',
-      luatexbase.priority_in_callback('pre_linebreak_filter',
-        'luaotfload.node_processor') or nil)
-    luatexbase.add_to_callback('hpack_filter',
-      Babel.pre_otfload,
-      'Babel.pre_otfload',
-      luatexbase.priority_in_callback('hpack_filter',
-        'luaotfload.node_processor') or nil)}}{}
+\ifodd\bbl at engine
+  \@ifpackagewith{babel}{bidi=basic-r}{% must go before any \DeclareOption
+    \let\bbl at beforeforeign\leavevmode
+    \AtEndOfPackage{\EnableBabelHook{babel-bidi}}%
+    \RequirePackage{luatexbase}%
+    \directlua{
+      require('babel-bidi.lua')
+      require('babel-bidi-basic-r.lua')
+      luatexbase.add_to_callback('pre_linebreak_filter',
+        Babel.pre_otfload,
+        'Babel.pre_otfload',
+        luatexbase.priority_in_callback('pre_linebreak_filter',
+          'luaotfload.node_processor') or nil)
+      luatexbase.add_to_callback('hpack_filter',
+        Babel.pre_otfload,
+        'Babel.pre_otfload',
+        luatexbase.priority_in_callback('hpack_filter',
+          'luaotfload.node_processor') or nil)}}{}
+\fi
 \@ifpackagewith{babel}{base}{%
   \ifx\directlua\@undefined
     \DeclareOption*{\bbl at patterns{\CurrentOption}}%
@@ -250,18 +252,33 @@
 \DeclareOption{safe=none}{\let\bbl at opt@safe\@empty}
 \DeclareOption{safe=bib}{\def\bbl at opt@safe{B}}
 \DeclareOption{safe=ref}{\def\bbl at opt@safe{R}}
-\DeclareOption{bidi=basic-r}%
-  {\newattribute\bbl at attr@dir
-   \let\bbl at beforeforeign\leavevmode
-   \AtEndOfPackage{\EnableBabelHook{babel-bidi}}}
+\ifodd\bbl at engine
+  \DeclareOption{bidi=basic-r}%
+    {\let\bbl at beforeforeign\leavevmode
+     \newattribute\bbl at attr@dir
+     \bbl at exp{\output{\bodydir\pagedir\the\output}}%
+     \AtEndOfPackage{\EnableBabelHook{babel-bidi}}}
+\else
+  \DeclareOption{bidi=basic-r}%
+    {\bbl at error
+      {The bidi method `basic-r' is available only in\\%
+       luatex. I'll continue with `bidi=default', so\\%
+       expect wrong results}%
+      {See the manual for further details.}%
+    \let\bbl at beforeforeign\leavevmode
+    \AtEndOfPackage{%
+      \EnableBabelHook{babel-bidi}%
+      \bbl at xebidipar}}
+\fi
 \DeclareOption{bidi=default}%
   {\let\bbl at beforeforeign\leavevmode
-   \ifcase\bbl at engine\or
+   \ifodd\bbl at engine
      \newattribute\bbl at attr@dir
+     \bbl at exp{\output{\bodydir\pagedir\the\output}}%
    \fi
    \AtEndOfPackage{%
      \EnableBabelHook{babel-bidi}%
-     \ifcase\bbl at engine\or\or
+     \ifodd\bbl at engine\else
        \bbl at xebidipar
      \fi}}
 \let\bbl at opt@shorthands\@nnil
@@ -268,6 +285,7 @@
 \let\bbl at opt@config\@nnil
 \let\bbl at opt@main\@nnil
 \let\bbl at opt@headfoot\@nnil
+\let\bbl at opt@layout\@nnil
 \def\bbl at tempa#1=#2\bbl at tempa{%
   \bbl at csarg\ifx{opt@#1}\@nnil
     \bbl at csarg\edef{opt@#1}{#2}%
@@ -276,7 +294,7 @@
       Bad option `#1=#2'. Either you have misspelled the\\%
       key or there is a previous setting of `#1'}{%
       Valid keys are `shorthands', `config', `strings', `main',\\%
-      `headfoot', `safe', `math'}
+      `headfoot', `safe', `math', among others.}
   \fi}
 \let\bbl at language@opts\@empty
 \DeclareOption*{%
@@ -328,6 +346,17 @@
     \ifx\bbl at language@opts\@empty\else\bbl at language@opts,\fi
       \bbl at opt@main}
 \fi
+\ifx\bbl at opt@layout\@nnil
+  \newcommand\IfBabelLayout[3]{#3}%
+\else
+  \newcommand\IfBabelLayout[1]{%
+    \@expandtwoargs\in@{.#1.}{.\bbl at opt@layout.}%
+    \ifin@
+      \expandafter\@firstoftwo
+    \else
+      \expandafter\@secondoftwo
+    \fi}
+\fi
 \let\bbl at afterlang\relax
 \let\BabelModifiers\relax
 \let\bbl at loaded\@empty

Modified: trunk/Master/texmf-dist/tex/generic/babel/francais.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/francais.sty	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/francais.sty	2018-01-04 23:39:46 UTC (rev 46210)
@@ -42,8 +42,8 @@
     \bblstyerror
   \fi
 \fi
-\def\CurrentOption{francais}
-\input frenchb.ldf\relax
+\def\CurrentOption{french}
+\input french.ldf\relax
 %%
 %% \CharacterTable
 %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z

Modified: trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2018-01-04 23:39:46 UTC (rev 46210)
@@ -36,7 +36,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{hyphen.cfg}[2017/11/03 3.15 Babel hyphens]
+\ProvidesFile{hyphen.cfg}[2018/01/04 3.16 Babel hyphens]
 \xdef\bbl at format{\jobname}
 \ifx\AtBeginDocument\@undefined
   \def\@empty{}
@@ -67,7 +67,7 @@
   \countdef\last at language=19
   \def\addlanguage{\alloc at 9\language\chardef\@cclvi}
 \fi
-\toks8{Babel <3.15> and hyphenation patterns for }%
+\toks8{Babel <3.16> and hyphenation patterns for }%
 \def\process at line#1#2 #3 #4 {%
   \ifx=#1%
     \process at synonym{#2}%

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/az/babel-azerbaijani-cyrl.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/az/babel-azerbaijani-cyrl.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/az/babel-azerbaijani-cyrl.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{azerbaijani-cyrillic}
+\input{babel-azerbaijani-cyrillic}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/az/babel-azerbaijani-latn.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/az/babel-azerbaijani-latn.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/az/babel-azerbaijani-latn.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{azerbaijani-latin}
+\input{babel-azerbaijani-latin}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/bs/babel-bosnian-cyrl.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/bs/babel-bosnian-cyrl.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/bs/babel-bosnian-cyrl.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{bosnian-cyrillic}
+\input{babel-bosnian-cyrillic}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/bs/babel-bosnian-latn.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/bs/babel-bosnian-latn.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/bs/babel-bosnian-latn.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{bosnian-latin}
+\input{babel-bosnian-latin}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-austrian.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-austrian.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-austrian.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{german-austria}
+\input{babel-german-austria}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-german-at.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-german-at.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-german-at.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{german-austria}
+\input{babel-german-austria}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-german-ch.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-german-ch.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-german-ch.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{german-switzerland}
+\input{babel-german-switzerland}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-nswissgerman.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-nswissgerman.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-nswissgerman.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{german-switzerland}
+\input{babel-german-switzerland}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-swissgerman.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-swissgerman.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/de/babel-swissgerman.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{german-switzerland}
+\input{babel-german-switzerland}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/dsb/babel-lsorbian.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/dsb/babel-lsorbian.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/dsb/babel-lsorbian.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{lowersorbian}
+\input{babel-lowersorbian}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-american.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-american.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-american.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-unitedstates}
+\input{babel-english-unitedstates}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-australian.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-australian.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-australian.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-australia}
+\input{babel-english-australia}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-british.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-british.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-british.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-unitedkingdom}
+\input{babel-english-unitedkingdom}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-canadian.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-canadian.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-canadian.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-canada}
+\input{babel-english-canada}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-au.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-au.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-au.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-australia}
+\input{babel-english-australia}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-ca.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-ca.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-ca.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-canada}
+\input{babel-english-canada}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-gb.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-gb.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-gb.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-unitedkingdom}
+\input{babel-english-unitedkingdom}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-nz.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-nz.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-nz.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-newzealand}
+\input{babel-english-newzealand}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-us.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-us.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-english-us.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-unitedstates}
+\input{babel-english-unitedstates}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-newzealand.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-newzealand.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-newzealand.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-newzealand}
+\input{babel-english-newzealand}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-ukenglish.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-ukenglish.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-ukenglish.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-unitedkingdom}
+\input{babel-english-unitedkingdom}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-usenglish.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-usenglish.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/en/babel-usenglish.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{english-unitedstates}
+\input{babel-english-unitedstates}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/es/babel-mexican.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/es/babel-mexican.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/es/babel-mexican.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{spanish-mexico}
+\input{babel-spanish-mexico}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/es/babel-spanish-mx.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/es/babel-spanish-mx.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/es/babel-spanish-mx.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{spanish-mexico}
+\input{babel-spanish-mexico}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-be.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-be.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-be.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{french-belgium}
+\input{babel-french-belgium}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-ca.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-ca.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-ca.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{french-canada}
+\input{babel-french-canada}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-ch.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-ch.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-ch.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{french-switzerland}
+\input{babel-french-switzerland}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-lu.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-lu.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/fr/babel-french-lu.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{french-luxembourg}
+\input{babel-french-luxembourg}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ha/babel-hausa-gh.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ha/babel-hausa-gh.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ha/babel-hausa-gh.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{hausa-ghana}
+\input{babel-hausa-ghana}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ha/babel-hausa-ne.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ha/babel-hausa-ne.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ha/babel-hausa-ne.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{hausa-niger}
+\input{babel-hausa-niger}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/hsb/babel-usorbian.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/hsb/babel-usorbian.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/hsb/babel-usorbian.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{uppersorbian}
+\input{babel-uppersorbian}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ms/babel-malay-bn.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ms/babel-malay-bn.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ms/babel-malay-bn.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{malay-brunei}
+\input{babel-malay-brunei}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ms/babel-malay-sg.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ms/babel-malay-sg.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ms/babel-malay-sg.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{malay-singapore}
+\input{babel-malay-singapore}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-norsk.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-norsk.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/nb/babel-norsk.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{norwegianbokmal}
+\input{babel-norwegianbokmal}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/nn/babel-nynorsk.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/nn/babel-nynorsk.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/nn/babel-nynorsk.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{norwegiannynorsk}
+\input{babel-norwegiannynorsk}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/pa/babel-punjabi-arab.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/pa/babel-punjabi-arab.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/pa/babel-punjabi-arab.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{punjabi-arabic}
+\input{babel-punjabi-arabic}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/pa/babel-punjabi-guru.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/pa/babel-punjabi-guru.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/pa/babel-punjabi-guru.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{punjabi-gurmukhi}
+\input{babel-punjabi-gurmukhi}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-brazilian.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-brazilian.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-brazilian.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{portuguese-brazil}
+\input{babel-portuguese-brazil}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-portuguese-br.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-portuguese-br.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-portuguese-br.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{portuguese-brazil}
+\input{babel-portuguese-brazil}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-portuguese-pt.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-portuguese-pt.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/pt/babel-portuguese-pt.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{portuguese-portugal}
+\input{babel-portuguese-portugal}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/ru/babel-ru.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/ru/babel-ru.ini	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/ru/babel-ru.ini	2018-01-04 23:39:46 UTC (rev 46210)
@@ -183,4 +183,3 @@
 alph = 
 Alph = 
 ordinals = 
-

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/se/babel-samin.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/se/babel-samin.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/se/babel-samin.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{northernsami}
+\input{babel-northernsami}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/shi/babel-tachelhit-latn.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/shi/babel-tachelhit-latn.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/shi/babel-tachelhit-latn.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{tachelhit-latin}
+\input{babel-tachelhit-latin}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/shi/babel-tachelhit-tfng.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/shi/babel-tachelhit-tfng.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/shi/babel-tachelhit-tfng.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{tachelhit-tifinagh}
+\input{babel-tachelhit-tifinagh}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sl/babel-slovene.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sl/babel-slovene.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sl/babel-slovene.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{slovenian}
+\input{babel-slovenian}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-ba.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-ba.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-ba.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{serbian-cyrillic-bosniaherzegovina}
+\input{babel-serbian-cyrillic-bosniaherzegovina}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-me.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-me.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-me.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{serbian-cyrillic-montenegro}
+\input{babel-serbian-cyrillic-montenegro}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-xk.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-xk.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl-xk.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{serbian-cyrillic-kosovo}
+\input{babel-serbian-cyrillic-kosovo}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-cyrl.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{serbian-cyrillic}
+\input{babel-serbian-cyrillic}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-ba.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-ba.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-ba.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{serbian-latin-bosniaherzegovina}
+\input{babel-serbian-latin-bosniaherzegovina}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-me.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-me.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-me.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{serbian-latin-montenegro}
+\input{babel-serbian-latin-montenegro}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-xk.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-xk.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn-xk.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{serbian-latin-kosovo}
+\input{babel-serbian-latin-kosovo}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sr/babel-serbian-latn.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{serbian-latin}
+\input{babel-serbian-latin}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-arab.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-arab.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-arab.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{uzbek-arabic}
+\input{babel-uzbek-arabic}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-cyrl.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-cyrl.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-cyrl.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{uzbek-cyrillic}
+\input{babel-uzbek-cyrillic}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-latn.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-latn.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/uz/babel-uzbek-latn.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{uzbek-latin}
+\input{babel-uzbek-latin}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/vai/babel-vai-latn.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/vai/babel-vai-latn.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/vai/babel-vai-latn.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{vai-latin}
+\input{babel-vai-latin}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/vai/babel-vai-vaii.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/vai/babel-vai-vaii.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/vai/babel-vai-vaii.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{vai-vai}
+\input{babel-vai-vai}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/vi/babel-vietnam.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/vi/babel-vietnam.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/vi/babel-vietnam.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{vietnamese}
+\input{babel-vietnamese}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-hk.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-hk.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-hk.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{chinese-simplified-hongkongsarchina}
+\input{babel-chinese-simplified-hongkongsarchina}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-mo.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-mo.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-mo.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{chinese-simplified-macausarchina}
+\input{babel-chinese-simplified-macausarchina}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-sg.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-sg.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans-sg.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{chinese-simplified-singapore}
+\input{babel-chinese-simplified-singapore}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hans.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{chinese-simplified}
+\input{babel-chinese-simplified}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant-hk.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant-hk.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant-hk.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{chinese-traditional-hongkongsarchina}
+\input{babel-chinese-traditional-hongkongsarchina}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant-mo.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant-mo.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant-mo.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{chinese-traditional-macausarchina}
+\input{babel-chinese-traditional-macausarchina}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant.tex	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/zh/babel-chinese-hant.tex	2018-01-04 23:39:46 UTC (rev 46210)
@@ -1,4 +1,4 @@
 % This file is part of babel. For further details see:
 % https://www.ctan.org/pkg/babel
-\input{chinese-traditional}
+\input{babel-chinese-traditional}
 \endinput
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/luababel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2018-01-04 23:39:46 UTC (rev 46210)
@@ -406,31 +406,6 @@
   \bbl at exp{\<fontspec_set_family:Nnn>\\#1%
     {\bbl at cs{lsys@\languagename},#2}}{#3}%
   \bbl at toglobal#1}%
-\def\bbl at provide@lsys#1{%
-  \bbl at ifunset{bbl at lname@#1}%
-    {\bbl at ini@ids{#1}}%
-    {}%
-  \bbl at csarg\let{lsys@#1}\@empty
-  \bbl at ifunset{bbl at sname@#1}{\bbl at csarg\gdef{sname@#1}{Default}}{}%
-  \bbl at ifunset{bbl at sotf#1}{\bbl at csarg\gdef{sotf@#1}{DFLT}}{}%
-  \bbl at csarg\bbl at add@list{lsys@#1}{Script=\bbl at cs{sname@#1}}%
-  \bbl at ifunset{bbl at lname@#1}{}%
-    {\bbl at csarg\bbl at add@list{lsys@#1}{Language=\bbl at cs{lname@#1}}}%
-  \bbl at csarg\bbl at toglobal{lsys@#1}}%
- %  \bbl at exp{% TODO - should be global
- %    \<keys_if_exist:nnF>{fontspec-opentype/Script}{\bbl at cs{sname@#1}}%
- %      {\\\newfontscript{\bbl at cs{sname@#1}}{\bbl at cs{sotf@#1}}}%
- %    \<keys_if_exist:nnF>{fontspec-opentype/Language}{\bbl at cs{lname@#1}}%
- %      {\\\newfontlanguage{\bbl at cs{lname@#1}}{\bbl at cs{lotf@#1}}}}}
-\def\bbl at ini@ids#1{%
-  \def\BabelBeforeIni##1##2{%
-    \begingroup
-      \bbl at add\bbl at secpost@identification{%
-        \def\bbl at iniline########1\bbl at iniline{}}%
-      \catcode`\[=12 \catcode`\]=12 \catcode`\==12
-      \bbl at read@ini{##1}%
-    \endgroup}
-  \InputIfFileExists{babel-#1.tex}{}{}}
 \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}
@@ -473,6 +448,54 @@
   \expandafter\addto\csname extras#1\endcsname{%
     \babel at save\bbl at langfeatures
     \edef\bbl at langfeatures{#2,}}}
+\ifx\bbl at opt@layout\@nnil\endinput\fi  % if no layout
+\ifx\bbl at beforeforeign\leavevmode % A poor test for bidi=
+  \def\@hangfrom#1{%
+    \setbox\@tempboxa\hbox{{#1}}%
+    \hangindent\wd\@tempboxa
+    \ifnum\bbl at getluadir{page}=\bbl at getluadir{par}\else
+      \shapemode\@ne
+    \fi
+    \noindent\box\@tempboxa}
+\fi
+\IfBabelLayout{lists}
+  {\def\list#1#2{%
+     \ifnum \@listdepth >5\relax
+       \@toodeep
+     \else
+       \global\advance\@listdepth\@ne
+     \fi
+     \rightmargin\z@
+     \listparindent\z@
+     \itemindent\z@
+     \csname @list\romannumeral\the\@listdepth\endcsname
+     \def\@itemlabel{#1}%
+     \let\makelabel\@mklab
+     \@nmbrlistfalse
+     #2\relax
+     \@trivlist
+     \parskip\parsep
+     \parindent\listparindent
+     \advance\linewidth -\rightmargin
+     \advance\linewidth -\leftmargin
+     \advance\@totalleftmargin \leftmargin
+     \parshape \@ne
+     \@totalleftmargin \linewidth
+     \ifnum\bbl at getluadir{page}=\bbl at getluadir{par}\else
+       \shapemode\tw@
+     \fi
+     \ignorespaces}}
+  {}
+\IfBabelLayout{counters}%  Global or language dependent? At begin doc?
+  {\let\bbl at latinarabic=\@arabic
+   \def\@arabic#1{\babelsublr{\bbl at latinarabic#1}}%
+   \@ifpackagewith{babel}{bidi=default}
+     {\let\bbl at asciiroman=\@roman
+      \def\@roman#1{\babelsublr{\ensureascii{\bbl at asciiroman#1}}}%
+      \let\bbl at asciiRoman=\@Roman
+      \def\@Roman#1{\babelsublr{\ensureascii{\bbl at asciiRoman#1}}}%
+      \def\labelenumii{)\theenumii(}%
+      \def\p at enumiii{\p at enumii)\theenumii(}}}{}
 \endinput
 %%
 %% End of file `luababel.def'.

Modified: trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2018-01-04 23:39:46 UTC (rev 46210)
@@ -31,7 +31,7 @@
 %% and covered by LPPL is defined by the unpacking scripts (with
 %% extension |.ins|) which are part of the distribution.
 %%
-\ProvidesLanguage{nil}[2017/11/03 3.15 Nil language]
+\ProvidesLanguage{nil}[2018/01/04 3.16 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	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/switch.def	2018-01-04 23:39:46 UTC (rev 46210)
@@ -36,7 +36,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{switch.def}[2017/11/03 3.15 Babel switching mechanism]
+\ProvidesFile{switch.def}[2018/01/04 3.16 Babel switching mechanism]
 \ifx\AtBeginDocument\@undefined
   \input plain.def\relax
 \fi
@@ -57,8 +57,8 @@
   \countdef\last at language=19
   \def\addlanguage{\alloc at 9\language\chardef\@cclvi}
 \fi
-\def\bbl at version{3.15}
-\def\bbl at date{2017/11/03}
+\def\bbl at version{3.16}
+\def\bbl at date{2018/01/04}
 \def\adddialect#1#2{%
   \global\chardef#1#2\relax
   \bbl at usehooks{adddialect}{{#1}{#2}}%
@@ -121,9 +121,7 @@
   \select at language{\languagename}%
   \expandafter\ifx\csname date\languagename\endcsname\relax\else
     \if at filesw
-      \protected at write\@auxout{}{\string\select at language{\languagename}}%
-      \bbl at foreach\BabelContentsFiles{%
-        \addtocontents{##1}{\xstring\select at language{\languagename}}}%
+      \protected at write\@auxout{}{\string\babel at aux{\languagename}{}}%
       \bbl at usehooks{write}{}%
     \fi
   \fi}
@@ -143,7 +141,14 @@
       \let\bbl at select@type\z@
       \expandafter\bbl at switch\expandafter{\languagename}%
     \fi}}
+\def\babel at aux#1#2{%
+  \select at language{#1}%
+  \bbl at foreach\BabelContentsFiles{%
+    \@writefile{##1}{\babel at toc{#1}{#2}}}} %% TODO - ok in plain?
+\def\babel at toc#1#2{%
+  \select at language{#1}}
 \let\select at language@x\select at language
+\newif\ifbbl at usedategroup
 \def\bbl at switch#1{%
   \originalTeX
   \expandafter\def\expandafter\originalTeX\expandafter{%
@@ -162,7 +167,16 @@
       \csname captions#1\endcsname\relax
       \csname date#1\endcsname\relax
     \fi
-  \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
+    \fi
+  \fi\fi
   \bbl at usehooks{beforeextras}{}%
   \csname extras#1\endcsname\relax
   \bbl at usehooks{afterextras}{}%

Added: trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def	2018-01-04 23:39:46 UTC (rev 46210)
@@ -0,0 +1,158 @@
+%%
+%% This is file `txtbabel.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% babel.dtx  (with options: `texxet')
+%% 
+%%
+%% Copyright (C) 2012-2017 Javier Bezos and Johannes L. Braams.
+%% Copyright (C) 1989-2012 Johannes L. Braams and
+%%           any individual authors listed elsewhere in this file.
+%% All rights reserved.
+%%
+%% This file is part of the Babel system.
+%% --------------------------------------
+%%
+%% It may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Javier Bezos.
+%%
+%% The list of derived (unpacked) files belonging to the distribution
+%% and covered by LPPL is defined by the unpacking scripts (with
+%% extension |.ins|) which are part of the distribution.
+%%
+\ifx\bbl at opt@layout\@nnil\endinput\fi  % No layout
+\def\bbl at startskip{\ifcase\bbl at thepardir\leftskip\else\rightskip\fi}
+\def\bbl at endskip{\ifcase\bbl at thepardir\rightskip\else\leftskip\fi}
+\ifx\bbl at beforeforeign\leavevmode % A poor test for bidi=
+  \def\@hangfrom#1{%
+    \setbox\@tempboxa\hbox{{#1}}%
+    \hangindent\ifcase\bbl at thepardir\wd\@tempboxa\else-\wd\@tempboxa\fi
+    \noindent\box\@tempboxa}
+  \def\raggedright{%
+    \let\\\@centercr
+    \bbl at startskip\z at skip
+    \@rightskip\@flushglue
+    \bbl at endskip\@rightskip
+    \parindent\z@
+    \parfillskip\bbl at startskip}
+  \def\raggedleft{%
+    \let\\\@centercr
+    \bbl at startskip\@flushglue
+    \bbl at endskip\z at skip
+    \parindent\z@
+    \parfillskip\bbl at endskip}
+\fi
+\IfBabelLayout{lists}
+  {\def\list#1#2{%
+    \ifnum \@listdepth >5\relax
+      \@toodeep
+    \else
+      \global\advance\@listdepth\@ne
+    \fi
+    \rightmargin\z@
+    \listparindent\z@
+    \itemindent\z@
+    \csname @list\romannumeral\the\@listdepth\endcsname
+    \def\@itemlabel{#1}%
+    \let\makelabel\@mklab
+    \@nmbrlistfalse
+    #2\relax
+    \@trivlist
+    \parskip\parsep
+    \parindent\listparindent
+    \advance\linewidth-\rightmargin
+    \advance\linewidth-\leftmargin
+    \advance\@totalleftmargin
+      \ifcase\bbl at thepardir\leftmargin\else\rightmargin\fi
+    \parshape\@ne\@totalleftmargin\linewidth
+    \ignorespaces}%
+  \def\labelenumii{)\theenumii(}%
+  \def\p at enumiii{\p at enumii)\theenumii(}}
+  {}
+\IfBabelLayout{contents}
+  {\def\@dottedtocline#1#2#3#4#5{%
+     \ifnum#1>\c at tocdepth\else
+       \vskip \z@ \@plus.2\p@
+       {\bbl at startskip#2\relax
+        \bbl at endskip\@tocrmarg
+        \parfillskip-\bbl at endskip
+        \parindent#2\relax
+        \@afterindenttrue
+        \interlinepenalty\@M
+        \leavevmode
+        \@tempdima#3\relax
+        \advance\bbl at startskip\@tempdima
+        \null\nobreak\hskip-\bbl at startskip
+        {#4}\nobreak
+        \leaders\hbox{%
+          $\m at th\mkern\@dotsep mu\hbox{.}\mkern\@dotsep mu$}%
+          \hfill\nobreak
+          \hb at xt@\@pnumwidth{\hfil\normalfont\normalcolor#5}%
+          \par}%
+     \fi}}
+  {}
+\IfBabelLayout{columns}
+  {\def\@outputdblcol{%
+     \if at firstcolumn
+       \global\@firstcolumnfalse
+       \global\setbox\@leftcolumn\copy\@outputbox
+       \splitmaxdepth\maxdimen
+       \vbadness\maxdimen
+       \setbox\@outputbox\vbox{\unvbox\@outputbox\unskip}%
+       \setbox\@outputbox\vsplit\@outputbox to\maxdimen
+       \toks@\expandafter{\topmark}%
+       \xdef\@firstcoltopmark{\the\toks@}%
+       \toks@\expandafter{\splitfirstmark}%
+       \xdef\@firstcolfirstmark{\the\toks@}%
+       \ifx\@firstcolfirstmark\@empty
+         \global\let\@setmarks\relax
+       \else
+         \gdef\@setmarks{%
+           \let\firstmark\@firstcolfirstmark
+           \let\topmark\@firstcoltopmark}%
+       \fi
+     \else
+       \global\@firstcolumntrue
+       \setbox\@outputbox\vbox{%
+         \hb at xt@\textwidth{%
+           \hskip\columnwidth
+           \hfil
+           {\normalcolor\vrule \@width\columnseprule}%
+           \hfil
+           \hb at xt@\columnwidth{\box\@leftcolumn \hss}%
+           \hskip-\textwidth
+           \hb at xt@\columnwidth{\box\@outputbox \hss}%
+           \hskip\columnsep
+           \hskip\columnwidth}}%
+       \@combinedblfloats
+       \@setmarks
+       \@outputpage
+       \begingroup
+         \@dblfloatplacement
+         \@startdblcolumn
+         \@whilesw\if at fcolmade \fi{\@outputpage
+         \@startdblcolumn}%
+       \endgroup
+     \fi}}%
+  {}
+\IfBabelLayout{counters}%  Global or language dependent? At begin doc?
+  {\let\bbl at latinarabic=\@arabic
+   \def\@arabic#1{\babelsublr{\bbl at latinarabic#1}}%
+   \let\bbl at asciiroman=\@roman
+   \def\@roman#1{\babelsublr{\ensureascii{\bbl at asciiroman#1}}}%
+   \let\bbl at asciiRoman=\@Roman
+   \def\@Roman#1{\babelsublr{\ensureascii{\bbl at asciiRoman#1}}}}{}
+\endinput
+%%
+%% End of file `txtbabel.def'.


Property changes on: trunk/Master/texmf-dist/tex/generic/babel/txtbabel.def
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/generic/babel/xebabel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/xebabel.def	2018-01-04 23:38:42 UTC (rev 46209)
+++ trunk/Master/texmf-dist/tex/generic/babel/xebabel.def	2018-01-04 23:39:46 UTC (rev 46210)
@@ -147,31 +147,6 @@
   \bbl at exp{\<fontspec_set_family:Nnn>\\#1%
     {\bbl at cs{lsys@\languagename},#2}}{#3}%
   \bbl at toglobal#1}%
-\def\bbl at provide@lsys#1{%
-  \bbl at ifunset{bbl at lname@#1}%
-    {\bbl at ini@ids{#1}}%
-    {}%
-  \bbl at csarg\let{lsys@#1}\@empty
-  \bbl at ifunset{bbl at sname@#1}{\bbl at csarg\gdef{sname@#1}{Default}}{}%
-  \bbl at ifunset{bbl at sotf#1}{\bbl at csarg\gdef{sotf@#1}{DFLT}}{}%
-  \bbl at csarg\bbl at add@list{lsys@#1}{Script=\bbl at cs{sname@#1}}%
-  \bbl at ifunset{bbl at lname@#1}{}%
-    {\bbl at csarg\bbl at add@list{lsys@#1}{Language=\bbl at cs{lname@#1}}}%
-  \bbl at csarg\bbl at toglobal{lsys@#1}}%
- %  \bbl at exp{% TODO - should be global
- %    \<keys_if_exist:nnF>{fontspec-opentype/Script}{\bbl at cs{sname@#1}}%
- %      {\\\newfontscript{\bbl at cs{sname@#1}}{\bbl at cs{sotf@#1}}}%
- %    \<keys_if_exist:nnF>{fontspec-opentype/Language}{\bbl at cs{lname@#1}}%
- %      {\\\newfontlanguage{\bbl at cs{lname@#1}}{\bbl at cs{lotf@#1}}}}}
-\def\bbl at ini@ids#1{%
-  \def\BabelBeforeIni##1##2{%
-    \begingroup
-      \bbl at add\bbl at secpost@identification{%
-        \def\bbl at iniline########1\bbl at iniline{}}%
-      \catcode`\[=12 \catcode`\]=12 \catcode`\==12
-      \bbl at read@ini{##1}%
-    \endgroup}
-  \InputIfFileExists{babel-#1.tex}{}{}}
 \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}
@@ -214,6 +189,7 @@
   \expandafter\addto\csname extras#1\endcsname{%
     \babel at save\bbl at langfeatures
     \edef\bbl at langfeatures{#2,}}}
+\input txtbabel.def
 \endinput
 %%
 %% End of file `xebabel.def'.



More information about the tex-live-commits mailing list