summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-08-27 21:41:07 +0000
committerKarl Berry <karl@freefriends.org>2018-08-27 21:41:07 +0000
commitd6f57515b98d2736c1e094a7df0623d0ffd7120a (patch)
tree5d5706d9d7ddec135b39decdc4d6f9c2493475a6
parentf1c2e4e8b45c0e7bbdaca6e345c187375d024f6a (diff)
tex-locale (27aug18)
git-svn-id: svn://tug.org/texlive/trunk@48500 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/CHANGES2
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/README32
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xe.pdfbin0 -> 17633 bytes
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xe.tex106
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx.pdfbin0 -> 16236 bytes
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx.tex109
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx2.pdfbin0 -> 23225 bytes
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx2.tex96
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx3.pdfbin0 -> 36956 bytes
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx3.tex64
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale.pdfbin0 -> 91348 bytes
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale.tex94
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale2.pdfbin0 -> 91386 bytes
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale2.tex89
-rw-r--r--Master/texmf-dist/doc/generic/tex-locale/tex-locale.pdfbin0 -> 678448 bytes
-rw-r--r--Master/texmf-dist/source/latex/tex-locale/tex-locale.dtx9082
-rw-r--r--Master/texmf-dist/source/latex/tex-locale/tex-locale.ins39
-rw-r--r--Master/texmf-dist/tex/generic/tex-locale/tex-locale.tex1735
-rw-r--r--Master/texmf-dist/tex/latex/tex-locale/tex-locale-encodings.def66
-rw-r--r--Master/texmf-dist/tex/latex/tex-locale/tex-locale-scripts-enc.def79
-rw-r--r--Master/texmf-dist/tex/latex/tex-locale/tex-locale-support.def308
-rw-r--r--Master/texmf-dist/tex/latex/tex-locale/tex-locale.sty640
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/tex-locale.tlpsrc0
25 files changed, 12543 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/generic/tex-locale/CHANGES b/Master/texmf-dist/doc/generic/tex-locale/CHANGES
new file mode 100644
index 00000000000..5ecdbdb28ee
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/CHANGES
@@ -0,0 +1,2 @@
+1.0 (2018-08-26):
+ * Initial release
diff --git a/Master/texmf-dist/doc/generic/tex-locale/README b/Master/texmf-dist/doc/generic/tex-locale/README
new file mode 100644
index 00000000000..6535e9429fd
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/README
@@ -0,0 +1,32 @@
+Generic TeX Bundle : tex-locale v1.0
+
+Last Modified : 2018-08-26
+
+Author : Nicola Talbot
+
+LaTeX usage: \usepackage{tex-locale}
+
+TeX usage: \input tex-locale
+
+LaTeX code is in tex-locale.sty. Generic TeX code is in tex-locale.tex.
+
+Requirements: tracklang and texosquery. Note that texosquery
+requires the Java Runtime Environment. See the texosquery
+documentation for setup instructions. If you can't enable piped
+shell escape, see the tex-locale documentation for an alternative
+method.
+
+This package uses both tracklang and texosquery to look up the
+locale information from the operating system and provide commands
+that can access locale-dependent information, such as the currency
+symbol and decimal separator.
+
+The LaTeX package tex-locale.sty can additionally load babel or
+polyglossia with the locale's language setting, as well as various other
+packages such as fontspec (XeLaTeX/LuaLaTeX) or fontenc + inputenc.
+
+This material is subject to the LaTeX Project Public License.
+See http://www.ctan.org/license/lppl1.3 for the details of that license.
+
+http://www.dickimaw-books.com/
+
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xe.pdf b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xe.pdf
new file mode 100644
index 00000000000..b5de82c18a3
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xe.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xe.tex b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xe.tex
new file mode 100644
index 00000000000..b64aff8d912
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xe.tex
@@ -0,0 +1,106 @@
+% arara: xetex
+
+% If texosquery.cfg is correctly set up to use texosquery-jre8
+% this should work in restricted mode. The texosquery.cfg
+% default settings require --shell-escape
+
+\font\nimbus="NimbusRoman-Regular" at 10pt
+\font\nimbusbf="NimbusRoman-Bold" at 10pt
+\font\nimbustt="NimbusMonoPS-Regular" at 10pt
+\nimbus
+
+% If \LocaleMain isn't defined, the locale will be obtained
+% from the operating system.
+%\def\LocaleMain{en-GB}
+% \LocaleOther may be a comma-separated list of language tags
+% denoting the other locales required by the document.
+\def\LocaleOther{fr-BE}
+% The above need to be defined before tex-locale.tex is input
+
+\input tex-locale
+
+This is a sample plain XeTeX document that uses
+{\nimbustt tex-locale.tex} and {\nimbustt texosquery} to obtain locale information
+from the operating system.
+
+{\nimbusbf General Information}
+
+OS name: \LocaleOSname.
+OS version: {\nimbustt \LocaleOSversion}.
+OS arch: \LocaleOSarch.
+
+PDF now: {\nimbustt \LocaleNowStamp}.
+Tag: \LocaleOStag.
+
+\ifx\LocaleMainFile\empty
+\else
+ File {\nimbustt \LocaleMainFile} last modified:
+ {\nimbustt \LocaleFileMod}.
+\fi
+
+Main locale: {\nimbustt \LocaleMain} ({\nimbustt \LocaleMainDialect}).
+
+\ForEachTrackedDialect{\thisdialect}{%
+ % Iterate over each tracked dialect.
+ {\nimbusbf \LocaleLanguageTag{\thisdialect}}
+
+ Dialect label: {\nimbustt \thisdialect}.
+ Language name: \LocaleLanguageNativeName{\thisdialect}
+ (\LocaleLanguageName{\thisdialect}).
+ \LocaleIfHasRegionName{\thisdialect}%
+ {%
+ Region name: \LocaleRegionNativeName{\thisdialect}
+ (\LocaleRegionName{\thisdialect})%
+ }%
+ {No region name}.
+ \LocaleIfHasVariantName{\thisdialect}%
+ {%
+ Variant name: \LocaleVariantNativeName{\thisdialect}
+ (\LocaleVariantName{\thisdialect})%
+ }%
+ {No variant name}.
+
+ Full date: \LocaleFullDate{\thisdialect}.
+ Long date: \LocaleLongDate{\thisdialect}.
+ Medium date: \LocaleMediumDate{\thisdialect}.
+ Short date: \LocaleShortDate{\thisdialect}.
+ First day of week: \LocaleFirstDayIndex{\thisdialect}
+ (\LocaleDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}
+ / \LocaleShortDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}).
+
+ Current month: \LocaleMonthName{\thisdialect}{\month} /
+ \LocaleShortMonthName{\thisdialect}{\month}.
+
+ Standalone (display form) first day of week:
+ \LocaleStandaloneDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}
+ / \LocaleStandaloneShortDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}.
+
+ Standalone (display form) current month:
+ \LocaleStandaloneMonthName{\thisdialect}{\month} /
+ \LocaleStandaloneShortMonthName{\thisdialect}{\month}.
+
+ Full time: \LocaleFullTime{\thisdialect}.
+ Long time: \LocaleLongTime{\thisdialect}.
+ Medium time: \LocaleMediumTime{\thisdialect}.
+ Short time: \LocaleShortTime{\thisdialect}.
+
+ Numeric: \LocaleNumericGroupSep{\thisdialect} (group sep)
+ \LocaleNumericDecimalSep{\thisdialect} (decimal sep)
+ \LocaleNumericMonetarySep{\thisdialect} (monetary sep)
+ \LocaleNumericExponent{\thisdialect} (exponent symbol).
+ \LocaleNumericPercent{\thisdialect} (percent symbol).
+ \LocaleNumericPermill{\thisdialect} (permill symbol).
+ \LocaleIfNumericUsesGroup{\thisdialect}{Uses}{Doesn't use}
+ numeric group separator.
+
+ Currency label:
+ \LocaleCurrencyLabel{\thisdialect}
+ (\LocaleCurrencyRegionalLabel{\thisdialect}).
+
+ Currency symbol:
+ \LocaleCurrencySymbol{\thisdialect}
+ (\LocaleCurrencyTeXSymbol{\thisdialect}).
+
+}
+
+\bye
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx.pdf b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx.pdf
new file mode 100644
index 00000000000..c2c31f10380
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx.tex b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx.tex
new file mode 100644
index 00000000000..8f5ce375ef8
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx.tex
@@ -0,0 +1,109 @@
+% arara: xelatex
+
+% If texosquery.cfg is correctly set up to use texosquery-jre8
+% this should work in restricted mode. The texosquery.cfg
+% default settings require --shell-escape
+
+\documentclass{article}
+
+\usepackage{tex-locale}
+
+\begin{document}
+
+\section{General Information}
+
+OS name: \LocaleOSname.
+OS version: \texttt{\LocaleOSversion}.
+OS arch: \LocaleOSarch.
+
+PDF now: \texttt{\LocaleNowStamp}.
+Tag: \LocaleOStag.
+
+\ifx\LocaleMainFile\empty
+\else
+ File \texttt{\LocaleMainFile} last modified:
+ \texttt{\LocaleFileMod}.
+\fi
+
+Main locale: \texttt{\LocaleMain} (\texttt{\LocaleMainDialect}).
+
+\newcount\tmpctr
+
+\ForEachTrackedDialect{\thisdialect}{%
+ \section{\LocaleLanguageTag{\thisdialect}}
+
+ Dialect label: \texttt{\thisdialect}.
+ Language name: \LocaleLanguageNativeName{\thisdialect}
+ (\LocaleLanguageName{\thisdialect}).
+ \LocaleIfHasRegionName{\thisdialect}%
+ {%
+ Region name: \LocaleRegionNativeName{\thisdialect}
+ (\LocaleRegionName{\thisdialect})%
+ }%
+ {No region name}.
+ \LocaleIfHasVariantName{\thisdialect}%
+ {%
+ Variant name: \LocaleVariantNativeName{\thisdialect}
+ (\LocaleVariantName{\thisdialect})%
+ }%
+ {No variant name}.
+
+ Full date: \LocaleFullDate{\thisdialect}.
+ Long date: \LocaleLongDate{\thisdialect}.
+ Medium date: \LocaleMediumDate{\thisdialect}.
+ Short date: \LocaleShortDate{\thisdialect}.
+ First day of week: \LocaleFirstDayIndex{\thisdialect}
+ (\LocaleDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}
+ / \LocaleShortDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}).
+
+ Days of the week:%
+ \tmpctr=0\relax
+ \loop
+ \space\LocaleDayName{\thisdialect}{\tmpctr}%
+ \advance\tmpctr by 1
+ \ifnum\tmpctr<7
+ \repeat.
+
+ Short days of the week:%
+ \tmpctr=0\relax
+ \loop
+ \space\LocaleShortDayName{\thisdialect}{\tmpctr}%
+ \advance\tmpctr by 1
+ \ifnum\tmpctr<7
+ \repeat.
+
+ Current month: \LocaleMonthName{\thisdialect}{\month} /
+ \LocaleShortMonthName{\thisdialect}{\month}.
+
+ Standalone (display form) first day of week:
+ \LocaleStandaloneDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}
+ / \LocaleStandaloneShortDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}.
+
+ Standalone (display form) current month:
+ \LocaleStandaloneMonthName{\thisdialect}{\month} /
+ \LocaleStandaloneShortMonthName{\thisdialect}{\month}.
+
+ Full time: \LocaleFullTime{\thisdialect}.
+ Long time: \LocaleLongTime{\thisdialect}.
+ Medium time: \LocaleMediumTime{\thisdialect}.
+ Short time: \LocaleShortTime{\thisdialect}.
+
+ Numeric: \LocaleNumericGroupSep{\thisdialect} (group sep)
+ \LocaleNumericDecimalSep{\thisdialect} (decimal sep)
+ \LocaleNumericMonetarySep{\thisdialect} (monetary sep)
+ \LocaleNumericExponent{\thisdialect} (exponent symbol).
+ \LocaleNumericPercent{\thisdialect} (percent symbol).
+ \LocaleNumericPermill{\thisdialect} (permill symbol).
+ \LocaleIfNumericUsesGroup{\thisdialect}{Uses}{Doesn't use}
+ numeric group separator.
+
+ Currency label:
+ \LocaleCurrencyLabel{\thisdialect}
+ (\LocaleCurrencyRegionalLabel{\thisdialect}).
+
+ Currency symbol:
+ \LocaleCurrencySymbol{\thisdialect}
+ (\LocaleCurrencyTeXSymbol{\thisdialect}).
+
+}
+\end{document}
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx2.pdf b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx2.pdf
new file mode 100644
index 00000000000..3bb54c42c7f
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx2.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx2.tex b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx2.tex
new file mode 100644
index 00000000000..fad6ac3800e
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx2.tex
@@ -0,0 +1,96 @@
+% arara: xelatex
+\documentclass{article}
+
+\usepackage[other={pt-BR,de-CH-1996,fr-BE},timedata]{tex-locale}
+
+\setmainfont{STIX}
+
+\newcount\tmpctr
+
+\newcommand{\test}{%
+ \section{Document language \languagename\space
+ (\CurrentTrackedLanguageTag)}
+ \subsection{datetime2 commands}
+ \texttt{\string\today}: \today.
+ \texttt{\string\DTMcurrenttime}: \DTMcurrenttime.
+ \subsection{Locale Details}
+ Language: \CurrentLocaleLanguageNativeName.
+ Region: \CurrentLocaleRegionNativeName.
+ \subsection{Dates and Times (Obtained from Java)}
+ Today: \CurrentLocaleDate.
+ Time: \CurrentLocaleTime.
+ First day of the week:
+ \CurrentLocaleStandaloneDayName{\CurrentLocaleFirstDayIndex}
+ (index: \CurrentLocaleFirstDayIndex).
+ Current month:
+ \CurrentLocaleStandaloneMonthName{\month}.
+ \par
+ Days of the week:%
+ \tmpctr=1\relax
+ \loop
+ \space
+ \CurrentLocaleStandaloneDayName
+ {\CurrentLocaleDayIndexFromRegion{\tmpctr}}%
+ \advance\tmpctr by 1
+ \ifnum\tmpctr<8
+ \repeat
+ .
+ \par
+ Full date-time pattern:
+ \texttt{\LocaleGetDialectAttribute{\CurrentTrackedDialect}{fulldatetimefmt}}
+ \par
+ Apply full date-time pattern:
+ \CurrentLocaleApplyDateTimePattern{fulldatetimefmt}{\LocaleDateTimeInfo}
+ \subsection{Numeric}
+ Numeric symbols:
+ \CurrentLocaleNumericGroupSep\ (group separator)
+ \CurrentLocaleDecimalSep\ (decimal separator)
+ \CurrentLocaleMonetarySep\ (monetary separator)
+ \CurrentLocaleExponent\ (exponent)
+ \CurrentLocalePercent\ (percent)
+ \CurrentLocalePermill\ (per mill).
+ \par
+ Uses numeric group separator:
+ \CurrentLocaleIfNumericUsesGroup{yes}{no}.
+ \par
+ Currency symbol: \CurrentLocaleCurrency
+ \par
+ Integer:
+ \texosqueryfmtnumber{\CurrentLocaleIntegerPattern}{123456}{0}{0}
+ \par
+ Decimal:
+ \texosqueryfmtnumber{\CurrentLocaleDecimalPattern}{123456}{78}{0}
+ \par
+ Percentage:
+ \texosqueryfmtnumber{\CurrentLocalePercentPattern}{0}{65}{0}
+ \par
+ Currency:
+ \texosqueryfmtnumber{\CurrentLocaleCurrencyPattern}{1234567}{0}{0}
+}
+
+\renewcommand*{\localedatetimefmt}[1]{\localenopolypunct{#1}}
+
+\begin{document}
+\section{General Information}
+
+OS name: \LocaleOSname.
+OS version: \LocaleOSversion.
+OS arch: \LocaleOSarch.
+
+Default file encoding: \LocaleOScodeset.
+
+The PDF file was last built: \texttt{\LocaleNowStamp}.
+
+The source file was last modified: \texttt{\LocaleFileMod}.
+
+Main locale: \LocaleMain\ (\LocaleMainDialect).
+
+Other locales: \LocaleOther.
+
+\ForEachTrackedLanguage{\thislanguage}
+{%
+ \selectlanguage{\thislanguage}
+ \test
+}
+
+\end{document}
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx3.pdf b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx3.pdf
new file mode 100644
index 00000000000..c4f8127b411
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx3.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx3.tex b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx3.tex
new file mode 100644
index 00000000000..e7039a1ea26
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale-xeltx3.tex
@@ -0,0 +1,64 @@
+% arara: xelatex: {shell: on}
+\documentclass{article}
+
+\usepackage[main={sr-Cyrl-RS},other={en-GB},date=full]{tex-locale}
+
+\LocaleSupportPackageCase
+{\newcommand{\textenglish}[1]{\foreignlanguage{british}{#1}}}% babel
+{% polyglossia
+ \setmainfont{Liberation Serif}
+ \setmonofont{Liberation Mono}
+ \newfontfamily\cyrillicfont{Liberation Serif}
+ \newfontfamily\cyrillicfonttt{Liberation Mono}
+}
+{\newcommand{\textenglish}[1]{#1}}% none
+
+\newcount\tmpctr
+
+\newcommand{\test}{%
+ \section{\textenglish{Document language} \languagename}
+ \subsection{\textenglish{datetime2 commands}}
+ \textenglish{\texttt{\string\today}}: \today.
+ \textenglish{\texttt{\string\DTMcurrenttime}}: \DTMcurrenttime.
+ \subsection{\textenglish{Locale Details}}
+ \textenglish{Language:} \CurrentLocaleLanguageNativeName.
+ \textenglish{Region:} \CurrentLocaleRegionNativeName.
+ \subsection{\textenglish{Dates and Times (Obtained from Java)}}
+ \textenglish{Today:} \CurrentLocaleDate.
+ \textenglish{Time:} \CurrentLocaleTime.
+ \textenglish{First day of the week:}
+ \CurrentLocaleStandaloneDayName{\CurrentLocaleFirstDayIndex}
+ (\textenglish{index:} \CurrentLocaleFirstDayIndex).
+ \textenglish{Current month:}
+ \CurrentLocaleStandaloneMonthName{\month}.
+ \par
+ \textenglish{Days of the week:}%
+ \tmpctr=1\relax
+ \loop
+ \space
+ \CurrentLocaleStandaloneDayName
+ {\CurrentLocaleDayIndexFromRegion{\tmpctr}}%
+ \advance\tmpctr by 1
+ \ifnum\tmpctr<8
+ \repeat
+ .
+ \subsection{\textenglish{Numeric}}
+ \textenglish{Numeric symbols:}
+ \CurrentLocaleNumericGroupSep\ \textenglish{(group separator)}
+ \CurrentLocaleDecimalSep\ \textenglish{(decimal separator)}
+ \CurrentLocaleMonetarySep\ \textenglish{(monetary separator)}
+ \CurrentLocaleExponent\ \textenglish{(exponent)}
+ \CurrentLocalePercent\ \textenglish{(percent)}
+ \CurrentLocalePermill\ \textenglish{(per mill).}
+ \par
+ \textenglish{Uses numeric group separator:
+ \CurrentLocaleIfNumericUsesGroup{yes}{no}.}
+ \par
+ \textenglish{Currency:} \CurrentLocaleCurrency
+}
+
+\begin{document}
+
+\test
+
+\end{document}
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale.pdf b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale.pdf
new file mode 100644
index 00000000000..91dcabbeb3d
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale.tex b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale.tex
new file mode 100644
index 00000000000..4c5050bfc79
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale.tex
@@ -0,0 +1,94 @@
+% arara: pdflatex
+
+% If texosquery.cfg is correctly set up to use texosquery-jre8
+% this should work in restricted mode. The texosquery.cfg
+% default settings require --shell-escape
+
+\documentclass{article}
+
+\usepackage{tex-locale}
+
+\title{Sample Document Illustrating the tex-locale package}
+\author{Nicola Talbot}
+
+\begin{document}
+\maketitle
+
+texosquery version: \texttt{\TeXOSInvokerName\
+\csname ver@texosquery.tex\endcsname}.
+OS name: \LocaleOSname.
+OS version: \LocaleOSversion.
+OS arch: \LocaleOSarch.
+PDF now: \LocaleNowStamp.
+(Compare \verb|\pdfcreationdate|: \pdfcreationdate.)
+Tag: \LocaleOStag.
+Codeset: \LocaleOScodeset.
+
+\ifx\LocaleMainFile\empty
+\else
+ File \texttt{\LocaleMainFile} last modified:
+ \texttt{\LocaleFileMod}.
+\fi
+
+Main locale: \texttt{\LocaleMain} (\texttt{\LocaleMainDialect}).
+
+\ForEachTrackedDialect{\thisdialect}{%
+ \section{\LocaleLanguageTag{\thisdialect}}
+
+ Dialect label: \texttt{\thisdialect}.
+ Language name: \LocaleLanguageNativeName{\thisdialect}
+ (\LocaleLanguageName{\thisdialect}).
+ \LocaleIfHasRegionName{\thisdialect}%
+ {%
+ Region name: \LocaleRegionNativeName{\thisdialect}
+ (\LocaleRegionName{\thisdialect})%
+ }%
+ {No region name}.
+ \LocaleIfHasVariantName{\thisdialect}%
+ {%
+ Variant name: \LocaleVariantNativeName{\thisdialect}
+ (\LocaleVariantName{\thisdialect})%
+ }%
+ {No variant name}.
+
+ Full date: \LocaleFullDate{\thisdialect}.
+ Long date: \LocaleLongDate{\thisdialect}.
+ Medium date: \LocaleMediumDate{\thisdialect}.
+ Short date: \LocaleShortDate{\thisdialect}.
+ First day of week: \LocaleFirstDayIndex{\thisdialect}
+ (\LocaleDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}
+ / \LocaleShortDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}).
+
+ Current month: \LocaleMonthName{\thisdialect}{\month} /
+ \LocaleShortMonthName{\thisdialect}{\month}.
+
+ Standalone (display form) first day of week:
+ \LocaleStandaloneDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}
+ / \LocaleStandaloneShortDayName{\thisdialect}{\LocaleFirstDayIndex{\thisdialect}}.
+
+ Standalone (display form) current month:
+ \LocaleStandaloneMonthName{\thisdialect}{\month} /
+ \LocaleStandaloneShortMonthName{\thisdialect}{\month}.
+
+ Full time: \LocaleFullTime{\thisdialect}.
+ Long time: \LocaleLongTime{\thisdialect}.
+ Medium time: \LocaleMediumTime{\thisdialect}.
+ Short time: \LocaleShortTime{\thisdialect}.
+
+ Numeric: \LocaleNumericGroupSep{\thisdialect} (group sep)
+ \LocaleNumericDecimalSep{\thisdialect} (decimal sep)
+ \LocaleNumericMonetarySep{\thisdialect} (monetary sep)
+ \LocaleNumericExponent{\thisdialect} (exponent symbol).
+ \LocaleNumericPercent{\thisdialect} (percent symbol).
+ \LocaleNumericPermill{\thisdialect} (permill symbol).
+ \LocaleIfNumericUsesGroup{\thisdialect}{Uses}{Doesn't use}
+ numeric group separator.
+
+ Currency label:
+ \LocaleCurrencyLabel{\thisdialect}
+ (\LocaleCurrencyRegionalLabel{\thisdialect}).
+
+ Currency symbol:
+ \LocaleCurrencyTeXSymbol{\thisdialect}.
+}
+\end{document}
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale2.pdf b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale2.pdf
new file mode 100644
index 00000000000..71ce9ba3c79
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale2.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale2.tex b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale2.tex
new file mode 100644
index 00000000000..ae70de932cd
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/samples/sample-locale2.tex
@@ -0,0 +1,89 @@
+% arara: pdflatex: {shell: on}
+\documentclass[nswissgerman]{article}
+
+\usepackage[main={locale},other={pt-BR,fr-BE},date=full,time=full,timedata]{tex-locale}
+
+\newcommand{\test}{%
+ \section{Document language \languagename\space
+ (\CurrentTrackedLanguageTag)}
+ \texttt{\string\today}: \today.
+ \texttt{\string\DTMcurrenttime}: \DTMcurrenttime.
+ (Obtained from \texttt{datetime2} package.)
+ \subsection{Locale Details}
+ Language: \CurrentLocaleLanguageNativeName.
+ Region: \CurrentLocaleRegionNativeName.
+ \subsection{Dates and Times (Obtained from Java)}
+ Today: \CurrentLocaleDate.
+ Time: \CurrentLocaleTime.
+ First day of the week:
+ \CurrentLocaleStandaloneDayName{\CurrentLocaleFirstDayIndex}.
+ Current month:
+ \CurrentLocaleStandaloneMonthName{\month}.
+ \par
+ Date pattern:
+ \texttt{\LocaleGetDialectAttribute{\CurrentTrackedDialect}{fulldatefmt}}.
+ \par
+ Apply pattern:
+ \CurrentLocaleApplyDateTimePattern{fulldatefmt}{\LocaleDateTimeInfo}.
+ \par
+ Time pattern:
+ \texttt{\LocaleGetDialectAttribute{\CurrentTrackedDialect}{fulltimefmt}}.
+ \par
+ Apply pattern:
+ \CurrentLocaleApplyDateTimePattern{fulltimefmt}{\LocaleDateTimeInfo}.
+ \subsection{Numeric}
+ Numeric symbols:
+ \CurrentLocaleNumericGroupSep\ (group separator)
+ \CurrentLocaleDecimalSep\ (decimal separator)
+ \CurrentLocaleMonetarySep\ (monetary separator)
+ \CurrentLocaleExponent\ (exponent)
+ \CurrentLocalePercent\ (percent)
+ \CurrentLocalePermill\ (per mill).
+ \par
+ Uses numeric group separator:
+ \CurrentLocaleIfNumericUsesGroup{yes}{no}.
+ \par
+ Currency Symbol: \CurrentLocaleCurrency
+ \par
+ Integer:
+ \texosqueryfmtnumber{\CurrentLocaleIntegerPattern}{123456}{0}{0}
+ \par
+ Decimal:
+ \texosqueryfmtnumber{\CurrentLocaleDecimalPattern}{123456}{78}{0}
+ \par
+ Percentage:
+ \texosqueryfmtnumber{\CurrentLocalePercentPattern}{0}{65}{0}
+ \par
+ Currency:
+ \texosqueryfmtnumber{\CurrentLocaleCurrencyPattern}{1234567}{0}{0}\par
+}
+
+\begin{document}
+\section{General Information}
+
+OS name: \LocaleOSname.
+OS version: \LocaleOSversion.
+OS arch: \LocaleOSarch.
+
+Default file encoding: \LocaleOScodeset.
+
+The PDF file was last built: \texttt{\LocaleNowStamp}.
+
+The source file was last modified: \texttt{\LocaleFileMod}.
+
+Main locale: \LocaleMain\ (\LocaleMainDialect).
+
+Other locales: \LocaleOther.
+
+\test
+
+\selectlocale{de-CH-1996}
+\test
+
+\selectlocale{fr-BE}
+\test
+
+\selectlocale{pt-BR}
+\test
+
+\end{document}
diff --git a/Master/texmf-dist/doc/generic/tex-locale/tex-locale.pdf b/Master/texmf-dist/doc/generic/tex-locale/tex-locale.pdf
new file mode 100644
index 00000000000..b00854549d9
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/tex-locale/tex-locale.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/tex-locale/tex-locale.dtx b/Master/texmf-dist/source/latex/tex-locale/tex-locale.dtx
new file mode 100644
index 00000000000..839c8834c0d
--- /dev/null
+++ b/Master/texmf-dist/source/latex/tex-locale/tex-locale.dtx
@@ -0,0 +1,9082 @@
+%\iffalse
+% tex-locale.dtx generated using makedtx version 1.2 (c) Nicola Talbot
+% Command line args:
+% -src "tex-locale.sty\Z=>tex-locale.sty"
+% -src "tex-locale.tex\Z=>tex-locale.tex"
+% -src "tex-locale-scripts-enc.def\Z=>tex-locale-scripts-enc.def"
+% -src "tex-locale-encodings.def\Z=>tex-locale-encodings.def"
+% -src "tex-locale-support.def\Z=>tex-locale-support.def"
+% -author "Nicola Talbot"
+% -section "chapter"
+% -doc "tex-locale-manual.tex"
+% tex-locale
+% Created on 2018/8/26 19:14
+%\fi
+%\iffalse
+%<*package>
+%% \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
+%% Lower-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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%</package>
+%\fi
+% \iffalse
+% Doc-Source file to use with LaTeX2e
+% Copyright (C) 2018 Nicola Talbot, all rights reserved.
+% \fi
+% \iffalse
+%<*driver>
+\documentclass[report,widecs,inlinetitle]{nlctdoc}
+
+\DeleteShortVerb{|}
+
+\usepackage{metalogo}
+
+\let\orgtheindex\theindex
+\let\orgendtheindex\endtheindex
+\usepackage{imakeidx}
+\usepackage[a4paper,left=1.5in,right=0.5in]{geometry}
+\usepackage[colorlinks,
+ bookmarks,
+ hyperindex=false,
+ pdfauthor={Nicola L.C. Talbot},
+ pdftitle={tex-locale: setup document locale}]{hyperref}
+
+\CheckSum{3313}
+
+\newcommand{\file}[1]{\texttt{#1}}
+
+\doxitem{Option}{option}{package options}
+
+\renewcommand{\nlctdocmarginfmt}{\scriptsize\raggedright}
+\renewcommand\MacroFont{\ttfamily\mdseries}
+
+\renewcommand*{\usage}[1]{\textit{\hyperpage{#1}}}
+\renewcommand*{\main}[1]{\underline{\hyperpage{#1}}}
+\PageIndex
+\setcounter{IndexColumns}{2}
+\newcommand*{\PrintCodeIndex}{%
+ \bgroup
+ \let\theindex\orgtheindex
+ \let\endtheindex\orgendtheindex
+ \PrintIndex
+ \egroup
+}
+\IndexPrologue{%
+\clearpage\phantomsection
+\addcontentsline{toc}{chapter}{Code Index}%
+\chapter*{Code Index}\markboth{Code Index}{Code Index}%
+}
+
+\newenvironment{code}%
+{\begin{flushleft}\ttfamily\obeylines\obeyspaces}
+{\end{flushleft}\ignorespacesafterend}
+
+\makeindex[name=user,title=Main Index,intoc]
+\renewcommand{\iapp}[1]{\index[user]{#1@\appfmt{#1}|hyperpage}}
+\renewcommand{\iterm}[1]{\index[user]{#1|hyperpage}}
+\renewcommand{\ics}[1]{\cs{#1}\index[user]{#1@\protect\cs{#1}|hyperpage}}
+\renewcommand*{\ipkgopt}[2][]{%
+ \ifstrempty{#1}%
+ {\index[user]{package options:!#2@\pkgoptfmt{#2}|hyperpage}}%
+ {\index[user]{package options:!#2@\pkgoptfmt{#2}!#1@\pkgoptfmt{#1}|hyperpage}}%
+}
+\renewcommand*{\pkgopt}[2][]{%
+ \pkgoptfmt{#2}\ifstrempty{#1}%
+ {\index[user]{package options:!#2@\pkgoptfmt{#2}|hyperpage}}%
+ {\index[user]{package options:!#2@\pkgoptfmt{#2}!#1@\pkgoptfmt{#1}|hyperpage}}%
+}
+\renewcommand*{\isty}[1]{%
+ \index[user]{#1 package@\styfmt{#1} package|hyperpage}}
+
+\newcommand{\attrfmt}[1]{\texttt{#1}}
+
+\newcommand{\attr}[2]{%
+ \attrfmt{#2}%
+ \index[user]{attributes!#1!#2@\protect\attrfmt{#2}}}
+
+\newcommand{\mattr}[2]{%
+ \attr{#1@\protect\meta{#1}}{#2}%
+}
+
+\newcommand{\dattr}[1]{\mattr{dialect}{#1}}
+\newcommand{\rattr}[1]{\mattr{region}{#1}}
+\newcommand{\cattr}[1]{\mattr{currency}{#1}}
+
+\newcommand{\longarg}[1]{\texttt{-{}-#1}}
+\newcommand{\shortarg}[1]{\texttt{-#1}}
+
+\newcommand{\PDFLaTeX}{PDF\LaTeX}
+
+\setcounter{secnumdepth}{3}
+\setcounter{tocdepth}{3}
+
+\begin{document}
+\DocInput{tex-locale.dtx}
+\end{document}
+%</driver>
+%\fi
+%
+%\MakeShortVerb{"}
+%
+%\title{tex-locale v1.0:
+%setup document locale}
+%\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}}
+%
+%\date{2018-08-26}
+%\maketitle
+%
+%\begin{abstract}
+%The generic \TeX\ \file{tex-locale.tex} code uses both \sty{tracklang}
+%(at least v1.3.4) and \sty{texosquery} (at least v1.2, but newest
+%version recommended) to look up the locale information from the
+%operating system and provide commands that can access
+%locale-dependent information, such as the currency symbol and
+%numeric separators. This works best with the shell escape when
+%building the document. (Some \hyperref[sec:noshell]{adjustments} are
+%needed to work without the shell escape.) \TeX\ Live 2017 now
+%includes \app{texosquery-jre8} on the restricted list, but the
+%\sty{texosquery} installation needs to be set up to enable this.
+%Set up instructions are in the file \file{texosquery.cfg}, which is
+%distributed with the \sty{texosquery} package. If the application
+%isn't on the restricted list, then you'll need to enable the
+%unrestricted mode, but take care as this mode is insecure.
+%
+%Example plain \XeTeX\ document:
+%\begin{verbatim}
+%\font\nimbus="NimbusRoman-Regular" at 10pt
+%\nimbus
+%
+%\input locale
+%
+%Currency: \CurrentLocaleCurrency.
+%Date: \CurrentLocaleDate.
+%Time: \CurrentLocaleTime.
+%\bye
+%\end{verbatim}
+%
+%The \LaTeX\ package \file{tex-locale.sty} can additionally load
+%\sty{babel} or \sty{polyglossia} with the locale's language
+%setting, as well as various other
+%packages such as \sty{fontspec} (\XeLaTeX\ or \LuaLaTeX) or
+%\sty{fontenc} and \sty{inputenc}. Packages that provide currency
+%symbols can also be loaded automatically (\sty{textcomp} by default).
+%Example \LaTeX\ document:
+%\begin{verbatim}
+%\documentclass{article}
+%
+%\usepackage{tex-locale}
+%
+%\begin{document}
+%Currency: \CurrentLocaleCurrency.
+%Date: \CurrentLocaleDate.
+%Time: \CurrentLocaleTime.
+%\end{document}
+%\end{verbatim}
+%\end{abstract}
+%
+%\begin{important}
+%\TeX's restricted mode prohibits the use of quotes in the shell
+%escape for security reasons. This means that if you want the file
+%modification date and you have spaces in your filename you must use
+%the unrestricted mode to allow the filename to be delimited by
+%quotes. In general it's best to avoid spaces in file names.
+%\end{important}
+%
+%
+%\tableofcontents
+%\chapter{Introduction}
+%
+%The \sty{tex-locale} package is designed to set up the document's
+%locale-sensitive information by querying the relevant information
+%from the operating system using \app{texosquery}.
+%\sectionref{sec:generic} describes generic commands that can be used
+%in \LaTeX\ or plain \TeX\ documents. \sectionref{sec:latex}
+%describes the \LaTeX-specific package \file{tex-locale.sty}, which does
+%more than simply input \file{tex-locale.tex}.
+%
+%The generic code \file{tex-locale.tex} requires: \file{tracklang.tex} and
+%\file{texosquery.tex}. The \LaTeX\ package \file{tex-locale.sty}
+%additionally requires: \file{tracklang.sty}, \file{texosquery.sty},
+%\sty{etoolbox}, \sty{xfor}, \sty{ifxetex}, \sty{ifluatex}, \sty{xkeyval}
+%and optionally:
+%\begin{itemize}
+%\item \sty{datetime2} (and associated language modules);
+%\item \sty{textcomp} or \sty{fontawesome};
+%\item \sty{fontspec} or \sty{fontenc}\&\sty{inputenc};
+%\item \sty{polyglossia} or \sty{babel};
+%\item \sty{CJK}, \sty{CJKutf8} or \sty{xeCJK};
+%\item \sty{tracklang-scripts} (provided with \sty{tracklang}).
+%\end{itemize}
+%
+%The \sty{texosquery} package (distributed separately) comes with generic
+%\TeX\ code \file{texosquery.tex}, a simple \LaTeX\ package wrapper
+%\file{texosquery.sty} and a Java application that comes in three
+%variants:
+%\begin{itemize}
+%\item \file{texosquery-jre8.jar}: the full application, requires at
+%least Java 8.
+%\item \file{texosquery.jar}: a slightly cut-down version of the
+%application with less locale support, requires at least Java 7.
+%\item \file{texosquery-jre5.jar}: a significantly reduced version of
+%the application with poor locale support, requires at least Java 5.
+%\emph{Less secure than the other variants.}
+%\end{itemize}
+%The Java~8 variant (\app{texosquery-jre8}) is on \TeX~Live
+%2017's restricted list, so it's possible to use it with
+%the restricted shell escape. The other variants should not be added
+%to the restricted list as old versions of Java are deprecated and
+%considered security risks. In particular, the Java~5 variant's file
+%listing actions are less secure as they allow file listings outside
+%of the current directory path, which the Java~7 and 8 variants
+%prohibit. If you have Java~8 installed, I recommend that you make
+%\app{texosquery-jre8} the default. This can be done by editing the
+%configuration file \file{texosquery.cfg}. See the \sty{texosquery}
+%documentation for further details. (This document assumes
+%\app{texosquery-jre8} in the examples. Substitute the appropriate command if you
+%have a different set up.)
+%
+%\begin{important}
+%MiKTeX users will need to enable piped shell escape with
+%\longarg{enable-pipes} (unless the non-shell escape method described
+%in \sectionref{sec:noshell} is used).
+%\end{important}
+%
+%The information returned by \app{texosquery} has special markup
+%that's converted by \cs{TeXOSQuery} or \cs{TeXOSQueryFromFile}. For
+%example, \ics{fhyn} is used to represent a literal hyphen (category
+%code~12) whereas \ics{thyn} is used for a textual hyphen.
+%For example, if a file name containing a hyphen is returned, the
+%hyphen will be marked as \cs{fhyn}, whereas a date containing a
+%hyphen will use \cs{thyn}.
+%
+%\section{Using the package without the shell escape}
+%\label{sec:noshell}
+%
+%The \sty{tex-locale} package is designed for use with the piped shell escape
+%(preferably the restricted mode for greater security), but it's
+%still possible to use \file{tex-locale.tex} when the shell escape is disabled,
+%although it's less convenient. (You will need at least
+%\sty{texosquery} v1.4 for this method.)
+%
+%First compile your document with the shell escape disabled. The dry
+%run mode will automatically be on, and the \sty{texosquery} command
+%\cs{TeXOSQuery} will simply write the command it would've tried to
+%the transcript. This will be prefixed by \texttt{TeXOSQuery:}
+%
+%For example, suppose the file \texttt{test.tex} contains:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{de-CH-1996,fr-BE}
+%
+%\input locale
+%
+%Currency: \CurrentLocaleCurrency.
+%
+%\bye
+%\end{verbatim}
+%Here the main locale has been explicitly set to
+%\texttt{en-GB} and the other locales have been set to
+%\texttt{de-CH-1996} and \texttt{fr-BE}, so the transcript file
+%\texttt{test.log} will include:
+%\begin{verbatim}
+%TeXOSQuery: texosquery-jre8 -o -r -a -n -N -C -d 'test.tex' -D en-GB
+%-D de-CH-1996 -D fr-BE
+%\end{verbatim}
+%Copy and paste this command into a command prompt or terminal and redirect the
+%output to a file. (Don't include the initial \texttt{TeXOSQuery:}
+%and don't include any line breaks.) For example (omit line break):
+%\begin{verbatim}
+%texosquery-jre8 -o -r -a -n -N -C -d 'test.tex' -D en-GB
+%-D de-CH-1996 -D fr-BE > localesettings.tex
+%\end{verbatim}
+%Then define
+%\begin{definition}[\DescribeMacro\LocaleQueryFile]
+%\cs{LocaleQueryFile}
+%\end{definition}
+%to the file name before loading \sty{tex-locale}:
+%\begin{verbatim}
+%\def\LocaleQueryFile{localesettings}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{de-CH-1996,fr-BE}
+%
+%\input locale
+%
+%Currency: \CurrentLocaleCurrency.
+%
+%\bye
+%\end{verbatim}
+%If you change any of the document settings you'll need to re-run
+%\app{texosquery} to update the query result file.
+%
+%\begin{important}
+%If you want the current date or time, the result files will need to
+%be updated before every document build.
+%\end{important}
+%
+%For example, if the file \texttt{test.tex} is simply:
+%\begin{verbatim}
+%\input locale
+%
+%Today: \CurrentLocaleShortDate.
+%Currency: \CurrentLocaleCurrency.
+%
+%\bye
+%\end{verbatim}
+%Then the document build process would be:
+%\begin{verbatim}
+%texosquery-jre8 -o -r -a -n -N -C -d 'test.tex' -D > testsettings.tex
+%etex '\def\LocaleQueryFile{testsettings}\input test'
+%\end{verbatim}
+%(Replace \app{etex} with \app{pdftex} or \app{xetex}, as required.)
+%
+%\begin{important}
+%If \cs{LocaleQueryFile} is defined and non-empty, the non-shell escape method
+%will automatically be implemented even if the shell escape is actually
+%enabled.
+%\end{important}
+%
+%If you're using \LaTeX\ (\file{tex-locale.sty}), there may be an initial query with
+%\texttt{-b} or \texttt{-C} (or both) before \file{tex-locale.tex} is
+%input. The result of this will also need to be captured in a file.
+%For example:
+%\begin{verbatim}
+%texosquery-jre8 -b -C > localestysettings.tex
+%\end{verbatim}
+%This file name should be provided in the command
+%\begin{definition}[\DescribeMacro\LocaleStyQueryFile]
+%\cs{LocaleStyQueryFile}
+%\end{definition}
+%In this case you only need to update the file if you change the
+%document locales, encoding or engine. (For example, if you change the
+%value of the package options \pkgopt{main}, \pkgopt{other},
+%\pkgopt{support}, \pkgopt{inputenc} or \pkgopt{fontenc}.)
+%
+%\LaTeX\ example:
+%\begin{verbatim}
+%\documentclass{article}
+%\newcommand{\LocaleStyQueryFile}{localestysettings}
+%\newcommand{\LocaleQueryFile}{localesettings}
+%\usepackage[main=en-GB,other={de-CH-1996,fr-BE}]{tex-locale}
+%\begin{document}
+%Currency: \CurrentLocaleCurrency.
+%\end{document}
+%\end{verbatim}
+%
+%\begin{important}
+%Even if the shell escape is on, if \cs{LocaleQueryFile} or
+%\cs{LocaleStyQueryFile} have been set (to a non-empty value),
+%they'll be used instead.
+%\end{important}
+%
+%It's possible to define one but not the other command. For example:
+%\begin{verbatim}
+%\documentclass{article}
+%\newcommand{\LocaleStyQueryFile}{localestysettings}
+%\usepackage[main=en-GB,other={de-CH-1996,fr-BE}]{tex-locale}
+%\begin{document}
+%Currency: \CurrentLocaleCurrency.
+%\end{document}
+%\end{verbatim}
+%This requires the shell escape for the main locale information
+%(used in \file{tex-locale.tex}) but omits the \LaTeX-specific shell
+%escape used in \file{tex-locale.sty}.
+%
+%\section{Encoding}
+%\label{sec:encoding}
+%
+%The default encoding used by \app{texosquery} when writing the
+%results to STDOUT (which are piped in through the shell escape)
+%can be obtained with \longarg{codeset} (from v1.6). For example:
+%\begin{verbatim}
+%texosquery-jre8 --codeset
+%\end{verbatim}
+%The short form of this switch is \shortarg{cs}. So the above is
+%equivalent to
+%\begin{verbatim}
+%texosquery-jre8 -cs
+%\end{verbatim}
+%For example, if the encoding is UTF-8, then this returns
+%\begin{verbatim}
+%UTF\fhyn 8
+%\end{verbatim}
+%
+%There's a similar switch \longarg{codeset-lcs} (from v1.2) that
+%converts the encoding name to lower case and strips hyphens.
+%For example
+%\begin{verbatim}
+%texosquery-jre8 --codeset-lcs
+%\end{verbatim}
+%The short form is \shortarg{C}
+%\begin{verbatim}
+%texosquery-jre8 -C
+%\end{verbatim}
+%For example, if the encoding is UTF-8, then this returns
+%\begin{verbatim}
+%utf8
+%\end{verbatim}
+%(The switches are case-sensitive. The lower case \shortarg{c} has a
+%different meaning.)
+%
+%The document encoding must match the encoding used by
+%\app{texosquery} when the query is made (through \cs{TeXOSQuery} or
+%\cs{TeXOSQueryFromFile}). This is why the \LaTeX\ package
+%\file{tex-locale.sty} makes an initial query with \shortarg{C} so that
+%it can set up the appropriate input encoding when used with the
+%\pkgoptfmt{inputenc=auto} package option. If the document doesn't use
+%this interface, then the encoding needs to be correctly set before
+%the query is made.
+%
+%You have a choice of either changing the document encoding to match
+%the encoding used by \app{texosquery} or by changing
+%\app{texosquery}'s encoding to match all your documents.
+%For example, if your Java runtime environment is set up so that the
+%default file encoding is ISO~8859-1 (Latin-1) but you always use
+%UTF-8 in your source code, then you can instruct \app{texosquery} to
+%use UTF-8 with the \longarg{encoding} option (from v1.6). For example:
+%\begin{verbatim}
+%texosquery-jre8 --encoding UTF-8 -N
+%\end{verbatim}
+%will ensure that the currency symbol is written as a UTF-8
+%character. The short form is \shortarg{enc}. For example:
+%\begin{verbatim}
+%texosquery-jre8 -enc UTF-8 -N
+%\end{verbatim}
+%You can append this option to the definition of
+%\cs{TeXOSInvokerName}. For example:
+%\begin{verbatim}
+%\def\TeXOSInvokerName{texosquery-jre8 -enc UTF-8}
+%\end{verbatim}
+%
+%There are two hooks which, if defined, are used immediately before
+%or immediately after the main query is made in \file{tex-locale.tex}.
+%The hook used before the query is
+%\begin{definition}[\DescribeMacro\localeprequery]
+%\cs{localeprequery}
+%\end{definition}
+%and the hook used after the query is
+%\begin{definition}[\DescribeMacro\localepostquery]
+%\cs{localepostquery}
+%\end{definition}
+%These may start and end a grouping, if required, as the result from
+%the query is given a global assignment, so these may be used to
+%temporarily switch the input encoding just for the query. This is
+%done by \file{tex-locale.sty} if it detects that the document requires
+%\sty{CJKutf8}. In this case it defines the hooks to locally switch
+%the encoding while the CJK characters are read from the query result.
+%
+%In addition to using markup commands like \cs{fhyn} and \cs{thyn},
+%\app{texosquery} also wraps non-ASCII characters in the argument of
+%\cs{fwrp} (which expands to \cs{texosquerynonasciidetokwrap}) and
+%\cs{twrp} (which expands to \cs{texosquerynonasciiwrap}). The
+%expanded versions of these commands may be changed to deal with
+%non-ASCII characters, but in general it's simpler to either use the
+%same encoding as the document or use the hooks to temporarily switch
+%encoding while the information is read.
+%
+%\chapter{Generic Use}
+%\label{sec:generic}
+%
+%The commands available for generic use are defined in
+%\file{tex-locale.tex}. Plain \TeX\ users can load this using \cs{input}:
+%\begin{verbatim}
+%\input locale
+%\end{verbatim}
+%\LaTeX\ users are also able to do this, but are better off loading
+%\file{tex-locale.sty} instead:
+%\begin{verbatim}
+%\usepackage{tex-locale}
+%\end{verbatim}
+%This does more than simply inputting \file{tex-locale.tex} as it also
+%loads other packages as well, such as \sty{babel} or
+%\sty{polyglossia}. See \sectionref{sec:latex} for \LaTeX\ package options.
+%
+%By default \file{tex-locale.tex} assumes that the document locale should
+%match your own locale as identified by your operating system. This
+%means that the same document code will produce different results
+%when compiled in different locations. If you want information for a
+%specific locale, then you need to identify the document's main
+%locale and optionally other locales. For plain \TeX\ users, this
+%means defining \cs{LocaleMain} and \cs{LocaleOther} \emph{before} loading
+%\file{tex-locale.tex}. For \LaTeX\ users, this is done through the
+%package options provided by \file{tex-locale.sty}.
+%
+%\begin{definition}[\DescribeMacro\LocaleMain]
+%\cs{LocaleMain}
+%\end{definition}
+%If this is defined before \file{tex-locale.tex} is input, then this may
+%be defined as the keyword \texttt{locale}:
+%\begin{verbatim}
+%\def\LocaleMain{locale}
+%\end{verbatim}
+%or the relevant language tag. For example:
+%\begin{verbatim}
+%\def\LocaleMain{de-CH-1996}
+%\end{verbatim}
+%The \texttt{locale} keyword indicates that the main locale should be
+%found by querying the operating system (using \app{texosquery}).
+%After \file{tex-locale.tex} has been input, this command will be set to
+%the language tag for the main locale. If \cs{LocaleMain} is undefined before
+%\file{tex-locale.tex} is input, then \texttt{locale} is assumed.
+%
+%\begin{definition}[\DescribeMacro\LocaleOther]
+%\cs{LocaleOther}
+%\end{definition}
+%If this is defined before \file{tex-locale.tex} is input, then this
+%should be a comma-separated list of language tags for the other
+%locales. If \cs{LocaleMain} has been defined to a language tag, the
+%list may also include the keyword \texttt{locale} to indicate the
+%operating system's locale.
+%
+%Note that the generic \file{tex-locale.tex} doesn't load \sty{babel} or
+%\sty{polyglossia}, but it does track each language using
+%\sty{tracklang}'s interface. You can switch to any of these locales
+%using\label{pg:selectlocale}
+%\begin{definition}[\DescribeMacro\selectlocale]
+%\cs{selectlocale}\marg{locale}
+%\end{definition}
+%where \meta{locale} is either a language tag or \sty{tracklang}
+%dialect label. If the locale is unrecognised, an error will occur
+%unless \sty{texosquery}'s dry run mode is on, in which case it will
+%just be a warning.
+%
+%This uses \sty{tracklang}'s
+%\cs{SetCurrentTrackedDialect}\marg{dialect} but additionally, if
+%\cs{selectlanguage} has been defined, it will try to determine the
+%correct label to pass to \ics{selectlanguage}.
+%
+%This means that if you use \LaTeX\ with \file{tex-locale.sty}, which
+%loads \sty{babel} or \sty{polyglossia}, then you don't need to
+%remember, for example, that \texttt{en-GB} has the \sty{babel}
+%dialect label \texttt{british}, and can simply do
+%\begin{verbatim}
+%\selectlocale{en-GB}
+%\end{verbatim}
+%If \cs{selectlanguage} isn't defined, then this command doesn't
+%switch the document language (that is, it doesn't change the
+%hyphenation patterns or \cs{languagename}) but it does allow
+%the \cs{CurrentLocale\ldots} commands (described in \sectionref{sec:currentlocale}) to reflect
+%the change in locale.
+%
+%Here's a plain \XeTeX\ document that sets up three locales for the
+%document. The first (main one) is obtained from the operating system
+%(because \cs{LocaleMain} isn't defined) and the other two are
+%explicitly set by defining \cs{LocaleOther} before \file{tex-locale.tex}
+%is input:
+%\begin{verbatim}
+%\def\LocaleOther{fr-BE,de-CH-1996}
+%
+%\input locale
+%
+%Currency: \CurrentLocaleCurrency.
+%
+%\selectlocale{fr-BE}
+%
+%Currency: \CurrentLocaleCurrency.
+%
+%\selectlocale{de-CH-1996}
+%
+%Currency: \CurrentLocaleCurrency.
+%\bye
+%\end{verbatim}
+%If this document is in a file called \file{test.tex}, then it can be
+%compiled using:
+%\begin{verbatim}
+%pdftex --shell-escape test
+%\end{verbatim}
+%or
+%\begin{verbatim}
+%etex --shell-escape test
+%\end{verbatim}
+%or
+%\begin{verbatim}
+%xetex --shell-escape test
+%\end{verbatim}
+%or
+%\begin{verbatim}
+%luatex --shell-escape test
+%\end{verbatim}
+%(Omit \longarg{shell-escape} if the application given by
+%\cs{TeXOSInvokerName} is on the restricted list.)
+%
+%The equivalent \LaTeX\ document is:
+%\begin{verbatim}
+%\documentclass{article}
+%
+%\usepackage[other={fr-BE,de-CH-1996}]{tex-locale}
+%
+%\begin{document}
+%Currency: \CurrentLocaleCurrency.
+%
+%\selectlocale{fr-BE}
+%
+%Currency: \CurrentLocaleCurrency.
+%
+%\selectlocale{de-CH-1996}
+%
+%Currency: \CurrentLocaleCurrency.
+%
+%\end{document}
+%\end{verbatim}
+%If this document is in a file called \file{test.tex}, then it can be
+%compiled using:
+%\begin{verbatim}
+%pdflatex --shell-escape test
+%\end{verbatim}
+%or
+%\begin{verbatim}
+%latex --shell-escape test
+%\end{verbatim}
+%or
+%\begin{verbatim}
+%xelatex --shell-escape test
+%\end{verbatim}
+%or
+%\begin{verbatim}
+%lualatex --shell-escape test
+%\end{verbatim}
+%(Again, omit \longarg{shell-escape} if the application given by
+%\cs{TeXOSInvokerName} is on the restricted list.)
+%
+%In the first two cases (\texttt{pdflatex} or \texttt{latex}),
+%\sty{babel} will be loaded (and also \sty{fontenc} and \sty{inputenc}
+%and various other packages). Whereas in the last two cases
+%(\texttt{xelatex} or \texttt{lualatex}),
+%\sty{polyglossia} will be loaded (and also \sty{fontspec} and
+%various other packages). This means that \cs{selectlocale} will also
+%use \cs{selectlanguage} to switch the document language. In the
+%plain \TeX\ version, \cs{languagename} remains undefined.
+%
+%The other difference between the plain \TeX\ and the \LaTeX\
+%examples, is the default output produced by
+%\cs{CurrentLocaleCurrency}. The plain \TeX\ version uses the
+%currency codes (for example, EUR) whereas the \LaTeX\ version uses
+%currency symbols. These differences are described in more detail
+%below.
+%
+%\section{General Information}
+%\label{sec:general}
+%
+%Each invocation of \app{texosquery} requires starting up the
+%Java Virtual Machine, so \file{tex-locale.tex} minimises this overhead by
+%only using a single system call. The \file{tex-locale.sty} \LaTeX\
+%package may need additional information that also requires a
+%\app{texosquery} call before \file{tex-locale.tex} is input. So \LaTeX\
+%users will have at most two system calls to \app{texosquery} when
+%loading \file{tex-locale.sty} whereas plain \TeX\ users will only have a
+%single system call when loading just \file{tex-locale.tex}.
+%
+%Since it's necessary to run \app{texosquery} to obtain all the
+%locale information, \file{tex-locale.tex} uses the opportunity to also
+%fetch more general information that may be of use.
+%
+%\begin{definition}[\DescribeMacro\LocaleOSname]
+%\cs{LocaleOSname}
+%\end{definition}
+%This expands to the operating system name. For example,
+%\texttt{Linux}.
+%
+%\begin{definition}[\DescribeMacro\LocaleOSversion]
+%\cs{LocaleOSversion}
+%\end{definition}
+%This expands to the operating system version. For example,
+%\verb|4.1.13-100.fc21.x86_64|. (Note that the underscore in this
+%case has been detokenized.)
+%
+%\begin{definition}[\DescribeMacro\LocaleOSarch]
+%\cs{LocaleOSarch}
+%\end{definition}
+%This expands to the architecture. For example,
+%\texttt{amd64}.
+%
+%\begin{definition}[\DescribeMacro\LocaleOScodeset]
+%\cs{LocaleOScodeset}
+%\end{definition}
+%This expands to the operating system's default file encoding (or the
+%value of the Java setting \texttt{file.encoding}). This uses
+%\app{texosquery}'s \shortarg{C} switch, which converts the encoding
+%name to lower case and strips the hyphens. (For example, \texttt{UTF-8}
+%is converted to \texttt{utf8}.) If you prefer to use the
+%\shortarg{cs} (or \longarg{codeset}) switch, you can define
+%\begin{definition}[\DescribeMacro\LocaleQueryCodesetParam]
+%\cs{LocaleQueryCodesetParam}
+%\end{definition}
+%to the required switch. For example:
+%\begin{verbatim}
+%\def\LocaleQueryCodesetParam{-cs}
+%\input locale
+%Encoding: \LocaleOScodeset.
+%\bye
+%\end{verbatim}
+%(Note that \cs{codeset} was added to \app{texosquery} v1.6.)
+%
+%\begin{definition}[\DescribeMacro\LocaleOStag]
+%\cs{LocaleOStag}
+%\end{definition}
+%This expands to the operating system's language tag, but note that
+%this doesn't mean that this locale has been tracked (either as the
+%main locale or one of the other document locales). It's for
+%informational purposes only.
+%
+%\begin{definition}[\DescribeMacro\LocaleNowStamp]
+%\cs{LocaleNowStamp}
+%\end{definition}
+%This expands to the current date-time in PDF format. This is like
+%the PDF primitive \ics{pdfcreationdate} (also available with \LuaTeX\
+%through \cs{pdffeedback}). Since \cs{pdfcreationdate} isn't provided
+%by \XeTeX, \cs{LocaleNowStamp} can be used instead if required.
+%
+%You can also obtain the file modification date of the document
+%source file. The file is assumed to be \cs{jobname}\texttt{.tex},
+%but you can choose another instead by first defining
+%\begin{definition}[\DescribeMacro\LocaleMainFile]
+%\cs{LocaleMainFile}
+%\end{definition}
+%before loading \file{tex-locale.tex}. The value should be the file name.
+%For example:
+%\begin{verbatim}
+%\def\LocaleMainFile{mydoc.tex}
+%\input locale
+%\end{verbatim}
+%You can define this command to empty if you don't want the file
+%modification PDF date-stamp. For example:
+%\begin{verbatim}
+%\def\LocaleMainFile{}
+%\input locale
+%\end{verbatim}
+%If the file name contains spaces, you can't use the restricted shell
+%escape and will have to use the less secure unrestricted mode instead.
+%
+%If \cs{LocaleMainFile} is not empty, the modification date can be
+%accessed using
+%\begin{definition}[\DescribeMacro\LocaleFileMod]
+%\cs{LocaleFileMod}
+%\end{definition}
+%For example:
+%\begin{verbatim}
+%\input locale
+%
+%\pdfinfo{
+% /CreationDate (\LocaleNowStamp)
+% /ModDate (\LocaleFileMod)
+%}
+%
+%Now: \LocaleNowStamp.
+%Mod: \LocaleFileMod.
+%
+%\bye
+%\end{verbatim}
+%This command will be empty if the modification date wasn't found.
+%
+%\section{Attributes}
+%\label{sec:attributes}
+%
+%The \file{tex-locale.tex} package stores and references information
+%through the use of attributes. These are set using:
+%\begin{definition}[\DescribeMacro\LocaleSetAttribute]
+%\cs{LocaleSetAttribute}\marg{label}\marg{attribute}\marg{value}
+%\end{definition}
+%and accessed using
+%\begin{definition}[\DescribeMacro\LocaleGetAttribute]
+%\cs{LocaleGetAttribute}\marg{label}\marg{attribute}
+%\end{definition}
+%The \meta{label} identifies the type of information,
+%\meta{attribute} is the attribute's label and \meta{value} is the
+%attribute's value.
+%
+%There are three particular types of identifiers: locales, regions
+%and currencies. For convenience, there are some shortcut commands so
+%you don't need to use the special prefix part of the label.
+%
+%For locales, where \meta{dialect} is the \sty{tracklang} dialect
+%label associated with that locale:
+%\begin{definition}[\DescribeMacro\LocaleSetDialectAttribute]
+%\cs{LocaleSetDialectAttribute}\marg{dialect}\marg{attribute}\marg{value}
+%\end{definition}
+%\begin{definition}[\DescribeMacro\LocaleGetDialectAttribute]
+%\cs{LocaleGetDialectAttribute}\marg{dialect}\marg{attribute}
+%\end{definition}
+%
+%Region attributes are set using:
+%\begin{definition}[\DescribeMacro\LocaleSetRegionAttribute]
+%\cs{LocaleSetRegionAttribute}\marg{region code}\marg{attribute}\marg{value}
+%\end{definition}
+%where \meta{region code} is the ISO territory code (for example,
+%\texttt{GB} or \texttt{CH}).
+%You can fetch a region's attribute value using:
+%\begin{definition}[\DescribeMacro\LocaleGetRegionAttribute]
+%\cs{LocaleGetRegionAttribute}\marg{region code}\marg{attribute}
+%\end{definition}
+%
+%Currency attributes are set using:
+%\begin{definition}[\DescribeMacro\LocaleSetCurrencyAttribute]
+%\cs{LocaleSetCurrencyAttribute}\marg{currency code}\marg{attribute}\marg{value}
+%\end{definition}
+%where \meta{currency code} is the ISO currency code (for example,
+%\texttt{GBP} or \texttt{EUR}).
+%You can fetch a currency's attribute value using:
+%\begin{definition}[\DescribeMacro\LocaleGetCurrencyAttribute]
+%\cs{LocaleGetCurrencyAttribute}\marg{currency code}\marg{attribute}
+%\end{definition}
+%
+%There's a debugging command available that uses \ics{show} to show
+%an attribute's value (or an error if undefined):
+%\begin{definition}[\DescribeMacro\localeshowattribute]
+%\cs{localeshowattribute}\marg{label}\marg{attribute}
+%\end{definition}
+%
+%Again there are shortcuts for the dialect, region and currency attribute groups:
+%\begin{definition}[\DescribeMacro\localeshowdialectattribute]
+%\cs{localeshowdialectattribute}\marg{dialect}\marg{attribute}
+%\end{definition}
+%\begin{definition}[\DescribeMacro\localeshowregionattribute]
+%\cs{localeshowregionattribute}\marg{region code}\marg{attribute}
+%\end{definition}
+%\begin{definition}[\DescribeMacro\localeshowcurrencyattribute]
+%\cs{localeshowcurrencyattribute}\marg{currency code}\marg{attribute}
+%\end{definition}
+%Further details of these and other attribute commands can be found in
+%\sectionref{sec:code.attributes}.
+%
+%For the most part, the attributes are stored and accessed internally
+%by the various commands described in this chapter, so you
+%won't usually need to worry about them. However, you can modify the
+%attributes. For example, the \texttt{de-CH-1996} locale uses an
+%apostrophe \verb|'| as the numeric group separator. This is actually
+%returned by \app{texosquery} as the 0x27 straight apostrophe from
+%the Basic Latin block. This isn't a problem for plain \TeX\ using
+%the default Computer Modern font, as illustrated by the following
+%document:
+%\begin{verbatim}
+%1'234.5
+%\bye
+%\end{verbatim}
+%This uses a curly quote in the resulting 1'234.5. However, changing the font can result in a
+%straight apostrophe instead, as illustrated in this plain \XeTeX\
+%document:
+%\begin{verbatim}
+%\font\nimbus="NimbusRoman-Regular" at 10pt
+%\nimbus
+%
+%1'234.5
+%\bye
+%\end{verbatim}
+%This isn't a problem with \XeLaTeX\ if the \sty{fontspec} package is
+%used:
+%\begin{verbatim}
+%\documentclass{article}
+%\usepackage{fontspec}
+%\setmainfont{NimbusRoman-Regular}
+%
+%\begin{document}
+%1'234.5
+%\end{document}
+%\end{verbatim}
+%
+%So a plain \XeTeX\ user might prefer to change the numeric group
+%separator to the right single quote character ' (0x2019).
+%The numeric group separator is provided by the \dattr{groupsep}
+%dialect attribute. The \sty{tracklang} dialect label corresponding
+%to the \texttt{de-CH-1996} locale is \texttt{nswissgerman}. So the
+%group separator for this dialect can be changed by setting the
+%attribute to the new value using:
+%\begin{code}
+%\cs{LocaleSetDialectAttribute}\{nswissgerman\}\{groupsep\}\{\textquoteright\}
+%\end{code}
+%(See \sectionref{sec:generalattr} to convert a language tag to
+%dialect label.)
+%
+%\subsection{Attribute Lists}
+%\label{sec:attrlists}
+%
+%Some attribute values may be comma-separated lists. You can
+%add a unique item to a list using:
+%\begin{definition}[\DescribeMacro\LocaleAddToAttributeList]
+%\cs{LocaleAddToAttributeList}\marg{label}\marg{attribute}\marg{item}
+%\end{definition}
+%This will do nothing if the item is already in the list, otherwise
+%it will append \meta{item} to the list. No
+%expansion is performed on \meta{item}. The item may be empty.
+%
+%\begin{definition}[\DescribeMacro\LocaleXpAddToAttributeList]
+%\cs{LocaleXpAddToAttributeList}\marg{label}\marg{attribute}\marg{item}
+%\end{definition}
+%As above but the first token of \meta{item} is expanded before
+%being added to the list.
+%
+%You can test if an item is in one of those lists using:
+%\begin{definition}[\DescribeMacro\LocaleIfInAttributeList]
+%\cs{LocaleIfInAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%where \meta{item} is the item. This does \meta{true} if
+%\meta{item} is found in the \meta{attribute} list for
+%\meta{label}, otherwise it does \meta{false}. If the attribute
+%hasn't been defined, \meta{false} is done.
+%
+%There's a similar command that expands the first token of
+%\meta{item} before performing the test:
+%\begin{definition}[\DescribeMacro\LocaleIfInAttributeList]
+%\cs{LocaleIfXpInAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%
+%You can iterate over the list using:
+%\begin{definition}[\DescribeMacro\LocaleForEachInAttributeList]
+%\cs{LocaleForEachInAttributeList}\marg{label}\marg{attribute}\marg{cs}\marg{body}
+%\end{definition}
+%This iterates over each element of the list, setting
+%the control sequence \meta{cs} to the current item and performing
+%\meta{body}. Note that this doesn't skip empty items.
+%
+%There are shortcut commands for the dialect, region and currency
+%attributes:
+%
+%\begin{definition}[\DescribeMacro\LocaleAddToDialectAttributeList]
+%\cs{LocaleAddToDialectAttributeList}\marg{label}\marg{attribute}\marg{item}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleXpAddToDialectAttributeList]
+%\cs{LocaleXpAddToDialectAttributeList}\marg{label}\marg{attribute}\marg{item}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleIfInDialectAttributeList]
+%\cs{LocaleIfInDialectAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleIfInDialectAttributeList]
+%\cs{LocaleIfXpInDialectAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleForEachInDialectAttributeList]
+%\cs{LocaleForEachInDialectAttributeList}\marg{label}\marg{attribute}\marg{cs}\marg{body}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleAddToRegionAttributeList]
+%\cs{LocaleAddToRegionAttributeList}\marg{label}\marg{attribute}\marg{item}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleXpAddToRegionAttributeList]
+%\cs{LocaleXpAddToRegionAttributeList}\marg{label}\marg{attribute}\marg{item}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleIfInRegionAttributeList]
+%\cs{LocaleIfInRegionAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleIfInRegionAttributeList]
+%\cs{LocaleIfXpInRegionAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleForEachInRegionAttributeList]
+%\cs{LocaleForEachInRegionAttributeList}\marg{label}\marg{attribute}\marg{cs}\marg{body}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleAddToCurrencyAttributeList]
+%\cs{LocaleAddToCurrencyAttributeList}\marg{label}\marg{attribute}\marg{item}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleXpAddToCurrencyAttributeList]
+%\cs{LocaleXpAddToCurrencyAttributeList}\marg{label}\marg{attribute}\marg{item}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleIfInCurrencyAttributeList]
+%\cs{LocaleIfInCurrencyAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleIfInCurrencyAttributeList]
+%\cs{LocaleIfXpInCurrencyAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\LocaleForEachInCurrencyAttributeList]
+%\cs{LocaleForEachInCurrencyAttributeList}\marg{label}\marg{attribute}\marg{cs}\marg{body}
+%\end{definition}
+%
+%\subsection{General Attributes}
+%\label{sec:generalattr}
+%
+%The language tag attribute type \mattr{lang tag}{tagtodialect} is set using
+%\begin{code}
+%\cs{LocaleSetAttribute}\marg{label}\{tagtodialect\}\marg{value}
+%\end{code}
+%and can be accessed using
+%\begin{code}
+%\cs{LocaleGetAttribute}\marg{label}\{tagtodialect\}
+%\end{code}
+%The \meta{label} is a language tag (such as \texttt{de-CH-1996})
+%and the \meta{value} is the associated \sty{tracklang} dialect label
+%(for example, \texttt{nswissgerman}).
+%This attribute is used by \ics{selectlocale} to convert the language
+%tag to the corresponding dialect label.
+%
+%If the time zone information was fetched with \app{texosquery}'s
+%\texttt{-Z} switch, then the time zone IDs will be stored
+%in the time zone \attr{timezone}{id} attribute list that can be fetched with
+%\begin{verbatim}
+%\LocaleGetAttribute{timezone}{id}
+%\end{verbatim}
+%or iterated over using \cs{LocaleForEachInAttributeList}.
+%For example:
+%\begin{verbatim}
+%\def\LocaleIfDateTimePatternsSupported#1#2{#1}
+%
+%\input locale
+%
+%Time zone IDs:
+%
+%\LocaleForEachInAttributeList{timezone}{id}{\ThisId}{\ThisId\endgraf}
+%
+%\bye
+%\end{verbatim}
+%This simply lists all the known time zone identifiers. (Since
+%\cs{LocaleForEachInAttributeList} is a short command,
+%\cs{endgraf} is used to create a paragraph break in the above
+%example.)
+%
+%There are two general currency attribute lists, where the
+%\meta{label} is \texttt{currencies} and the attribute values
+%are \attr{currencies}{official} for the list of official currency codes
+%and \attr{currencies}{regional} for the regional currency codes.
+%For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{en-IM,en-GG,fr-BE,nl-BE,de-DE-1996}
+%
+%\input locale
+%
+%Official: \LocaleGetAttribute{currencies}{official}.
+%Regional: \LocaleGetAttribute{currencies}{regional}.
+%
+%\bye
+%\end{verbatim}
+%produces:
+%\begin{quote}
+%Official: GBP,EUR. Regional: GBP,IMP,GGP,EUR.
+%\end{quote}
+%
+%You can iterate over these lists using
+%\cs{LocaleForEachInAttributeList}. For example:
+%\begin{verbatim}
+%% arara: xetex: {shell: on}
+%\font\nimbus="NimbusRoman-Regular" at 10pt
+%\nimbus
+%
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{en-IM,en-GG,fr-BE,nl-BE,de-DE-1996}
+%
+%\input locale
+%
+%\LocaleForEachInAttributeList{currencies}{regional}{\thiscode}%
+%{\thiscode\ (\LocaleGetCurrencyAttribute{\thiscode}{sym}) }
+%
+%\bye
+%\end{verbatim}
+%which produces:
+%\begin{quote}
+%GBP (\pounds) IMP (M\pounds) GGP (\pounds) EUR (\texteuro)
+%\end{quote}
+%
+%\subsection{Dialect Attributes}
+%\label{sec:dialectattr}
+%
+%The following attributes are associated with dialects and can be set
+%using
+%\begin{code}
+%\cs{LocaleSetDialectAttribute}\marg{dialect}\marg{attribute}\marg{value}
+%\end{code}
+%or fetched with
+%\begin{code}
+%\cs{LocaleGetDialectAttribute}\marg{dialect}\marg{attribute}
+%\end{code}
+%where \meta{dialect} is the \sty{tracklang} dialect label.
+%Known values of \meta{attribute} are listed below.
+%
+%\subsubsection{General Dialect Attributes}
+%\label{sec:dialectgenattr}
+%
+%\begin{itemize}
+%\item\dattr{langtag}: the \meta{value} is the language tag associated with the
+%dialect label \meta{dialect}.
+%\item\dattr{langname}: the \meta{value} is the language name associated with the
+%dialect label \meta{dialect}.
+%\item\dattr{nativelangname}: the \meta{value} is the native language name
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{regionname}: the \meta{value} is the region name associated with the
+%dialect label \meta{dialect}.
+%\item\dattr{nativeregionname}: the \meta{value} is the native region name
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{variantname}: the \meta{value} is the variant name associated with the
+%dialect label \meta{dialect}.
+%\item\dattr{nativevariantname}: the \meta{value} is the native variant name associated with the
+%dialect label \meta{dialect}.
+%\end{itemize}
+%
+%\subsubsection{Dates and Times Dialect Attributes}
+%\label{sec:attrdatetime}
+%
+%The commands described in \sectionref{sec:datetimes} use these attributes.
+%
+%\begin{itemize}
+%\item\dattr{fulldate}: the \meta{value} is the full date associated with the
+%dialect label \meta{dialect}. (Used by \ics{LocaleFullDate}.)
+%\item\dattr{longdate}: the \meta{value} is the long date associated with the
+%dialect label \meta{dialect}. (Used by \ics{LocaleLongDate}.)
+%\item\dattr{meddate}: the \meta{value} is the medium date associated with the
+%dialect label \meta{dialect}. (Used by \ics{LocaleMediumDate}.)
+%\item\dattr{shortdate}: the \meta{value} is the short date associated with the
+%dialect label \meta{dialect}. (Used by \ics{LocaleShortDate}.)
+%\item\dattr{firstday}: the \meta{value} is the index of the first day of the week associated with the
+%dialect label \meta{dialect}. (Used by \ics{LocaleFirstDayIndex}.)
+%\item\dattr{fulltime}: the \meta{value} is the full time associated with the
+%dialect label \meta{dialect}. (Used by \ics{LocaleFullTime}.)
+%\item\dattr{longtime}: the \meta{value} is the long time associated with the
+%dialect label \meta{dialect}. (Used by \ics{LocaleLongTime}.)
+%\item\dattr{medtime}: the \meta{value} is the medium time associated with the
+%dialect label \meta{dialect}. (Used by \ics{LocaleMediumTime}.)
+%\item\dattr{shorttime}: the \meta{value} is the short time associated with the
+%dialect label \meta{dialect}. (Used by \ics{LocaleShortTime}.)
+%\item\dattr{fulldatetime}: the \meta{value} is the full date and time
+%associated with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleFullDateTime}.)
+%\item\dattr{longdatetime}: the \meta{value} is the long date and time
+%associated with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleLongDateTime}.)
+%\item\dattr{meddatetime}: the \meta{value} is the medium date and time
+%associated with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleMediumDateTime}.)
+%\item\dattr{shortdatetime}: the \meta{value} is the short date and time
+%associated with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleShortDateTime}.)
+%\end{itemize}
+%Note that the combined date and time attributes (such as
+%\attrfmt{fulldatetime}) aren't used by
+%\ics{CurrentLocaleDateTime}.
+%
+%\paragraph{Patterns}
+%The following attributes store date or time patterns (see
+%\sectionref{sec:datetimepat}).
+%\begin{itemize}
+%\item\dattr{fulldatefmt}: the \meta{value} is the full date format associated
+%with the dialect label \meta{dialect}.
+%\item\dattr{longdatefmt}: the \meta{value} is the long date format associated
+%with the dialect label \meta{dialect}.
+%\item\dattr{meddatefmt}: the \meta{value} is the medium date format associated
+%with the dialect label \meta{dialect}.
+%\item\dattr{shortdatefmt}: the \meta{value} is the short date format associated
+%with the dialect label \meta{dialect}.
+%\item\dattr{fulltimefmt}: the \meta{value} is the full time format associated
+%with the dialect label \meta{dialect}.
+%\item\dattr{longtimefmt}: the \meta{value} is the long time format associated
+%with the dialect label \meta{dialect}.
+%\item\dattr{medtimefmt}: the \meta{value} is the medium time format associated
+%with the dialect label \meta{dialect}.
+%\item\dattr{shorttimefmt}: the \meta{value} is the short time format associated
+%with the dialect label \meta{dialect}.
+%\item\dattr{fulldatetimefmt}: the \meta{value} is the full date time format
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{longdatetimefmt}: the \meta{value} is the long date time format
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{meddatetimefmt}: the \meta{value} is the medium date time format
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{shortdatetimefmt}: the \meta{value} is the short date time format
+%associated with the dialect label \meta{dialect}.
+%\end{itemize}
+%
+%\paragraph{Day Names}
+%
+%The commands \ics{LocaleDayName}, \ics{LocaleShortDayName},
+%\ics{LocaleStandaloneDayName} and \ics{LocaleStandaloneShortDayName}
+%use these attributes.
+%
+%\begin{itemize}
+%\item\dattr{day.0}: the \meta{value} is the name for day~0 (Monday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{day.1}: the \meta{value} is the name for day~1 (Tuesday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{day.2}: the \meta{value} is the name for day~2 (Wednesday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{day.3}: the \meta{value} is the name for day~3 (Thursday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{day.4}: the \meta{value} is the name for day~4 (Friday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{day.5}: the \meta{value} is the name for day~5 (Saturday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{day.6}: the \meta{value} is the name for day~6 (Sunday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{shortday.0}: the \meta{value} is the short name for day~0 (Monday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{shortday.1}: the \meta{value} is the short name for day~1 (Tuesday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{shortday.2}: the \meta{value} is the short name for day~2 (Wednesday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{shortday.3}: the \meta{value} is the short name for day~3 (Thursday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{shortday.4}: the \meta{value} is the short name for day~4 (Friday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{shortday.5}: the \meta{value} is the short name for day~5 (Saturday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{shortday.6}: the \meta{value} is the short name for day~6 (Sunday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.day.0}: the \meta{value} is the name for day~0 (Monday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.day.1}: the \meta{value} is the standalone name for day~1 (Tuesday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.day.2}: the \meta{value} is the standalone name for day~2 (Wednesday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.day.3}: the \meta{value} is the standalone name for day~3 (Thursday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.day.4}: the \meta{value} is the standalone name for day~4 (Friday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.day.5}: the \meta{value} is the standalone name for day~5 (Saturday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.day.6}: the \meta{value} is the standalone name for day~6 (Sunday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortday.0}: the \meta{value} is the standalone short name for day~0 (Monday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortday.1}: the \meta{value} is the standalone short name for day~1 (Tuesday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortday.2}: the \meta{value} is the standalone short name for day~2 (Wednesday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortday.3}: the \meta{value} is the standalone short name for day~3 (Thursday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortday.4}: the \meta{value} is the standalone short name for day~4 (Friday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortday.5}: the \meta{value} is the standalone short name for day~5 (Saturday)
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortday.6}: the \meta{value} is the standalone short name for day~6 (Sunday)
+%associated with the dialect label \meta{dialect}.
+%\end{itemize}
+%
+%\paragraph{Month Names}
+%
+%The commands \ics{LocaleMonthName}, \ics{LocaleShortMonthName},
+%\ics{LocaleStandaloneMonthName} and \ics{LocaleStandaloneShortMonthName}
+%use these attributes.
+%
+%\begin{itemize}
+%\item\dattr{month.1}: the \meta{value} is the name for month~1
+%(January) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.2}: the \meta{value} is the name for month~2
+%(February) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.3}: the \meta{value} is the name for month~3
+%(March) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.4}: the \meta{value} is the name for month~4
+%(April) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.5}: the \meta{value} is the name for month~5
+%(May) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.6}: the \meta{value} is the name for month~6
+%(June) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.7}: the \meta{value} is the name for month~7
+%(July) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.8}: the \meta{value} is the name for month~8
+%(August) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.9}: the \meta{value} is the name for month~9
+%(September) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.10}: the \meta{value} is the name for month~10
+%(October) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.11}: the \meta{value} is the name for month~11
+%(November) associated with the dialect label \meta{dialect}.
+%\item\dattr{month.12}: the \meta{value} is the name for month~12
+%(December) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.1}: the \meta{value} is the short name for month~1
+%(January) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.2}: the \meta{value} is the short name for month~2
+%(February) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.3}: the \meta{value} is the short name for month~3
+%(March) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.4}: the \meta{value} is the short name for month~4
+%(April) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.5}: the \meta{value} is the short name for month~5
+%(May) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.6}: the \meta{value} is the short name for month~6
+%(June) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.7}: the \meta{value} is the short name for month~7
+%(July) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.8}: the \meta{value} is the short name for month~8
+%(August) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.9}: the \meta{value} is the short name for month~9
+%(September) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.10}: the \meta{value} is the short name for month~10
+%(October) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.11}: the \meta{value} is the short name for month~11
+%(November) associated with the dialect label \meta{dialect}.
+%\item\dattr{shortmonth.12}: the \meta{value} is the short name for month~12
+%(December) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.1}: the \meta{value} is the standalone name for month~1
+%(January) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.2}: the \meta{value} is the standalone name for month~2
+%(February) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.3}: the \meta{value} is the standalone name for month~3
+%(March) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.4}: the \meta{value} is the standalone name for month~4
+%(April) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.5}: the \meta{value} is the standalone name for month~5
+%(May) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.6}: the \meta{value} is the standalone name for month~6
+%(June) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.7}: the \meta{value} is the standalone name for month~7
+%(July) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.8}: the \meta{value} is the standalone name for month~8
+%(August) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.9}: the \meta{value} is the standalone name for month~9
+%(September) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.10}: the \meta{value} is the standalone name for month~10
+%(October) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.11}: the \meta{value} is the standalone name for month~11
+%(November) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.month.12}: the \meta{value} is the standalone name for month~12
+%(December) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.1}: the \meta{value} is the standalone short name for month~1
+%(January) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.2}: the \meta{value} is the standalone short name for month~2
+%(February) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.3}: the \meta{value} is the standalone short name for month~3
+%(March) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.4}: the \meta{value} is the standalone short name for month~4
+%(April) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.5}: the \meta{value} is the standalone short name for month~5
+%(May) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.6}: the \meta{value} is the standalone short name for month~6
+%(June) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.7}: the \meta{value} is the standalone short name for month~7
+%(July) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.8}: the \meta{value} is the standalone short name for month~8
+%(August) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.9}: the \meta{value} is the standalone short name for month~9
+%(September) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.10}: the \meta{value} is the standalone short name for month~10
+%(October) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.11}: the \meta{value} is the standalone short name for month~11
+%(November) associated with the dialect label \meta{dialect}.
+%\item\dattr{standalone.shortmonth.12}: the \meta{value} is the standalone short name for month~12
+%(December) associated with the dialect label \meta{dialect}.
+%\end{itemize}
+%
+%\subsubsection{Time Zones}
+%
+%These attributes won't be set if the time zone information wasn't
+%fetched (with \app{texosquery}'s \texttt{-Z} switch). These attributes
+%include the time zone identifier in the
+%attribute label. (The list of known identifiers is stored
+%in the \texttt{timezone} \attr{timezone}{id} attribute.) For example, \texttt{Europe/London} is the
+%identifier for the UK time zone. So the attribute
+%\texttt{timezone.Europe/London.short} is for the short name for that
+%zone (\texttt{GMT}) and \texttt{timezone.Europe/London.shortdst}
+%is for the short daylight saving name for that zone (\texttt{BST}).
+%
+%\begin{itemize}
+%\item\dattr{timezone.\meta{zone}.short}: the \meta{value} is the
+%short name for the zone identified by \meta{zone}
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{timezone.\meta{zone}.long}: the \meta{value} is the
+%long name for the zone identified by \meta{zone}
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{timezone.\meta{zone}.shortdst}: the \meta{value} is the
+%short daylight saving name for the zone identified by \meta{zone}
+%associated with the dialect label \meta{dialect}.
+%\item\dattr{timezone.\meta{zone}.longdst}: the \meta{value} is the
+%long daylight saving name for the zone identified by \meta{zone}
+%associated with the dialect label \meta{dialect}.
+%\end{itemize}
+%
+%\subsubsection{Numeric}
+%\label{sec:attrnum}
+%
+%\begin{itemize}
+%\item\dattr{groupsep}: the \meta{value} is the numeric group
+%separator associated with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleNumericGroupSep}.)
+%\item\dattr{decsep}: the \meta{value} is the numeric decimal
+%separator associated with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleNumericDecimalSep}.)
+%\item\dattr{currencysep}: the \meta{value} is the numeric currency
+%separator associated with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleNumericMonetarySep}.)
+%\item\dattr{exp}: the \meta{value} is the exponent symbol associated
+%with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleNumericExponent}.)
+%\item\dattr{usesgroup}: the \meta{value} (either 1 or 0) indicates if
+%the number group separator should be used
+%with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleIfNumericUsesGroup}.)
+%\item\dattr{percent}: the \meta{value} is the percentage symbol associated
+%with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleNumericPercent}.)
+%\item\dattr{permill}: the \meta{value} is the per mill symbol associated
+%with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleNumericPermill}.)
+%\item\dattr{decfmt}: the \meta{value} is the decimal format associated
+%with the dialect label \meta{dialect}. (Used by
+%\ics{CurrentLocaleDecimalPattern}.)
+%\item\dattr{intfmt}: the \meta{value} is the integer format associated
+%with the dialect label \meta{dialect}. (Used by
+%\ics{CurrentLocaleIntegerPattern}.)
+%\item\dattr{curfmt}: the \meta{value} is the currency format associated
+%with the dialect label \meta{dialect}. (Used by
+%\ics{CurrentLocaleCurrencyPattern}.)
+%\item\dattr{perfmt}: the \meta{value} is the percent format associated
+%with the dialect label \meta{dialect}. (Used by
+%\ics{CurrentLocalePercentPattern}.)
+%\item\dattr{currency}: the \meta{value} is the currency code associated
+%with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleCurrencyLabel}.)
+%\item\dattr{regionalcurrency}: the \meta{value} is the regional currency code
+%associated with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleCurrencyRegionalLabel}.)
+%\item\dattr{currencysym}: the \meta{value} is the currency symbol associated
+%with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleCurrencySymbol}, if the \attrfmt{currency}
+%attribute isn't \texttt{XXX}.)
+%\item\dattr{currencytex}: the \meta{value} is the \TeX\ code
+%representing the currency symbol associated
+%with the dialect label \meta{dialect}. (Used by
+%\ics{LocaleCurrencyTeXSymbol}, if the \attrfmt{currency}
+%attribute isn't \texttt{XXX}.)
+%\end{itemize}
+%
+%Note that the currency information is also available through
+%the currency attributes \cattr{official}, \cattr{sym} and \cattr{tex}.
+%The dialect attribute allows for a different symbol to be
+%used within the context of a specific dialect. For example,
+%if a country has multiple scripts (such as Latin and Cyrillic)
+%then the dialect currency symbol can reflect a specific script,
+%whereas the currency \cattr{sym} attribute might be in the default
+%script.
+%
+%
+%\subsection{Region Attributes}
+%\label{sec:regionattr}
+%
+%The following attributes are associated with region and can be set
+%using
+%\begin{code}
+%\cs{LocaleSetRegionAttribute}\marg{region code}\marg{attribute}\marg{value}
+%\end{code}
+%or fetched with
+%\begin{code}
+%\cs{LocaleGetRegionAttribute}\marg{region code}\marg{attribute}
+%\end{code}
+%
+%\begin{itemize}
+%\item\rattr{currency}: the regional currency code (for
+%example, \texttt{IMP}).
+%\item\rattr{dialect}: a comma-separated list of the dialects
+%associated with this region. For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{fr-BE,nl-BE}
+%\input locale
+%
+%GB: \LocaleGetRegionAttribute{GB}{dialect}.
+%BE: \LocaleGetRegionAttribute{BE}{dialect}.
+%
+%\bye
+%\end{verbatim}
+%produces: GB: british. BE: belgique,flemish.
+%\end{itemize}
+%
+%
+%\subsection{Currency Attributes}
+%\label{sec:currencyattr}
+%
+%The following attributes are associated with currency and can be set
+%using
+%\begin{code}
+%\cs{LocaleSetCurrencyAttribute}\marg{code}\marg{attribute}\marg{value}
+%\end{code}
+%or fetched with
+%\begin{code}
+%\cs{LocaleGetCurrencyAttribute}\marg{code}\marg{attribute}
+%\end{code}
+%where \meta{code} is the ISO currency code or regional currency
+%code.
+%
+%\begin{itemize}
+%\item\cattr{region}: a comma-separated list of regions that
+%use this currency. If the regional currency code is different from
+%the official ISO currency code, then both codes will have this
+%attribute set. For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{en-IM}
+%
+%\input locale
+%
+%GBP: \LocaleGetCurrencyAttribute{GBP}{region}.
+%IMP: \LocaleGetCurrencyAttribute{IMP}{region}.
+%
+%\bye
+%\end{verbatim}
+%produces: GBP: GB,IM. IMP: IM.
+%
+%\item \cattr{official}: the official ISO currency code for
+%\meta{code}. In most cases this will be the same as \meta{code}.
+%For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{en-IM}
+%
+%\input locale
+%
+%GBP: \LocaleGetCurrencyAttribute{GBP}{official}.
+%IMP: \LocaleGetCurrencyAttribute{IMP}{official}.
+%
+%\bye
+%\end{verbatim}
+%produces: GBP: GBP. IMP: GBP.
+%
+%\item\cattr{sym}: the currency symbol (using characters, not
+%\TeX\ commands, except for \verb|\$|) for regional currency
+%\meta{code}.
+%
+%\item\cattr{tex}: the currency symbol using \TeX\ code (such
+%as \cs{texosquerycurrencypound}) for regional currency
+%\meta{code}.
+%\end{itemize}
+%
+%\section{Patterns}
+%\label{sec:patterns}
+%
+%The \sty{texosquery} package provides for two types of patterns:
+%date-time and numeric. The date-time patterns may just display a
+%date, or just a time or both. They may or may not include a time
+%zone. The numeric patterns can be used to format integers, decimals,
+%scientific notation, percentages or currency. New patterns can be
+%defined by commands provided in \file{texosquery.tex}. The
+%\sty{tex-locale} package can also fetch the patterns for the document
+%locales so that they can be applied to data in the document
+%to match the current locale.
+%
+%The numeric patterns are fairly easy to use but are tricky to
+%define. The date-time patterns are fairly easy to define but are
+%tricky to use.
+%
+%\subsection{Numeric Patterns}
+%\label{sec:numpatterns}
+%
+%The \sty{texosquery} numeric pattern symbol commands are redefined
+%by \sty{tex-locale} to use the appropriate symbol from the current
+%locale. For example, \ics{texosquerypatfmtgroupsep} is redefined to
+%use \cs{CurrentLocaleNumericGroupSep}. (See the \sty{texosquery}
+%documentation for further details of these pattern commands.)
+%
+%You can access a numeric pattern for a particular locale by querying
+%one of the dialect attributes listed in \sectionref{sec:attrnum}: \dattr{intfmt} (integer pattern),
+%\dattr{decfmt} (decimal pattern), \dattr{curfmt} (currency pattern) or
+%\dattr{perfmt} (percent pattern).
+%
+%These can be accessed explicitly using
+%\begin{definition}
+%\ics{LocaleGetDialectAttribute}\marg{dialect}\marg{attribute}
+%\end{definition}
+%For example:
+%\begin{verbatim}
+%\LocaleGetDialectAttribute{british}{intfmt}
+%\end{verbatim}
+%However it's simpler to use the shortcut commands described in
+%\sectionref{sec:currpat}. For example:
+%\begin{verbatim}
+%\CurrentLocaleIntegerPattern
+%\end{verbatim}
+%
+%A pattern can be used in two ways. If it's simply used in the
+%document, then it just reproduces the pattern specification. For
+%example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\input locale
+%
+%{\tt \CurrentLocaleDecimalPattern}
+%\bye
+%\end{verbatim}
+%This simply produces:
+%\begin{quote}
+%\texttt{\#,\#\#\#,\#\#\#,\#\#0.\#\#\#\#\#\#\#\#\#\#}
+%\end{quote}
+%This can be used for debugging purposes to check the pattern.
+%
+%The second use is to apply the pattern to a number. This is done
+%with \sty{texosquery}'s \cs{texosqueryfmtnumber} command:
+%\begin{definition}
+%\ics{texosqueryfmtnumber}\marg{pattern}\marg{int part}\marg{frac
+%part}\marg{mantissa}
+%\end{definition}
+%where \meta{pattern} is the pattern (defined using
+%\cs{texosquerydefpattern} or fetched with the \app{texosquery}
+%application), \meta{int part} is the integer part, \meta{frac part}
+%is the fractional part and \meta{mantissa} is the exponent part.
+%
+%For example:
+%\begin{verbatim}
+%% arara: xetex: {shell: on}
+%
+%\def\LocaleMain{en-GB}
+%\input locale
+%
+%\texosqueryfmtnumber{\CurrentLocaleIntegerPattern}{12}{34567}{4}
+%
+%\texosqueryfmtnumber{\CurrentLocaleCurrencyPattern}{12345}{67}{0}
+%
+%\texosqueryfmtnumber{\CurrentLocaleDecimalPattern}{123}{4567}{2}
+%
+%\texosqueryfmtnumber{\CurrentLocalePercentPattern}{123}{4567}{2}
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%123,456
+%
+%GBP12,345.67
+%
+%12,345.67
+%
+%1,234,567\%
+%\end{quote}
+%There are some shortcut commands provided, to allow for more
+%convenient code.
+%
+%A numeric pattern can be applied to a numeric value using
+%\begin{definition}[\DescribeMacro\localenumfmt]
+%\cs{localenumfmt}\marg{pattern}\marg{decimal}
+%\end{definition}
+%where \meta{pattern} is the pattern (as for \cs{texosqueryfmtnumber})
+%and \meta{decimal} is the numeric value in the form
+%\meta{int}\texttt{.}\meta{frac}\texttt{E}\meta{mantissa}
+%(where \texttt{.} represents the decimal separator and \texttt{E} represents
+%the exponent separator, regardless of locale). The \texttt{.}\meta{frac} and
+%\texttt{E}\meta{mantissa} parts are optional.
+%
+%The \cs{localenumfmt} command splits up \meta{decimal} into the
+%\meta{int part}, \meta{frac part} and \meta{mantissa} required by
+%\cs{texosqueryfmtnumber}. It then does
+%\begin{code}
+%\meta{fmt cs}\{\cs{texosqueryfmtnumber}\marg{pattern}\marg{int part}\marg{frac part}\marg{mantissa}
+%\end{code}
+%where \meta{fmt cs} is one of:
+%\begin{definition}[\DescribeMacro\localenumfmtneg]
+%\cs{localenumfmtneg}\marg{text}
+%\end{definition}
+%if the \meta{int part} is negative,
+%\begin{definition}[\DescribeMacro\localenumfmtzero]
+%\cs{localenumfmtzero}\marg{text}
+%\end{definition}
+%if the \meta{int part}, \meta{frac part} and \meta{mantissa} are all
+%zero, otherwise
+%\begin{definition}[\DescribeMacro\localenumfmtpos]
+%\cs{localenumfmtpos}\marg{text}
+%\end{definition}
+%These three commands all simply default to just doing \meta{text}.
+%
+%\begin{definition}[\DescribeMacro\localeint]
+%\cs{localeint}\marg{value}
+%\end{definition}
+%This is equivalent to
+%\begin{definition}
+%\cs{localenumfmt}\{\cs{CurrentLocaleIntegerPattern}\}\marg{value}
+%\end{definition}
+%
+%\begin{definition}[\DescribeMacro\localedec]
+%\cs{localedec}\marg{decimal}
+%\end{definition}
+%As above but uses \cs{CurrentLocaleDecimalPattern}.
+%
+%\begin{definition}[\DescribeMacro\localecur]
+%\cs{localecur}\marg{decimal}
+%\end{definition}
+%As above but uses \cs{CurrentLocaleCurrencyPattern}.
+%
+%\begin{definition}[\DescribeMacro\localeper]
+%\cs{localeper}\marg{decimal}
+%\end{definition}
+%As above but uses \cs{CurrentLocalePercentPattern}.
+%
+%The above example can be simplified to:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\input locale
+%
+%\localeint{12.34567E4}
+%
+%\localecur{12345.67}
+%
+%\localedec{123.4567E2}
+%
+%\localeper{123.4567E2}
+%\bye
+%\end{verbatim}
+%This produces the same result as before.
+%
+%As described in \sectionref{sec:currnumsym}, the currency unit can
+%be switched to a symbol by redefining \cs{localecurrchoice}. For
+%example:
+%\begin{verbatim}
+%\font\nimbus="NimbusRoman-Regular" at 10pt
+%\nimbus
+%
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{pt-BR,de-CH-1996}
+%\input locale
+%
+%\def\localecurrchoice#1#2#3#4{#3}
+%
+%en-GB: \localecur{12345.67}
+%
+%\selectlocale{pt-BR}
+%pt-BR: \localecur{12345.67}
+%
+%\selectlocale{de-CH-1996}
+%de-CH-1996: \localecur{12345.67}
+%
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%en-GB: \pounds 12,345.67
+%
+%pt-BR: R\$ 12.345,67
+%
+%de-CH-1996: SFr. 12'345.67
+%\end{quote}
+%
+%You can define your own pattern using the commands provided by
+%\sty{texosquery}. For example:
+%\begin{verbatim}
+%\texosquerydefpattern{\sinumpattern}{%
+% \sinumfmt
+% {\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\#\#\#\#\#\#\#\#\#}}%
+% {\-\#\#\#\#\#\#\#\#\0\0}%
+%}
+%\end{verbatim}
+%This can then be used with \cs{localenumfmt}. The \sty{texosquery}
+%documentation includes other examples, including a currency pattern
+%that shifts the sign before the currency symbol for negative
+%amounts:
+%\begin{verbatim}
+%\texosquerydefpattern{\curpattern}{%
+%\pmnumfmt
+%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{}}%
+%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{\-}}}
+%\end{verbatim}
+%(No sign is used for positive amounts.)
+%
+%Here's a complete document:
+%\begin{verbatim}
+%\font\nimbus="NimbusRoman-Regular" at 10pt
+%\nimbus
+%
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{pt-BR,de-CH-1996}
+%\input locale
+%
+%\def\localecurrchoice#1#2#3#4{#3}
+%
+%\texosquerydefpattern{\sinumpattern}{%
+% \sinumfmt
+% {\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\#\#\#\#\#\#\#\#\#}}%
+% {\-\#\#\#\#\#\#\#\#\0\0}%
+%}
+%
+%\texosquerydefpattern{\curpattern}{%
+%\pmnumfmt
+%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{}}%
+%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{\-}}}
+%
+%en-GB:
+%\localenumfmt{\sinumpattern}{1.2345E-3}.
+%\localenumfmt{\curpattern}{12345.6}.
+%\localenumfmt{\curpattern}{-12345.6}.
+%\localenumfmt{\curpattern}{0}.
+%
+%\selectlocale{pt-BR}
+%pt-BR:
+%\localenumfmt{\sinumpattern}{1.2345E-3}.
+%\localenumfmt{\curpattern}{12345.6}.
+%\localenumfmt{\curpattern}{-12345.6}.
+%\localenumfmt{\curpattern}{0}.
+%
+%\selectlocale{de-CH-1996}
+%de-CH-1996:
+%\localenumfmt{\sinumpattern}{1.2345E-3}.
+%\localenumfmt{\curpattern}{12345.6}.
+%\localenumfmt{\curpattern}{-12345.6}.
+%\localenumfmt{\curpattern}{0}.
+%
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%en-GB: 1.2345E$-$03. \pounds 12,345.60. $-$\pounds12,345.60.
+%\pounds0.00.
+%
+%pt-BR: 1,2345E$-$03. R\$12.345,60. $-$R\$12.345,60.
+%R\$0,00.
+%
+%de-CH-1996: 1.2345E$-$03. SFr.12'345.60. $-$SFr.12'345.60.
+%SFr.0.00.
+%\end{quote}
+%
+%Here's a \LaTeX\ alternative that redefines the formatting commands
+%used by \cs{localenumfmt}:
+%\begin{verbatim}
+%\documentclass{article}
+%
+%\usepackage{color}
+%\usepackage[main={en-GB},other={pt-BR,de-CH-1996}]{tex-locale}
+%\setmainfont{NimbusRoman-Regular}
+%
+%\texosquerydefpattern{\sinumpattern}{%
+% \sinumfmt
+% {\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\#\#\#\#\#\#\#\#\#}}%
+% {\-\#\#\#\#\#\#\#\#\0\0}%
+%}
+%
+%\texosquerydefpattern{\curpattern}{%
+%\pmnumfmt
+%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{}}%
+%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{\-}}}
+%
+%\renewcommand*{\localenumfmtpos}[1]{\textcolor{green}{#1}}
+%\renewcommand*{\localenumfmtneg}[1]{\textcolor{red}{#1}}
+%\renewcommand*{\localenumfmtzero}[1]{\textbf{#1}}
+%
+%\begin{document}
+%
+%en-GB:
+%\localenumfmt{\sinumpattern}{1.2345E-3}.
+%\localenumfmt{\curpattern}{12345.6}.
+%\localenumfmt{\curpattern}{-12345.6}.
+%\localenumfmt{\curpattern}{0}.
+%
+%\selectlocale{pt-BR}
+%pt-BR:
+%\localenumfmt{\sinumpattern}{1.2345E-3}.
+%\localenumfmt{\curpattern}{12345.6}.
+%\localenumfmt{\curpattern}{-12345.6}.
+%\localenumfmt{\curpattern}{0}.
+%
+%\selectlocale{de-CH-1996}
+%de-CH-1996:
+%\localenumfmt{\sinumpattern}{1.2345E-3}.
+%\localenumfmt{\curpattern}{12345.6}.
+%\localenumfmt{\curpattern}{-12345.6}.
+%\localenumfmt{\curpattern}{0}.
+%\end{document}
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%en-GB: \textcolor{green}{1.2345E$-$03}.
+%\textcolor{green}{\pounds 12,345.60}.
+%\textcolor{red}{$-$\pounds12,345.60}.
+%\textbf{\pounds0.00}.
+%
+%pt-BR: \textcolor{green}{1,2345E$-$03}.
+%\textcolor{green}{R\$12.345,60}.
+%\textcolor{red}{$-$R\$12.345,60}.
+%\textbf{R\$0,00}.
+%
+%de-CH-1996: \textcolor{green}{1.2345E$-$03}.
+%\textcolor{green}{SFr.12'345.60}.
+%\textcolor{red}{$-$SFr.12'345.60}.
+%\textbf{SFr.0.00}.
+%\end{quote}
+%
+%\subsection{Date-Time Patterns}
+%\label{sec:datetimepat}
+%
+%In addition to providing locale-sensitive strings for the current
+%date-time, the \app{texosquery} application can also provide the
+%locale's pattern that's used to describe how the dates and times
+%should be formatted. Additionally, it can provide time-zone mappings
+%from identifying labels to locale-sensitive names. Both these things
+%require extra overhead and so these functions aren't on by default.
+%
+%You can enable them by defining
+%\begin{definition}[\DescribeMacro\LocaleIfDateTimePatternsSupported]
+%\cs{LocaleIfDateTimePatternsSupported}\marg{true}\marg{false}
+%\end{definition}
+%\emph{before} you input \file{tex-locale.tex}. \LaTeX\ users can use the
+%more convenient \pkgopt{timedata} package option:
+%\begin{verbatim}
+%\usepackage[timedata]{tex-locale}
+%\end{verbatim}
+%Plain \TeX\ users need to define
+%\cs{LocaleIfDateTimePatternsSupported} so that it does the \meta{true}
+%argument and ignores the \meta{false} argument:
+%\begin{verbatim}
+%\def\LocaleIfDateTimePatternsSupported#1#2{#1}
+%\input locale
+%\end{verbatim}
+%
+%If enabled, \sty{tex-locale} will add the \texttt{-M} and \texttt{-Z}
+%switches to the \app{texosquery} command invocation. This will
+%additionally redefine \sty{texosquery}'s pattern format commands
+%(such as \cs{texosqueryfmtpatMMM}) to use the appropriate commands
+%for the current locale. For example, \cs{texosqueryfmtpatMMM}\marg{n} is
+%redefined to use \cs{CurrentLocaleShortMonthName}\marg{n}. (See the
+%\sty{texosquery} documentation for further details on these
+%commands.)
+%
+%If date-time patterns are supported then the current date-time data will be
+%stored in
+%\begin{definition}[\DescribeMacro\LocaleDateTimeInfo]
+%\cs{LocaleDateTimeInfo}
+%\end{definition}
+%This will be empty if date-time patterns aren't supported.
+%
+%The value of this command contains all the information for the current date-time provided
+%in a format that can easily be parsed by date or time patterns.
+%(This is done through \sty{texosquery}'s \ics{texosqueryfmtdatetime}
+%command, which is internally used by
+%\ics{LocaleApplyDateTimePattern}, described below.)
+%For example, \cs{LocaleDateTimeInfo} might be set to
+%\begin{verbatim}
+%{1}{2017}{2017}{3}{12}{4}{85}{26}{4}{7}{1}{19}{19}{7}{7}{16}{39}{136}
+%{{1}{0}{Europe/London}{1}}
+%\end{verbatim}
+%(Line break inserted above for clarity.) See the \sty{texosquery}
+%documentation for details of this syntax.
+%
+%Alternatively you can use \sty{texosquery}'s pattern generator to
+%create your own date-time pattern and explicitly use
+%\cs{texosqueryfmtdatetime}. In which case \cs{LocaleDateTimeInfo}
+%provides a convenient way of applying the pattern to the current
+%date-time. For example:
+%\begin{verbatim}
+%\def\LocaleIfDateTimePatternsSupported#1#2{#1}
+%\def\LocaleMain{en-GB}
+%\input locale
+%
+%\texosquerydefpattern{\pattern}{\%3E \%1d \%3M \%4y \%2H:\%2m:\%2s \%2z}
+%
+%\ifx\LocaleDateTimeInfo\empty
+%\else
+% \expandafter\texosqueryfmtdatetime\expandafter\pattern\LocaleDateTimeInfo
+%\fi
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%Sun 26 Mar 2017 21:38:06 BST
+%\end{quote}
+%(assuming that was the date and time of the document build). The
+%textual elements (\qt{Sun}, \qt{Mar} and \qt{BST}) are obtained from
+%the current locale.
+%
+%If the date-time patterns are supported, you can apply a pattern to
+%a specific date or time using
+%\begin{definition}[\DescribeMacro\LocaleApplyDateTimePattern]
+%\cs{LocaleApplyDateTimePattern}\marg{dialect}\marg{attribute}\marg{data}
+%\end{definition}
+%This uses \sty{texosquery}'s \cs{texosqueryfmtdatetime} command to
+%format a date or time according to a date-time pattern (identified
+%by \meta{attribute}) for the locale identified by \meta{dialect}.
+%The \sty{texosquery} manual provides further details on this
+%command, but essentially the first argument of \cs{texosqueryfmtdatetime}
+%should be a control sequence containing the special pattern markup
+%and the remaining arguments are the date-time data, which are
+%supplied in the \meta{data} argument of \cs{LocaleApplyDateTimePattern}.
+%
+%The \ics{LocaleDateTimeInfo} command will either be empty or set to
+%the correct data for the current date and time. This can be used
+%in the \meta{data} argument. Since \cs{LocaleDateTimeInfo} might be
+%empty, \cs{LocaleApplyDateTimePattern} will first test for this and
+%not try applying the pattern in that case. (Remember that you can
+%also define your own custom date-time patterns, as mentioned in
+%\sectionref{sec:general}.)
+%
+%Note that the \meta{dialect} is used to fetch the pattern data, but
+%the month and day names will be obtained using the
+%\cs{CurrentLocale\ldots} commands described in
+%\sectionref{sec:currdatetime}, which may not match \meta{dialect}.
+%In general it's easiest to use the shortcut
+%\ics{CurrentLocaleApplyDateTimePattern} (\sectionref{sec:currpat}) instead to ensure the
+%pattern matches the current locale.
+%
+%The attributes associated with date-time patterns are listed below
+%(see \sectionref{sec:attrdatetime}).
+%\begin{itemize}
+%\item \dattr{fulldatefmt}: the full date format pattern (as used in
+%\cs{LocaleFullDate}).
+%\item \dattr{longdatefmt}: the long date format pattern (as used in
+%\cs{LocaleLongDate}).
+%\item \dattr{meddatefmt}: the medium date format pattern (as used in
+%\cs{LocaleMediumDate}).
+%\item \dattr{shortdatefmt}: the short date format pattern (as used in
+%\cs{LocaleShortDate}).
+%\item \dattr{fulltimefmt}: the full time format pattern (as used in
+%\cs{LocaleFullTime}).
+%\item \dattr{longtimefmt}: the long time format pattern (as used in
+%\cs{LocaleLongTime}).
+%\item \dattr{medtimefmt}: the medium time format pattern (as used in
+%\cs{LocaleMediumTime}).
+%\item \dattr{shorttimefmt}: the short time format pattern (as used in
+%\cs{LocaleShortTime}).
+%\item \dattr{fulldatetimefmt}: the full date and time format pattern.
+%\item \dattr{longdatetimefmt}: the long date and time format pattern.
+%\item \dattr{meddatetimefmt}: the medium date and time format pattern.
+%\item \dattr{shortdatetimefmt}: the short date and time format pattern.
+%\end{itemize}
+%
+%For example:
+%\begin{verbatim}
+%\def\LocaleIfDateTimePatternsSupported#1#2{#1}
+%\def\LocaleMain{en-GB}
+%
+%\input locale
+%
+%Now:
+%\CurrentLocaleApplyDateTimePattern{fulldatetimefmt}{\LocaleDateTimeInfo}.
+%\bye
+%\end{verbatim}
+%This displays:
+%\begin{quote}
+%Now: Sunday, 26 March 2017 21:12:10 British Summer Time.
+%\end{quote}
+%However, it's simpler to just use:
+%\begin{verbatim}
+%\def\LocaleIfDateTimePatternsSupported#1#2{#1}
+%\def\LocaleMain{en-GB}
+%
+%\input locale
+%
+%\def\localedatechoice#1#2#3#4{#1}
+%\def\localetimechoice#1#2#3#4{#1}
+%
+%Now: \CurrentLocaleDateTime.
+%\bye
+%\end{verbatim}
+%or with \LaTeX:
+%\begin{verbatim}
+%\documentclass{article}
+%
+%\usepackage[timedata,date=full,time=full,main={en-GB}]{tex-locale}
+%
+%\begin{document}
+%Now: \CurrentLocaleDateTime.
+%\end{document}
+%\end{verbatim}
+%
+%The date-time patterns are therefore more useful when applied to
+%something other that the current date-time. However, it's more
+%complicated to work out the data.
+%
+%For example:
+%\begin{verbatim}
+%\def\LocaleIfDateTimePatternsSupported#1#2{#1}
+%\def\LocaleMain{en-GB}
+%
+%\input locale
+%
+%\CurrentLocaleApplyDateTimePattern{fulldatetimefmt}%
+%{{1}{2017}{2017}{3}{12}{4}{85}{26}{4}{7}{1}{21}{21}{9}{9}{23}{36}{140}%
+%{{1}{0}{Europe/London}{1}}}
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%Sunday, 26 March 2017 21:23:36 British Summer Time.
+%\end{quote}
+%
+%
+%\section{Locale Information}
+%\label{sec:localedata}
+%
+%Information about each locale is fetched for each tracked dialect (the
+%main locale, identified by \cs{LocaleMain}, and the other locales,
+%identified by \cs{LocaleOther}). This information can be accessed
+%using the commands described below, where \meta{dialect} is a
+%\sty{tracklang} dialect label that identifies the locale. There are convenient commands
+%(\cs{CurrentLocale\ldots}) that select the appropriate command with
+%the label provided by the currently selected dialect. (See
+%\sectionref{sec:currentlocale}.)
+%
+%Most of the commands in this package are intended to be used in an
+%expandable context, and so will expand to nothing if the dialect isn't
+%recognised.
+%
+%\begin{definition}[\DescribeMacro\LocaleMainDialect]
+%\cs{LocaleMainDialect}
+%\end{definition}
+%This expands to the main locale's dialect label. For example with:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\input locale
+%\end{verbatim}
+%the main dialect is \texttt{british}.
+%
+%\begin{definition}[\DescribeMacro\LocaleMainRegion]
+%\cs{LocaleMainRegion}
+%\end{definition}
+%This expands to the main locale's region. For example, if the main
+%locale is \texttt{en-GB}, then the main region is \texttt{GB}.
+%
+%\begin{definition}[\DescribeMacro\LocaleLanguageTag]
+%\cs{LocaleLanguageTag}\marg{dialect}
+%\end{definition}
+%Expands to the language tag for the given dialect. For example, if
+%the document locales are set using:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{pt-BR,fr-BE,de-CH-1996}
+%\input locale
+%\end{verbatim}
+%then
+%\begin{verbatim}
+%\LocaleLanguageTag{british}
+%\end{verbatim}
+%will expand to \texttt{en-GB} and
+%\begin{verbatim}
+%\LocaleLanguageTag{nswissgerman}
+%\end{verbatim}
+%will expand to \texttt{de-CH-1996}.
+%
+%\begin{definition}[\DescribeMacro\LocaleLanguageName]
+%\cs{LocaleLanguageName}\marg{dialect}
+%\end{definition}
+%The name of the language associated with \meta{dialect} provided in
+%the Java virtual machine's default language.
+%
+%\begin{definition}[\DescribeMacro\LocaleLanguageNativeName]
+%\cs{LocaleLanguageNativeName}\marg{dialect}
+%\end{definition}
+%The name of the language associated with \meta{dialect} provided in
+%that language.
+%
+%For example:
+%\begin{verbatim}
+%\font\nimbus="NimbusRoman-Regular" at 10pt
+%\nimbus
+%
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{pt-BR,fr-BE}
+%
+%\input locale
+%
+%en-GB: \LocaleLanguageName{british}.
+%pt-BR: \LocaleLanguageName{brazilian}.
+%fr-BE: \LocaleLanguageName{belgique}.
+%\bye
+%\end{verbatim}
+%For me this produces:
+%\begin{quote}
+%en-GB: English. pt-BR: Portuguese. fr-BE: French.
+%\end{quote}
+%because my operating system's default language is English. If I
+%edit the \app{texosquery-jre8} bash script so that it includes
+%\begin{verbatim}
+%-Duser.language=fr
+%\end{verbatim}
+%in the \app{java} arguments, then the same document will produce:
+%\begin{quote}
+%en-GB: anglais. pt-BR: portugais. fr-BE: fran\c{c}ais.
+%\end{quote}
+%So this isn't necessarily in the same language as the main locale (or
+%any of the other locales tracked in the document). It's in the Java
+%virtual machine's default language. Compare this document with:
+%\begin{verbatim}
+%\font\nimbus="NimbusRoman-Regular" at 10pt
+%\nimbus
+%
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{pt-BR,fr-BE}
+%
+%\input locale
+%
+%en-GB: \LocaleLanguageNativeName{british}.
+%pt-BR: \LocaleLanguageNativeName{brazilian}.
+%fr-BE: \LocaleLanguageNativeName{belgique}.
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%en-GB: English. pt-BR: portugu\^es. fr-BE: fran\c{c}ais.
+%\end{quote}
+%So in this case each name is displayed according to its own language.
+%
+%There are similar commands for the region and variant.
+%\begin{definition}[\DescribeMacro\LocaleRegionName]
+%\cs{LocaleRegionName}\marg{dialect}
+%\end{definition}
+%The name of the region associated with \meta{dialect} provided in
+%the Java virtual machine's default language. This will be an empty
+%string if the region wasn't supplied.
+%
+%\begin{definition}[\DescribeMacro\LocaleRegionNativeName]
+%\cs{LocaleRegionNativeName}\marg{dialect}
+%\end{definition}
+%The name of the region associated with \meta{dialect} provided in
+%that language. This will be an empty string if the region wasn't supplied.
+%
+%\begin{definition}[\DescribeMacro\LocaleVariantName]
+%\cs{LocaleVariantName}\marg{dialect}
+%\end{definition}
+%The name of the variant associated with \meta{dialect} provided in
+%the Java virtual machine's default language. This will be an empty
+%string if a variant wasn't supplied.
+%
+%\begin{definition}[\DescribeMacro\LocaleVariantNativeName]
+%\cs{LocaleVariantNativeName}\marg{dialect}
+%\end{definition}
+%The name of the variant associated with \meta{dialect} provided in
+%that language. This will be an empty string if a variant wasn't supplied.
+%This may well be the same as \cs{LocaleVariantName} as the variants
+%are often identifiers (such as \texttt{1996} in the case of
+%\texttt{de-CH-1996}) that remain the same in different languages.
+%
+%You can find out if the language name, region name or variant have
+%been set using the commands listed below. In each case,
+%\meta{dialect} is again the dialect label, \meta{true} is the code
+%to do if the condition is true and \meta{false} is the code to do if
+%the condition is false.
+%
+%\begin{definition}[\DescribeMacro\LocaleIfHasLanguageName]
+%\cs{LocaleIfHasLanguageName}\marg{dialect}\marg{true}\marg{false}
+%\end{definition}
+%This tests if the dialect has an associated language name. This will
+%typically be true.
+%
+%\begin{definition}[\DescribeMacro\LocaleIfHasRegionName]
+%\cs{LocaleIfHasRegionName}\marg{dialect}\marg{true}\marg{false}
+%\end{definition}
+%This tests if the dialect has an associated region name. Some
+%language tags don't have regions supplied. For example:
+%\begin{verbatim}
+%\def\LocaleMain{en}
+%\input locale
+%\end{verbatim}
+%In this case, there's no region associated with the main locale.
+%
+%\begin{definition}[\DescribeMacro\LocaleIfHasVariantName]
+%\cs{LocaleIfHasVariantName}\marg{dialect}\marg{true}\marg{false}
+%\end{definition}
+%This tests if the dialect has an associated variant name. For
+%example, there's no variant in \texttt{de-DE} but there is a variant
+%in \texttt{de-DE-1996}.
+%
+%\section{Dates and Times}
+%\label{sec:datetimes}
+%
+%Date and time information is fetched for each tracked dialect.
+%The \file{tex-locale.tex} code doesn't
+%modify \ics{today} (although the \file{tex-locale.sty} \LaTeX\ package
+%can load \sty{datetime2}, which does). Instead, the dates or times
+%for a specific locale can be obtained using the commands listed
+%below. The \meta{dialect} argument indicates the \sty{tracklang}
+%dialect label. See \sectionref{sec:currentlocale} for shortcut
+%commands that select the appropriate command with the label of the
+%currently selected locale.
+%
+%Dates and times are wrapped in a formatting command:
+%\begin{definition}[\DescribeMacro\localedatetimefmt]
+%\cs{localedatetimefmt}\marg{date-time text}
+%\end{definition}
+%By default this simply does its argument. For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%
+%\input locale
+%
+%\def\localedatetimefmt#1{{\it #1}}
+%
+%Date: \LocaleFullDate{british}.
+%
+%\bye
+%\end{verbatim}
+%This displays the date in italic. The \LaTeX\ equivalent is:
+%\begin{verbatim}
+%\documentclass{article}
+%\usepackage[main=en-GB]{tex-locale}
+%
+%\renewcommand*{\localedatetimefmt}[1]{\textit{#1}}
+%
+%\begin{document}
+%Date: \LocaleFullDate{british}.
+%\end{document}
+%\end{verbatim}
+%
+%\subsection{Dates}
+%\label{sec:localedates}
+%
+%\begin{definition}[\DescribeMacro\LocaleFullDate]
+%\cs{LocaleFullDate}\marg{dialect}
+%\end{definition}
+%This displays the full date for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%\begin{definition}[\DescribeMacro\LocaleLongDate]
+%\cs{LocaleLongDate}\marg{dialect}
+%\end{definition}
+%This displays the long date for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%\begin{definition}[\DescribeMacro\LocaleMediumDate]
+%\cs{LocaleMediumDate}\marg{dialect}
+%\end{definition}
+%This displays the medium date for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%\begin{definition}[\DescribeMacro\LocaleShortDate]
+%\cs{LocaleShortDate}\marg{dialect}
+%\end{definition}
+%This displays the short date for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%
+%\input locale
+%
+%Full: \LocaleFullDate{british}.
+%Long: \LocaleLongDate{british}.
+%Medium: \LocaleMediumDate{british}.
+%Short: \LocaleShortDate{british}.
+%\bye
+%\end{verbatim}
+%In the above, the main locale is explicitly set by defining \cs{LocaleMain}
+%before loading \file{tex-locale.tex}. The \sty{tracklang} package
+%identifies the \texttt{en-GB} locale with the label
+%\texttt{british}.
+%
+%Different locales have different concepts of full, long, medium and
+%short dates. In most cases the short form is numeric and the full
+%form is textual. The medium form may be numeric or it may use an
+%abbreviated month name. The locale provided used by Java may also
+%influence the result. For example, if you are using
+%\app{texosquery-jre8} with \texttt{java.locale.providers} set to
+%\texttt{CLDR,JRE} then the above document will display (assuming
+%today is 2017-03-26):
+%\begin{quote}
+%Full: Sunday, 26 March 2017. Long: 26 March 2017. Medium: 26 Mar
+%2017. Short: 26/03/2017.
+%\end{quote}
+%However, if I instead use the Java 7 version (\file{texosquery.jar})
+%which doesn't support the CLDR, then the above document will
+%display:
+%\begin{quote}
+%Full: Sunday, 26 March 2017. Long: 26 March 2017. Medium:
+%26-Mar-2017. Short: 26/03/17.
+%\end{quote}
+%The CLDR provides more extensive locale support than the JRE. In the
+%case of \texttt{en-GB}, the difference is minor (as shown above),
+%but in some cases a language may be supported in the CLDR but not in
+%the JRE. For example, if in the above document I change the main
+%locale to \texttt{cy-GB} (which maps to the \sty{tracklang dialect
+%label \texttt{GBwelsh}}):
+%\begin{verbatim}
+%\def\LocaleMain{cy-GB}
+%
+%\input locale
+%
+%Full: \LocaleFullDate{GBwelsh}.
+%Long: \LocaleLongDate{GBwelsh}.
+%Medium: \LocaleMediumDate{GBwelsh}.
+%Short: \LocaleShortDate{GBwelsh}.
+%\bye
+%\end{verbatim}
+%then the Java 7 version produces US English dates:
+%\begin{quote}
+%Full: Sunday, March 26, 2017. Long: March 26, 2017. Medium: Mar 26,
+%2017. Short: 3/26/17.
+%\end{quote}
+%This is because Welsh isn't supported by the JRE, but it is
+%supported by the CLDR, so the Java 8 version (\app{texosquery-jre8})
+%does work (provided \texttt{java.locale.providers} is set to
+%\texttt{CLDR,JRE}):
+%\begin{quote}
+%Full: Dydd Sul, 26 Mawrth 2017. Long: 26 Mawrth 2017. Medium: 26
+%Mawrth 2017. Short: 26/03/2017.
+%\end{quote}
+%
+%\subsubsection{Week Days}
+%\label{sec:weekdays}
+%
+%In order to be compatible with \sty{pgfcalendar} (and hence
+%\sty{datetime2}), the \sty{tex-locale} package uses
+%a zero-based indexing where 0 represents Monday, 1 represents
+%Tuesday, etc. If you can't remember the index for a particular day,
+%you can use the following commands:
+%\begin{definition}[\DescribeMacro\dtmMondayIndex]
+%\cs{dtmMondayIndex}
+%\end{definition}
+%This expands to 0, the index for Monday.
+%
+%\begin{definition}[\DescribeMacro\dtmTuesdayIndex]
+%\cs{dtmTuesdayIndex}
+%\end{definition}
+%This expands to 1, the index for Tuesday.
+%
+%\begin{definition}[\DescribeMacro\dtmWednesdayIndex]
+%\cs{dtmWednesdayIndex}
+%\end{definition}
+%This expands to 2, the index for Wednesday.
+%
+%\begin{definition}[\DescribeMacro\dtmThursdayIndex]
+%\cs{dtmThursdayIndex}
+%\end{definition}
+%This expands to 3, the index for Thursday.
+%
+%\begin{definition}[\DescribeMacro\dtmFridayIndex]
+%\cs{dtmFridayIndex}
+%\end{definition}
+%This expands to 4, the index for Friday.
+%
+%\begin{definition}[\DescribeMacro\dtmSaturdayIndex]
+%\cs{dtmSaturdayIndex}
+%\end{definition}
+%This expands to 5, the index for Saturday.
+%
+%\begin{definition}[\DescribeMacro\dtmSundayIndex]
+%\cs{dtmSundayIndex}
+%\end{definition}
+%This expands to 6, the index for Sunday.
+%
+%You can get the day of week name identified by the Monday=0 based
+%index for a particular dialect using
+%\begin{definition}[\DescribeMacro\LocaleDayName]
+%\cs{LocaleDayName}\marg{dialect}\marg{index}
+%\end{definition}
+%For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{pt-BR}
+%
+%\input locale
+%
+%en-GB: \LocaleDayName{british}{0}.
+%pt-BR: \LocaleDayName{brazilian}{0}.
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%en-GB: Monday. pt-BR: Segunda-feira.
+%\end{quote}
+%
+%The abbreviated day of week name can be obtained with:
+%\begin{definition}[\DescribeMacro\LocaleShortDayName]
+%\cs{LocaleShortDayName}\marg{dialect}\marg{index}
+%\end{definition}
+%This has the same syntax as the previous command. As with the date
+%commands described in the \hyperref[sec:localedates]{previous
+%section}, the support for the given locale depends on the locale
+%provider used by \app{texosquery}.
+%
+%Some languages have a different form for day of week names when used in a
+%standalone context, such as in a column header. These can be
+%obtained using the commands below, \emph{but only with
+%\app{texosquery-jre8}}. If you are using Java 7 or earlier, these
+%commands will produce identical results to the analogous command
+%above.
+%
+%\begin{definition}[\DescribeMacro\LocaleStandaloneDayName]
+%\cs{LocaleStandaloneDayName}\marg{dialect}\marg{index}
+%\end{definition}
+%The same syntax as above, this produces the standalone day of week
+%name. The abbreviated name is produced with:
+%\begin{definition}[\DescribeMacro\LocaleStandaloneShortDayName]
+%\cs{LocaleStandaloneShortDayName}\marg{dialect}\marg{index}
+%\end{definition}
+%
+%The first day of the week varies according to region. In some
+%locales, Monday is considered the first day of the week (for
+%example, en-GB), but in other locales, Sunday is the first day
+%(for example, pt-BR). You can find out which day of the week is
+%considered the first day using:
+%\begin{definition}[\DescribeMacro\LocaleFirstDayIndex]
+%\cs{LocaleFirstDayIndex}\marg{dialect}
+%\end{definition}
+%This expands to an integer index identifying the day.
+%
+%For example, Monday (0) is the first day of the week in \texttt{en-GB},
+%but Sunday (6) is the first day of the week in \texttt{pt-BR}.
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{pt-BR}
+%
+%\input locale
+%
+%First day (en-GB): \LocaleFirstDayIndex{british}.
+%First day (pt-BR): \LocaleFirstDayIndex{brazilian}.
+%
+%\bye
+%\end{verbatim}
+%So the above produces:
+%\begin{quote}
+%First day (en-GB): 0. First day (pt-BR): 6.
+%\end{quote}
+%
+%Since it's possible that you may want to use a different indexing
+%system, there are commands provided to convert between them:
+%\begin{definition}[\DescribeMacro\LocaleDayIndexFromZeroMonToOneSun]
+%\cs{LocaleDayIndexFromZeroMonToOneSun}\marg{index}
+%\end{definition}
+%This converts a day index from the Monday=0 based system to the
+%Sunday=1 based system. For example, in Monday=0 indexing then the
+%index 3 represents Thursday. In the Sunday=1 based system, the index
+%5 represents Thursday, so
+%\begin{verbatim}
+%\LocaleDayIndexFromZeroMonToOneSun{3}
+%\end{verbatim}
+%expands to 5.
+%
+%\begin{definition}[\DescribeMacro\LocaleDayIndexFromZeroMonToOneMon]
+%\cs{LocaleDayIndexFromZeroMonToOneMon}\marg{index}
+%\end{definition}
+%This converts a day index from the Monday=0 (Sunday=6) based system to
+%the ISO-8601 Monday=1 (Sunday=7) based system. For example
+%\begin{verbatim}
+%\LocaleDayIndexFromZeroMonToOneMon{3}
+%\end{verbatim}
+%expands to 4.
+%
+%\begin{definition}[\DescribeMacro\LocaleDayIndexFromOneSunToZeroMon]
+%\cs{LocaleDayIndexFromOneSunToZeroMon}\marg{index}
+%\end{definition}
+%This converts a day index from the Sunday=1 based system to the
+%Monday=0 based system. For example
+%\begin{verbatim}
+%\LocaleDayIndexFromOneSunToZeroMon{5}
+%\end{verbatim}
+%expands to 3. (That is, it performs the reverse of
+%\cs{LocaleDayIndexFromZeroMonToOneSun}.)
+%
+%\begin{definition}[\DescribeMacro\LocaleDayIndexFromOneMonToZeroMon]
+%\cs{LocaleDayIndexFromOneMonToZeroMon}\marg{index}
+%\end{definition}
+%This converts a day index from the ISO-8601 Monday=1 (Sunday=7) based system
+%to the Monday=0 (Sunday=6) based system. For example
+%\begin{verbatim}
+%\LocaleDayIndexFromOneMonToZeroMon{4}
+%\end{verbatim}
+%expands to 3. (That is, it performs the reverse of
+%\cs{LocaleDayIndexFromZeroMonToOneMon}.)
+%
+%\begin{definition}[\DescribeMacro\LocaleDayIndexFromRegion]
+%\cs{LocaleDayIndexFromRegion}\marg{dialect}\marg{index}
+%\end{definition}
+%This converts the region's day of the week (starting from 1 for the
+%region's first day) to Monday=0 based indexing. The region is identified by
+%\meta{dialect}. This first uses
+%\cs{LocaleFirstDayIndex}\marg{dialect} to find the
+%1-based first day of week index for the region and then converts it
+%to the Monday=0 based system. An invalid \meta{index} results in
+%\texttt{-1}.
+%
+%For example, the \texttt{en-GB} locale has Monday as the first day
+%of the week. So if the \meta{index} argument is 1
+%\begin{verbatim}
+%\LocaleDayIndexFromRegion{british}{1}
+%\end{verbatim}
+%that indicates Monday. This is then converted to 0 (using
+%\cs{LocaleDayIndexFromOneMonToZeroMon}). If the \meta{index}
+%argument is 7
+%\begin{verbatim}
+%\LocaleDayIndexFromRegion{british}{7}
+%\end{verbatim}
+%that indicates Sunday, so this would be converted to 6.
+%
+%The \texttt{pt-BR} locale has Sunday as the first day of the week.
+%So if the \meta{index} argument is 2
+%\begin{verbatim}
+%\LocaleDayIndexFromRegion{brazilian}{2}
+%\end{verbatim}
+%that indicates Monday. This is
+%converted to 0 (using \cs{LocaleDayIndexFromOneSunToZeroMon}). If
+%the \meta{index} argument is 1
+%\begin{verbatim}
+%\LocaleDayIndexFromRegion{brazilian}{1}
+%\end{verbatim}
+%that indicates Sunday, so this would be converted to 6.
+%
+%\begin{definition}[\DescribeMacro\LocaleDayIndexToRegion]
+%\cs{LocaleDayIndexToRegion}\marg{dialect}\marg{index}
+%\end{definition}
+%This performs the reverse operation. In this case the \meta{index}
+%argument is Monday=0 based and the result is the locale's day index
+%(starting with 1 for the first day of the week).
+%
+%\subsubsection{Month Names}
+%\label{sec:monthnames}
+%
+%The month name for a given locale can be obtained using
+%\begin{definition}[\DescribeMacro\LocaleMonthName]
+%\cs{LocaleMonthName}\marg{dialect}\marg{index}
+%\end{definition}
+%where \meta{dialect} is the \sty{tracklang} dialect label that
+%identifies the locale and \meta{index} is an integer from 1
+%(January) to 12 (December) indicating the month.
+%
+%For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{pt-BR}
+%
+%\input locale
+%
+%en-GB: \LocaleMonthName{british}{1}.
+%pt-BR: \LocaleMonthName{brazilian}{1}.
+%
+%\bye
+%\end{verbatim}
+%produces:
+%\begin{quote}
+%en-GB: January. pt-BR: Janeiro.
+%\end{quote}
+%
+%The abbreviated month name can be obtained using
+%\begin{definition}[\DescribeMacro\LocaleShortMonthName]
+%\cs{LocaleShortMonthName}\marg{dialect}\marg{index}
+%\end{definition}
+%which has the same syntax as the previous command.
+%
+%Some languages have a different form for month names when used in a
+%standalone context, such as in a column header. These can be
+%obtained using the commands below, \emph{but only with
+%\app{texosquery-jre8}}. If you are using Java 7 or earlier, these
+%commands will produce identical results to the analogous command
+%above.
+%
+%\begin{definition}[\DescribeMacro\LocaleStandaloneMonthName]
+%\cs{LocaleStandaloneMonthName}\marg{dialect}\marg{index}
+%\end{definition}
+%The same syntax as above, this produces the standalone month
+%name. The abbreviated name is produced with:
+%\begin{definition}[\DescribeMacro\LocaleStandaloneShortMonthName]
+%\cs{LocaleStandaloneShortMonthName}\marg{dialect}\marg{index}
+%\end{definition}
+%
+%\subsection{Times}
+%\label{sec:localetimes}
+%
+%\begin{definition}[\DescribeMacro\LocaleFullTime]
+%\cs{LocaleFullTime}\marg{dialect}
+%\end{definition}
+%This displays the full time for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%\begin{definition}[\DescribeMacro\LocaleLongTime]
+%\cs{LocaleLongTime}\marg{dialect}
+%\end{definition}
+%This displays the long time for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%\begin{definition}[\DescribeMacro\LocaleMediumTime]
+%\cs{LocaleMediumTime}\marg{dialect}
+%\end{definition}
+%This displays the medium time for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%\begin{definition}[\DescribeMacro\LocaleShortTime]
+%\cs{LocaleShortTime}\marg{dialect}
+%\end{definition}
+%This displays the short time for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%As with \hyperref[sec:localedates]{dates}, the results are
+%determined by the locale provider used by \app{texosquery}.
+%For example, the Java 8 variant (\app{texosquery-jre8}) with
+%\texttt{java.locale.providers} set to \texttt{CLDR,JRE} may produce
+%a different result to a variant of \app{texosquery} that only uses
+%the JRE provider.
+%
+%For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%
+%\input locale
+%
+%Full: \LocaleLongTime{british}.
+%Long: \LocaleLongTime{british}.
+%Medium: \LocaleMediumTime{british}.
+%Short: \LocaleShortTime{british}.
+%
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%Full: 13:43:53 BST. Long: 13:43:53 BST. Medium: 13:43:53. Short:
+%13:43.
+%\end{quote}
+%In this particular case there's no difference between using the CLDR
+%and the JRE locale providers, but note that there's no difference in
+%the full and long forms.
+%
+%There are also commands for the combined date and time:
+%\begin{definition}[\DescribeMacro\LocaleFullDateTime]
+%\cs{LocaleFullDateTime}\marg{dialect}
+%\end{definition}
+%This displays the full date and time for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%\begin{definition}[\DescribeMacro\LocaleLongDateTime]
+%\cs{LocaleLongDateTime}\marg{dialect}
+%\end{definition}
+%This displays the long date and time for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%\begin{definition}[\DescribeMacro\LocaleMediumDateTime]
+%\cs{LocaleMediumDateTime}\marg{dialect}
+%\end{definition}
+%This displays the medium date and time for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%\begin{definition}[\DescribeMacro\LocaleShortDateTime]
+%\cs{LocaleShortDateTime}\marg{dialect}
+%\end{definition}
+%This displays the short date and time for the locale identified by \meta{dialect}
+%as provided by \app{texosquery}.
+%
+%
+%\section{Numbers}
+%\label{sec:numbers}
+%
+%Different locales use different symbols to denote the decimal mark
+%or the number group separator when displaying numbers. There are
+%other numeric-related symbols that may also vary according to
+%region, such as the currency symbol, exponent, percent or per mill
+%signs. Since most of these are outside of the Basic Latin set, the
+%examples here use \XeTeX\ with a font that supports those symbols.
+%If you don't have that font installed, you will need to adapt the
+%examples accordingly.
+%
+%As with date and times, the commands describe here need the
+%\sty{tracklang} dialect label that identifies the required locale.
+%See \sectionref{sec:currentlocale} for shortcut commands that
+%automatically select the current locale's dialect label.
+%
+%In general, most of these commands won't need to be used explicitly
+%as it's easier to use a numeric pattern instead (see
+%\sectionref{sec:numpatterns}).
+%
+%\subsection{Numeric Symbols}
+%\label{sec:numsyms}
+%
+%The number group separator for a particular locale can be obtained
+%using:
+%\begin{definition}[\DescribeMacro\LocaleNumericGroupSep]
+%\cs{LocaleNumericGroupSep}\marg{dialect}
+%\end{definition}
+%where \meta{dialect} is the \sty{tracklang} dialect label
+%representing the locale.
+%
+%You can determine whether or not the locale uses a number group
+%separator using:
+%\begin{definition}[\DescribeMacro\LocaleIfNumericUsesGroup]
+%\cs{LocaleIfNumericUsesGroup}\marg{dialect}\marg{true
+%code}\marg{false code}
+%\end{definition}
+%This does \meta{true code} if the locale identified by \meta{dialect}
+%uses a number group separator otherwise it does \meta{false code}.
+%
+%The decimal mark is obtained using:
+%\begin{definition}[\DescribeMacro\LocaleNumericDecimalSep]
+%\cs{LocaleNumericDecimalSep}\marg{dialect}
+%\end{definition}
+%
+%The monetary separator is often the same as the decimal separator,
+%but isn't always, so there's a separate command for it:
+%\begin{definition}[\DescribeMacro\LocaleNumericMonetarySep]
+%\cs{LocaleNumericMonetarySep}\marg{dialect}
+%\end{definition}
+%
+%The exponent symbol is obtained using:
+%\begin{definition}[\DescribeMacro\LocaleNumericExponent]
+%\cs{LocaleNumericExponent}\marg{dialect}
+%\end{definition}
+%
+%The percent symbol is obtained using:
+%\begin{definition}[\DescribeMacro\LocaleNumericPercent]
+%\cs{LocaleNumericPercent}\marg{dialect}
+%\end{definition}
+%This will typically use \verb|\%| (the percent symbol \%).
+%
+%The per mill symbol is obtained using:
+%\begin{definition}[\DescribeMacro\LocaleNumericPermill]
+%\cs{LocaleNumericPermill}\marg{dialect}
+%\end{definition}
+%This will typically be a character outside the Basic Latin set, so
+%the document will need to support this symbol if required.
+%
+%\subsection{Currencies}
+%\label{sec:currencies}
+%
+%The official currency code (such as \texttt{GBP} or \texttt{USD}) is
+%obtained using:
+%\begin{definition}[\DescribeMacro\LocaleCurrencyLabel]
+%\cs{LocaleCurrencyLabel}\marg{dialect}
+%\end{definition}
+%This first checks if the \dattr{currency} attribute for the given
+%dialect is \texttt{XXX} (which denotes an unknown currency,
+%typically because there's no region associated with \meta{dialect}).
+%If the currency for \meta{dialect} is known (that is, the attribute
+%value isn't \texttt{XXX}), then that currency's official code is
+%produced. If the currency is unknown, then it will try to fallback
+%on the main dialect's currency code if the main dialect has an
+%associated region, otherwise it will fallback on the OS currency
+%code.
+%
+%Remember that with the language tag, you're not restricted to using
+%official languages for a given region. For example, if you're
+%writing in English in Belgium, it's valid to use \texttt{en-BE} as a
+%locale. For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{en-BE,pt-BR}
+%
+%\input locale
+%
+%en-GB: \LocaleCurrencyLabel{british}.
+%en-BE: \LocaleCurrencyLabel{enBE}.
+%pt-BR: \LocaleCurrencyLabel{brazilian}.
+%
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%en-GB: GBP. en-BE: EUR. pt-BR: BRL.
+%\end{quote}
+%
+%There are a few currencies that have an unofficial currency code.
+%These are typically currencies pegged to another currency with a
+%fixed exchange rate of 1.0. The
+%official ISO currency code for one
+%region may be the code for the other currency. For example, the Isle
+%of Man currency is the Manx pound, which is kept in parity with
+%pound sterling. The currency code for \texttt{en-IM} is returned as
+%\texttt{GBP} by Java (since IMP has no official recognition in
+%ISO~4217), but \app{texosquery} recognises that this
+%region has an unofficial currency code \texttt{IMP}. This can be
+%obtained using
+%\begin{definition}[\DescribeMacro\LocaleCurrencyRegionalLabel]
+%\cs{LocaleCurrencyRegionalLabel}\marg{dialect}
+%\end{definition}
+%This command is much the same as the previous command in that it
+%will fallback on the main or OS currency code if not known.
+%The dialect attribute \dattr{regionalcurrency} is queried for the
+%required information.
+%For most regions, this command will return the same as
+%\cs{LocaleCurrencyLabel}.
+%
+%For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{en-IM,pt-BR}
+%
+%\input locale
+%
+%en-GB: \LocaleCurrencyRegionalLabel{british}.
+%en-IM: \LocaleCurrencyRegionalLabel{isleofmanenglish}.
+%pt-BR: \LocaleCurrencyRegionalLabel{brazilian}.
+%
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%en-GB: GBP. en-IM: IMP. pt-BR: BRL.
+%\end{quote}
+%If I had used \cs{LocaleCurrencyLabel} instead, the \texttt{en-IM}
+%currency label would've been displayed as GBP.
+%
+%The currency symbol (for example, \$ or \pounds) is obtained using
+%\begin{definition}[\DescribeMacro\LocaleCurrencySymbol]
+%\cs{LocaleCurrencySymbol}\marg{dialect}
+%\end{definition}
+%Except in the case of \$ this will include symbols outside the Basic
+%Latin set. This means that if you use this command in your document,
+%you need to ensure that the document encoding has been set up before
+%\file{tex-locale.tex} is loaded. (The \LaTeX\ \file{tex-locale.sty} package
+%can automatically load \sty{fontspec} or
+%\sty{inputenc} \& \sty{fontenc}, if required.) As with the previous
+%commands, if the currency is unknown it will try to fallback on the
+%main or OS currency. If the \dattr{currencysym} dialect attribute
+%is the same as the currency code, then the \cattr{sym} currency
+%attribute will be used instead.
+%
+%Modifying the above example:
+%\begin{verbatim}
+%\font\nimbus="NimbusRoman-Regular" at 10pt
+%\nimbus
+%
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{en-IM,pt-BR}
+%
+%\input locale
+%
+%en-GB: \LocaleCurrencySymbol{british}.
+%en-IM: \LocaleCurrencySymbol{isleofmanenglish}.
+%pt-BR: \LocaleCurrencySymbol{brazilian}.
+%
+%\bye
+%\end{verbatim}
+%This produces:
+%\begin{quote}
+%en-GB: \pounds. en-IM: M\pounds. pt-BR: R\$.
+%\end{quote}
+%The \XeLaTeX\ equivalent is:
+%\begin{verbatim}
+%\documentclass{article}
+%
+%\usepackage[main={en-GB},other={en-IM,pt-BR}]{tex-locale}
+%\setmainfont{NimbusRoman-Regular}
+%
+%\begin{document}
+%en-GB: \LocaleCurrencySymbol{british}.
+%en-IM: \LocaleCurrencySymbol{isleofmanenglish}.
+%pt-BR: \LocaleCurrencySymbol{brazilian}.
+%\end{document}
+%\end{verbatim}
+%
+%Alternatively, you can use:
+%\begin{definition}[\DescribeMacro\LocaleCurrencyTeXSymbol]
+%\cs{LocaleCurrencyTeXSymbol}\marg{dialect}
+%\end{definition}
+%This works in the same way as the previous command, except
+%that it checks the \dattr{currencytex} dialect attribute.
+%If this attribute is the same as the currency code, then
+%the \cattr{tex} currency attribute is used instead.
+%
+%This command uses control sequences instead of the actual currency
+%character. Since both \sty{texosquery} and \sty{tex-locale} are designed
+%for generic \TeX\ use, \sty{texosquery} just performs some limited
+%tests for the existence of common command names (such as \cs{pounds}
+%or \cs{euro}). If it can't find an appropriate command to use, the
+%currency commands simply expand to a textual tag.
+%
+%For example, when \file{texosquery.tex} is input, it checks for the
+%existence of \cs{faGbp} and \cs{pounds}. If one of those commands
+%exist, then \ics{texosquerycurrencypound} is defined to that
+%commands, otherwise it's defined to just \qt{pound}. For the Euro
+%symbol (\ics{texosquerycurrencyeuro}) the code checks for
+%\cs{faEuro}, \cs{texteuro} and \cs{euro}. (See the \sty{texosquery}
+%package for more information about these currency commands.)
+%
+%The \LaTeX\ \file{tex-locale.sty} package will automatically load the
+%\sty{textcomp} package by default. You can switch this to another
+%package (for example, \sty{fontawesome}) using the \pkgopt{symbols}
+%package option (for example, \pkgoptfmt{symbols=fontawesome}).
+%
+%\section{Current Locale}
+%\label{sec:currentlocale}
+%
+%The commands described above mostly require a recognised \sty{tracklang}
+%dialect label in the argument to identify the locale. These labels
+%aren't intuitively obvious. There are some predefined dialect labels
+%that try to be compatible with known \sty{babel} dialects, but
+%neither \sty{babel} nor \sty{polyglossia} provide as much detail
+%about the non-language aspects of the dialect (such as the region or
+%variant). For example, there's no \sty{babel} or \sty{polyglossia}
+%setting for English in the Isle of Man (\texttt{en-IM}). Users need
+%to select the closest matching dialect (\texttt{british} in the case
+%of \texttt{en-IM}). The \sty{tracklang} package also allows an
+%unofficial language and region combination.
+%For example, a document written in English but with the regional information,
+%such as currencies, matching those for Belgium, should be identified
+%with \texttt{en-BE}. This isn't recognised as a predefined
+%\sty{tracklang} dialect, so \sty{tracklang} creates its own dialect
+%label (\texttt{enBE} in this case) when it parses this language tag.
+%
+%This makes it a bit awkward to directly use the above commands and
+%it's most likely that the required dialect will be the currently selected
+%language setting, so \file{tex-locale.tex} provides some convenient
+%wrapper commands, listed below. These \cs{CurrentLocale\ldots} commands are redefined every
+%time the locale is changed (except for \cs{CurrentLocaleDateTime}). For a document that doesn't use
+%\sty{babel} or \sty{polyglossia}, these commands can be reset using
+%\ics{selectlocale} (described on page~\pageref{pg:selectlocale}). If \file{tex-locale.tex} detects
+%any language hooks \cs{captions}\meta{language} (such as
+%\cs{captionsenglish} or \cs{captionsbritish}) then code is added to
+%those hooks to ensure that the locale is switched when the language
+%changes.
+%
+%\TeX's \ics{show} command provides a useful way of checking the
+%current settings. For example:
+%\begin{verbatim}
+%\def\LocaleMain{en-GB}
+%\def\LocaleOther{en-IM,pt-BR}
+%
+%\input locale
+%
+%\show\CurrentLocaleMonthName
+%
+%\selectlocale{en-IM}
+%\show\CurrentLocaleMonthName
+%
+%\selectlocale{pt-BR}
+%\show\CurrentLocaleMonthName
+%
+%\bye
+%\end{verbatim}
+%These cause three interruptions to the \TeX\ build, which look like
+%errors but are the results from each \cs{show} command. In the first
+%case the transcript shows:
+%\begin{verbatim}
+%> \CurrentLocaleMonthName=macro:
+%->\LocaleMonthName {british}.
+%\end{verbatim}
+%I haven't specifically set the locale at this point. At the end of
+%the \file{tex-locale.tex} code, the main locale was automatically
+%selected. So the current locale dialect label is \texttt{british}
+%and \cs{CurrentLocaleMonthName} has been defined as
+%\begin{verbatim}
+%\LocaleMonthName{british}
+%\end{verbatim}
+%Note that there's no check for \cs{languagename} or similar command
+%here. The dialect label is hard-coded into the definition of
+%\cs{CurrentLocaleMonthName}, so it's fully-expandable (unless the
+%month name contains any awkward non-expandable characters, which can
+%occur with \sty{inputenc} and non-ASCII characters).
+%
+%The next instance of \cs{show} produces the following lines in the
+%transcript:
+%\begin{verbatim}
+%> \CurrentLocaleMonthName=macro:
+%->\LocaleMonthName {isleofmanenglish}.
+%\end{verbatim}
+%The command \cs{CurrentLocaleMonthName} was redefined when
+%\verb|\selectlocale{en-IM}| was used.
+%
+%Similarly for the final instance of \cs{show}:
+%\begin{verbatim}
+%> \CurrentLocaleMonthName=macro:
+%->\LocaleMonthName {brazilian}.
+%\end{verbatim}
+%
+%All the commands that are redefined with each instance of \cs{selectlocale}
+%are listed below. Note that \cs{selectlocale} also uses
+%\sty{tracklang}'s \cs{SetCurrentTrackedDialect}, which also defines
+%a set of commands that can be used to identify information about the
+%current dialect. (See the \sty{tracklang} documentation for further
+%details.)
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleLanguageName]
+%\cs{CurrentLocaleLanguageName}
+%\end{definition}
+%This is a shortcut for \ics{LocaleLanguageName}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleLanguageNativeName]
+%\cs{CurrentLocaleLanguageNativeName}
+%\end{definition}
+%This is a shortcut for \ics{LocaleLanguageNativeName}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleRegionName]
+%\cs{CurrentLocaleRegionName}
+%\end{definition}
+%This is a shortcut for \ics{LocaleRegionName}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleRegionNativeName]
+%\cs{CurrentLocaleRegionNativeName}
+%\end{definition}
+%This is a shortcut for \ics{LocaleRegionNativeName}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleVariantName]
+%\cs{CurrentLocaleVariantName}
+%\end{definition}
+%This is a shortcut for \ics{LocaleVariantName}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleVariantNativeName]
+%\cs{CurrentLocaleVariantNativeName}
+%\end{definition}
+%This is a shortcut for \ics{LocaleRegionNativeName}\marg{dialect}.
+%
+%\subsection{Dates and Times}
+%\label{sec:currdatetime}
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleFirstDayIndex]
+%\cs{CurrentLocaleFirstDayIndex}
+%\end{definition}
+%This is a shortcut for \ics{LocaleFirstDayIndex}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleDayIndexFromRegion]
+%\cs{CurrentLocaleDayIndexFromRegion}\marg{index}
+%\end{definition}
+%This is a shortcut for
+%\ics{LocaleDayIndexFromRegion}\marg{dialect}\marg{index}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleDayName]
+%\cs{CurrentLocaleDayName}\marg{index}
+%\end{definition}
+%This is a shortcut for \ics{LocaleDayName}\marg{dialect}\marg{index}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleShortDayName]
+%\cs{CurrentLocaleShortDayName}\marg{index}
+%\end{definition}
+%This is a shortcut for \ics{LocaleShortDayName}\marg{dialect}\marg{index}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleStandaloneDayName]
+%\cs{CurrentLocaleStandaloneDayName}\marg{index}
+%\end{definition}
+%This is a shortcut for \ics{LocaleStandaloneDayName}\marg{dialect}\marg{index}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleStandaloneShortDayName]
+%\cs{CurrentLocaleStandaloneShortDayName}\marg{index}
+%\end{definition}
+%This is a shortcut for \ics{LocaleStandaloneShortDayName}\marg{dialect}\marg{index}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleMonthName]
+%\cs{CurrentLocaleMonthName}\marg{index}
+%\end{definition}
+%This is a shortcut for \ics{LocaleMonthName}\marg{dialect}\marg{index}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleShortMonthName]
+%\cs{CurrentLocaleShortMonthName}\marg{index}
+%\end{definition}
+%This is a shortcut for \ics{LocaleShortMonthName}\marg{dialect}\marg{index}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleStandaloneMonthName]
+%\cs{CurrentLocaleStandaloneMonthName}\marg{index}
+%\end{definition}
+%This is a shortcut for \ics{LocaleStandaloneMonthName}\marg{dialect}\marg{index}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleStandaloneShortMonthName]
+%\cs{CurrentLocaleStandaloneShortMonthName}\marg{index}
+%\end{definition}
+%This is a shortcut for \ics{LocaleStandaloneShortMonthName}\marg{dialect}\marg{index}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleDate]
+%\cs{CurrentLocaleDate}
+%\end{definition}
+%This is slightly more complicated that the above. It uses
+%\begin{definition}[\DescribeMacro\localedatechoice]
+%\cs{localedatechoice}\marg{full}\marg{long}\marg{medium}\marg{short}
+%\end{definition}
+%to determine whether to use the full date \ics{LocaleFullDate}\marg{dialect},
+%the long date \ics{LocaleLongDate}\marg{dialect},
+%the medium date \ics{LocaleMediumDate}\marg{dialect} or
+%the short date \ics{LocaleShortDate}\marg{dialect}.
+%
+%This command may be defined before \file{tex-locale.tex} is loaded or
+%redefined afterwards. For example, to ensure that
+%\cs{CurrentLocaleDate} uses the medium form:
+%\begin{verbatim}
+%\def\localedatechoice#1#2#3#4{#3}
+%\input locale
+%\end{verbatim}
+%\LaTeX\ users should instead use the \pkgopt{date} package option in
+%the \file{tex-locale.sty} package interface:
+%\begin{verbatim}
+%\usepackage[date=medium]{tex-locale}
+%\end{verbatim}
+%\LaTeX\ users can also redefine the command afterwards. For example:
+%\begin{verbatim}
+%\renewcommand*{\localedatechoice}[4]{#3}
+%\end{verbatim}
+%
+%There is a similar command for the time:
+%\begin{definition}[\DescribeMacro\CurrentLocaleTime]
+%\cs{CurrentLocaleTime}
+%\end{definition}
+%This uses
+%\begin{definition}[\DescribeMacro\localetimechoice]
+%\cs{localetimechoice}\marg{full}\marg{long}\marg{medium}\marg{short}
+%\end{definition}
+%to determine whether to use the full time \ics{LocaleFullTime}\marg{dialect},
+%the long time \ics{LocaleLongTime}\marg{dialect},
+%the medium time \ics{LocaleMediumTime}\marg{dialect} or
+%the short time \ics{LocaleShortTime}\marg{dialect}. As with the date choice, this command
+%may be defined by plain \TeX\ users before \file{tex-locale.tex} is
+%input. \LaTeX\ users should use the \pkgopt{time} package option
+%instead. In both formats, the command may be redefined after
+%\sty{tex-locale} has been loaded.
+%
+%There is also a command for the combined date and time:
+%\begin{definition}[\DescribeMacro\CurrentLocaleDateTime]
+%\cs{CurrentLocaleDateTime}
+%\end{definition}
+%This doesn't use the analogous \cs{LocaleFullDateTime} etc
+%commands, but instead is simply defined as:
+%\begin{code}
+%\cs{CurrentLocaleDate}\cs{space}\cs{CurrentLocaleTime}
+%\end{code}
+%This allows for a mix of date and time styles, reflecting
+%the definitions of \cs{localedatechoice} and \cs{localetimechoice}.
+%
+%If you want a specific style (ignoring \cs{localedatechoice}
+%and \cs{localetimechoice}), you can use the following commands:
+%\begin{definition}[\DescribeMacro\CurrentLocaleFullDate]
+%\cs{CurrentLocaleFullDate}
+%\end{definition}
+%This just uses \cs{LocaleFullDate}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleLongDate]
+%\cs{CurrentLocaleLongDate}
+%\end{definition}
+%This just uses \cs{LocaleLongDate}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleMediumDate]
+%\cs{CurrentLocaleMediumDate}
+%\end{definition}
+%This just uses \cs{LocaleMediumDate}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleShortDate]
+%\cs{CurrentLocaleShortDate}
+%\end{definition}
+%This just uses \cs{LocaleShortDate}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleFullTime]
+%\cs{CurrentLocaleFullTime}
+%\end{definition}
+%This just uses \cs{LocaleFullTime}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleLongTime]
+%\cs{CurrentLocaleLongTime}
+%\end{definition}
+%This just uses \cs{LocaleLongTime}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleMediumTime]
+%\cs{CurrentLocaleMediumTime}
+%\end{definition}
+%This just uses \cs{LocaleMediumTime}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleShortTime]
+%\cs{CurrentLocaleShortTime}
+%\end{definition}
+%This just uses \cs{LocaleShortTime}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleFullDateTime]
+%\cs{CurrentLocaleFullDateTime}
+%\end{definition}
+%This just uses \cs{LocaleFullDateTime}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleLongDateTime]
+%\cs{CurrentLocaleLongDateTime}
+%\end{definition}
+%This just uses \cs{LocaleLongDateTime}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleMediumDateTime]
+%\cs{CurrentLocaleMediumDateTime}
+%\end{definition}
+%This just uses \cs{LocaleMediumDateTime}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleShortDateTime]
+%\cs{CurrentLocaleShortDateTime}
+%\end{definition}
+%This just uses \cs{LocaleShortDateTime}\marg{dialect}.
+%
+%
+%\subsection{Numeric Symbols}
+%\label{sec:currnumsym}
+%
+%The currency for the current locale is similar in construct to the
+%current locale's date and time commands listed above.
+%\begin{definition}[\DescribeMacro\CurrentLocaleCurrency]
+%\cs{CurrentLocaleCurrency}
+%\end{definition}
+%This uses
+%\begin{definition}[\DescribeMacro\localecurrchoice]
+%\cs{localecurrchoice}\marg{label}\marg{regional}\marg{symbol}\marg{\TeX}
+%\end{definition}
+%to determine whether to use \ics{LocaleCurrencyLabel}\marg{dialect},
+%\ics{LocaleCurrencyRegionalLabel}\marg{dialect},
+%\ics{LocaleCurrencySymbol}\marg{dialect} or
+%\ics{LocaleCurrencyTeXSymbol}\marg{dialect}.
+%This can similarly be defined before \file{tex-locale.tex} is input or
+%redefined afterwards. \LaTeX\ users can use the \pkgopt{currency}
+%package option.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleNumericGroupSep]
+%\cs{CurrentLocaleNumericGroupSep}
+%\end{definition}
+%This is a shortcut for \ics{LocaleNumericGroupSep}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleIfNumericUsesGroup]
+%\cs{CurrentLocaleIfNumericUsesGroup}\marg{true code}\marg{false code}
+%\end{definition}
+%This is a shortcut for
+%\ics{LocaleIfNumericUsesGroup}\marg{dialect}\marg{true
+%code}\marg{false code}.
+%
+%The next few commands have a slightly different pattern to the
+%shortcut control sequence name. For brevity, the shortcut command
+%omits the \qt{Numeric} part of the corresponding name.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleDecimalSep]
+%\cs{CurrentLocaleDecimalSep}
+%\end{definition}
+%This is a shortcut for \ics{LocaleNumericDecimalSep}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleMonetarySep]
+%\cs{CurrentLocaleMonetarySep}
+%\end{definition}
+%This is a shortcut for \ics{LocaleNumericMonetarySep}\marg{dialect}.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleExponent]
+%\cs{CurrentLocaleExponent}
+%\end{definition}
+%This is a shortcut for \ics{LocaleNumericExponent}\marg{dialect}.
+%
+%\subsection{Current Locale Patterns}
+%\label{sec:currpat}
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleIntegerPattern]
+%\cs{CurrentLocaleIntegerPattern}
+%\end{definition}
+%This is a convenient shortcut to access the integer pattern for the
+%current dialect.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleDecimalPattern]
+%\cs{CurrentLocaleDecimalPattern}
+%\end{definition}
+%This is a convenient shortcut to access the decimal pattern for the
+%current dialect.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleCurrencyPattern]
+%\cs{CurrentLocaleCurrencyPattern}
+%\end{definition}
+%This is a convenient shortcut to access the currency pattern for the
+%current dialect.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocalePercentPattern]
+%\cs{CurrentLocalePercentPattern}
+%\end{definition}
+%This is a convenient shortcut to access the percent pattern for the
+%current dialect.
+%
+%\begin{definition}[\DescribeMacro\CurrentLocaleApplyDateTimePattern]
+%\cs{CurrentLocaleApplyDateTimePattern}
+%\end{definition}
+%This is a convenient shortcut for
+%\ics{LocaleApplyDateTimePattern}\marg{dialect}.
+%
+%\chapter{\texorpdfstring{\LaTeX}{LaTeX}\ Use}
+%\label{sec:latex}
+%
+%The \sty{tex-locale} package is loaded in \LaTeX\ with the usual
+%\cs{usepackage} syntax:
+%\begin{verbatim}
+%\usepackage{tex-locale}
+%\end{verbatim}
+%This does more than simply input \file{tex-locale.tex}. The options
+%are listed below.
+%
+%\begin{description}
+%\item[\pkgopt{main}=\marg{tag}] This option identifies the main locale for the
+%document. The value should be a valid language tag. If this option
+%is omitted, the main language will be obtained from the Java Runtime
+%Environment, which should match your operating system's default
+%locale. If any languages have already been tracked in your document with
+%\sty{tracklang} prior to loading \sty{tex-locale}, the main
+%language is set to the first tracked dialect. Normally you don't
+%need to explicitly load \sty{tracklang}.
+%
+%\item[\pkgopt{other}=\marg{list}] This option identifies other
+%locales required by the document. The value should be a
+%comma-separated list of language tags or the keyword \pkgoptfmt{locale}
+%to indicate the system's default locale. The value must be grouped
+%to protect any commas from the key=value parser.
+%\begin{important}
+%This option has a cumulative effect.
+%\end{important}
+%
+%\item[\pkgopt{symbols}=\marg{name}] This option identifies the
+%symbol package to automatically load. For example,
+%\pkgoptfmt{symbols=textcomp} or \pkgoptfmt{symbols=fontawesome}. If
+%another package is required, \sty{texosquery}'s currency symbol commands
+%will need to be redefined as appropriate.
+%
+%The keyword \pkgoptfmt{none} indicates that no package is required. The
+%default is \pkgoptfmt{symbols=none} for \XeLaTeX\ or \LuaLaTeX,
+%otherwise it's \pkgoptfmt{symbols=textcomp}.
+%
+%\item[\pkgopt{support}=\marg{value}] This option identifies the
+%language support value. Available values are:
+%\begin{itemize}
+%\item \pkgoptfmt{none}: don't load any language support package;
+%\item \pkgoptfmt{auto}: load \sty{polyglossia} for \XeLaTeX\ or
+%\LuaLaTeX, otherwise load \sty{babel};
+%\item \pkgoptfmt{babel}: load \sty{babel} regardless of the \LaTeX\
+%format;
+%\item \pkgoptfmt{polyglossia}: load \sty{polyglossia} without checking
+%the \LaTeX\ format (but remember that \sty{polyglossia} doesn't work
+%with \PDFLaTeX);
+%\item \pkgoptfmt{cjk}: load CJK support with either \sty{xeCJK}
+%(\XeLaTeX/\LuaLaTeX) or \sty{CJKutf8}. This isn't fully tested, and
+%there's no support for non-UTF encoding.
+%\end{itemize}
+%
+%\item[\pkgopt{fontenc}=\marg{value}] This option indicates whether
+%or not to load the \sty{fontenc} package. The value should be one
+%of: \pkgoptfmt{none} (don't load), \pkgoptfmt{auto} (automatically load
+%with the encoding determined from the language settings), or
+%\meta{option} (indicating the package option to pass to
+%\sty{fontenc}). The default is \pkgoptfmt{fontenc=auto} unless
+%\sty{fontenc} has already been loaded.
+%
+%This option is ignored with \XeLaTeX\ or \LuaLaTeX.
+%
+%\item[\pkgopt{inputenc}=\marg{value}] This option indicates whether
+%or not to load the \sty{inputenc} package. The value should be one
+%of: \pkgoptfmt{none} (don't load), \pkgoptfmt{auto} (automatically load
+%with the encoding determined from the default obtained from
+%\sty{texosquery}), or \meta{option} (indicating the package option
+%to pass to \sty{inputenc}). The default is \pkgoptfmt{inputenc=auto}
+%but \sty{inputenc} won't be loaded if the appropriate encoding can't
+%be determined. Note that loading \sty{inputenc} before the
+%\sty{texosquery} lookup is performed will cause a problem with
+%non-ASCII characters appearing in the result.
+%
+%This option is ignored with \XeLaTeX\ or \LuaLaTeX.
+%
+%\item[\pkgopt{datetime}=\meta{value}] This option indicates whether
+%or not to load the \sty{datetime2} package. The value may be one of:
+%\begin{itemize}
+%\item \pkgoptfmt{false}: don't load \sty{datetime2};
+%\item \pkgoptfmt{iso}: load \sty{datetime2} with the package option
+%\pkgoptfmt{useregional=false} and sets the date-time style to \pkgoptfmt{iso};
+%\item \pkgoptfmt{text}: load \sty{datetime2} with the package option
+%\pkgoptfmt{useregional=text};
+%\item \pkgoptfmt{num} or \pkgoptfmt{numeric}: load \sty{datetime2} with the
+%package option \pkgoptfmt{useregional=numeric};
+%\item \pkgoptfmt{locale}: don't load \sty{datetime2} and set \ics{today}
+%to \ics{CurrentLocaleDate}, if available.
+%\end{itemize}
+%
+%\item[\pkgopt{date}=\meta{value}] This option indicates the
+%preferred date style for \ics{CurrentLocaleDate}. The value may be
+%one of: \pkgoptfmt{full}, \pkgoptfmt{long}, \pkgoptfmt{medium}
+%\pkgoptfmt{short}. This option doesn't affect \ics{today} unless you
+%have used \pkgoptfmt{datetime=locale}.
+%
+%\item[\pkgopt{time}=\meta{value}] This option indicates the
+%preferred time style for \ics{CurrentLocaleTime}. The value may be
+%one of: \pkgoptfmt{full}, \pkgoptfmt{long}, \pkgoptfmt{medium}
+%\pkgoptfmt{short}.
+%
+%\item[\pkgopt{timedate}=\meta{boolean}] This option indicates
+%whether or not to support date and time patterns. (See
+%\sectionref{sec:datetimepat}.)
+%
+%\item[\pkgopt{currency}=\meta{value}] This option indicates the
+%preferred currency style for \ics{CurrentLocaleCurrency}. Available
+%values: \pkgoptfmt{official} (official identifier), \pkgoptfmt{unofficial}
+%unofficial identified, \pkgoptfmt{sym} (the symbol, which may include
+%non-ASCII characters) or \pkgoptfmt{tex} (use the commands provided by
+%\sty{texosquery}). The default is \pkgoptfmt{currency=sym} for
+%\XeLaTeX/\LuaLaTeX\ or \pkgoptfmt{currency=tex} otherwise.
+%
+%\end{description}
+%
+%The \sty{tex-locale} package will use \sty{texosquery} to lookup the
+%default language tag and encoding, and then attempt to load the
+%appropriate encoding and language support packages.
+%
+%For example, consider the following document:
+%\begin{verbatim}
+%\documentclass{article}
+%\usepackage{tex-locale}
+%\begin{document}
+%Currency: \CurrentLocaleCurrency.
+%\end{document}
+%\end{verbatim}
+%My default locale is \texttt{en-GB} with UTF-8 as the default file
+%encoding, so if I compile this document with \PDFLaTeX, then this is
+%essentially equivalent to:
+%\begin{verbatim}
+%\documentclass{article}
+%\usepackage[en-GB]{tracklang}
+%\usepackage[T1]{fontenc}
+%\usepackage[utf8]{inputenc}
+%\usepackage[british]{babel}
+%\usepackage[useregional]{datetime2}
+%\begin{document}
+%Currency: \pounds.
+%\end{document}
+%\end{verbatim}
+%(Other dependent packages omitted for clarity.) Whereas if I compile
+%the document with \XeLaTeX, then this is essentially equivalent to:
+%\begin{verbatim}
+%\documentclass{article}
+%\usepackage[en-GB]{tracklang}
+%\usepackage{fontspec}
+%\usepackage{polyglossia}
+%\setmainlanguage[variant=uk]{english}
+%\usepackage[useregional]{datetime2}
+%\begin{document}
+%Currency: £.
+%\end{document}
+%\end{verbatim}
+%If I still want to use \sty{babel}, then I can enforce this with:
+%\begin{verbatim}
+%\usepackage[support=babel]{tex-locale}
+%\end{verbatim}
+%Or if I don't want \sty{babel} or \sty{polyglossia}:
+%\begin{verbatim}
+%\usepackage[support=none]{tex-locale}
+%\end{verbatim}
+%
+%You can determine which language package was used with:
+%\begin{definition}[\DescribeMacro\LocaleSupportPackageCase]
+%\cs{LocaleSupportPackageCase}\marg{babel}\marg{polyglossia}\marg{neither}
+%\end{definition}
+%If either package has been loaded \ics{selectlocale}\marg{locale}
+%should automatically be implemented when the document language
+%changes, so you can the use the current locale commands described in
+%\sectionref{sec:currentlocale}.
+%
+%Example:
+%\begin{verbatim}
+%\usepackage[main={sr-Cyrl-RS},other={en-GB}]{tex-locale}
+%
+%\LocaleSupportPackageCase
+%{\newcommand{\textenglish}[1]{\foreignlanguage{british}{#1}}}% babel
+%{% polyglossia
+% \setmainfont{Liberation Serif}
+% \newfontfamily\cyrillicfont{Liberation Serif}
+%}
+%{\newcommand{\textenglish}[1]{#1}}% none
+%\end{verbatim}
+%
+%\StopEventually{%
+% \printindex[user]
+% \PrintCodeIndex
+% \PrintChanges
+%}
+%
+%
+%\chapter{The Code}
+%\iffalse
+% \begin{macrocode}
+%<*tex-locale.sty>
+% \end{macrocode}
+%\fi
+%\changes{1.0}{2018-08-26}{Initial release}
+%\section{\LaTeX\ Code (\texttt{tex-locale.sty})}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{tex-locale}[2018/08/26 v1.0 (NLCT) localisation support]
+% \end{macrocode}
+%Make life easier by using \sty{etoolbox}:
+% \begin{macrocode}
+\RequirePackage{etoolbox}
+% \end{macrocode}
+% Also need \sty{xfor} to break out of \cs{@for} loop.
+% \begin{macrocode}
+\RequirePackage{xfor}
+% \end{macrocode}
+%Load \sty{tracklang} using package interface just in case any
+%languages have been passed through the document class options.
+%Require at least v1.3.3 since the dialect label mappings are needed
+%in this file.
+% \begin{macrocode}
+\RequirePackage{tracklang}[2016/11/03]
+% \end{macrocode}
+%If any languages have been tracked, set the main language to the
+%first tracked dialect.
+% \begin{macrocode}
+\AnyTrackedLanguages
+{%
+ \ForEachTrackedDialect{\locale@this@dialect}
+ {
+ \ifx\LocaleMain\undefined
+ \edef\LocaleMain{\GetTrackedLanguageTag{\locale@this@dialect}}
+ \let\@locale@trackedmain\LocaleMain
+ \else
+ \ifx\LocaleOther\undefined
+ \edef\LocaleOther{\GetTrackedLanguageTag{\locale@this@dialect}}
+ \else
+ \edef\LocaleOther{\LocaleOther,\GetTrackedLanguageTag{\locale@this@dialect}}
+ \fi
+ \fi
+ }
+}
+{}
+% \end{macrocode}
+%Need to determine if we're using \XeLaTeX\ or \LuaLaTeX.
+% \begin{macrocode}
+\RequirePackage{ifxetex}
+\RequirePackage{ifluatex}
+% \end{macrocode}
+%\begin{macro}{\@locale@ifxeorlua}
+%Short cut to check if we're using either:
+% \begin{macrocode}
+\ifxetex
+ \newcommand*{\@locale@ifxeorlua}[2]{#1}
+\else
+ \ifluatex
+ \newcommand*{\@locale@ifxeorlua}[2]{#1}
+ \else
+ \newcommand*{\@locale@ifxeorlua}[2]{#2}
+ \fi
+\fi
+% \end{macrocode}
+%\end{macro}
+%
+%Need \sty{xkeyval} for key-value interface:
+% \begin{macrocode}
+\RequirePackage{xkeyval}
+% \end{macrocode}
+%
+%Define package options.
+%
+% Each \cs{DeclareOptionX} needs a corresponding \cs{DeclareOption}
+% so that it can be passed as a document class option, so define a
+% command that will implement both.
+%\begin{macro}{\@locale@declareoption}
+% \begin{macrocode}
+\newcommand*{\@locale@declareoption}[2]{%
+ \DeclareOptionX{#1}{#2}%
+ \DeclareOption{#1}{#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{option}{main}
+%This option identifies the main locale. This will
+%default to the operating system's locale if not set. The value
+%should be the language tag or the keyword \texttt{locale}.
+% \begin{macrocode}
+\define@key{tex-locale.sty}{main}{%
+% \end{macrocode}
+%If this has already been set in the earlier tracked dialect check,
+%move the original main to the other list.
+% \begin{macrocode}
+ \ifx\@locale@trackedmain\undefined
+ \else
+ \ifx\LocaleOther\undefined
+ \let\LocaleOther\@locale@trackedmain
+ \else
+ \edef\LocaleOther{\@locale@trackedmain,\LocaleOther}%
+ \fi
+ \let\@locale@trackedmain\undefined
+ \fi
+ \def\LocaleMain{#1}%
+}
+% \end{macrocode}
+%\end{option}
+%\begin{option}{other}
+%This option identifies the other locales. The value
+%should be a comma-separated list of language tags or the keyword
+%\texttt{locale}. The value must be grouped to protect any commas
+%from the key-value parser. Note this option has a cumulative
+%effect.
+% \begin{macrocode}
+\define@key{tex-locale.sty}{other}{%
+ \ifx\LocaleOther\undefined
+ \def\LocaleOther{#1}%
+ \else
+ \edef\LocaleOther{\LocaleOther,#1}%
+ \fi
+}
+% \end{macrocode}
+%\end{option}
+%\begin{option}{symbols}
+%This option identifies the symbol package to automatically load.
+%For example, \sty{textcomp} or \texttt{fontawesome}. If another
+%package is required, \sty{texosquery}'s currency symbol commands
+%will need to be redefined as appropriate. The key word \texttt{none}
+%indicates that no package is required. The default is \texttt{none}
+%for \XeLaTeX\ or \LuaLaTeX\ and \sty{textcomp} otherwise.
+%\texttt{textcomp}
+% \begin{macrocode}
+\@locale@ifxeorlua{\def\@locale@symbols{none}}{\def\@locale@symbols{textcomp}}
+\define@key{tex-locale.sty}{symbols}{\def\@locale@symbols{#1}}
+% \end{macrocode}
+%\end{option}
+%
+%To make it easier to add extra support options, assign a numeric
+%value to each option so that \cs{ifcase} can be used. Recognised
+%values: 0 (none), 1 (auto), 2 (babel), 3 (polyglossia), 4 (cjk).
+%\begin{macro}{\@locale@supportopt}
+% \begin{macrocode}
+\newcount\@locale@supportopt
+% \end{macrocode}
+% The default value is auto unless a known language package has
+% already been loaded.
+% \begin{macrocode}
+\@ifpackageloaded{polyglossia}
+{\@locale@supportopt=0\relax}
+{
+ \@ifpackageloaded{babel}
+ {\@locale@supportopt=0\relax}
+ {
+ \@ifpackageloaded{CJK}
+ {\@locale@supportopt=0\relax}
+ {\@locale@supportopt=1\relax}
+ }
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{option}{support}
+%This option identifies the language support package.
+% \begin{macrocode}
+\define@choicekey{tex-locale.sty}{support}%
+ [\@locale@support@val\@locale@support@nr]%
+ {none,auto,babel,polyglossia,cjk}
+{\@locale@supportopt=\@locale@support@nr\relax}
+% \end{macrocode}
+%\end{option}
+%\begin{option}{fontspec}
+%This option identifies whether or not to load \sty{fontspec} if
+%\XeLaTeX\ or \LuaLaTeX\ is in use. Defaults to true and is ignored
+%if neither \XeLaTeX\ nor \LuaLaTeX\ are in use.
+% \begin{macrocode}
+\define@boolkey{tex-locale.sty}[@locale@]{fontspec}[true]{}
+\@locale@ifxeorlua{\@locale@fontspectrue}{\@locale@fontspecfalse}
+% \end{macrocode}
+%\end{option}
+%\begin{option}{fontenc}
+%This option identifies whether or not to load \sty{fontenc} if
+%neither \XeLaTeX\ nor \LuaLaTeX\ is in use. The value should be
+%either \pkgoptfmt{none} (don't load) or \pkgoptfmt{auto}
+%(determined from the main language or script) or the option to pass to
+%\sty{fontenc}. If the \pkgoptfmt{auto} option is used but the
+%appropriate encoding can't be determined, \sty{fontenc} won't be
+%loaded. The default value is \pkgoptfmt{auto} unless \sty{fontenc}
+%has already been loaded. This option is ignored if
+% either \XeLaTeX\ or \LuaLaTeX\ are in use.
+% \begin{macrocode}
+\define@key{tex-locale.sty}{fontenc}{%
+ \edef\@locale@fontenc{#1}%
+ \ifdefstring{\@locale@fontenc}{false}{\def\@locale@fontenc{none}}{}%
+}
+\@ifpackageloaded{fontenc}
+{\def\@locale@fontenc{none}}
+{\def\@locale@fontenc{auto}}
+% \end{macrocode}
+%\end{option}
+%\begin{option}{inputenc}
+%This option identifies whether or not to load \sty{inputenc} if
+%neither \XeLaTeX\ nor \LuaLaTeX\ is in use. The value should be
+%either \pkgoptfmt{none} (don't load) or \pkgoptfmt{auto}
+%(determined from the locale's default encoding) or the option to pass to
+%\sty{inputenc}. If the \pkgoptfmt{auto} option is used but the
+%appropriate encoding can't be determined, \sty{inputenc} won't be
+%loaded. The default value is \pkgoptfmt{auto}. This option is ignored if
+% either \XeLaTeX\ or \LuaLaTeX\ are in use. Note that loading
+% \sty{inputenc} before the query is performed will cause a problem
+% with non-ASCII characters appearing in the result.
+% \begin{macrocode}
+\define@key{tex-locale.sty}{inputenc}{%
+ \edef\@locale@inputenc{#1}%
+ \ifdefstring{\@locale@inputenc}{false}{\def\@locale@inputenc{none}}{}%
+}
+\@ifpackageloaded{inputenc}
+{\def\@locale@inputenc{none}}
+{\def\@locale@inputenc{auto}}
+% \end{macrocode}
+%\end{option}
+%
+%\begin{macro}{\@locale@load@dtm}
+%This command is used to load \sty{datetime2}, if required, and setup the style.
+% \begin{macrocode}
+\@ifpackageloaded{datetime2}
+{
+% \end{macrocode}
+% User has already loaded \sty{datetime2}. Assume they have already
+% set their preferred style. (They would also need to have loaded
+% \sty{babel}\slash\sty{polyglossia} before \sty{datetime2}, which
+% rather reduces the point of the \sty{tex-locale} package.)
+% \begin{macrocode}
+ \newcommand\@locale@load@dtm{}
+}
+{
+ \newcommand\@locale@load@dtm{%
+% \end{macrocode}
+% First check if \sty{datetime2} is installed. If it isn't, then
+% default to \pkgopt[locale]{datetime2}.
+% \begin{macrocode}
+ \IfFileExists{datetime2.sty}%
+ {\@locale@load@regional@dtm}%
+ {\@locale@set@today}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@load@regional@dtm}
+%Load \sty{datetime2} with regional settings.
+% \begin{macrocode}
+\newcommand\@locale@load@regional@dtm{%
+ \localedatechoice
+ {%full
+ \PassOptionsToPackage{showdow}{datetime2}%
+ \PassOptionsToPackage{useregional=text}{datetime2}%
+ }%
+ {%long
+ \PassOptionsToPackage{useregional=text}{datetime2}%
+ }%
+ {%medium
+ \PassOptionsToPackage{useregional=text}{datetime2}%
+ }%
+ {%short
+ \PassOptionsToPackage{useregional=numeric}{datetime2}%
+ }%
+ \RequirePackage{datetime2}%
+ \localedatechoice{}{}{\DTMlangsetup*{abbr}}{}%
+}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@set@today}
+%Redefine \cs{today}.
+% \begin{macrocode}
+\newcommand*{\@locale@set@today}{%
+% \end{macrocode}
+% If \cs{CurrentLocaleDate} is empty then the query failed, in which
+% case don't change \cs{today}.
+% \begin{macrocode}
+ \ifdefempty\CurrentLocaleDate
+ {}%
+ {%
+ \renewcommand{\today}{\CurrentLocaleDate}%
+ \ForEachTrackedDialect{\locale@this@dialect}
+ {%
+% \end{macrocode}
+%Add to \cs{date}\meta{lang} hook.
+% \begin{macrocode}
+ \SetCurrentTrackedDialect{\locale@this@dialect}%
+ \@TrackLangAddToHook
+ {\renewcommand{\today}{\CurrentLocaleDate}}
+ {date}%
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{option}{datetime}
+%Provide an option to adjust the date and time settings.
+% \begin{macrocode}
+\define@choicekey{tex-locale.sty}{datetime}%
+ [\@locale@datetime@val\@locale@datetime@nr]%
+ {false,iso,text,num,numeric,locale}
+{%
+ \ifcase\@locale@datetime@nr
+ \def\@locale@load@dtm{}%
+ \or
+ \def\@locale@load@dtm{%
+ \PassOptionsToPackage{useregional=false}{datetime2}%
+ \RequirePackage{datetime2}%
+ \DTMsetstyle{iso}%
+ }%
+ \or
+ \def\@locale@load@dtm{%
+ \@locale@load@regional@dtm
+ }%
+ \or
+ \def\@locale@load@dtm{%
+ \PassOptionsToPackage{useregional=numeric}{datetime2}%
+ \RequirePackage{datetime2}%
+ }%
+ \or
+ \def\@locale@load@dtm{%
+ \PassOptionsToPackage{useregional=numeric}{datetime2}%
+ \RequirePackage{datetime2}%
+ }%
+ \or
+ \def\@locale@load@dtm{\@locale@set@today}%
+ \fi
+}
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{iso}
+%Shortcut for \pkgopt[iso]{datetime2}.
+% \begin{macrocode}
+\@locale@declareoption{iso}{%
+ \def\@locale@load@dtm{%
+ \PassOptionsToPackage{useregional=false}{datetime2}%
+ \RequirePackage{datetime2}%
+ \DTMsetstyle{iso}%
+ }%
+}
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{date}
+%Preferred date style for \cs{CurrentLocaleDate}.
+% \begin{macrocode}
+\define@choicekey{tex-locale.sty}{date}%
+[\@locale@date@val\@locale@date@nr]{full,long,medium,short}
+{%
+ \ifcase\@locale@date@nr
+ \def\localedatechoice##1##2##3##4{##1}%
+ \or
+ \def\localedatechoice##1##2##3##4{##2}%
+ \or
+ \def\localedatechoice##1##2##3##4{##3}%
+ \or
+ \def\localedatechoice##1##2##3##4{##4}%
+ \fi
+}
+\newcommand*{\localedatechoice}[4]{#2}%
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{time}
+%Preferred date style for \cs{CurrentLocaleTime}.
+% \begin{macrocode}
+\define@choicekey{tex-locale.sty}{time}%
+[\@locale@time@val\@locale@time@nr]{full,long,medium,short}
+{%
+ \ifcase\@locale@time@nr
+ \def\localetimechoice##1##2##3##4{##1}%
+ \or
+ \def\localetimechoice##1##2##3##4{##2}%
+ \or
+ \def\localetimechoice##1##2##3##4{##3}%
+ \or
+ \def\localetimechoice##1##2##3##4{##4}%
+ \fi
+}
+\newcommand*{\localetimechoice}[4]{#3}%
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{timedata}
+%Determine whether or not to use \texttt{-M} and \texttt{-Z}.
+% \begin{macrocode}
+\define@choicekey{tex-locale.sty}{timedata}%
+[\@locale@timedata@val\@locale@timedata@nr]{true,false}[true]
+{%
+ \ifcase\@locale@timedata@nr
+ \def\LocaleIfDateTimePatternsSupported##1##2{##1}%
+ \or
+ \def\LocaleIfDateTimePatternsSupported##1##2{##2}%
+ \fi
+}
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{currency}
+%Preferred currency style for \cs{CurrentLocaleCurrency}.
+% \begin{macrocode}
+\define@choicekey{tex-locale.sty}{currency}%
+[\@locale@currency@val\@locale@currency@nr]%
+{official,unofficial,sym,tex}
+{%
+ \ifcase\@locale@currency@nr
+ \def\localecurrchoice##1##2##3##4{##1}%
+ \or
+ \def\localecurrchoice##1##2##3##4{##2}%
+ \or
+ \def\localecurrchoice##1##2##3##4{##3}%
+ \or
+ \def\localecurrchoice##1##2##3##4{##4}%
+ \fi
+}
+\@locale@ifxeorlua
+ {\newcommand*{\localecurrchoice}[4]{#3}}
+ {\newcommand*{\localecurrchoice}[4]{#4}}
+% \end{macrocode}
+%\end{option}
+%
+% Process package options. First process any options that have been
+% passed via the document class.
+% \begin{macrocode}
+\@for\CurrentOption:=\@declaredoptions\do{%
+ \ifx\CurrentOption\@empty
+ \else
+ \@expandtwoargs
+ \in@{,\CurrentOption,}{,\@classoptionslist,\@curroptions,}%
+ \ifin@
+ \@use@ption
+ \expandafter\let\csname ds@\CurrentOption\endcsname\@empty
+ \fi
+ \fi
+}
+% \end{macrocode}
+% Now process options passed to the package:
+% \begin{macrocode}
+\ProcessOptionsX
+% \end{macrocode}
+%
+% Check if \sty{babel} or \sty{polyglossia} have already been loaded
+% (user may have used \pkgopt[babel]{support} or \pkgopt[polyglossia]{support}
+% without realising it's already been loaded). Since
+% \sty{polyglossia} pretends \sty{babel} has been loaded, only
+% \sty{babel} test is required.
+% \begin{macrocode}
+\@ifpackageloaded{babel}
+{%
+ \@locale@supportopt=0\relax
+}
+{}
+% \end{macrocode}
+% If the main language hasn't been set, define it (needed before
+% the generic code is input.)
+% \begin{macrocode}
+\ifx\LocaleMain\undefined
+ \def\LocaleMain{locale}
+\fi
+\ifx\LocaleOther\undefined
+ \def\LocaleOther{}
+\fi
+% \end{macrocode}
+%
+%\begin{macro}{\@locale@postparse@hook}
+%Post-parser hook.
+% \begin{macrocode}
+\newcommand*{\@locale@postparse@hook}{%
+ \input{tex-locale-support.def}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%If symbol support is required, load the package now:
+% \begin{macrocode}
+\ifdefstring{\@locale@symbols}{none}
+{}
+{\RequirePackage{\@locale@symbols}}
+% \end{macrocode}
+%Load \sty{texosquery} using package interface (needs to be done
+%after the symbol support is loaded since \texttt{texosquery.tex}
+%detects some common symbol commands).
+% \begin{macrocode}
+\RequirePackage{texosquery}
+% \end{macrocode}
+%The encoding needs to be set up before the main query in case there
+%are any non-ASCII characters returned by the query (for example,
+%the currency symbol or in month or day names).
+%
+% May need to track all the listed dialects before
+% \texttt{tex-locale.tex} is loaded.
+%\begin{macro}{\@locale@trackall}
+% Track the main language if set.
+% \begin{macrocode}
+\newcommand\@locale@trackall{%
+ \ifdefstring\LocaleMain{locale}%
+ {%
+ \ifx\LocaleOStag\empty
+ \PackageWarning{tex-locale}{Unable to determine locale
+ (check shell escape)}%
+ \else
+ \TrackLanguageTag{\LocaleOStag}%
+ \fi
+ }%
+ {\TrackLanguageTag{\LocaleMain}}%
+% \end{macrocode}
+% Track the other languages.
+% \begin{macrocode}
+ \@for\locale@this@dialect:=\LocaleOther\do{%
+ \ifdefstring\locale@this@dialect{locale}
+ {%
+ \ifx\LocaleOStag\empty
+ \PackageWarning{tex-locale}{Unable to determine locale
+ (check shell escape)}%
+ \else
+ \TrackLanguageTag{\LocaleOStag}%
+ \fi
+ }%
+ {\TrackLanguageTag{\locale@this@dialect}}%
+ }%
+ \let\@locale@trackall\relax
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@loadinputenc}
+% \begin{macrocode}
+\newcommand{\@locale@loadinputenc}{}
+% \end{macrocode}
+%\end{macro}
+%
+%It may be necessary to use texosquery here to determine the
+%language tag ("-b") and\slash or the codeset ("-C"). It makes more
+%sense to minimise the number of shell escapes, so try to determine
+%what extra information we need here. The required parameters are stored in
+%\cs{@locale@pre@query@params}
+%\begin{macro}{\@locale@pre@query@params}
+% \begin{macrocode}
+\newcommand*\@locale@pre@query@params{}%
+% \end{macrocode}
+%\end{macro}
+%Now we need some commands that will parse the result, depending on
+%the parameters.
+%\begin{macro}{\@locale@pre@query@parsetag}
+%Only the language tag ("-b") is required. The shell escape will
+%only return a single result. \cs{LocaleOStag} will either be set to
+%the language tag, if successful, or will be empty, if in dry run
+%mode.
+% \begin{macrocode}
+\newcommand*\@locale@pre@query@parsetag{%
+ \ifx\LocaleStyQueryFile\undefined
+ \TeXOSQuery{\@locale@result}{\@locale@pre@query@params}%
+ \else
+ \ifx\LocaleStyQueryFile\empty
+ \TeXOSQuery{\@locale@result}{\@locale@pre@query@params}%
+ \else
+ \ifx\TeXOSQueryFromFile\undefined
+ \PackageError{locale}{texosquery too old to support
+ \string\LocaleStyQueryFile. At least v1.4 required}
+ {You need to update your version of texosquery}
+ \def\@locale@result{}%
+ \else
+ \PackageInfo{locale}{Fetching query results from `\LocaleStyQueryFile'}%
+ \TeXOSQueryFromFile{\@locale@result}{\LocaleStyQueryFile}%
+ \fi
+ \fi
+ \fi
+ \edef\LocaleOStag{\@locale@result}%
+}%
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@locale@pre@query@parsecodeset}
+%Only the codeset ("-C") is required. The shell escape will
+%only return a single result. \cs{LocaleOScodeset} will either be set to
+%the codeset, if successful, or will be empty, if in dry run
+%mode.
+% \begin{macrocode}
+\newcommand*\@locale@pre@query@parsecodeset{%
+ \TeXOSQuery{\@locale@result}{\@locale@pre@query@params}%
+ \edef\LocaleOScodeset{\@locale@result}%
+}%
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@locale@pre@query@parsetagcodeset}
+%Both the language tag ("-b") and the codeset ("-C") are required.
+%The shell escape will return two arguments.
+% \begin{macrocode}
+\newcommand*\@locale@pre@query@parsetagcodeset{%
+ \def\LocaleOStag{}%
+ \def\LocaleOScodeset{}%
+ \TeXOSQuery{\@locale@result}{\@locale@pre@query@params}%
+ \ifx\@locale@result\@empty
+ \else
+ \edef\LocaleOStag{\expandafter\@firstoftwo\@locale@result}%
+ \edef\LocaleOScodeset{\expandafter\@secondoftwo\@locale@result}%
+ \fi
+}%
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@locale@pre@query@parse}
+%This will be set to the appropriate command after determining what
+%information is actually required.
+% \begin{macrocode}
+\let\@locale@pre@query@parse\relax
+% \end{macrocode}
+%\end{macro}
+%
+%If \XeLaTeX\ or \LuaLaTeX\ is in use and the \pkgopt{fontspec} option
+%is on, load \sty{fontspec}.
+% \begin{macrocode}
+\@locale@ifxeorlua
+{%
+ \if@locale@fontspec\RequirePackage{fontspec}\fi
+% \end{macrocode}
+%The language tag is needed if \pkgopt[auto]{support}.
+% \begin{macrocode}
+ \ifnum\@locale@supportopt=1\relax
+ \ifdefstring\LocaleMain{locale}
+ {%
+ \def\@locale@pre@query@params{\string-b }%
+ \let\@locale@pre@query@parse\@locale@pre@query@parsetag
+ }%
+ {%
+ \@for\locale@this@dialect:=\LocaleOther\do{%
+ \ifdefstring\locale@this@dialect{locale}
+ {%
+ \def\@locale@pre@query@params{\string-b }%
+ \let\@locale@pre@query@parse\@locale@pre@query@parsetag
+ \@endfortrue
+ }%
+ {}%
+ }%
+ }%
+% \end{macrocode}
+%Perform the shell escape if required.
+% \begin{macrocode}
+ \@locale@pre@query@parse
+ \fi
+}
+{%
+% \end{macrocode}
+%The language tag is needed if \pkgopt[auto]{fontenc}.
+% \begin{macrocode}
+ \ifdefstring{\@locale@fontenc}{auto}
+ {%
+ \ifdefstring\LocaleMain{locale}
+ {%
+ \def\@locale@pre@query@params{\string-b }%
+ \let\@locale@pre@query@parse\@locale@pre@query@parsetag
+ }%
+ {%
+ \@for\locale@this@dialect:=\LocaleOther\do{%
+ \ifdefstring\locale@this@dialect{locale}
+ {%
+ \def\@locale@pre@query@params{\string-b }%
+ \let\@locale@pre@query@parse\@locale@pre@query@parsetag
+ \@endfortrue
+ }%
+ {}%
+ }%
+ }%
+ }%
+ {}%
+% \end{macrocode}
+%The codeset is needed if \pkgopt[auto]{inputenc}.
+%The "-C" (\texttt{-{}-codeset-lcs}) switch is used rather
+%than the "-cs" (\texttt{-{}-codeset}) switch to make it more
+%compatible with \sty{inputenc}.
+% \begin{macrocode}
+ \ifdefstring{\@locale@inputenc}{auto}
+ {%
+ \ifx\@locale@pre@query@params\@empty
+ \let\@locale@pre@query@parse\@locale@pre@query@parsecodeset
+ \else
+ \let\@locale@pre@query@parse\@locale@pre@query@parsetagcodeset
+ \fi
+ \edef\@locale@pre@query@params{\@locale@pre@query@params\string-C}%
+ }%
+ {}%
+% \end{macrocode}
+%Perform the shell escape if required.
+% \begin{macrocode}
+ \@locale@pre@query@parse
+% \end{macrocode}
+% Do we need to load \sty{fontenc}?
+% \begin{macrocode}
+ \ifdefstring{\@locale@fontenc}{none}
+ {}
+ {%
+ \ifdefstring{\@locale@fontenc}{auto}
+ {%
+% \end{macrocode}
+% If \pkgopt[auto]{fontenc}, set up some script to \sty{fontenc} mappings.
+% \begin{macrocode}
+ \input{tex-locale-scripts-enc.def}%
+ \@locale@trackall
+% \end{macrocode}
+% Iterate through all the dialects.
+% \begin{macrocode}
+ \ForEachTrackedDialect{\locale@this@dialect}%
+ {
+ \edef\@locale@lang{\TrackedLanguageFromDialect{\locale@this@dialect}}%
+ \@locale@if@langenc@map{\locale@this@dialect}%
+ {%
+ \edef\@locale@fontenc@opt{%
+ \@locale@get@langenc@map{\locale@this@dialect}}%
+ \expandafter\PassOptionsToPackage\expandafter
+ {\@locale@fontenc@opt}{fontenc}%
+ }%
+ {%
+ \@locale@if@langenc@map{\@locale@lang}%
+ {%
+ \edef\@locale@fontenc@opt{%
+ \@locale@get@langenc@map{\@locale@lang}}%
+ \expandafter\PassOptionsToPackage\expandafter
+ {\@locale@fontenc@opt}{fontenc}%
+ }%
+ {%
+ \edef\@locale@script{\GetTrackedDialectScript{\locale@this@dialect}}%
+ \ifx\@locale@script\empty
+ \edef\@locale@script{\TrackLangGetDefaultScript{\@locale@lang}}%
+ \fi
+ \@locale@if@scriptenc@map{\@locale@script}%
+ {%
+ \edef\@locale@fontenc@opt{%
+ \@locale@get@scriptenc@map{\@locale@script}}%
+ \expandafter\PassOptionsToPackage\expandafter
+ {\@locale@fontenc@opt}{fontenc}%
+ }%
+ {}%
+ }%
+ }%
+ }%
+ \ifx\@locale@fontenc@opt\empty
+ \PackageWarning{tex-locale}{Option `fontenc=auto' failed.
+ Can't determine an appropriate font encoding for dialect(s).
+ (Dialect list: \@tracklang@dialects.)
+ Either set the encoding explicitly or switch to XeLaTeX%
+ }%
+ \else
+ \RequirePackage{fontenc}%
+ \fi
+ }
+ {%
+ \expandafter\PassOptionsToPackage\expandafter{\@locale@fontenc}{fontenc}%
+ \RequirePackage{fontenc}%
+ }
+ }
+% \end{macrocode}
+% Do we need to load \sty{inputenc}? This needs to be done before
+% the main \texttt{tex-locale.tex} shell escape.
+% \begin{macrocode}
+ \ifdefstring{\@locale@inputenc}{none}
+ {}
+ {%
+ \ifdefstring{\@locale@inputenc}{auto}
+ {%
+% \end{macrocode}
+%If the earlier shell escape was successful, \cs{LocaleOScodeset} will be set.
+% \begin{macrocode}
+ \ifx\LocaleOScodeset\empty
+% \end{macrocode}
+%Query failed.
+% \begin{macrocode}
+ \PackageWarning{tex-locale}{Option `inputenc=auto' failed.
+ (Check shell escape.) Default file encoding unavailable}
+ \else
+% \end{macrocode}
+%If the file \cs{LocaleOScodeset}\texttt{.def} exists, then the
+%codeset should hopefully be valid.
+% \begin{macrocode}
+ \IfFileExists{\LocaleOScodeset.def}%
+ {%
+ \renewcommand{\@locale@loadinputenc}{%
+ \RequirePackage{inputenc}%
+ \inputencoding{\LocaleOScodeset}%
+ }
+ \let\@locale@inputenc\LocaleOScodeset
+ }%
+ {%
+% \end{macrocode}
+%May have a different name. Try known encoding mappings.
+% \begin{macrocode}
+ \input{tex-locale-encodings.def}%
+ \@locale@ifhasencmap{\LocaleOScodeset}
+ {
+ \edef\@locale@inputenc{\@locale@getencmap\LocaleOScodeset}
+ \renewcommand{\@locale@loadinputenc}{%
+ \RequirePackage{inputenc}%
+ \inputencoding{\@locale@inputenc}%
+ }
+ }
+ {%
+ \PackageWarning{tex-locale}{Option `inputenc=auto' failed.
+ Don't know how to interpret codeset `\LocaleOScodeset'}%
+ }%
+ }
+ \fi
+ }
+ {%
+ \renewcommand{\@locale@loadinputenc}{%
+ \RequirePackage{inputenc}%
+ \inputencoding{\@locale@inputenc}%
+ }
+ }
+ }
+}
+% \end{macrocode}
+%
+%\begin{macro}{\@locale@loadscripts}
+%Only load \sty{tracklang-scripts} if required.
+% \begin{macrocode}
+\newcommand{\@locale@loadscripts}{%
+ \RequirePackage{tracklang-scripts}%
+ \let\@locale@loadscripts\relax
+}
+% \end{macrocode}
+%\end{macro}
+%
+%The \LaTeX\ kernel provides \cs{@thirdofthree} but not
+%\cs{@secondofthree}.
+%\begin{macro}{\@secondofthree}
+% \begin{macrocode}
+\providecommand*{\@secondofthree}[3]{#2}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@ifsupportbabelorpoly}
+%\begin{definition}
+%\cs{@locale@ifsupportbabelorpoly}\marg{neither
+%case}\marg{babel case}\marg{polyglossia case}
+%\end{definition}
+%Should \sty{babel} or \sty{polyglossia} be loaded? Initialise to false.
+% \begin{macrocode}
+\newcommand*{\@locale@ifsupportbabelorpoly}[3]{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@ifsupportcjk}
+%Should \sty{CJK} be loaded? Initialise to false.
+% \begin{macrocode}
+\newcommand*{\@locale@ifsupportcjk}[2]{#2}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@ifsupportpinyin}
+%Should \sty{pinyin} be loaded? Initialise to false.
+% \begin{macrocode}
+\newcommand*{\@locale@ifsupportpinyin}[2]{#2}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@cjklist}
+%List of languages supported by \sty{CJK}. This just makes it easier to test the
+%language without multiple conditions.
+% \begin{macrocode}
+\newcommand*{\@locale@cjklist}{}
+\listadd{\@locale@cjklist}{chinese}
+\listadd{\@locale@cjklist}{japanese}
+\listadd{\@locale@cjklist}{korean}
+\listadd{\@locale@cjklist}{thai}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@ifcjk}
+%\begin{definition}
+%\cs{@locale@ifcjk}\marg{language}\marg{true case}\marg{false case}
+%\end{definition}
+%Check if given root language is in the CJK list.
+% \begin{macrocode}
+\newcommand*{\@locale@ifcjk}[1]{%
+ \xifinlist{#1}{\@locale@cjklist}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@iflatinscript}
+%\begin{definition}
+%\cs{@locale@iflatinscript}\marg{dialect}\marg{true case}\marg{false case}
+%\end{definition}
+%Check if given dialect has the script explicitly set to Latn.
+% \begin{macrocode}
+\newcommand*{\@locale@iflatinscript}[1]{%
+ \ifcsstring{@tracklang@script@#1}{Latn}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%Should \sty{babel} or \sty{polyglossia} be loaded?
+% \begin{macrocode}
+\ifcase\@locale@supportopt
+% \end{macrocode}
+% No support required.
+% \begin{macrocode}
+\or
+% \end{macrocode}
+% \pkgopt{auto} option.
+% \begin{macrocode}
+ \@locale@trackall
+ \ForEachTrackedDialect{\locale@this@dialect}%
+ {%
+% \end{macrocode}
+% Get root language name.
+% \begin{macrocode}
+ \edef\this@root@lang{\TrackedLanguageFromDialect{\locale@this@dialect}}%
+% \end{macrocode}
+% Is this language in the CJK list?
+% \begin{macrocode}
+ \@locale@ifcjk{\this@root@lang}%
+ {
+ \let\@locale@ifsupportcjk\@firstoftwo
+% \end{macrocode}
+% Is pinyin needed?
+% \begin{macrocode}
+ \@locale@iflatinscript{\locale@this@dialect}%
+ {\let\@locale@ifsupportpinyin\@firstoftwo}%
+ {}
+ }
+ {}
+% \end{macrocode}
+% No point checking for \sty{polyglossia} support if not using
+% \XeLaTeX\ or \LuaLaTeX.
+% \begin{macrocode}
+ \@locale@ifxeorlua
+ {
+ \@locale@ifsupportbabelorpoly
+ {
+% \end{macrocode}
+% Haven't yet determined support for \sty{babel} or \sty{polyglossia}.
+% Does the file \texttt{gloss-}\meta{language}\texttt{.ldf} exist?
+% \begin{macrocode}
+ \IfFileExists{gloss-\this@root@lang.ldf}
+ {
+ \let\@locale@ifsupportbabelorpoly\@thirdofthree
+ }
+ {
+% \end{macrocode}
+% Does the file \meta{language}\texttt{.ldf} exist?
+% \begin{macrocode}
+ \IfFileExists{\this@root@lang.ldf}
+ {\let\@locale@ifsupportbabelorpoly\@secondofthree}
+ {}
+ }
+ }
+% \end{macrocode}
+% Don't bother checking if already determined that \sty{babel} needs
+% to be used.
+% \begin{macrocode}
+ {}
+ {
+% \end{macrocode}
+% Already found one language supported by \sty{polyglossia}. Now
+% check this one.
+% Does the file \texttt{gloss-}\meta{language}\texttt{.ldf} exist?
+% \begin{macrocode}
+ \IfFileExists{gloss-\this@root@lang.ldf}
+ {}
+ {
+% \end{macrocode}
+% No support for this language with \sty{polyglossia}.
+% Does the file \meta{language}\texttt{.ldf} exist?
+% \begin{macrocode}
+ \IfFileExists{\this@root@lang.ldf}
+ {\let\@locale@ifsupportbabelorpoly\@secondofthree}
+ {}
+ }
+ }
+ }
+ {
+% \end{macrocode}
+% Not using \XeLaTeX\ or \LuaLaTeX\ so no \sty{polyglossia} support.
+% Does the file \meta{language}\texttt{.ldf} exist?
+% \begin{macrocode}
+ \IfFileExists{\this@root@lang.ldf}
+ {\let\@locale@ifsupportbabelorpoly\@secondofthree}
+ {}
+ }
+ }
+\or
+% \end{macrocode}
+% \pkgopt{babel} option.
+% \begin{macrocode}
+ \let\@locale@ifsupportbabelorpoly\@secondofthree
+\or
+% \end{macrocode}
+% \pkgopt{polyglossia} option.
+% \begin{macrocode}
+ \let\@locale@ifsupportbabelorpoly\@thirdofthree
+\or
+% \end{macrocode}
+% \pkgopt{cjk} option.
+% \begin{macrocode}
+ \let\@locale@currentiscjk\@secondoftwo
+% \end{macrocode}
+% Is pinyin needed?
+% \begin{macrocode}
+ \ForEachTrackedDialect{\locale@this@dialect}%
+ {%
+ \edef\this@root@lang{\TrackedLanguageFromDialect{\locale@this@dialect}}%
+ \@locale@ifcjk{\this@root@lang}%
+ {
+ \@locale@iflatinscript{\locale@this@dialect}%
+ {\let\@locale@ifsupportpinyin\@firstoftwo}%
+ {}
+ }
+ {}
+ }
+% \end{macrocode}
+%End of case statement
+% \begin{macrocode}
+\fi
+% \end{macrocode}
+%
+% Does \sty{CJK} need to be loaded?
+% \begin{macrocode}
+\@locale@ifsupportcjk
+{
+% \end{macrocode}
+% Is UTF-8 support needed?
+% \begin{macrocode}
+ \@locale@ifxeorlua
+ {
+ \RequirePackage{xeCJK}%
+ }
+ {
+ \ifdefstring\@locale@inputenc{utf8}%
+ {%
+ \RequirePackage{CJKutf8}%
+% \end{macrocode}
+% \sty{CJKutf8} automatically loads
+% \sty{inputenc} with the \pkgopt{utf8} option.
+% \begin{macrocode}
+ \renewcommand{\@locale@loadinputenc}{}%
+% \end{macrocode}
+% Need to ensure UTF-8 characters are correctly set up when the
+% query is made.
+% \begin{macrocode}
+ \newcommand*{\localeprequery}{\begin{CJK}{UTF8}{}\makeatletter}
+ \newcommand*{\localepostquery}{\end{CJK}}
+ }%
+ {%
+ \RequirePackage{CJK}%
+% \end{macrocode}
+% Non-UTF encoding. Not implemented as I'm
+% not familiar with these encodings.
+% \begin{macrocode}
+ \PackageWarning{tex-locale}{Unsupported encoding `\@locale@loadinputenc'}%
+ }%
+ }
+% \end{macrocode}
+% Load \sty{pinyin} if needed.
+% \begin{macrocode}
+ \@locale@ifsupportpinyin
+ {\RequirePackage{pinyin}}%
+ {}%
+}
+{}
+% \end{macrocode}
+
+% Load \sty{inputenc} if required.
+% \begin{macrocode}
+\@locale@loadinputenc
+% \end{macrocode}
+%
+%\begin{macro}{\localenopolypunct}
+%Just does its argument (scoped) if \sty{polyglossia} hasn't been
+%loaded. (Made robust if \sty{polyglossia} is loaded.)
+% \begin{macrocode}
+\newcommand{\localenopolypunct}[1]{{#1}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@nopolypunct}
+%Robust form used with \sty{polyglossia}.
+% \begin{macrocode}
+\newrobustcmd{\@locale@nopolypunct}[1]{%
+ {%
+ \@tracklang@ifundef{no\languagename @punctuation}{}%
+ {\csname no\languagename @punctuation\endcsname}%
+ #1%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%Load the generic code.
+% \begin{macrocode}
+\input{tex-locale}
+% \end{macrocode}
+%Load \sty{datetime2} if required:
+% \begin{macrocode}
+\@locale@load@dtm
+% \end{macrocode}
+%
+%\begin{macro}{\LocaleSupportPackageCase}
+%\begin{definition}
+%\cs{LocaleSupportPackageCase}\marg{babel}\marg{polyglossia}\marg{neither}
+%\end{definition}
+%Provide a user-level command to determine whether \sty{babel} or
+%\sty{polyglossia} was used. This doesn't test if \sty{CJK} was
+%loaded, which may have additionally been loaded.
+% \begin{macrocode}
+\@ifpackageloaded{polyglossia}
+{\newcommand{\LocaleSupportPackageCase}[3]{#2}}
+{%
+ \@ifpackageloaded{babel}
+ {\newcommand{\LocaleSupportPackageCase}[3]{#1}}%
+ {\newcommand{\LocaleSupportPackageCase}[3]{#3}}%
+}
+% \end{macrocode}
+%\end{macro}
+%\iffalse
+% \begin{macrocode}
+%</tex-locale.sty>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*tex-locale.tex>
+% \end{macrocode}
+%\fi
+%\section{Generic Code (\texttt{tex-locale.tex})}
+% Does the category code of \verb|@| need changing?
+%\begin{macro}{\@locale@restore@at}
+% \begin{macrocode}
+\ifnum\catcode`\@=11\relax
+ \def\@locale@restore@at{}%
+\else
+ \expandafter\edef\csname @locale@restore@at\endcsname{%
+ \noexpand\catcode`\noexpand\@=\number\catcode`\@\relax
+ }%
+ \catcode`\@=11\relax
+\fi
+% \end{macrocode}
+%\end{macro}
+% First check if this file has already been loaded:
+% \begin{macrocode}
+\ifx\@locale@parse@query\undefined
+\else
+ \@locale@restore@at
+ \expandafter\endinput
+\fi
+% \end{macrocode}
+% Version info.
+% \begin{macrocode}
+\expandafter\def\csname ver@tex-locale.tex\endcsname{2018/08/26 v1.0
+(NLCT) localisation support}
+% \end{macrocode}
+% Load \styfmt{tracklang} and \styfmt{texosquery}:
+% \begin{macrocode}
+\input tracklang
+\input texosquery
+% \end{macrocode}
+%
+%\begin{macro}{\@locale@err}
+% \begin{macrocode}
+\ifx\PackageError\undefined
+ \def\@locale@err#1#2{%
+ \errhelp{#2}%
+ \errmessage{tex-locale: #1}}
+\else
+ \def\@locale@err#1#2{\PackageError{tex-locale}{#1}{#2}}
+\fi
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@warn}
+%Use \sty{tracklang}'s warning to allow all warnings to be switched
+%off at the same time.
+% \begin{macrocode}
+\def\@locale@warn{\@tracklang@pkgwarn{tex-locale}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@info}
+%Information message.
+% \begin{macrocode}
+\ifx\PackageInfo\undefined
+ \def\@locale@info#1{%
+ {%
+ \newlinechar=`\^^J
+ \def\MessageBreak{^^J}%
+ \message{^^Jtex-locale Info: #1^^J}%
+ }%
+ }
+\else
+ \def\@locale@info#1{\PackageInfo{tex-locale}{#1}}
+\fi
+% \end{macrocode}
+%\end{macro}
+%
+%Check \sty{tracklang} is at least v1.3.4.
+% \begin{macrocode}
+\ifx\@tracklang@pkgwarn\undefined
+ \@locale@err{tracklang version is too old. At least v1.3.4 required}
+ {You need to update tracklang to at least v1.3.4}%
+\fi
+% \end{macrocode}
+%
+%Check \sty{texosquery} is at least v1.4.
+% \begin{macrocode}
+\ifx\@texosquery@argquote\undefined
+ \@locale@err{texosquery version is too old. At least v1.4 required}
+ {You need to update texosquery to at least v1.4}%
+\fi
+% \end{macrocode}
+%
+%\begin{macro}{\LocaleMain}
+%If \cs{LocaleMain} hasn't been defined, define it. This macro
+%stores the language tag of the document's main region or
+%\texttt{locale} to use the OS locale. The default is
+%\texttt{locale}. This is a user-level command so it can be set before loading
+%\file{tex-locale.tex}.
+% \begin{macrocode}
+\ifx\LocaleMain\undefined
+ \def\LocaleMain{locale}
+\fi
+% \end{macrocode}
+%Sanitize just in case.
+% \begin{macrocode}
+\@tracklang@sanitize\LocaleMain
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleOther}
+%If \cs{LocaleOther} hasn't been defined, define it. This macro
+%stores a comma-separated list of language tags or
+%\texttt{locale} for additional regions. The default is empty. This
+%is a user-level command so it can be set before loading
+%\file{tex-locale.tex}.
+% \begin{macrocode}
+\ifx\LocaleOther\undefined
+ \def\LocaleOther{}
+\else
+% \end{macrocode}
+%Sanitize just in case.
+% \begin{macrocode}
+ \@tracklang@sanitize\LocaleOther
+\fi
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@tag}
+%Command to keep track of the OS locale. This is
+%initialised as empty but will be set if the \sty{texosquery} call
+%is successful.
+% \begin{macrocode}
+\def\@locale@os@tag{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@default}
+%The keyword used to indicate the OS locale.
+% \begin{macrocode}
+\def\@locale@os@default{locale}
+% \end{macrocode}
+%Sanitize since it needs to be compared with \cs{LocaleMain}.
+% \begin{macrocode}
+\@tracklang@sanitize\@locale@os@default
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@unknown@currency}
+%Unknown currency designator.
+% \begin{macrocode}
+\def\@locale@unknown@currency{XXX}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@region}
+%The OS region. Initialised as empty but will be set if the
+%\sty{texosquery} call is successful.
+% \begin{macrocode}
+\def\@locale@os@region{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@groupsep}
+%The OS numeric group sep. Initialised as empty but will be set if the
+%\sty{texosquery} call is successful.
+% \begin{macrocode}
+\def\@locale@os@groupsep{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@decsep}
+%The OS numeric group sep. Initialised as empty but will be set if the
+%\sty{texosquery} call is successful.
+% \begin{macrocode}
+\def\@locale@os@decsep{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@cursep}
+%The OS currency separator. Initialised as empty but will be set if the
+%\sty{texosquery} call is successful.
+% \begin{macrocode}
+\def\@locale@os@cursep{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@exp}
+%The OS exponent symbol. Initialised as empty but will be set if the
+%\sty{texosquery} call is successful.
+% \begin{macrocode}
+\def\@locale@os@exp{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@usesgroup}
+%The OS numeric uses group value. Initialised as empty but will be set if the
+%\sty{texosquery} call is successful.
+% \begin{macrocode}
+\def\@locale@os@usesgroup{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@currencycode}
+%The OS currency code. Initialised as unknown code but will be set if the
+%\sty{texosquery} call is successful.
+% \begin{macrocode}
+\def\@locale@os@currencycode{XXX}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@regionalcurrencycode}
+%The OS regional currency code. Initialised as empty but will be set if the
+%\sty{texosquery} call is successful.
+% \begin{macrocode}
+\def\@locale@os@regionalcurrencycode{XXX}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@currencysym}
+%The OS currency symbol. Initialised as empty but will be set if the
+%\sty{texosquery} call is successful.
+% \begin{macrocode}
+\def\@locale@os@currencysym{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@os@currencytex}
+%The OS currency \TeX\ code. Initialised as empty but will be set if the
+%\sty{texosquery} call is successful.
+% \begin{macrocode}
+\def\@locale@os@currencytex{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleMainFile}
+%The document's main file. (The modification date is queried if not
+%empty.) If \cs{jobname} includes double-quotes, these need to be
+%stripped to avoid interfering with the shell-escape (especially in
+%restricted mode).
+% \begin{macrocode}
+\ifx\LocaleMainFile\undefined
+ \edef\LocaleMainFile{\expandafter\texosquerystripquotes{\jobname}.tex}
+\fi
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfDateTimePatternsSupported}
+%The \texttt{-M} and \texttt{-Z} lookup is optional. This may be
+%defined before \file{texosquery.tex} is input.
+% \begin{macrocode}
+\ifx\LocaleIfDateTimePatternsSupported\undefined
+ \def\LocaleIfDateTimePatternsSupported#1#2{#2}
+\fi
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localedatetimefmt}
+%Allow the date/time to be wrapped in a formatting command.
+% \begin{macrocode}
+\def\localedatetimefmt#1{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Setting Command Line Switches}
+%
+%\begin{macro}{\LocaleQueryCodesetParam}
+%\app{texosquery} has two different actions for obtaining the
+%codeset: \texttt{-{}-codeset-lcs} ("-C") and \texttt{-{}-codeset}
+%(-cs). The second returns the codeset name as recognised by Java.
+%The first returns a modified version that's closer
+%to the \sty{inputenc} setting. This macro defaults to using "-C"
+%but may be defined before this file is loaded to use "-cs" instead.
+%(This command isn't used by \file{locale.sty} when determining the
+%input encoding for \sty{inputenc}.)
+% \begin{macrocode}
+\ifx\LocaleQueryCodesetParam\undefined
+ \edef\LocaleQueryCodesetParam{\string-C}
+\fi
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@query@params}
+%It's more efficient to have a single \sty{texosquery} call, but the
+%parameters need to be determined first. (Use short arg with
+%\cs{string} just in case the hyphen character has a special
+%meaning.)
+% \begin{macrocode}
+\edef\@locale@query@params{%
+% \end{macrocode}
+%Since we need to use \sty{texosquery} anyway, may as well look up
+%the OS information at the same time.
+% \begin{macrocode}
+ \string-o \string-r \string-a
+% \end{macrocode}
+% May as well get the PDF date in case we have a TeX format that
+% doesn't provide \ics{pdfcreationdate}.
+% \begin{macrocode}
+ \string-n
+% \end{macrocode}
+% Default locale data (requires \sty{texosquery} v1.2):
+% \begin{macrocode}
+ \string-N
+% \end{macrocode}
+% May as well get the default codeset (requires \sty{texosquery}
+% v1.2). Note that \texttt{locale.sty} may have already found this
+% if the \sty{inputenc} package was automatically loaded.
+% \begin{macrocode}
+ \LocaleQueryCodesetParam\space
+}
+% \end{macrocode}
+%The remaining arguments need to be appended programatically.
+%
+%If the date-time patterns are needed, get the full date-time
+%information.
+% \begin{macrocode}
+\LocaleIfDateTimePatternsSupported
+{%
+ \edef\@locale@query@params{\@locale@query@params \string-M }
+}
+{}
+% \end{macrocode}
+%
+% May as well get the modification date of the document file since
+% we need to make a system call anyway, but only if
+% \cs{LocaleMainFile} isn't empty.
+% \begin{macrocode}
+\ifx\LocaleMainFile\empty
+\else
+ \edef\@locale@query@params{\@locale@query@params
+ \string-d \@texosquery@argquote{\LocaleMainFile}
+ }
+\fi
+% \end{macrocode}
+%The \texttt{-D} switch also requires \sty{texosquery} v1.2.
+%First deal with the main language.
+% \begin{macrocode}
+\ifx\LocaleMain\@locale@os@default
+ \LocaleIfDateTimePatternsSupported
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \string-Z
+ }
+ }
+ {
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D
+ }
+ }
+\else
+ \LocaleIfDateTimePatternsSupported
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \LocaleMain\space\string-Z \LocaleMain\space
+ }
+ }
+ {
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \LocaleMain\space
+ }
+ }
+\fi
+% \end{macrocode}
+%Iterate through the list of other languages.
+% \begin{macrocode}
+\@tracklang@for\@locale@tag:=\LocaleOther\do{%
+ \ifx\@locale@tag\@locale@os@default
+ \LocaleIfDateTimePatternsSupported
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \string-Z
+ }
+ }
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D
+ }
+ }
+ \else
+ \LocaleIfDateTimePatternsSupported
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \@locale@tag\space\string-Z \@locale@tag\space
+ }
+ }
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \@locale@tag\space
+ }
+ }
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{System Call}
+%
+%\begin{macro}{\localeprequery}
+%Allow for a hook immediately before the query.
+% \begin{macrocode}
+\csname localeprequery\endcsname
+% \end{macrocode}
+%\end{macro}
+%
+%Now run \sty{texosquery} unless \cs{LocaleQueryFile} has been
+%defined, in which case use \cs{TeXOSQueryFromFile}
+% \begin{macrocode}
+\ifx\LocaleQueryFile\undefined
+% \end{macrocode}
+% No file provided.
+% \begin{macrocode}
+ \TeXOSQuery{\@locale@result}{\@locale@query@params}
+\else
+ \ifx\LocaleQueryFile\empty
+ \TeXOSQuery{\@locale@result}{\@locale@query@params}
+ \else
+% \end{macrocode}
+%\cs{TeXOSQueryFromFile} was added to \sty{texosquery} v1.4, so
+%check it's available.
+% \begin{macrocode}
+ \ifx\TeXOSQueryFromFile\undefined
+ \@locale@err{texosquery too old to support
+ \string\LocaleQueryFile. At least v1.4 required}
+ {You need to update your version of texosquery}
+ \def\@locale@result{}
+ \else
+ \@locale@info{Fetching query results from `\LocaleQueryFile'}%
+ \TeXOSQueryFromFile{\@locale@result}{\LocaleQueryFile}
+ \fi
+ \fi
+\fi
+% \end{macrocode}
+%Make the result global in case the pre and post query hooks have
+%introduced a local scope.
+% \begin{macrocode}
+\global\let\@locale@result\@locale@result
+% \end{macrocode}
+%
+%\begin{macro}{\localepostquery}
+%Allow for a hook immediately after the query.
+% \begin{macrocode}
+\csname localepostquery\endcsname
+% \end{macrocode}
+%\end{macro}
+%
+%If the result is empty then the query failed (\sty{texosquery} not
+%installed correctly or JRE not installed or shell escape not
+%permitted or dry run mode on). The result now needs to be parsed,
+%but first define some convenient commands that can be used by the
+%parser.
+%
+%\subsection{Attributes}\label{sec:code.attributes}
+%\begin{macro}{\LocaleSetAttribute}
+%\begin{definition}
+%\cs{LocaleSetAttribute}\marg{label}\marg{attribute
+%label}\marg{attribute value}
+%\end{definition}
+%Provide convenient way of defining attributes. The label depends on
+%the attribute type. For example, it could be the dialect label or
+%the region code.
+% \begin{macrocode}
+\def\LocaleSetAttribute#1#2#3{%
+ \expandafter\def\csname locale@#2@#1\endcsname{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleAppToAttribute}
+%\begin{definition}
+%\cs{LocaleAppToAttribute}\marg{label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Append \meta{value} to this attribute value.
+% \begin{macrocode}
+\def\LocaleAppToAttribute#1#2#3{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\csname locale@#2@#1\expandafter\endcsname
+ \expandafter\expandafter\expandafter{\csname locale@#2@#1\endcsname#3}%
+ }%
+ {\expandafter\def\csname locale@#2@#1\endcsname{#3}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleXpAppToAttribute}
+%\begin{definition}
+%\cs{LocaleXpAppToAttribute}\marg{label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%As above but expand first token of \meta{value}.
+% \begin{macrocode}
+\def\LocaleXpAppToAttribute#1#2#3{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\csname locale@#2@#1\expandafter\endcsname
+ \expandafter\expandafter\expandafter{%
+ \csname locale@#2@#1\expandafter\endcsname#3}%
+ }%
+ {%
+ \expandafter\def\csname locale@#2@#1\expandafter\endcsname\expandafter{#3}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleAddToAttributeList}
+%\begin{definition}
+%\cs{LocaleAddToAttributeList}\marg{label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Adds \meta{value} to this attribute's list (without repetition).
+% \begin{macrocode}
+\def\LocaleAddToAttributeList#1#2#3{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \LocaleIfInAttributeList{#1}{#2}{#3}%
+ {}%
+ {\LocaleAppToAttribute{#1}{#2}{,#3}}%
+ }%
+ {\LocaleSetAttribute{#1}{#2}{#3}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleXpAddToAttributeList}
+%\begin{definition}
+%\cs{LocaleXpAddToAttributeList}\marg{label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Adds \meta{value} to this attribute's list (without repetition).
+% \begin{macrocode}
+\def\LocaleXpAddToAttributeList#1#2#3{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \LocaleIfXpInAttributeList{#1}{#2}{#3}%
+ {}%
+ {\LocaleXpAppToAttribute{#1}{#2}{\expandafter,#3}}%
+ }%
+ {\expandafter\def\csname locale@#2@#1\expandafter\endcsname\expandafter{#3}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localeshowattribute}
+%Debugging command.
+% \begin{macrocode}
+\def\localeshowattribute#1#2{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\show\csname locale@#2@#1\endcsname
+ }%
+ {\@locale@err{Attribute `#2' not defined for `#1'}%
+ {\string\localeshowattribute\space was asked to show this
+ attribute for the given attribute type, but the
+ associated command hasn't been defined}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleProvideAttribute}
+%\begin{definition}
+%\cs{LocaleProvideAttribute}\marg{label}\marg{attribute
+%label}\marg{attribute value}
+%\end{definition}
+%Only set the attribute if it hasn't already been set for this label.
+% \begin{macrocode}
+\def\LocaleProvideAttribute#1#2#3{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {}%
+ {\LocaleSetAttribute{#1}{#2}{#3}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleLetAttribute}
+%\begin{definition}
+%\cs{LocaleLetAttribute}\marg{label}\marg{attribute
+%label}\marg{cs}
+%\end{definition}
+%Set the attribute value to the definition of the control sequence \meta{cs}.
+% \begin{macrocode}
+\def\LocaleLetAttribute#1#2#3{%
+ \expandafter\let\csname locale@#2@#1\endcsname#3%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleGetAttributeOrDefValue}
+%\begin{definition}
+%\cs{LocaleGetAttributeOrDefValue}\marg{label}\marg{attribute label}\marg{def
+%value}
+%\end{definition}
+%Gets the attribute or the default value if unset.
+% \begin{macrocode}
+\def\LocaleGetAttributeOrDefValue#1#2#3{%
+ \@tracklang@ifundef{locale@#2@#1}%
+ {#3\@locale@undef@action{#1}{#2}}%
+ {\csname locale@#2@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleGetAttribute}
+%\begin{definition}
+%\cs{LocaleGetAttribute}\marg{label}\marg{attribute label}
+%\end{definition}
+% \begin{macrocode}
+\def\LocaleGetAttribute#1#2{%
+ \LocaleGetAttributeOrDefValue{#1}{#2}{}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@undef@action}
+%Action if an undefined attribute is referenced.
+%Does nothing by default but may be redefined for debugging
+%purposes.
+% \begin{macrocode}
+\def\@locale@undef@action#1#2{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfHasAttribute}
+%\begin{definition}
+%\cs{LocaleIfHasAttribute}\marg{label}\marg{attribute
+%label}\marg{true}\marg{false}
+%\end{definition}
+%Tests if the given attribute has been assigned.
+% \begin{macrocode}
+\def\LocaleIfHasAttribute#1#2#3#4{%
+ \@tracklang@ifundef{locale@#2@#1}%
+ {#4}%
+ {#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleForEachInAttributeList}
+%\begin{definition}
+%\cs{LocaleForEachInAttributeList}\marg{label}\marg{attribute
+%label}\marg{cs}\marg{body}
+%\end{definition}
+%Where an attribute value is a comma-separated list, this iterates
+%over each item in that list, setting \meta{cs} to that item and
+%performing \meta{body}.
+% \begin{macrocode}
+\def\LocaleForEachInAttributeList#1#2#3#4{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\@tracklang@for\expandafter#3\expandafter:\expandafter
+ =\csname locale@#2@#1\endcsname\do{#4}%
+ }%
+ {}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfInAttributeList}
+%\begin{definition}
+%\cs{LocaleIfInAttributeList}\marg{label}\marg{attribute
+%label}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%Where an attribute value is a comma-separated list, this tests if
+%\meta{item} is in that list.
+% \begin{macrocode}
+\def\LocaleIfInAttributeList#1#2#3#4#5{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\let\expandafter\@locale@attrlist\csname locale@#2@#1\endcsname
+ \@tracklang@ifinlist{#3}{\@locale@attrlist}{#4}{#5}%
+ }%
+ {#5}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfXpInAttributeList}
+%\begin{definition}
+%\cs{LocaleIfXpInAttributeList}\marg{label}\marg{attribute
+%label}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%As above but expands the first token of \meta{item}.
+% \begin{macrocode}
+\def\LocaleIfXpInAttributeList#1#2#3#4#5{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\let\expandafter\@locale@attrlist\csname locale@#2@#1\endcsname
+ \expandafter\@tracklang@ifinlist\expandafter{#3}{\@locale@attrlist}{#4}{#5}%
+ }%
+ {#5}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfHasNonEmptyAttribute}
+%\begin{definition}
+%\cs{LocaleIfHasNonEmptyAttribute}\marg{label}\marg{attribute
+%label}\marg{true}\marg{false}
+%\end{definition}
+%Tests if the given attribute has been assigned a non-empty value.
+% \begin{macrocode}
+\def\LocaleIfHasNonEmptyAttribute#1#2#3#4{%
+ \@tracklang@ifundef{locale@#2@#1}%
+ {#4}%
+ {%
+ \expandafter\ifx\csname locale@#2@#1\endcsname\empty
+ #4%
+ \else
+ #3%
+ \fi
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfAttributeEqCs}
+%\begin{definition}
+%\cs{LocaleIfAttributeEqCs}\marg{label}\marg{attribute
+%label}\marg{cs}\marg{true}\marg{false}
+%\end{definition}
+%If the attribute value is the same as the definition of the control
+%sequence \meta{cs} to \meta{true} otherwise do false.
+% \begin{macrocode}
+\def\LocaleIfAttributeEqCs#1#2#3#4#5{%
+ \expandafter\ifx\csname locale@#2@#1\endcsname#3%
+ #4%
+ \else
+ #5%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfAttributeEqCsName}
+%\begin{definition}
+%\cs{LocaleIfAttributeEqCsName}\marg{label}\marg{attribute
+%label}\marg{cs name}\marg{true}\marg{false}
+%\end{definition}
+%If the attribute value is the same as the definition of the control
+%sequence name \meta{cs name} to \meta{true} otherwise do false.
+% \begin{macrocode}
+\def\LocaleIfAttributeEqCsName#1#2#3#4#5{%
+ \expandafter\ifx
+ \csname locale@#2@#1\expandafter\endcsname
+ \csname #3\endcsname
+ #4%
+ \else
+ #5%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfAttributeEqNum}
+%\begin{definition}
+%\cs{LocaleIfAttributeEqNum}\marg{label}\marg{attribute
+%label}\marg{n}\marg{true}\marg{false}
+%\end{definition}
+%If the numeric attribute value is equal to \meta{n} do \meta{true}
+%otherwise do \meta{false}.
+% \begin{macrocode}
+\def\LocaleIfAttributeEqNum#1#2#3#4#5{%
+ \LocaleIfHasNonEmptyAttribute{#1}{#2}%
+ {%
+ \expandafter\ifnum\csname locale@#2@#1\endcsname=#3
+ #4%
+ \else
+ #5%
+ \fi
+ }%
+ {#5}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfSameAttributeValues}
+%\begin{definition}
+%\cs{LocaleIfSameAttributeValues}\marg{label}\marg{attribute
+%1}\marg{attribute 2}\marg{true}\marg{false}
+%\end{definition}
+%Tests if two different attributes for the same \meta{label} have
+%matching values.
+% \begin{macrocode}
+\def\LocaleIfSameAttributeValues#1#2#3#4#5{%
+ \expandafter\ifx
+ \csname locale@#2@#1\expandafter\endcsname
+ \csname locale@#3@#1\endcsname
+ #4%
+ \else
+ #5%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localeshowdialectattribute}
+%Debugging command.
+% \begin{macrocode}
+\def\localeshowdialectattribute#1#2{%
+ \localeshowattribute{#1}{dialect@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleSetDialectAttribute}
+%\begin{definition}
+%\cs{LocaleSetDialectAttribute}\marg{dialect label}\marg{attribute
+%label}\marg{attribute value}
+%\end{definition}
+%Sets dialect attribute.
+% \begin{macrocode}
+\def\LocaleSetDialectAttribute#1#2#3{%
+ \LocaleSetAttribute{#1}{dialect@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleProvideDialectAttribute}
+%\begin{definition}
+%\cs{LocaleProvideDialectAttribute}\marg{dialect label}\marg{attribute
+%label}\marg{attribute value}
+%\end{definition}
+%Provides dialect attribute.
+% \begin{macrocode}
+\def\LocaleProvideDialectAttribute#1#2#3{%
+ \LocaleProvideAttribute{#1}{dialect@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleLetDialectAttribute}
+%\begin{definition}
+%\cs{LocaleLetDialectAttribute}\marg{dialect label}\marg{attribute
+%label}\marg{cs}
+%\end{definition}
+%Set the dialect attribute value to the definition of the control sequence \meta{cs}.
+% \begin{macrocode}
+\def\LocaleLetDialectAttribute#1#2#3{%
+ \LocaleLetAttribute{#1}{dialect@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleAppToDialectAttribute}
+%\begin{definition}
+%\cs{LocaleAppToDialectAttribute}\marg{dialect label}\marg{attribute
+%label}\marg{attribute value}
+%\end{definition}
+%Append to dialect attribute value.
+% \begin{macrocode}
+\def\LocaleAppToDialectAttribute#1#2#3{%
+ \LocaleAppToAttribute{#1}{dialect@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleXpAppToDialectAttribute}
+%\begin{definition}
+%\cs{LocaleXpAppToDialectAttribute}\marg{dialect label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Append to dialect attribute value (expand first token of
+%\meta{value}).
+% \begin{macrocode}
+\def\LocaleXpAppToDialectAttribute#1#2#3{%
+ \LocaleXpAppToAttribute{#1}{dialect@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleAddToDialectAttributeList}
+%\begin{definition}
+%\cs{LocaleAddToDialectAttributeList}\marg{label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Adds \meta{value} to this attribute's list (without repetition).
+% \begin{macrocode}
+\def\LocaleAddToDialectAttributeList#1#2{%
+ \LocaleAddToAttributeList{#1}{dialect@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleXpAddToDialectAttributeList}
+%\begin{definition}
+%\cs{LocaleXpAddToDialectAttributeList}\marg{label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Adds \meta{value} to this attribute's list (without repetition).
+% \begin{macrocode}
+\def\LocaleXpAddToDialectAttributeList#1#2{%
+ \LocaleXpAddToAttributeList{#1}{dialect@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleGetDialectAttribute}
+%\begin{definition}
+%\cs{LocaleGetDialectAttribute}\marg{dialect label}\marg{attribute
+%label}
+%\end{definition}
+%Gets dialect attribute.
+% \begin{macrocode}
+\def\LocaleGetDialectAttribute#1#2{%
+ \LocaleGetAttribute{#1}{dialect@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleGetDialectAttributeOrDefValue}
+%\begin{definition}
+%\cs{LocaleGetDialectAttributeOrDefValue}\marg{dialect label}\marg{attribute
+%label}\marg{def value}
+%\end{definition}
+%Gets attribute for given dialect or \meta{def value} if unset.
+% \begin{macrocode}
+\def\LocaleGetDialectAttributeOrDefValue#1#2{%
+ \LocaleGetAttributeOrDefValue{#1}{dialect@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfHasDialectAttribute}
+%\begin{definition}
+%\cs{LocaleIfHasDialectAttribute}\marg{dialect label}\marg{attribute
+%label}\marg{true}\marg{false}
+%\end{definition}
+% \begin{macrocode}
+\def\LocaleIfHasDialectAttribute#1#2{%
+ \LocaleIfHasAttribute{#1}{dialect@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleForEachInDialectAttributeList}
+%\begin{definition}
+%\cs{LocaleForEachInDialectAttributeList}\marg{label}\marg{attribute
+%label}\marg{cs}\marg{body}
+%\end{definition}
+%Where an attribute value is a comma-separated list, this iterates
+%over each item in that list, setting \meta{cs} to that item and
+%performing \meta{body}.
+% \begin{macrocode}
+\def\LocaleForEachInDialectAttributeList#1#2{%
+ \LocaleForEachInAttributeList{#1}{dialect@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfInDialectAttributeList}
+%\begin{definition}
+%\cs{LocaleIfInDialectAttributeList}\marg{label}\marg{attribute
+%label}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%Where an attribute value is a comma-separated list, this tests if
+%\meta{item} is in that list.
+% \begin{macrocode}
+\def\LocaleIfInDialectAttributeList#1#2{%
+ \LocaleIfInAttributeList{#1}{dialect@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfXpInDialectAttributeList}
+%\begin{definition}
+%\cs{LocaleIfXpInDialectAttributeList}\marg{label}\marg{attribute
+%label}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%As above but expands the first token of \meta{item}.
+% \begin{macrocode}
+\def\LocaleIfXpInDialectAttributeList#1#2{%
+ \LocaleIfXpInAttributeList{#1}{dialect@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfHasDialectNonEmptyAttribute}
+%\begin{definition}
+%\cs{LocaleIfHasDialectNonEmptyAttribute}\marg{dialect label}\marg{attribute
+%label}\marg{true}\marg{false}
+%\end{definition}
+% \begin{macrocode}
+\def\LocaleIfHasDialectNonEmptyAttribute#1#2{%
+ \LocaleIfHasNonEmptyAttribute{#1}{dialect@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfDialectAttributeEqCs}
+%\begin{definition}
+%\cs{LocaleIfDialectAttributeEqCs}\marg{dialect label}\marg{attribute
+%label}\marg{cs}\marg{true}\marg{false}
+%\end{definition}
+%If the attribute value for the given dialect is the same as the definition of the control
+%sequence \meta{cs} do \meta{true} otherwise do \meta{false}.
+% \begin{macrocode}
+\def\LocaleIfDialectAttributeEqCs#1#2#3{%
+ \LocaleIfAttributeEqCs{#1}{dialect@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfDialectAttributeEqCsName}
+%\begin{definition}
+%\cs{LocaleIfDialectAttributeEqCsName}\marg{dialect label}\marg{attribute
+%label}\marg{cs name}\marg{true}\marg{false}
+%\end{definition}
+%If the attribute value for the given dialect is the same as the definition of the control
+%sequence name \meta{cs name} do \meta{true} otherwise do \meta{false}.
+% \begin{macrocode}
+\def\LocaleIfDialectAttributeEqCsName#1#2#3{%
+ \LocaleIfAttributeEqCsName{#1}{dialect@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfDialectAttributeEqNum}
+%\begin{definition}
+%\cs{LocaleIfDialectAttributeEqNum}\marg{dialect label}\marg{attribute
+%label}\marg{n}\marg{true}\marg{false}
+%\end{definition}
+%If the numeric attribute value for the given dialect is equal to
+%the number \meta{n} do \meta{true} otherwise do \meta{false}.
+% \begin{macrocode}
+\def\LocaleIfDialectAttributeEqNum#1#2#3{%
+ \LocaleIfAttributeEqNum{#1}{dialect@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfSameDialectAttributeValues}
+%\begin{definition}
+%\cs{LocaleIfSameDialectAttributeValues}\marg{dialect label}\marg{attribute
+%1}\marg{attribute 2}\marg{true}\marg{false}
+%\end{definition}
+%Tests if two different dialect attributes for the same
+%\meta{dialect label} have
+%matching values.
+% \begin{macrocode}
+\def\LocaleIfSameDialectAttributeValues#1#2#3{%
+ \LocaleIfSameAttributeValues{#1}{dialect@#2}{dialect@#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localeshowregionattribute}
+%Debugging command.
+% \begin{macrocode}
+\def\localeshowregionattribute#1#2{%
+ \localeshowattribute{#1}{region@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleSetRegionAttribute}
+%\begin{definition}
+%\cs{LocaleSetRegionAttribute}\marg{region code}\marg{attribute
+%label}\marg{attribute value}
+%\end{definition}
+%Sets region attribute.
+% \begin{macrocode}
+\def\LocaleSetRegionAttribute#1#2#3{%
+ \LocaleSetAttribute{#1}{region@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleProvideRegionAttribute}
+%\begin{definition}
+%\cs{LocaleProvideRegionAttribute}\marg{region code}\marg{attribute
+%label}\marg{attribute value}
+%\end{definition}
+%Provides region attribute.
+% \begin{macrocode}
+\def\LocaleProvideRegionAttribute#1#2#3{%
+ \LocaleProvideAttribute{#1}{region@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleLetRegionAttribute}
+%\begin{definition}
+%\cs{LocaleLetRegionAttribute}\marg{region code}\marg{attribute
+%label}\marg{cs}
+%\end{definition}
+%Set the region attribute value to the definition of the control sequence \meta{cs}.
+% \begin{macrocode}
+\def\LocaleLetRegionAttribute#1#2#3{%
+ \LocaleLetAttribute{#1}{region@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleAppToRegionAttribute}
+%\begin{definition}
+%\cs{LocaleAppToRegionAttribute}\marg{region code}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Append to region attribute.
+% \begin{macrocode}
+\def\LocaleAppToRegionAttribute#1#2#3{%
+ \LocaleAppToAttribute{#1}{region@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleXpAppToRegionAttribute}
+%\begin{definition}
+%\cs{LocaleXpAppToRegionAttribute}\marg{region code}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Append to region attribute (expand first token of
+%\meta{value}).
+% \begin{macrocode}
+\def\LocaleXpAppToRegionAttribute#1#2#3{%
+ \LocaleXpAppToAttribute{#1}{region@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleAddToRegionAttributeList}
+%\begin{definition}
+%\cs{LocaleAddToRegionAttributeList}\marg{label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Adds \meta{value} to this attribute's list (without repetition).
+% \begin{macrocode}
+\def\LocaleAddToRegionAttributeList#1#2{%
+ \LocaleAddToAttributeList{#1}{region@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleXpAddToRegionAttributeList}
+%\begin{definition}
+%\cs{LocaleXpAddToRegionAttributeList}\marg{label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Adds \meta{value} to this attribute's list (without repetition).
+% \begin{macrocode}
+\def\LocaleXpAddToRegionAttributeList#1#2{%
+ \LocaleXpAddToAttributeList{#1}{region@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleGetRegionAttribute}
+%\begin{definition}
+%\cs{LocaleGetRegionAttribute}\marg{region code}\marg{attribute
+%label}
+%\end{definition}
+%Gets region attribute.
+% \begin{macrocode}
+\def\LocaleGetRegionAttribute#1#2{%
+ \LocaleGetAttribute{#1}{region@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleGetRegionAttributeOrDefValue}
+%\begin{definition}
+%\cs{LocaleGetRegionAttributeOrDefValue}\marg{region code}\marg{attribute
+%label}\marg{def value}
+%\end{definition}
+%Gets attribute for given region or \meta{def value} if unset.
+% \begin{macrocode}
+\def\LocaleGetRegionAttributeOrDefValue#1#2{%
+ \LocaleGetAttributeOrDefValue{#1}{region@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfHasRegionAttribute}
+%\begin{definition}
+%\cs{LocaleIfHasRegionAttribute}\marg{region code}\marg{attribute
+%label}\marg{true}\marg{false}
+%\end{definition}
+% \begin{macrocode}
+\def\LocaleIfHasRegionAttribute#1#2{%
+ \LocaleIfHasAttribute{#1}{region@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleForEachInRegionAttributeList}
+%\begin{definition}
+%\cs{LocaleForEachInRegionAttributeList}\marg{label}\marg{attribute
+%label}\marg{cs}\marg{body}
+%\end{definition}
+%Where an attribute value is a comma-separated list, this iterates
+%over each item in that list, setting \meta{cs} to that item and
+%performing \meta{body}.
+% \begin{macrocode}
+\def\LocaleForEachInRegionAttributeList#1#2{%
+ \LocaleForEachInAttributeList{#1}{region@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfInRegionAttributeList}
+%\begin{definition}
+%\cs{LocaleIfInRegionAttributeList}\marg{label}\marg{attribute
+%label}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%Where an attribute value is a comma-separated list, this tests if
+%\meta{item} is in that list.
+% \begin{macrocode}
+\def\LocaleIfInRegionAttributeList#1#2{%
+ \LocaleIfInAttributeList{#1}{region@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfXpInRegionAttributeList}
+%\begin{definition}
+%\cs{LocaleIfXpInRegionAttributeList}\marg{label}\marg{attribute
+%label}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%As above but expands the first token of \meta{item}.
+% \begin{macrocode}
+\def\LocaleIfXpInRegionAttributeList#1#2{%
+ \LocaleIfXpInAttributeList{#1}{region@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfHasRegionNonEmptyAttribute}
+%\begin{definition}
+%\cs{LocaleIfHasRegionNonEmptyAttribute}\marg{region code}\marg{attribute
+%label}\marg{true}\marg{false}
+%\end{definition}
+% \begin{macrocode}
+\def\LocaleIfHasRegionNonEmptyAttribute#1#2{%
+ \LocaleIfHasNonEmptyAttribute{#1}{region@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfRegionAttributeEqCs}
+%\begin{definition}
+%\cs{LocaleIfRegionAttributeEqCs}\marg{region code}\marg{attribute
+%label}\marg{cs}\marg{true}\marg{false}
+%\end{definition}
+%If the attribute value for the given region is the same as the definition of the control
+%sequence \meta{cs} do \meta{true} otherwise do \meta{false}.
+% \begin{macrocode}
+\def\LocaleIfRegionAttributeEqCs#1#2#3{%
+ \LocaleIfAttributeEqCs{#1}{region@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfRegionAttributeEqCsName}
+%\begin{definition}
+%\cs{LocaleIfRegionAttributeEqCsName}\marg{region code}\marg{attribute
+%label}\marg{cs name}\marg{true}\marg{false}
+%\end{definition}
+%If the attribute value for the given region is the same as the definition of the control
+%sequence name \meta{cs name} do \meta{true} otherwise do \meta{false}.
+% \begin{macrocode}
+\def\LocaleIfRegionAttributeEqCsName#1#2#3{%
+ \LocaleIfAttributeEqCsName{#1}{region@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfRegionAttributeEqNum}
+%\begin{definition}
+%\cs{LocaleIfRegionAttributeEqNum}\marg{region label}\marg{attribute
+%label}\marg{n}\marg{true}\marg{false}
+%\end{definition}
+%If the numeric attribute value for the given region is equal to
+%the number \meta{n} do \meta{true} otherwise do \meta{false}.
+% \begin{macrocode}
+\def\LocaleIfRegionAttributeEqNum#1#2#3{%
+ \LocaleIfAttributeEqNum{#1}{region@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfSameRegionAttributeValues}
+%\begin{definition}
+%\cs{LocaleIfSameRegionAttributeValues}\marg{region code}\marg{attribute
+%1}\marg{attribute 2}\marg{true}\marg{false}
+%\end{definition}
+%Tests if two different region attributes for the same
+%\meta{region code} have matching values.
+% \begin{macrocode}
+\def\LocaleIfSameRegionAttributeValues#1#2#3{%
+ \LocaleIfSameAttributeValues{#1}{region@#2}{region@#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localeshowcurrencyattribute}
+%Debugging command.
+% \begin{macrocode}
+\def\localeshowcurrencyattribute#1#2{%
+ \localeshowattribute{#1}{currency@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleSetCurrencyAttribute}
+%\begin{definition}
+%\cs{LocaleSetCurrencyAttribute}\marg{currency code}\marg{attribute
+%label}\marg{attribute value}
+%\end{definition}
+%Sets currency attribute.
+% \begin{macrocode}
+\def\LocaleSetCurrencyAttribute#1#2#3{%
+ \LocaleSetAttribute{#1}{currency@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleProvideCurrencyAttribute}
+%\begin{definition}
+%\cs{LocaleProvideCurrencyAttribute}\marg{currency code}\marg{attribute
+%label}\marg{attribute value}
+%\end{definition}
+%Provides currency attribute.
+% \begin{macrocode}
+\def\LocaleProvideCurrencyAttribute#1#2#3{%
+ \LocaleProvideAttribute{#1}{currency@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleLetCurrencyAttribute}
+%\begin{definition}
+%\cs{LocaleLetCurrencyAttribute}\marg{currency code}\marg{attribute
+%label}\marg{cs}
+%\end{definition}
+%Set the currency attribute value to the definition of the control sequence \meta{cs}.
+% \begin{macrocode}
+\def\LocaleLetCurrencyAttribute#1#2#3{%
+ \LocaleLetAttribute{#1}{currency@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleAppToCurrencyAttribute}
+%\begin{definition}
+%\cs{LocaleAppToCurrencyAttribute}\marg{currency code}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Append to currency attribute value.
+% \begin{macrocode}
+\def\LocaleAppToCurrencyAttribute#1#2#3{%
+ \LocaleAppToAttribute{#1}{currency@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleXpAppToCurrencyAttribute}
+%\begin{definition}
+%\cs{LocaleXpAppToCurrencyAttribute}\marg{currency code}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Append to currency attribute value (expand first token of
+%\meta{value}).
+% \begin{macrocode}
+\def\LocaleXpAppToCurrencyAttribute#1#2#3{%
+ \LocaleXpAppToAttribute{#1}{currency@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleAddToCurrencyAttributeList}
+%\begin{definition}
+%\cs{LocaleAddToCurrencyAttributeList}\marg{label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Adds \meta{value} to this attribute's list (without repetition).
+% \begin{macrocode}
+\def\LocaleAddToCurrencyAttributeList#1#2{%
+ \LocaleAddToAttributeList{#1}{currency@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleXpAddToCurrencyAttributeList}
+%\begin{definition}
+%\cs{LocaleXpAddToCurrencyAttributeList}\marg{label}\marg{attribute
+%label}\marg{value}
+%\end{definition}
+%Adds \meta{value} to this attribute's list (without repetition).
+% \begin{macrocode}
+\def\LocaleXpAddToCurrencyAttributeList#1#2{%
+ \LocaleXpAddToAttributeList{#1}{currency@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleGetCurrencyAttribute}
+%\begin{definition}
+%\cs{LocaleGetCurrencyAttribute}\marg{currency code}\marg{attribute
+%label}
+%\end{definition}
+%Gets currency attribute.
+% \begin{macrocode}
+\def\LocaleGetCurrencyAttribute#1#2{%
+ \LocaleGetAttribute{#1}{currency@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleGetCurrencyAttributeOrDefValue}
+%\begin{definition}
+%\cs{LocaleGetCurrencyAttributeOrDefValue}\marg{currency code}\marg{attribute
+%label}\marg{def value}
+%\end{definition}
+%Gets attribute for given currency or \meta{def value} if unset.
+% \begin{macrocode}
+\def\LocaleGetCurrencyAttributeOrDefValue#1#2{%
+ \LocaleGetAttributeOrDefValue{#1}{currency@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfHasCurrencyAttribute}
+%\begin{definition}
+%\cs{LocaleIfHasCurrencyAttribute}\marg{currency code}\marg{attribute
+%label}\marg{true}\marg{false}
+%\end{definition}
+% \begin{macrocode}
+\def\LocaleIfHasCurrencyAttribute#1#2{%
+ \LocaleIfHasAttribute{#1}{currency@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleForEachInCurrencyAttributeList}
+%\begin{definition}
+%\cs{LocaleForEachInCurrencyAttributeList}\marg{label}\marg{attribute
+%label}\marg{cs}\marg{body}
+%\end{definition}
+%Where an attribute value is a comma-separated list, this iterates
+%over each item in that list, setting \meta{cs} to that item and
+%performing \meta{body}.
+% \begin{macrocode}
+\def\LocaleForEachInCurrencyAttributeList#1#2{%
+ \LocaleForEachInAttributeList{#1}{currency@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfInCurrencyAttributeList}
+%\begin{definition}
+%\cs{LocaleIfInCurrencyAttributeList}\marg{label}\marg{attribute
+%label}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%Where an attribute value is a comma-separated list, this tests if
+%\meta{item} is in that list.
+% \begin{macrocode}
+\def\LocaleIfInCurrencyAttributeList#1#2{%
+ \LocaleIfInAttributeList{#1}{currency@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfXpInCurrencyAttributeList}
+%\begin{definition}
+%\cs{LocaleIfXpInCurrencyAttributeList}\marg{label}\marg{attribute
+%label}\marg{item}\marg{true}\marg{false}
+%\end{definition}
+%As above but expands the first token of \meta{item}.
+% \begin{macrocode}
+\def\LocaleIfXpInCurrencyAttributeList#1#2{%
+ \LocaleIfXpInAttributeList{#1}{currency@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfHasCurrencyNonEmptyAttribute}
+%\begin{definition}
+%\cs{LocaleIfHasCurrencyNonEmptyAttribute}\marg{currency code}\marg{attribute
+%label}\marg{true}\marg{false}
+%\end{definition}
+% \begin{macrocode}
+\def\LocaleIfHasCurrencyNonEmptyAttribute#1#2{%
+ \LocaleIfHasNonEmptyAttribute{#1}{currency@#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfCurrencyAttributeEqCs}
+%\begin{definition}
+%\cs{LocaleIfCurrencyAttributeEqCs}\marg{currency code}\marg{attribute
+%label}\marg{cs}\marg{true}\marg{false}
+%\end{definition}
+%If the attribute value for the given currency is the same as the definition of the control
+%sequence \meta{cs} do \meta{true} otherwise do \meta{false}.
+% \begin{macrocode}
+\def\LocaleIfCurrencyAttributeEqCs#1#2#3{%
+ \LocaleIfAttributeEqCs{#1}{currency@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfCurrencyAttributeEqCsName}
+%\begin{definition}
+%\cs{LocaleIfCurrencyAttributeEqCsName}\marg{currency code}\marg{attribute
+%label}\marg{cs name}\marg{true}\marg{false}
+%\end{definition}
+%If the attribute value for the given currency is the same as the definition of the control
+%sequence name \meta{cs name} do \meta{true} otherwise do
+%\meta{false}.
+% \begin{macrocode}
+\def\LocaleIfCurrencyAttributeEqCsName#1#2#3{%
+ \LocaleIfAttributeEqCsName{#1}{currency@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfCurrencyAttributeEqNum}
+%\begin{definition}
+%\cs{LocaleIfCurrencyAttributeEqNum}\marg{currency label}\marg{attribute
+%label}\marg{n}\marg{true}\marg{false}
+%\end{definition}
+%If the numeric attribute value for the given currency is equal to
+%the number \meta{n} do \meta{true} otherwise do \meta{false}.
+% \begin{macrocode}
+\def\LocaleIfCurrencyAttributeEqNum#1#2#3{%
+ \LocaleIfAttributeEqNum{#1}{currency@#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfSameCurrencyAttributeValues}
+%\begin{definition}
+%\cs{LocaleIfSameCurrencyAttributeValues}\marg{currency code}\marg{attribute
+%1}\marg{attribute 2}\marg{true}\marg{false}
+%\end{definition}
+%Tests if two different currency attributes for the same
+%\meta{currency code} have matching values.
+% \begin{macrocode}
+\def\LocaleIfSameCurrencyAttributeValues#1#2#3{%
+ \LocaleIfSameAttributeValues{#1}{currency@#2}{currency@#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Parser Commands}
+%
+%Define commands that are needed to parse the result.
+%\begin{macro}{\@locale@parse@result}
+%Start parsing the result. There are more than nine arguments, so do
+%this in bits. The first six arguments are: OS name, OS version, OS
+%architecture, PDF date-time, BCP 47 tag for default locale,
+%the default file encoding.
+% \begin{macrocode}
+\def\@locale@parse@result#1#2#3#4#5#6{%
+ \def\LocaleOSname{#1}%
+ \def\LocaleOSversion{#2}%
+ \def\LocaleOSarch{#3}%
+ \def\LocaleNowStamp{#4}%
+ \@locale@parse@default#5% remove outer group
+ \def\LocaleOScodeset{#6}%
+% \end{macrocode}
+% Is date-time pattern support required?
+% \begin{macrocode}
+ \LocaleIfDateTimePatternsSupported
+ {%
+ \let\@locale@next\@locale@parse@datetimeinfo
+ }%
+ {%
+ \def\LocaleDateTimeInfo{}%
+% \end{macrocode}
+% Was a file modification date included?
+% \begin{macrocode}
+ \ifx\LocaleMainFile\empty
+ \def\LocaleFileMod{}%
+ \let\@locale@next\@locale@parse@maindata
+ \else
+ \let\@locale@next\@locale@parse@filemod
+ \fi
+ }%
+ \@locale@next
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@datetimeinfo}
+% \begin{macrocode}
+\def\@locale@parse@datetimeinfo#1{%
+ \def\LocaleDateTimeInfo{#1}%
+% \end{macrocode}
+% Was a file modification date included?
+% \begin{macrocode}
+ \ifx\LocaleMainFile\empty
+ \def\LocaleFileMod{}%
+ \let\@locale@next\@locale@parse@maindata
+ \else
+ \let\@locale@next\@locale@parse@filemod
+ \fi
+ \@locale@next
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@default}
+%Parse the result of \texttt{-N}
+% \begin{macrocode}
+\def\@locale@parse@default#1#2#3#4#5#6#7#8#9{%
+ \def\LocaleOStag{#1}%
+% \end{macrocode}
+%Parse (but don't track) tag.
+% \begin{macrocode}
+ \@tracklang@parselangtag{#1}%
+% \end{macrocode}
+%Can now get the region code.
+% \begin{macrocode}
+ \let\@locale@os@region\@TrackLangEnvTerritory
+ \def\@locale@os@groupsep{#2}%
+ \def\@locale@os@decsep{#3}%
+ \def\@locale@os@exp{#4}%
+ \def\@locale@os@usesgroup{#5}%
+ \def\@locale@os@currencycode{#6}%
+ \def\@locale@os@regionalcurrencycode{#7}%
+ \def\@locale@os@currencysym{#8}%
+ \def\@locale@os@currencytex{#9}%
+% \end{macrocode}
+%Provide currency attributes.
+% \begin{macrocode}
+ \LocaleSetRegionAttribute{\@locale@os@region}{currency}{#7}%
+ \LocaleProvideCurrencyAttribute{#7}{official}{#6}%
+ \LocaleProvideCurrencyAttribute{#7}{sym}{#8}%
+ \LocaleProvideCurrencyAttribute{#7}{tex}{#9}%
+ \@locale@parse@default@cursep
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@locale@parse@default@cursep}
+% \begin{macrocode}
+\def\@locale@parse@default@cursep#1{%
+ \def\@locale@os@cursep{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@filemod}
+% \begin{macrocode}
+\def\@locale@parse@filemod#1{%
+ \def\LocaleFileMod{#1}%
+ \@locale@parse@maindata
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@maindata}
+% \begin{macrocode}
+\def\@locale@parse@maindata#1{%
+ \@locale@parse@maindatablock#1% remove outer group
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@maindatablock}
+% \begin{macrocode}
+\def\@locale@parse@maindatablock#1{%
+ \@locale@parse@maindatalocaleblock#1% remove outer group
+ \@locale@parse@dateblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@maindatalocaleblock}
+% \begin{macrocode}
+\def\@locale@parse@maindatalocaleblock#1#2#3#4#5#6#7{%
+ \def\LocaleMain{#1}%
+ \TrackLanguageTag{#1}%
+ \let\LocaleMainDialect\TrackLangLastTrackedDialect
+ \let\@locale@dialect\TrackLangLastTrackedDialect
+% \end{macrocode}
+%Get the region code if provided.
+% \begin{macrocode}
+ \IfTrackedLanguageHasIsoCode{3166-1}{\@locale@dialect}%
+ {%
+ \edef\@locale@region{%
+ \TrackedIsoCodeFromLanguage{3166-1}{\@locale@dialect}}%
+ }%
+ {\def\@locale@region{}}%
+ \let\LocaleMainRegion\@locale@region
+ \ifx\LocaleMainRegion\empty
+ \else
+ \LocaleLetRegionAttribute{\LocaleMainRegion}{dialect}{\@locale@dialect}%
+ \fi
+% \end{macrocode}
+%Save language tag. (Provides a convenient mapping from dialect
+%label to tag.)
+% \begin{macrocode}
+ \LocaleSetDialectAttribute{\@locale@dialect}{langtag}{#1}%
+% \end{macrocode}
+%Provide reverse mapping from tag to dialect label.
+% \begin{macrocode}
+ \LocaleLetAttribute{#1}{tagtodialect}{\@locale@dialect}%
+% \end{macrocode}
+%Save display names.
+% \begin{macrocode}
+ \LocaleSetDialectAttribute{\@locale@dialect}{langname}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativelangname}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{regionname}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativeregionname}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{variantname}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativevariantname}{#7}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@otherdatalocaleblock}
+% \begin{macrocode}
+\def\@locale@parse@otherdatalocaleblock#1#2#3#4#5#6#7{%
+ \TrackLanguageTag{#1}%
+ \let\@locale@dialect\TrackLangLastTrackedDialect
+% \end{macrocode}
+%Get the region code if provided.
+% \begin{macrocode}
+ \IfTrackedLanguageHasIsoCode{3166-1}{\@locale@dialect}%
+ {%
+ \edef\@locale@region{%
+ \TrackedIsoCodeFromLanguage{3166-1}{\@locale@dialect}}%
+ \ifx\@locale@region\empty
+ \else
+ \LocaleXpAddToRegionAttributeList
+ {\@locale@region}{dialect}{\@locale@dialect}%
+ \fi
+ }%
+ {\def\@locale@region{}}%
+% \end{macrocode}
+%Save language tag.
+% \begin{macrocode}
+ \LocaleSetDialectAttribute{\@locale@dialect}{langtag}{#1}%
+% \end{macrocode}
+%Provide reverse mapping from tag to dialect label.
+% \begin{macrocode}
+ \LocaleLetAttribute{#1}{tagtodialect}{\@locale@dialect}%
+% \end{macrocode}
+%Save attributes.
+% \begin{macrocode}
+ \LocaleSetDialectAttribute{\@locale@dialect}{langname}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativelangname}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{regionname}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativeregionname}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{variantname}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativevariantname}{#7}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@dateblock}
+% \begin{macrocode}
+\def\@locale@parse@dateblock#1{%
+ \@locale@parse@dates#1% remove outer group
+ \@locale@parse@datefmtblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@dates}
+% \begin{macrocode}
+\def\@locale@parse@dates#1#2#3#4#5{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulldate}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longdate}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{meddate}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortdate}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{firstday}{#5}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@datefmtblock}
+% \begin{macrocode}
+\def\@locale@parse@datefmtblock#1{%
+ \@locale@parse@datefmts#1% remove outer group
+ \@locale@parse@timeblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@datefmts}
+% \begin{macrocode}
+\def\@locale@parse@datefmts#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulldatefmt}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longdatefmt}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{meddatefmt}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortdatefmt}{#4}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@timeblock}
+% \begin{macrocode}
+\def\@locale@parse@timeblock#1{%
+ \@locale@parse@times#1% remove outer group
+ \@locale@parse@timefmtblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@times}
+% \begin{macrocode}
+\def\@locale@parse@times#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulltime}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longtime}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{medtime}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shorttime}{#4}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@timefmtblock}
+% \begin{macrocode}
+\def\@locale@parse@timefmtblock#1{%
+ \@locale@parse@timefmts#1% remove outer group
+ \@locale@parse@datetimeblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@timefmts}
+% \begin{macrocode}
+\def\@locale@parse@timefmts#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulltimefmt}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longtimefmt}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{medtimefmt}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shorttimefmt}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@datetimeblock}
+% \begin{macrocode}
+\def\@locale@parse@datetimeblock#1{%
+ \@locale@parse@datetimes#1% remove outer group
+ \@locale@parse@datetimefmtblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@datetimes}
+% \begin{macrocode}
+\def\@locale@parse@datetimes#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulldatetime}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longdatetime}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{meddatetime}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortdatetime}{#4}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@datetimefmtblock}
+% \begin{macrocode}
+\def\@locale@parse@datetimefmtblock#1{%
+ \@locale@parse@datetimefmts#1% remove outer group
+ \@locale@parse@weekdayblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@datetimefmts}
+% \begin{macrocode}
+\def\@locale@parse@datetimefmts#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulldatetimefmt}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longdatetimefmt}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{meddatetimefmt}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortdatetimefmt}{#4}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@weekdayblock}
+% \begin{macrocode}
+\def\@locale@parse@weekdayblock#1{%
+ \@locale@parse@weekdays#1% remove outer group
+ \@locale@parse@shortweekdayblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@weekdays}
+% \begin{macrocode}
+\def\@locale@parse@weekdays#1#2#3#4#5#6#7{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.0}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.1}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.2}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.3}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.4}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.5}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.6}{#7}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@shortweekdayblock}
+% \begin{macrocode}
+\def\@locale@parse@shortweekdayblock#1{%
+ \@locale@parse@shortweekdays#1% remove outer group
+ \@locale@parse@monthblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@shortweekdays}
+% \begin{macrocode}
+\def\@locale@parse@shortweekdays#1#2#3#4#5#6#7{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.0}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.1}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.2}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.3}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.4}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.5}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.6}{#7}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@monthblock}
+% \begin{macrocode}
+\def\@locale@parse@monthblock#1{%
+ \@locale@parse@months#1% remove outer group
+ \@locale@parse@shortmonthblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@months}
+% \begin{macrocode}
+\def\@locale@parse@months#1#2#3#4#5#6#7#8#9{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.1}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.2}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.3}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.4}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.5}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.6}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.7}{#7}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.8}{#8}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.9}{#9}%
+% \end{macrocode}
+%Grab the remaining three arguments:
+% \begin{macrocode}
+ \@locale@parse@endmonths
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@endmonths}
+% \begin{macrocode}
+\def\@locale@parse@endmonths#1#2#3{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.10}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.11}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.12}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@shortmonthblock}
+% \begin{macrocode}
+\def\@locale@parse@shortmonthblock#1{%
+ \@locale@parse@shortmonths#1% remove outer group
+ \@locale@parse@standalone@weekdayblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@shortmonths}
+% \begin{macrocode}
+\def\@locale@parse@shortmonths#1#2#3#4#5#6#7#8#9{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.1}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.2}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.3}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.4}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.5}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.6}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.7}{#7}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.8}{#8}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.9}{#9}%
+% \end{macrocode}
+%Grab the remaining three arguments:
+% \begin{macrocode}
+ \@locale@parse@endshortmonths
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@endshortmonths}
+% \begin{macrocode}
+\def\@locale@parse@endshortmonths#1#2#3{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.10}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.11}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.12}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@standalone@weekdayblock}
+% \begin{macrocode}
+\def\@locale@parse@standalone@weekdayblock#1{%
+ \@locale@parse@standalone@weekdays#1% remove outer group
+ \@locale@parse@standalone@shortweekdayblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@standalone@weekdays}
+% \begin{macrocode}
+\def\@locale@parse@standalone@weekdays#1#2#3#4#5#6#7{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.0}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.1}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.2}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.3}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.4}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.5}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.6}{#7}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@standalone@shortweekdayblock}
+% \begin{macrocode}
+\def\@locale@parse@standalone@shortweekdayblock#1{%
+ \@locale@parse@standalone@shortweekdays#1% remove outer group
+ \@locale@parse@standalone@monthblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@standalone@shortweekdays}
+% \begin{macrocode}
+\def\@locale@parse@standalone@shortweekdays#1#2#3#4#5#6#7{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.0}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.1}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.2}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.3}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.4}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.5}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.6}{#7}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@standalone@monthblock}
+% \begin{macrocode}
+\def\@locale@parse@standalone@monthblock#1{%
+ \@locale@parse@standalone@months#1% remove outer group
+ \@locale@parse@standalone@shortmonthblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@standalone@months}
+% \begin{macrocode}
+\def\@locale@parse@standalone@months#1#2#3#4#5#6#7#8#9{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.1}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.2}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.3}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.4}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.5}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.6}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.7}{#7}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.8}{#8}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.9}{#9}%
+% \end{macrocode}
+%Grab the remaining three arguments:
+% \begin{macrocode}
+ \@locale@parse@endstandalone@months
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@endstandalone@months}
+% \begin{macrocode}
+\def\@locale@parse@endstandalone@months#1#2#3{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.10}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.11}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.12}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@standalone@shortmonthblock}
+% \begin{macrocode}
+\def\@locale@parse@standalone@shortmonthblock#1{%
+ \@locale@parse@standalone@shortmonths#1% remove outer group
+ \@locale@parse@numericblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@standalone@shortmonths}
+% \begin{macrocode}
+\def\@locale@parse@standalone@shortmonths#1#2#3#4#5#6#7#8#9{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.1}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.2}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.3}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.4}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.5}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.6}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.7}{#7}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.8}{#8}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.9}{#9}%
+% \end{macrocode}
+%Grab the remaining three arguments:
+% \begin{macrocode}
+ \@locale@parse@endstandalone@shortmonths
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@endstandalone@shortmonths}
+% \begin{macrocode}
+\def\@locale@parse@endstandalone@shortmonths#1#2#3{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.10}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.11}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.12}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@numericblock}
+% \begin{macrocode}
+\def\@locale@parse@numericblock#1{%
+ \@locale@parse@numeric#1% remove outer group
+ \@locale@parse@numericfmtblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@numeric}
+% \begin{macrocode}
+\def\@locale@parse@numeric#1#2#3#4#5#6#7#8#9{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{groupsep}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{decsep}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{exp}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{usesgroup}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{currency}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{regionalcurrency}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{currencysym}{#7}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{currencytex}{#8}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{currencysep}{#9}%
+% \end{macrocode}
+% Set currency attributes.
+% \begin{macrocode}
+ \LocaleProvideCurrencyAttribute{#6}{official}{#5}%
+ \LocaleProvideCurrencyAttribute{#6}{sym}{#7}%
+ \LocaleProvideCurrencyAttribute{#6}{tex}{#8}%
+ \LocaleAddToAttributeList{currencies}{official}{#5}%
+ \LocaleAddToAttributeList{currencies}{regional}{#6}%
+% \end{macrocode}
+%If this dialect has an associated region, map the region to the
+%currency code.
+% \begin{macrocode}
+ \ifx\@locale@region\empty
+ \else
+ \LocaleProvideRegionAttribute{\@locale@region}{currency}{#6}%
+ \LocaleXpAddToCurrencyAttributeList{#5}{region}{\@locale@region}%
+ \LocaleIfSameDialectAttributeValues{\@locale@dialect}%
+ {regionalcurrency}{currency}%
+ {}%
+ {%
+ \LocaleXpAddToCurrencyAttributeList{#6}{region}{\@locale@region}%
+ }%
+ \fi
+% \end{macrocode}
+%Grab remaining arguments.
+% \begin{macrocode}
+ \@locale@parse@persym
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@locale@parse@persym}
+% \begin{macrocode}
+\def\@locale@parse@persym#1#2{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{percent}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{permill}{#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@numericfmtblock}
+% \begin{macrocode}
+\def\@locale@parse@numericfmtblock#1{%
+ \@locale@parse@numericfmt#1% remove outer group
+ \LocaleIfDateTimePatternsSupported
+ {\@locale@parse@timezones}%
+ {\@locale@parse@otherdata}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@numericfmt}
+% \begin{macrocode}
+\def\@locale@parse@numericfmt#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{decfmt}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{intfmt}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{curfmt}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{perfmt}{#4}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@timezones}
+% \begin{macrocode}
+\def\@locale@parse@timezones#1{%
+ \@locale@parse@timezonemap#1\relax
+ \@locale@parse@otherdata
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@timezonemap}
+% \begin{macrocode}
+\def\@locale@parse@timezonemap#1{%
+ \ifx\relax#1\relax
+ \let\@locale@next\relax
+ \else
+ \@locale@save@timezonemap#1%
+ \let\@locale@next\@locale@parse@timezonemap
+ \fi
+ \@locale@next
+}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@save@timezonemap}
+% \begin{macrocode}
+\def\@locale@save@timezonemap#1#2#3#4#5{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.short}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.long}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.shortdst}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.longdst}{#5}%
+ \LocaleAddToAttributeList{timezone}{id}{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@otherdata}
+% \begin{macrocode}
+\def\@locale@endparse@result{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@locale@parse@otherdata}
+% \begin{macrocode}
+\def\@locale@parse@otherdata#1{%
+ \ifx\@locale@endparse@result#1\relax
+% \end{macrocode}
+%Finished.
+% \begin{macrocode}
+ \let\@locale@next\relax
+ \else
+ \def\@locale@next{\@locale@parse@otherdata@localeblock#1}%
+ \fi
+ \@locale@next
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@parse@otherdata@localeblock}
+% \begin{macrocode}
+\def\@locale@parse@otherdata@localeblock#1{%
+ \@locale@parse@otherdatalocaleblock#1% remove outer group
+ \@locale@parse@dateblock
+}
+% \end{macrocode}
+%\end{macro}
+%
+% \begin{macrocode}
+\ifx\@locale@result\empty
+% \end{macrocode}
+%Set defaults.
+% \begin{macrocode}
+ \ifTeXOSQueryDryRun
+ \@locale@warn{Dry run mode on. No data provided by texosquery. Check
+ TeX's shell escape status}%
+ \else
+ \@locale@warn{No data provided by texosquery. Check
+ TeX's shell escape status and texosquery's setup}%
+ \fi
+ \def\LocaleOSname{}%
+ \def\LocaleOSversion{}%
+ \def\LocaleOSarch{}%
+ \def\LocaleNowStamp{}%
+ \def\LocaleOStag{}%
+ \def\LocaleOScodeset{}%
+ \def\LocaleFileMod{}%
+ \def\LocaleMain{}%
+ \def\LocaleMainDialect{}%
+ \def\LocaleMainRegion{}%
+ \def\LocaleDateTimeInfo{}%
+\else
+ \expandafter\@locale@parse@result\@locale@result\@locale@endparse@result
+\fi
+% \end{macrocode}
+%
+%\subsection{Locale User Commands}
+%
+%\begin{macro}{\LocaleLanguageTag}
+%\begin{definition}
+%\cs{LocaleLanguageTag}\marg{dialect}
+%\end{definition}
+%Get the language tag of the given dialect.
+% \begin{macrocode}
+\def\LocaleLanguageTag#1{%
+ \LocaleGetDialectAttribute{#1}{langtag}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\LocaleLanguageName}
+%\begin{definition}
+%\cs{LocaleLanguageName}\marg{dialect}
+%\end{definition}
+%Get the language name of the given dialect according to the OS
+%default language.
+% \begin{macrocode}
+\def\LocaleLanguageName#1{%
+ \LocaleGetDialectAttribute{#1}{langname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\LocaleLanguageNativeName}
+%\begin{definition}
+%\cs{LocaleLanguageNativeName}\marg{dialect}
+%\end{definition}
+%Get the language name of the given dialect according to that
+%dialect.
+% \begin{macrocode}
+\def\LocaleLanguageNativeName#1{%
+ \LocaleGetDialectAttribute{#1}{nativelangname}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleRegionName}
+%\begin{definition}
+%\cs{LocaleRegionName}\marg{dialect}
+%\end{definition}
+%Get the region name of the given dialect according to the OS
+%default language.
+% \begin{macrocode}
+\def\LocaleRegionName#1{%
+ \LocaleGetDialectAttribute{#1}{regionname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\LocaleRegionNativeName}
+%\begin{definition}
+%\cs{LocaleRegionNativeName}\marg{dialect}
+%\end{definition}
+%Get the region name of the given dialect according to that
+%dialect.
+% \begin{macrocode}
+\def\LocaleRegionNativeName#1{%
+ \LocaleGetDialectAttribute{#1}{nativeregionname}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleVariantName}
+%\begin{definition}
+%\cs{LocaleVariantName}\marg{dialect}
+%\end{definition}
+%Get the variant name of the given dialect according to the OS
+%default language.
+% \begin{macrocode}
+\def\LocaleVariantName#1{%
+ \LocaleGetDialectAttribute{#1}{variantname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\LocaleVariantNativeName}
+%\begin{definition}
+%\cs{LocaleVariantNativeName}\marg{dialect}
+%\end{definition}
+%Get the variant name of the given dialect according to that
+%dialect.
+% \begin{macrocode}
+\def\LocaleVariantNativeName#1{%
+ \LocaleGetDialectAttribute{#1}{nativevariantname}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleFullDate}
+%\begin{definition}
+%\cs{LocaleFullDate}\marg{dialect}
+%\end{definition}
+%Get the full date for the given dialect.
+% \begin{macrocode}
+\def\LocaleFullDate#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{fulldate}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleLongDate}
+%\begin{definition}
+%\cs{LocaleLongDate}\marg{dialect}
+%\end{definition}
+%Get the long date for the given dialect.
+% \begin{macrocode}
+\def\LocaleLongDate#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{longdate}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleMediumDate}
+%\begin{definition}
+%\cs{LocaleMediumDate}\marg{dialect}
+%\end{definition}
+%Get the medium date for the given dialect.
+% \begin{macrocode}
+\def\LocaleMediumDate#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{meddate}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleShortDate}
+%\begin{definition}
+%\cs{LocaleShortDate}\marg{dialect}
+%\end{definition}
+%Get the short date for the given dialect.
+% \begin{macrocode}
+\def\LocaleShortDate#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{shortdate}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleFirstDayIndex}
+%\begin{definition}
+%\cs{LocaleFirstDayIndex}\marg{dialect}
+%\end{definition}
+%Get the index for the first day of the week for the given dialect.
+%This starts with 0 for Monday to be compatible with
+%\sty{pgfcalendar} (and \sty{datetime2} which similar does this to
+%be compatible with \sty{pgfcalendar}).
+% \begin{macrocode}
+\def\LocaleFirstDayIndex#1{%
+ \LocaleGetDialectAttributeOrDefValue{#1}{firstday}{-1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtmMondayIndex}
+% \begin{macrocode}
+\def\dtmMondayIndex{0}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtmTuesdayIndex}
+% \begin{macrocode}
+\def\dtmTuesdayIndex{1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtmWednesdayIndex}
+% \begin{macrocode}
+\def\dtmWednesdayIndex{2}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtmThursdayIndex}
+% \begin{macrocode}
+\def\dtmThursdayIndex{3}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtmFridayIndex}
+% \begin{macrocode}
+\def\dtmFridayIndex{4}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtmSaturdayIndex}
+% \begin{macrocode}
+\def\dtmSaturdayIndex{5}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtmSundayIndex}
+% \begin{macrocode}
+\def\dtmSundayIndex{6}
+% \end{macrocode}
+%\end{macro}
+%
+%The ISO-8601 standard has day of week indexing starting with
+%1 for Monday. The \sty{datetime} package has day of week indexing
+%starting with 1 for Sunday, so provide convenient ways to convert
+%if necessary.
+%\begin{macro}{\LocaleDayIndexFromZeroMonToOneSun}
+%Convert from \sty{pgfcalendar}'s Monday=0 indexing to
+%\sty{datetime}'s Sunday=1 indexing.
+% \begin{macrocode}
+\def\LocaleDayIndexFromZeroMonToOneSun#1{%
+ \ifcase#1
+ 2% Monday 0 -> 2
+ \or
+ 3% Tuesday 1 -> 3
+ \or
+ 4% Wednesday 2 -> 4
+ \or
+ 5% Thursday 3 -> 5
+ \or
+ 6% Friday 4 -> 6
+ \or
+ 7% Saturday 5 -> 7
+ \or
+ 1% Sunday 6 -> 1
+ \else
+ -1% invalid
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleDayIndexFromZeroMonToOneMon}
+%Convert from \sty{pgfcalendar}'s Monday=0 indexing to
+%ISO-8601's Monday=1 indexing.
+% \begin{macrocode}
+\def\LocaleDayIndexFromZeroMonToOneMon#1{%
+ \ifcase#1
+ 1% Monday 0 -> 1
+ \or
+ 2% Tuesday 1 -> 2
+ \or
+ 3% Wednesday 2 -> 3
+ \or
+ 4% Thursday 3 -> 4
+ \or
+ 5% Friday 4 -> 5
+ \or
+ 6% Saturday 5 -> 6
+ \or
+ 7% Sunday 6 -> 7
+ \else
+ -1% invalid
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleDayIndexFromOneSunToZeroMon}
+%Convert from \sty{datetime}'s Sunday=1 indexing to \sty{pgfcalendar}'s
+%Monday=0 indexing.
+% \begin{macrocode}
+\def\LocaleDayIndexFromOneSunToZeroMon#1{%
+ \ifcase#1
+ % no 0
+ \or
+ 6% Sunday 1 -> 6
+ \or
+ 0% Monday 2 -> 0
+ \or
+ 1% Tuesday 3 -> 1
+ \or
+ 2% Wednesday 4 -> 2
+ \or
+ 3% Thursday 5 -> 3
+ \or
+ 4% Friday 6 -> 4
+ \or
+ 5% Saturday 7 -> 5
+ \else
+ -1% invalid
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleDayIndexFromOneMonToZeroMon}
+%Convert from ISO-8601's Monday=1 indexing to \sty{pgfcalendar}'s
+%Monday=0 indexing.
+% \begin{macrocode}
+\def\LocaleDayIndexFromOneMonToZeroMon#1{%
+ \ifcase#1
+ % no 0
+ \or
+ 0% Monday 1 -> 0
+ \or
+ 1% Tuesday 2 -> 1
+ \or
+ 2% Wednesday 3 -> 2
+ \or
+ 3% Thursday 4 -> 3
+ \or
+ 4% Friday 5 -> 4
+ \or
+ 5% Saturday 6 -> 5
+ \or
+ 6% Sunday 7 -> 6
+ \else
+ -1% invalid
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleDayIndexFromRegion}
+%Convert from the region's day of the week (starting from 1)
+%to \sty{pgfcalendar}'s 0=Monday indexing. The first argument is the
+%dialect label.
+% \begin{macrocode}
+\def\LocaleDayIndexFromRegion#1#2{%
+% \end{macrocode}
+%Get the region's first day of the week.
+% \begin{macrocode}
+ \ifcase\LocaleFirstDayIndex{#1}
+% \end{macrocode}
+%Monday is the first day of the week. That is, the region's using 1=Monday
+%indexing.
+% \begin{macrocode}
+ \LocaleDayIndexFromOneMonToZeroMon{#2}%
+ \or
+% \end{macrocode}
+%Tuesday is the first day of the week. That is, the region's using
+%1=Tuesday indexing. (These mid-week cases are unlikely, but add
+%them for completeness.)
+% \begin{macrocode}
+ \ifnum#2=7 % Monday
+ 0%
+ \else
+ #2%
+ \fi
+ \or
+% \end{macrocode}
+%Wednesday is the first day of the week. That is, the region's using
+%1=Wednesday indexing.
+% \begin{macrocode}
+ \ifcase#1
+ % no 0
+ \or
+ 2% Wednesday 1 -> 2
+ \or
+ 3% Thursday 2 -> 3
+ \or
+ 4% Friday 3 -> 4
+ \or
+ 5% Saturday 4 -> 5
+ \or
+ 6% Sunday 5 -> 6
+ \or
+ 0% Monday 6 -> 0
+ \or
+ 1% Tuesday 7 -> 1
+ \else
+ -1% invalid
+ \fi
+ \or
+% \end{macrocode}
+%Thursday is the first day of the week. That is, the region's using
+%1=Thursday indexing.
+% \begin{macrocode}
+ \ifcase#1
+ % no 0
+ \or
+ 3% Thursday 1 -> 3
+ \or
+ 4% Friday 2 -> 4
+ \or
+ 5% Saturday 3 -> 5
+ \or
+ 6% Sunday 4 -> 6
+ \or
+ 0% Monday 5 -> 0
+ \or
+ 1% Tuesday 6 -> 1
+ \or
+ 2% Wednesday 7 -> 2
+ \else
+ -1% invalid
+ \fi
+ \or
+% \end{macrocode}
+%Friday is the first day of the week. That is, the region's using
+%1=Friday indexing.
+% \begin{macrocode}
+ \ifcase#1
+ % no 0
+ \or
+ 4% Friday 1 -> 4
+ \or
+ 5% Saturday 2 -> 5
+ \or
+ 6% Sunday 3 -> 6
+ \or
+ 0% Monday 4 -> 0
+ \or
+ 1% Tuesday 5 -> 1
+ \or
+ 2% Wednesday 6 -> 2
+ \or
+ 3% Thursday 7 -> 3
+ \else
+ -1% invalid
+ \fi
+ \or
+% \end{macrocode}
+%Saturday is the first day of the week. That is, the region's using
+%1=Saturday indexing.
+% \begin{macrocode}
+ \ifcase#1
+ % no 0
+ \or
+ 5% Saturday 1 -> 5
+ \or
+ 6% Sunday 2 -> 6
+ \or
+ 0% Monday 3 -> 0
+ \or
+ 1% Tuesday 4 -> 1
+ \or
+ 2% Wednesday 5 -> 2
+ \or
+ 3% Thursday 6 -> 3
+ \or
+ 4% Friday 7 -> 4
+ \else
+ -1% invalid
+ \fi
+ \or
+% \end{macrocode}
+%Sunday is the first day of the week. That is, the region's using
+%1=Sunday indexing.
+% \begin{macrocode}
+ \LocaleDayIndexFromOneSunToZeroMon{#2}%
+ \else
+ #2%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleDayIndexToRegion}
+%Convert from \sty{pgfcalendar}'s 0=Monday indexing to the region's
+%first day of the week (starting from 1). The first argument is the
+%dialect label.
+% \begin{macrocode}
+\def\LocaleDayIndexToRegion#1#2{%
+% \end{macrocode}
+%Get the region's first day of the week.
+% \begin{macrocode}
+ \ifcase\LocaleFirstDayIndex{#1}
+% \end{macrocode}
+%Monday is the first day of the week. That is, the region's using 1=Monday
+%indexing.
+% \begin{macrocode}
+ \LocaleDayIndexFromZeroMonToOneMon{#2}%
+ \or
+% \end{macrocode}
+%Tuesday is the first day of the week. That is, the region's using
+%1=Tuesday indexing. (These mid-week cases are unlikely, but add
+%them for completeness.)
+% \begin{macrocode}
+ \ifnum#2=0 % Monday
+ 7%
+ \else
+ #2%
+ \fi
+ \or
+% \end{macrocode}
+%Wednesday is the first day of the week. That is, the region's using
+%1=Wednesday indexing.
+% \begin{macrocode}
+ \ifcase#1
+ 6% Monday 0 -> 6
+ \or
+ 7% Tuesday 1 -> 7
+ \or
+ 1% Wednesday 2 -> 1
+ \or
+ 2% Thursday 3 -> 2
+ \or
+ 3% Friday 4 -> 3
+ \or
+ 4% Saturday 5 -> 4
+ \or
+ 5% Sunday 6 -> 5
+ \else
+ -1% invalid
+ \fi
+ \or
+% \end{macrocode}
+%Thursday is the first day of the week. That is, the region's using
+%1=Thursday indexing.
+% \begin{macrocode}
+ \ifcase#1
+ 5% Monday 0 -> 5
+ \or
+ 6% Tuesday 1 -> 6
+ \or
+ 7% Wednesday 2 -> 7
+ \or
+ 1% Thursday 3 -> 1
+ \or
+ 2% Friday 4 -> 2
+ \or
+ 3% Saturday 5 -> 3
+ \or
+ 4% Sunday 6 -> 4
+ \else
+ -1% invalid
+ \fi
+ \or
+% \end{macrocode}
+%Friday is the first day of the week. That is, the region's using
+%1=Friday indexing.
+% \begin{macrocode}
+ \ifcase#1
+ 4% Monday 0 -> 4
+ \or
+ 5% Tuesday 1 -> 5
+ \or
+ 6% Wednesday 2 -> 6
+ \or
+ 7% Thursday 3 -> 7
+ \or
+ 1% Friday 4 -> 1
+ \or
+ 2% Saturday 5 -> 2
+ \or
+ 3% Sunday 6 -> 3
+ \else
+ -1% invalid
+ \fi
+ \or
+% \end{macrocode}
+%Saturday is the first day of the week. That is, the region's using
+%1=Saturday indexing.
+% \begin{macrocode}
+ \ifcase#1
+ 3% Monday 0 -> 3
+ \or
+ 4% Tuesday 1 -> 4
+ \or
+ 5% Wednesday 2 -> 5
+ \or
+ 6% Thursday 3 -> 6
+ \or
+ 7% Friday 4 -> 7
+ \or
+ 1% Saturday 5 -> 1
+ \or
+ 2% Sunday 6 -> 2
+ \else
+ -1% invalid
+ \fi
+ \or
+% \end{macrocode}
+%Sunday is the first day of the week. That is, the region's using
+%1=Sunday indexing.
+% \begin{macrocode}
+ \LocaleDayIndexFromZeroMonToOneSun{#2}%
+ \else
+ #2%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleFullTime}
+%\begin{definition}
+%\cs{LocaleFullTime}\marg{dialect}
+%\end{definition}
+%Get the full time for the given dialect.
+% \begin{macrocode}
+\def\LocaleFullTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{fulltime}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleLongTime}
+%\begin{definition}
+%\cs{LocaleLongTime}\marg{dialect}
+%\end{definition}
+%Get the long time for the given dialect.
+% \begin{macrocode}
+\def\LocaleLongTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{longtime}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleMediumTime}
+%\begin{definition}
+%\cs{LocaleMediumTime}\marg{dialect}
+%\end{definition}
+%Get the medium time for the given dialect.
+% \begin{macrocode}
+\def\LocaleMediumTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{medtime}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleShortTime}
+%\begin{definition}
+%\cs{LocaleShortTime}\marg{dialect}
+%\end{definition}
+%Get the short time for the given dialect.
+% \begin{macrocode}
+\def\LocaleShortTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{shorttime}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleFullDateTime}
+%\begin{definition}
+%\cs{LocaleFullDateTime}\marg{dialect}
+%\end{definition}
+%Get the full date and time for the given dialect.
+% \begin{macrocode}
+\def\LocaleFullDateTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{fulldatetime}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleLongDateTime}
+%\begin{definition}
+%\cs{LocaleLongDateTime}\marg{dialect}
+%\end{definition}
+%Get the long date and time for the given dialect.
+% \begin{macrocode}
+\def\LocaleLongDateTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{longdatetime}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleMediumDateTime}
+%\begin{definition}
+%\cs{LocaleMediumDateTime}\marg{dialect}
+%\end{definition}
+%Get the medium date and time for the given dialect.
+% \begin{macrocode}
+\def\LocaleMediumDateTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{meddatetime}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleShortDateTime}
+%\begin{definition}
+%\cs{LocaleShortDateTime}\marg{dialect}
+%\end{definition}
+%Get the short date and time for the given dialect.
+% \begin{macrocode}
+\def\LocaleShortDateTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{shortdatetime}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleDayName}
+%\begin{definition}
+%\cs{LocaleDayName}\marg{dialect}\marg{n}
+%\end{definition}
+%Gets the day of week name identified by the index \meta{n} (0 for
+%Monday, 1 for Tuesday, etc) in the given dialect.
+% \begin{macrocode}
+\def\LocaleDayName#1#2{%
+ \LocaleGetDialectAttribute{#1}{day.\number#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleShortDayName}
+%\begin{definition}
+%\cs{LocaleShortDayName}\marg{dialect}\marg{n}
+%\end{definition}
+%Gets the abbreviated day of week name identified by the index \meta{n} (0 for
+%Monday, 1 for Tuesday, etc) in the given dialect.
+% \begin{macrocode}
+\def\LocaleShortDayName#1#2{%
+ \LocaleGetDialectAttribute{#1}{shortday.\number#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleMonthName}
+%\begin{definition}
+%\cs{LocaleMonthName}\marg{dialect}\marg{n}
+%\end{definition}
+%Gets the month name identified by the index \meta{n} (1 for
+%January, 2 for February, etc) in the given dialect.
+% \begin{macrocode}
+\def\LocaleMonthName#1#2{%
+ \LocaleGetDialectAttribute{#1}{month.\number#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleShortMonthName}
+%\begin{definition}
+%\cs{LocaleShortMonthName}\marg{dialect}\marg{n}
+%\end{definition}
+%Gets the month week name identified by the index \meta{n} (1 for
+%January, 2 for February, etc) in the given dialect.
+% \begin{macrocode}
+\def\LocaleShortMonthName#1#2{%
+ \LocaleGetDialectAttribute{#1}{shortmonth.\number#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%Some languages have a different form for month or week day names
+%used in a standalone context, such as in a column header. These are
+%provided with the \cs{LocaleStandalone\ldots} commands defined
+%below. For most languages they will be the same as the above.
+%
+%\begin{macro}{\LocaleStandaloneDayName}
+%\begin{definition}
+%\cs{LocaleStandaloneDayName}\marg{dialect}\marg{n}
+%\end{definition}
+%Gets the day of week name identified by the index \meta{n} (0 for
+%Monday, 1 for Tuesday, etc) in the given dialect.
+% \begin{macrocode}
+\def\LocaleStandaloneDayName#1#2{%
+ \LocaleGetDialectAttribute{#1}{standalone.day.\number#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleStandaloneShortDayName}
+%\begin{definition}
+%\cs{LocaleStandaloneShortDayName}\marg{dialect}\marg{n}
+%\end{definition}
+%Gets the abbreviated day of week name identified by the index \meta{n} (0 for
+%Monday, 1 for Tuesday, etc) in the given dialect.
+% \begin{macrocode}
+\def\LocaleStandaloneShortDayName#1#2{%
+ \LocaleGetDialectAttribute{#1}{standalone.shortday.\number#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleStandaloneMonthName}
+%\begin{definition}
+%\cs{LocaleStandaloneMonthName}\marg{dialect}\marg{n}
+%\end{definition}
+%Gets the month week name identified by the index \meta{n} (1 for
+%January, 2 for February, etc) in the given dialect.
+% \begin{macrocode}
+\def\LocaleStandaloneMonthName#1#2{%
+ \LocaleGetDialectAttribute{#1}{standalone.month.\number#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleStandaloneShortMonthName}
+%\begin{definition}
+%\cs{LocaleStandaloneShortMonthName}\marg{dialect}\marg{n}
+%\end{definition}
+%Gets the month week name identified by the index \meta{n} (1 for
+%January, 2 for February, etc) in the given dialect.
+% \begin{macrocode}
+\def\LocaleStandaloneShortMonthName#1#2{%
+ \LocaleGetDialectAttribute{#1}{standalone.shortmonth.\number#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleNumericGroupSep}
+%\begin{definition}
+%\cs{LocaleNumericGroupSep}\marg{dialect}
+%\end{definition}
+%Gets the numeric group separator for the given dialect.
+% \begin{macrocode}
+\def\LocaleNumericGroupSep#1{%
+ \LocaleGetDialectAttribute{#1}{groupsep}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleNumericDecimalSep}
+%\begin{definition}
+%\cs{LocaleNumericDecimalSep}\marg{dialect}
+%\end{definition}
+%Gets the numeric decimal separator for the given dialect.
+% \begin{macrocode}
+\def\LocaleNumericDecimalSep#1{%
+ \LocaleGetDialectAttribute{#1}{decsep}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleNumericMonetarySep}
+%\begin{definition}
+%\cs{LocaleNumericMonetarySep}\marg{dialect}
+%\end{definition}
+%Gets the numeric monetary separator for the given dialect.
+% \begin{macrocode}
+\def\LocaleNumericMonetarySep#1{%
+ \LocaleGetDialectAttribute{#1}{currencysep}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleNumericExponent}
+%\begin{definition}
+%\cs{LocaleNumericExponent}\marg{dialect}
+%\end{definition}
+%Gets the exponent symbol for the given dialect.
+% \begin{macrocode}
+\def\LocaleNumericExponent#1{%
+ \LocaleGetDialectAttribute{#1}{exp}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleCurrencyLabel}
+%\begin{definition}
+%\cs{LocaleCurrencyLabel}\marg{dialect}
+%\end{definition}
+%Gets the currency label for the given dialect.
+% \begin{macrocode}
+\def\LocaleCurrencyLabel#1{%
+ \LocaleIfDialectAttributeEqCs{#1}{currency}{\@locale@unknown@currency}%
+ {%
+% \end{macrocode}
+%Unknown currency symbol.
+% \begin{macrocode}
+ \ifx\LocaleMainRegion\empty
+ \@locale@os@currencycode
+ \else
+ \LocaleGetDialectAttributeOrDefValue{\LocaleMainDialect}{currency}%
+ {\@locale@os@currencycode}%
+ \fi
+ }%
+ {\LocaleGetDialectAttribute{#1}{currency}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleCurrencyRegionalLabel}
+%\begin{definition}
+%\cs{LocaleCurrencyRegionalLabel}\marg{dialect}
+%\end{definition}
+%Gets the regional currency label for the given dialect.
+% \begin{macrocode}
+\def\LocaleCurrencyRegionalLabel#1{%
+ \LocaleIfDialectAttributeEqCs{#1}{regionalcurrency}%
+ {\@locale@unknown@currency}%
+ {%
+% \end{macrocode}
+%Unknown currency symbol.
+% \begin{macrocode}
+ \ifx\LocaleMainRegion\empty
+ \@locale@os@regionalcurrencycode
+ \else
+ \LocaleGetDialectAttributeOrDefValue{\LocaleMainDialect}{regionalcurrency}%
+ {\@locale@os@regionalcurrencycode}%
+ \fi
+ }%
+ {\LocaleGetDialectAttribute{#1}{regionalcurrency}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleCurrencySymbol}
+%\begin{definition}
+%\cs{LocaleCurrencySymbol}\marg{dialect}
+%\end{definition}
+%Gets the currency symbol for the given dialect. (May have non-ASCII
+%characters.)
+% \begin{macrocode}
+\def\LocaleCurrencySymbol#1{%
+ \LocaleIfDialectAttributeEqCs{#1}{currency}{\@locale@unknown@currency}%
+ {%
+% \end{macrocode}
+%Unknown currency code. Does the main locale have a region?
+% \begin{macrocode}
+ \ifx\LocaleMainRegion\empty
+% \end{macrocode}
+%No main region, try the default OS currency.
+% \begin{macrocode}
+ \ifx\@locale@os@currencysym\empty
+ \LocaleGetDialectAttribute{#1}{currencysym}%
+ \else
+ \@locale@os@currencysym
+ \fi
+ \else
+% \end{macrocode}
+%Try the main dialect attribute.
+% \begin{macrocode}
+ \LocaleGetDialectAttributeOrDefValue{\LocaleMainDialect}{currencysym}%
+ {\LocaleGetDialectAttribute{#1}{currencysym}}%
+ \fi
+ }%
+ {%
+ \LocaleIfSameDialectAttributeValues{#1}%
+ {currency}{currencysym}%
+ {%
+ \LocaleGetCurrencyAttributeOrDefValue
+ {\LocaleGetDialectAttribute{#1}{currency}}{sym}%
+ {\LocaleGetDialectAttribute{#1}{currencysym}}%
+ }%
+ {%
+ \LocaleGetDialectAttribute{#1}{currencysym}%
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleCurrencyTeXSymbol}
+%\begin{definition}
+%\cs{LocaleCurrencyTeXSymbol}\marg{dialect}
+%\end{definition}
+%Gets the currency symbol for the given dialect. (May include
+%\sty{texosquery} currency control symbols.)
+% \begin{macrocode}
+\def\LocaleCurrencyTeXSymbol#1{%
+ \LocaleIfDialectAttributeEqCs{#1}{currency}{\@locale@unknown@currency}%
+ {%
+% \end{macrocode}
+%Unknown currency code. Does the main locale have a region?
+% \begin{macrocode}
+ \ifx\LocaleMainRegion\empty
+ \ifx\@locale@os@currencytex\empty
+ \LocaleGetDialectAttribute{#1}{currencytex}%
+ \else
+ \@locale@os@currencytex
+ \fi
+ \fi
+ }%
+ {%
+ \LocaleIfSameDialectAttributeValues{#1}%
+ {currency}{currencytex}%
+ {%
+ \LocaleGetCurrencyAttributeOrDefValue
+ {\LocaleGetDialectAttribute{#1}{currency}}{tex}%
+ {\LocaleGetDialectAttribute{#1}{currencytex}}%
+ }%
+ {%
+ \LocaleGetDialectAttribute{#1}{currencytex}%
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleNumericPercent}
+%\begin{definition}
+%\cs{LocaleNumericPercent}\marg{dialect}
+%\end{definition}
+%Gets the percent symbol for this dialect.
+% \begin{macrocode}
+\def\LocaleNumericPercent#1{%
+ \LocaleGetDialectAttribute{#1}{percent}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleNumericPermill}
+%\begin{definition}
+%\cs{LocaleNumericPermill}\marg{dialect}
+%\end{definition}
+%Gets the permill symbol for this dialect.
+% \begin{macrocode}
+\def\LocaleNumericPermill#1{%
+ \LocaleGetDialectAttribute{#1}{permill}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Patterns}
+%
+%\begin{macro}{\LocaleApplyDateTimePattern}
+%\begin{definition}
+%\cs{LocaleApplyDateTimePattern}\marg{dialect}\marg{attribute}\marg{date-time data}
+%\end{definition}
+% \begin{macrocode}
+\def\LocaleApplyDateTimePattern#1#2#3{%
+ \LocaleIfHasDialectNonEmptyAttribute{#1}{#2}%
+ {%
+% \end{macrocode}
+%The data might be provided with the control sequence
+%\cs{LocaleDateTimeInfo}, which may be empty and will need expanding.
+% \begin{macrocode}
+ \ifx\empty#3\empty
+ \@locale@warn{No date-time data for pattern
+ (attribute `#2', dialect `#1')}%
+ \else
+ \localedatetimefmt
+ {\expandafter\texosqueryfmtdatetime
+ \csname locale@dialect@#2@#1\expandafter\endcsname#3}%
+ \fi
+ }%
+ {%
+ \@locale@warn{No date-time pattern attribute `#2' for dialect `#1'}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%If the date-time patterns are required, the name commands such as
+%\cs{texosqueryfmtpatMMM} need defining
+% \begin{macrocode}
+\LocaleIfDateTimePatternsSupported
+{%
+% \end{macrocode}
+%\begin{macro}{\texosqueryfmtpatMMM}
+%Short month name.
+% \begin{macrocode}
+ \def\texosqueryfmtpatMMM#1{%
+ \CurrentLocaleShortMonthName{#1}%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosqueryfmtpatMMMM}
+%Full month name.
+% \begin{macrocode}
+ \def\texosqueryfmtpatMMMM#1{%
+ \CurrentLocaleMonthName{#1}%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosqueryfmtpatLLL}
+%Short standalone month name.
+% \begin{macrocode}
+ \def\texosqueryfmtpatLLL#1{%
+ \CurrentLocaleStandaloneShortMonthName{#1}%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosqueryfmtpatLLLL}
+%Full standalone month name.
+% \begin{macrocode}
+ \def\texosqueryfmtpatLLLL#1{%
+ \CurrentLocaleStandaloneMonthName{#1}%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosqueryfmtpatEEE}
+%Short day of week name.
+% \begin{macrocode}
+ \def\texosqueryfmtpatEEE#1{%
+ \CurrentLocaleShortDayName{\LocaleDayIndexFromOneMonToZeroMon{#1}}%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosqueryfmtpatEEEE}
+%Full day of week name.
+% \begin{macrocode}
+ \def\texosqueryfmtpatEEEE#1{%
+ \CurrentLocaleDayName{\LocaleDayIndexFromOneMonToZeroMon{#1}}%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosquerytimezonefmt}
+%Allow the time zone name to be wrapped in a formatting command.
+% \begin{macrocode}
+ \def\texosquerytimezonefmt#1{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosqueryshorttimezone}
+% \begin{macrocode}
+ \def\texosqueryshorttimezone#1{%
+ \texosquerytimezonefmt
+ {\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.short}}%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosqueryshortdstzone}
+% \begin{macrocode}
+ \def\texosqueryshortdstzone#1{%
+ \texosquerytimezonefmt
+ {\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.shortdst}}%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosquerylongtimezone}
+% \begin{macrocode}
+ \def\texosquerylongtimezone#1{%
+ \texosquerytimezonefmt
+ {\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.long}}%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosquerylongdstzone}
+% \begin{macrocode}
+ \def\texosquerylongdstzone#1{%
+ \texosquerytimezonefmt
+ {\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.longdst}}%
+ }
+% \end{macrocode}
+%\end{macro}
+%End of first argument of \cs{LocaleIfDateTimePatternsSupported}.
+%(Do nothing if date-time patterns not required.)
+% \begin{macrocode}
+}
+{}
+% \end{macrocode}
+%
+%Set up the \sty{texosquery} numbering commands to use the current
+%locale symbols.
+%\begin{macro}{\texosquerypatfmtgroupsep}
+% \begin{macrocode}
+\def\texosquerypatfmtgroupsep{\CurrentLocaleNumericGroupSep}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosquerypatfmtdecsep}
+% \begin{macrocode}
+\def\texosquerypatfmtdecsep{\CurrentLocaleDecimalSep}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosquerypatfmtcurdecsep}
+% \begin{macrocode}
+\def\texosquerypatfmtcurdecsep{\CurrentLocaleMonetarySep}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosquerypatfmtexp}
+% \begin{macrocode}
+\def\texosquerypatfmtexp{\CurrentLocaleExponent}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosquerypatfmtcurrencysign}
+% \begin{macrocode}
+\def\texosquerypatfmtcurrencysign{\CurrentLocaleCurrency}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosquerypatfmtpercentsign}
+% \begin{macrocode}
+\def\texosquerypatfmtpercentsign{\CurrentLocalePercent}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\texosquerypatfmtpermillsign}
+% \begin{macrocode}
+\def\texosquerypatfmtpermillsign{\CurrentLocalePermill}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Conditionals}
+%\begin{macro}{\LocaleIfNumericUsesGroup}
+%\begin{definition}
+%\cs{LocaleIfNumericUsesGroup}\marg{dialect}\marg{true}\marg{false}
+%\end{definition}
+%Determines if the locale uses numerical group separator. The
+%\texttt{usesgroup} attribute will be 1 for true and 0 for false, so
+%we need a numerical comparison.
+% \begin{macrocode}
+\def\LocaleIfNumericUsesGroup#1{%
+ \LocaleIfDialectAttributeEqNum{#1}{usesgroup}{1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfHasLanguageName}
+%\begin{definition}
+%\cs{LocaleIfHasLanguageName}\marg{dialect}\marg{true}\marg{false}
+%\end{definition}
+%Determines if the given dialect has a language name.
+% \begin{macrocode}
+\def\LocaleIfHasLanguageName#1{%
+ \LocaleIfHasDialectNonEmptyAttribute{#1}{langname}%
+}
+% \end{macrocode}
+%\end{macro}
+%No need for a separate check for the native version. If it has
+%one, then it will have the other.
+%
+%\begin{macro}{\LocaleIfHasRegionName}
+%\begin{definition}
+%\cs{LocaleIfHasRegionName}\marg{dialect}\marg{true}\marg{false}
+%\end{definition}
+%Determines if the given dialect has a region name.
+% \begin{macrocode}
+\def\LocaleIfHasRegionName#1{%
+ \LocaleIfHasDialectNonEmptyAttribute{#1}{regionname}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\LocaleIfHasVariantName}
+%\begin{definition}
+%\cs{LocaleIfHasVariantName}\marg{dialect}\marg{true}\marg{false}
+%\end{definition}
+%Determines if the given dialect has a variant name.
+% \begin{macrocode}
+\def\LocaleIfHasVariantName#1{%
+ \LocaleIfHasDialectNonEmptyAttribute{#1}{variantname}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Post-Parsing}
+%If this hook has been defined, use it.
+% \begin{macrocode}
+\ifx\@locale@postparse@hook\undefined
+\else
+ \@locale@postparse@hook
+\fi
+% \end{macrocode}
+%
+%\subsection{Initialising Current Locale Commands}
+%These commands are all initialised to do nothing (except for
+%indexes which are initialised to \texttt{-1}), in the event that
+%the dry run mode is on.
+% \begin{macrocode}
+\def\CurrentLocaleLanguageName{}%
+\def\CurrentLocaleLanguageNativeName{}%
+\def\CurrentLocaleRegionName{}%
+\def\CurrentLocaleRegionNativeName{}%
+\def\CurrentLocaleVariantName{}%
+\def\CurrentLocaleVariantNativeName{}%
+\def\CurrentLocaleFirstDayIndex{-1}%
+\def\CurrentLocaleDayIndexFromRegion{-1}%
+\def\CurrentLocaleDayName{}%
+\def\CurrentLocaleShortDayName{}%
+\def\CurrentLocaleStandaloneDayName{}%
+\def\CurrentLocaleStandaloneShortDayName{}%
+\def\CurrentLocaleMonthName{}%
+\def\CurrentLocaleShortMonthName{}%
+\def\CurrentLocaleStandaloneMonthName{}%
+\def\CurrentLocaleStandaloneShortMonthName{}%
+\def\CurrentLocaleFullDate{}%
+\def\CurrentLocaleLongDate{}%
+\def\CurrentLocaleMediumDate{}%
+\def\CurrentLocaleShortDate{}%
+\def\CurrentLocaleFullTime{}%
+\def\CurrentLocaleLongTime{}%
+\def\CurrentLocaleMediumTime{}%
+\def\CurrentLocaleShortTime{}%
+\def\CurrentLocaleFullDateTime{}%
+\def\CurrentLocaleLongDateTime{}%
+\def\CurrentLocaleMediumDateTime{}%
+\def\CurrentLocaleShortDateTime{}%
+\def\CurrentLocaleDate{}%
+\def\CurrentLocaleTime{}%
+\def\CurrentLocaleCurrency{}%
+\def\CurrentLocaleNumericGroupSep{}%
+\def\CurrentLocaleIfNumericUsesGroup{}%
+\def\CurrentLocaleDecimalSep{}%
+\def\CurrentLocaleMonetarySep{}%
+\def\CurrentLocaleExponent{}%
+\def\CurrentLocalePercent{}%
+\def\CurrentLocalePermill{}%
+\def\CurrentLocaleIntegerPattern{}%
+\def\CurrentLocaleDecimalPattern{}%
+\def\CurrentLocaleCurrencyPattern{}%
+\def\CurrentLocalePercentPattern{}%
+\def\CurrentLocaleApplyDateTimePattern{}%
+\def\CurrentTrackedDialect{}%
+% \end{macrocode}
+%
+%\subsection{Switching Locale}
+%\begin{macro}{\@locale@select}
+%Used when a language is changed. The argument is the dialect label.
+% \begin{macrocode}
+\def\@locale@select#1{%
+ \SetCurrentTrackedDialect{#1}%
+ \def\CurrentLocaleLanguageName{\LocaleLanguageName{#1}}%
+ \def\CurrentLocaleLanguageNativeName{\LocaleLanguageNativeName{#1}}%
+ \def\CurrentLocaleRegionName{\LocaleRegionName{#1}}%
+ \def\CurrentLocaleRegionNativeName{\LocaleRegionNativeName{#1}}%
+ \def\CurrentLocaleVariantName{\LocaleVariantName{#1}}%
+ \def\CurrentLocaleVariantNativeName{\LocaleVariantNativeName{#1}}%
+ \def\CurrentLocaleFirstDayIndex{\LocaleFirstDayIndex{#1}}%
+ \def\CurrentLocaleDayIndexFromRegion{\LocaleDayIndexFromRegion{#1}}%
+ \def\CurrentLocaleDayName{\LocaleDayName{#1}}%
+ \def\CurrentLocaleShortDayName{\LocaleShortDayName{#1}}%
+ \def\CurrentLocaleStandaloneDayName{%
+ \LocaleStandaloneDayName{#1}}%
+ \def\CurrentLocaleStandaloneShortDayName{%
+ \LocaleStandaloneShortDayName{#1}}%
+ \def\CurrentLocaleMonthName{\LocaleMonthName{#1}}%
+ \def\CurrentLocaleShortMonthName{\LocaleShortMonthName{#1}}%
+ \def\CurrentLocaleStandaloneMonthName{%
+ \LocaleStandaloneMonthName{#1}}%
+ \def\CurrentLocaleStandaloneShortMonthName{%
+ \LocaleStandaloneShortMonthName{#1}}%
+ \def\CurrentLocaleFullDate{\LocaleFullDate{#1}}%
+ \def\CurrentLocaleLongDate{\LocaleLongDate{#1}}%
+ \def\CurrentLocaleMediumDate{\LocaleMediumDate{#1}}%
+ \def\CurrentLocaleShortDate{\LocaleShortDate{#1}}%
+ \def\CurrentLocaleFullTime{\LocaleFullTime{#1}}%
+ \def\CurrentLocaleLongTime{\LocaleLongTime{#1}}%
+ \def\CurrentLocaleMediumTime{\LocaleMediumTime{#1}}%
+ \def\CurrentLocaleShortTime{\LocaleShortTime{#1}}%
+ \def\CurrentLocaleFullDateTime{\LocaleFullDateTime{#1}}%
+ \def\CurrentLocaleLongDateTime{\LocaleLongDateTime{#1}}%
+ \def\CurrentLocaleMediumDateTime{\LocaleMediumDateTime{#1}}%
+ \def\CurrentLocaleShortDateTime{\LocaleShortDateTime{#1}}%
+ \def\CurrentLocaleDate{%
+ \localedatechoice
+ {\LocaleFullDate{#1}}%
+ {\LocaleLongDate{#1}}%
+ {\LocaleMediumDate{#1}}%
+ {\LocaleShortDate{#1}}%
+ }%
+ \def\CurrentLocaleTime{%
+ \localetimechoice
+ {\LocaleFullTime{#1}}%
+ {\LocaleLongTime{#1}}%
+ {\LocaleMediumTime{#1}}%
+ {\LocaleShortTime{#1}}%
+ }%
+ \def\CurrentLocaleCurrency{%
+ \localecurrchoice
+ {\LocaleCurrencyLabel{#1}}%
+ {\LocaleCurrencyRegionalLabel{#1}}%
+ {\LocaleCurrencySymbol{#1}}%
+ {\LocaleCurrencyTeXSymbol{#1}}%
+ }%
+ \def\CurrentLocaleNumericGroupSep{%
+ \LocaleNumericGroupSep{#1}%
+ }%
+ \def\CurrentLocaleIfNumericUsesGroup{%
+ \LocaleIfNumericUsesGroup{#1}%
+ }%
+ \def\CurrentLocaleDecimalSep{%
+ \LocaleNumericDecimalSep{#1}%
+ }%
+ \def\CurrentLocaleMonetarySep{%
+ \LocaleNumericMonetarySep{#1}%
+ }%
+ \def\CurrentLocaleExponent{%
+ \LocaleNumericExponent{#1}%
+ }%
+ \def\CurrentLocalePercent{%
+ \LocaleNumericPercent{#1}%
+ }%
+ \def\CurrentLocalePermill{%
+ \LocaleNumericPermill{#1}%
+ }%
+ \def\CurrentLocaleIntegerPattern{%
+ \LocaleGetDialectAttribute{#1}{intfmt}%
+ }%
+ \def\CurrentLocaleDecimalPattern{%
+ \LocaleGetDialectAttribute{#1}{decfmt}%
+ }%
+ \def\CurrentLocaleCurrencyPattern{%
+ \LocaleGetDialectAttribute{#1}{curfmt}%
+ }%
+ \def\CurrentLocalePercentPattern{%
+ \LocaleGetDialectAttribute{#1}{perfmt}%
+ }%
+ \def\CurrentLocaleApplyDateTimePattern{%
+ \LocaleApplyDateTimePattern{#1}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%Provide the choice commands:
+%\begin{macro}{\localedatechoice}
+% \begin{macrocode}
+\ifx\localedatechoice\undefined
+ \def\localedatechoice#1#2#3#4{#2}
+\fi
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localetimechoice}
+% \begin{macrocode}
+\ifx\localetimechoice\undefined
+ \def\localetimechoice#1#2#3#4{#3}
+\fi
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localecurrchoice}
+% \begin{macrocode}
+\ifx\localecurrchoice\undefined
+ \def\localecurrchoice#1#2#3#4{#2}
+\fi
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\CurrentLocaleDateTime}
+%Shortcut for date and time.
+% \begin{macrocode}
+\def\CurrentLocaleDateTime{\CurrentLocaleDate\space\CurrentLocaleTime}
+% \end{macrocode}
+%\end{macro}
+%
+%Provide convenient shortcut commands for formatting numbers.
+%These need a bit of help to split the argument on "."
+%and on "E". First provide a general purpose command.
+%
+%\begin{macro}{\localenumfmt}
+%The first argument is the pattern. The second argument is the
+%value.
+% \begin{macrocode}
+\def\localenumfmt#1#2{%
+ \@locale@decfmt#2\empty.0E0\relax
+ \ifnum\@locale@decfmt@int<0
+ \let\@localenum@fmt\localenumfmtneg
+ \else
+ \ifnum\@locale@decfmt@int=0
+ \ifnum\@locale@decfmt@frac=0
+ \ifnum\@locale@decfmt@exp=0
+ \let\@localenum@fmt\localenumfmtzero
+ \else
+ \let\@localenum@fmt\localenumfmtpos
+ \fi
+ \else
+ \let\@localenum@fmt\localenumfmtpos
+ \fi
+ \else
+ \let\@localenum@fmt\localenumfmtpos
+ \fi
+ \fi
+ \@localenum@fmt
+ {%
+ \texosqueryfmtnumber{#1}%
+ {\@locale@decfmt@int}%
+ {\@locale@decfmt@frac}%
+ {\@locale@decfmt@exp}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localenumfmtpos}
+%Wrapper for positive values.
+% \begin{macrocode}
+\def\localenumfmtpos#1{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localenumfmtneg}
+%Wrapper for negative values.
+% \begin{macrocode}
+\def\localenumfmtneg#1{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localenumfmtzero}
+%Wrapper for zero values.
+% \begin{macrocode}
+\def\localenumfmtzero#1{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localeint}
+% \begin{macrocode}
+\def\localeint#1{%
+ \localenumfmt{\CurrentLocaleIntegerPattern}{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\localedec}
+% \begin{macrocode}
+\def\localedec#1{%
+ \localenumfmt{\CurrentLocaleDecimalPattern}{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localecur}
+% \begin{macrocode}
+\def\localecur#1{%
+ \localenumfmt{\CurrentLocaleCurrencyPattern}{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\localeper}
+% \begin{macrocode}
+\def\localeper#1{%
+ \localenumfmt{\CurrentLocalePercentPattern}{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@decfmt}
+% \begin{macrocode}
+\def\@locale@decfmt#1.#2E#3\relax{%
+% \end{macrocode}
+%Allow for mantissa present but missing fractional part.
+% \begin{macrocode}
+ \@locale@decfmt@split#1E\empty\relax
+ \ifx\@locale@decfmt@exp\empty
+ \edef\@locale@decfmt@frac{\@locale@gobbleemptytorelax#2\empty\relax}%
+ \edef\@locale@decfmt@exp{\@locale@gobbleemptytorelax#3\empty\relax}%
+ \else
+ \def\@locale@decfmt@frac{0}%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@gobbleemptytorelax}
+%Strip everything between \cs{empty} and \cs{relax}
+% \begin{macrocode}
+\def\@locale@gobbleemptytorelax#1\empty#2\relax{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@decfmt@split}
+%Split on "E". (In case "E" but no "." supplied.)
+% \begin{macrocode}
+\def\@locale@decfmt@split#1E#2\empty#3\relax{%
+ \edef\@locale@decfmt@int{\@locale@gobbleemptytorelax#1\empty\relax}%
+ \edef\@locale@decfmt@exp{\@locale@gobbleemptytorelax#2\empty\relax}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%Iterate through all languages and add to caption hook.
+% \begin{macrocode}
+\ForEachTrackedDialect{\locale@this@dialect}{%
+ \SetCurrentTrackedDialect{\locale@this@dialect}%
+ \expandafter\@TrackLangAddToHook\expandafter
+ {\expandafter\@locale@select\expandafter{\locale@this@dialect}}
+ {captions}%
+}
+% \end{macrocode}
+%
+%Provide a command to select a language using the \sty{tracklang}
+%dialect label or the language tag.
+%\begin{macro}{\selectlocale}
+% \begin{macrocode}
+\def\selectlocale#1{%
+ \ifx\selectlanguage\undefined
+ \IfTrackedDialect{#1}%
+ {\@locale@select{#1}}%
+ {%
+ \LocaleIfHasAttribute{#1}{tagtodialect}
+ {%
+ \edef\@locale@dialect{\LocaleGetAttribute{#1}{tagtodialect}}%
+ \expandafter\@locale@select\expandafter{\@locale@dialect}%
+ }%
+ {%
+ \ifTeXOSQueryDryRun
+ \@locale@warn{Unknown locale `#1'}%
+ \else
+ \@locale@err{Unknown locale `#1'}%
+ {The argument to \string\selectlocale\space must be either a
+ tracklang dialect label or a tracked dialect language tag}%
+ \fi
+ }%
+ }%
+ \else
+% \end{macrocode}
+% Need to find the correct label to use in \cs{selectlanguage}
+% \begin{macrocode}
+ \IfTrackedDialect{#1}%
+ {%
+ \@locale@select@dialect{#1}%
+ }%
+ {%
+ \LocaleIfHasAttribute{#1}{tagtodialect}
+ {\@locale@select@dialect{\LocaleGetAttribute{#1}{tagtodialect}}}%
+ {%
+ \ifTeXOSQueryDryRun
+ \@locale@warn{Unknown locale `#1'}%
+ \else
+ \@locale@err{Unknown locale `#1'}%
+ {The argument to \string\selectlocale\space must be either a
+ tracklang dialect label or a tracked dialect language tag}%
+ \fi
+ }%
+ }%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@select@dialect}
+%Select language from \sty{tracklang} dialect label.
+% \begin{macrocode}
+\def\@locale@select@dialect#1{%
+ \IfTrackedDialectHasMapping{#1}%
+ {\edef\@locale@dialect{\GetTrackedDialectToMapping{#1}}}%
+ {\edef\@locale@dialect{#1}}%
+% \end{macrocode}
+% Is there a date hook available? (Match the check used by
+% \cs{selectlanguage}.)
+% \begin{macrocode}
+ \@tracklang@ifundef{date\@locale@dialect}%
+ {%
+% \end{macrocode}
+% Try the root language.
+% \begin{macrocode}
+ \edef\@locale@dialect{\TrackedLanguageFromDialect{#1}}%
+% \end{macrocode}
+% Is there a date hook available?
+% \begin{macrocode}
+ \@tracklang@ifundef{date\@locale@dialect}%
+ {%
+ \@locale@warn{Can't determine correct label for
+ \string\selectlanguage\space from tracklang dialect `#1'}%
+ \SetCurrentTrackedDialect{#1}%
+ }%
+ {\expandafter\selectlanguage\expandafter{\@locale@dialect}}%
+ }%
+ {\expandafter\selectlanguage\expandafter{\@locale@dialect}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%Select the main locale (but don't try any language change
+%as this might upset \sty{polyglossia} if the fonts haven't been set
+%yet), so use the internal
+%\cs{@locale@select}.
+% \begin{macrocode}
+\ifx\LocaleMainDialect\empty
+\else
+ \expandafter\@locale@select\expandafter{\LocaleMainDialect}
+\fi
+% \end{macrocode}
+%
+%Restore category code for \texttt{@} if necessary.
+% \begin{macrocode}
+\@locale@restore@at
+% \end{macrocode}
+
+%\iffalse
+% \begin{macrocode}
+%</tex-locale.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*tex-locale-scripts-enc.def>
+% \end{macrocode}
+%\fi
+%\section{Scripts to \styfmt{fontenc} mappings
+%(\texttt{tex-locale-scripts-enc.def})}
+%\label{sec:locale-scripts-enc.def}
+%Provides mappings from scripts to font encodings. Not all
+%supported. This file is only loaded if the \pkgopt[auto]{fontenc}
+%option is used. The \texttt{@} character is assumed to have
+%category code when this file is input.
+%\begin{macro}{\@locale@scriptenc@map}
+%Maps ISO 15924 script label to \LaTeX\ font encoding name.
+% \begin{macrocode}
+\def\@locale@scriptenc@map#1#2{%
+ \@tracklang@namedef{@locale@scriptenc@map@#1}{#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@locale@get@scriptenc@map}
+%Get the mapping.
+% \begin{macrocode}
+\def\@locale@get@scriptenc@map#1{%
+ \@tracklang@ifundef{@locale@scriptenc@map@#1}%
+ {}%
+ {\csname @locale@scriptenc@map@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@locale@if@scriptenc@map}
+%Test if there's a script mapping.
+% \begin{macrocode}
+\def\@locale@if@scriptenc@map#1#2#3{%
+ \@tracklang@ifundef{@locale@scriptenc@map@#1}%
+ {#3}% false
+ {#2}% true
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@langenc@map}
+%Maps tracklang language or dialect labels to \LaTeX\ font encoding name.
+% \begin{macrocode}
+\def\@locale@langenc@map#1#2{%
+ \@tracklang@namedef{@locale@langenc@map@#1}{#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@if@langenc@map}
+%Test if there's a lang mapping.
+% \begin{macrocode}
+\def\@locale@if@langenc@map#1#2#3{%
+ \@tracklang@ifundef{@locale@langenc@map@#1}%
+ {#3}% false
+ {#2}% true
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@locale@get@langenc@map}
+%Get the mapping.
+% \begin{macrocode}
+\def\@locale@get@langenc@map#1{%
+ \@tracklang@ifundef{@locale@langenc@map@#1}%
+ {}%
+ {\csname @locale@langenc@map@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%Define mappings. Only a few currently supported. It's better to use
+%\sty{fontspec} instead of \sty{fontenc} for non-Latin scripts.
+%
+% Scripts first.
+% \begin{macrocode}
+\@locale@scriptenc@map{Latn}{T1}
+\@locale@scriptenc@map{Latf}{T1}
+\@locale@scriptenc@map{Latg}{T1}
+\@locale@scriptenc@map{Cyrl}{T2A,T2B,T2C}
+% \end{macrocode}
+%Now languages or dialect labels:
+% \begin{macrocode}
+\@locale@langenc@map{vietnamese}{T5}
+\@locale@langenc@map{polish}{OT4}
+\@locale@langenc@map{armenian}{OT6}
+\@locale@langenc@map{greek}{LGR}
+% \end{macrocode}
+%\iffalse
+% \begin{macrocode}
+%</tex-locale-scripts-enc.def>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*tex-locale-encodings.def>
+% \end{macrocode}
+%\fi
+%\section{texosquery to \styfmt{inputenc} mappings
+%(\texttt{tex-locale-encodings.def})}
+%Encoding mappings.
+%\begin{macro}{\@locale@newencmap}
+% \begin{macrocode}
+\def\@locale@newencmap#1#2{%
+ \@tracklang@namedef{@locale@encmap@#1}{#2}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@locale@ifhasencmap}
+% \begin{macrocode}
+\def\@locale@ifhasencmap#1#2#3{%
+ \@tracklang@ifundef{@locale@encmap@#1}{#3}{#2}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@locale@getencmap}
+% \begin{macrocode}
+\def\@locale@getencmap#1{%
+ \@tracklang@nameuse{@locale@encmap@#1}}
+% \end{macrocode}
+%\end{macro}
+% \begin{macrocode}
+\@locale@newencmap{iso88591}{latin1}
+\@locale@newencmap{iso88592}{latin2}
+\@locale@newencmap{iso88593}{latin3}
+\@locale@newencmap{iso88594}{latin4}
+\@locale@newencmap{iso88595}{latin5}
+\@locale@newencmap{iso88599}{latin9}
+\@locale@newencmap{windows1250}{cp1250}
+\@locale@newencmap{windows1252}{cp1252}
+\@locale@newencmap{windows1257}{cp1257}
+\@locale@newencmap{ibm850}{cp850}
+\@locale@newencmap{ibm852}{cp852}
+\@locale@newencmap{ibm437}{cp437}
+\@locale@newencmap{ibm865}{cp865}
+\@locale@newencmap{usascii}{ascii}
+\@locale@newencmap{xmaccentraleurope}{macce}
+% \end{macrocode}
+%\iffalse
+% \begin{macrocode}
+%</tex-locale-encodings.def>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*tex-locale-support.def>
+% \end{macrocode}
+%\fi
+%\section{Language Support Setup}
+%The language support setup performed in \cs{@locale@postparse@hook}.
+%Load \sty{babel} or \sty{polyglossia}.
+% \begin{macrocode}
+\@locale@ifsupportbabelorpoly
+{}
+{%
+% \end{macrocode}
+%(\sty{babel} support.)
+%Set up some extra mappings that aren't in \sty{tracklang} version
+%1.3. There's no intuitive way of testing if a dialect label is
+%provided by \sty{babel}. There's only a test for the root language
+%by checking for the existence of the ldf file, so these are known
+%\sty{babel} options. This means that if there isn't a mapping, the
+%root language will be used instead.
+% \begin{macrocode}
+ \def\@locale@providemap#1#2{%
+ \IfTrackedDialectHasMapping{#1}%
+ {}%
+ {\SetTrackedDialectLabelMap{#1}{#2}}%
+ }%
+ \@locale@providemap{bahasa}{bahasa}%
+ \@locale@providemap{indonesian}{indonesian}%
+ \@locale@providemap{indon}{indon}%
+ \@locale@providemap{bahasam}{bahasam}%
+ \@locale@providemap{malay}{malay}%
+ \@locale@providemap{melayu}{melayu}%
+ \@locale@providemap{USenglish}{USenglish}%
+ \@locale@providemap{american}{american}%
+ \@locale@providemap{UKenglish}{UKenglish}%
+ \@locale@providemap{british}{british}%
+ \@locale@providemap{canadian}{canadian}%
+ \@locale@providemap{australian}{australian}%
+ \@locale@providemap{newzealand}{newzealand}%
+ \@locale@providemap{francais}{francais}%
+ \@locale@providemap{canadien}{canadien}%
+ \@locale@providemap{acadian}{acadian}%
+ \@locale@providemap{austrian}{austrian}%
+ \@locale@providemap{germanb}{germanb}%
+ \@locale@providemap{ngerman}{ngerman}%
+ \@locale@providemap{naustrian}{naustrian}%
+ \@locale@providemap{nswissgerman}{nswissgerman}%
+ \@locale@providemap{swissgerman}{swissgerman}%
+ \@locale@providemap{polutonikogreek}{greek}%
+ \@locale@providemap{nynorsk}{nynorsk}%
+ \@locale@providemap{portuguese}{portuguese}%
+ \@locale@providemap{brazilian}{brazilian}%
+ \@locale@providemap{brazil}{brazil}%
+% \end{macrocode}
+%Work out how to pass the options since we may need to convert a
+%\sty{tracklang} dialect label to a recognised \sty{babel} label.
+% \begin{macrocode}
+ \def\@locale@bbl@options{}%
+ \ForEachTrackedDialect{\this@dialect}%
+ {%
+ \edef\this@root@lang{%
+ \TrackedLanguageFromDialect{\this@dialect}}%
+% \end{macrocode}
+%Is there a language file?
+% \begin{macrocode}
+ \IfFileExists{\this@root@lang.ldf}
+ {%
+% \end{macrocode}
+%Check for Serbian, since we need to know the script.
+% \begin{macrocode}
+ \ifdefstring{\this@root@lang}{serbian}%
+ {%
+ \@locale@loadscripts
+ \IfTrackedDialectIsScriptCs{\this@dialect}%
+ {\TrackLangScriptLatn}%
+ {\def\locale@bbl@dialect{serbian}}%
+ {\def\locale@bbl@dialect{serbianc}}%
+ }%
+ {%
+ \IfFileExists{\this@dialect.ldf}%
+ {%
+ \let\locale@bbl@dialect\this@dialect
+ }%
+ {%
+% \end{macrocode}
+%Do we have a mapping for this dialect label?
+% \begin{macrocode}
+ \IfTrackedDialectHasMapping{\this@dialect}%
+ {%
+ \edef\locale@bbl@dialect{%
+ \GetTrackedDialectToMapping{\this@dialect}}%
+ }%
+ {%
+ \let\locale@bbl@dialect\this@root@lang
+ }%
+ }%
+ }%
+ \SetTrackedDialectLabelMap{\this@dialect}{\locale@bbl@dialect}%
+ \ifx\this@dialect\LocaleMainDialect
+ \ifx\@locale@bbl@options\empty
+ \edef\@locale@bbl@options{main=\locale@bbl@dialect}%
+ \else
+ \edef\@locale@bbl@options{\@locale@bbl@options,%
+ main=\locale@bbl@dialect}%
+ \fi
+ \else
+ \ifx\@locale@bbl@options\empty
+ \edef\@locale@bbl@options{\locale@bbl@dialect}%
+ \else
+ \edef\@locale@bbl@options{\@locale@bbl@options,%
+ \locale@bbl@dialect}%
+ \fi
+ \fi
+ }%
+ {}%
+ }%
+ \ifx\@locale@bbl@options\@empty
+ \ifTeXOSQueryDryRun
+ \@locale@err{Can't determine `babel' package
+ options\MessageBreak (texosquery's dry run mode is on)}{}
+ \else
+ \@locale@err{Can't determine `babel' package
+ options (perhaps the shell escape failed, check
+ `\jobname.log')}{}
+ \fi
+ \else
+ \expandafter\PassOptionsToPackage\expandafter
+ {\@locale@bbl@options}{babel}
+ \RequirePackage{babel}%
+ \fi
+}%
+{%
+% \end{macrocode}
+% (\sty{polyglossia} support).
+% \begin{macrocode}
+% \end{macrocode}
+% Need a way of mapping scripts, regions and variants to known
+% \sty{polyglossia} keys. A lot of these variants aren't official
+% BCP 47 tags.
+% \begin{macrocode}
+ \def\@set@locale@poly@map@script#1#2#3{%
+ \@tracklang@namedef{@local@poly@map@script@#1@#2}{#3}%
+ }
+ \def\@if@locale@poly@map@script#1#2#3#4{%
+ \@tracklang@ifundef{@local@poly@map@script@#1@#2}{#4}{#3}%
+ }
+ \def\@get@locale@poly@map@script#1#2{%
+ \@tracklang@nameuse{@local@poly@map@script@#1@#2}%
+ }
+ \def\@set@locale@poly@map@region#1#2#3{%
+ \@tracklang@namedef{@local@poly@map@region@#1@#2}{#3}%
+ }
+ \def\@if@locale@poly@map@region#1#2#3#4{%
+ \@tracklang@ifundef{@local@poly@map@region@#1@#2}{#4}{#3}%
+ }
+ \def\@get@locale@poly@map@region#1#2{%
+ \@tracklang@nameuse{@local@poly@map@region@#1@#2}%
+ }
+ \def\@set@locale@poly@map@variant#1#2#3{%
+ \@tracklang@namedef{@local@poly@map@variant@#1@#2}{#3}%
+ }
+ \def\@if@locale@poly@map@variant#1#2#3#4{%
+ \@tracklang@ifundef{@local@poly@map@variant@#1@#2}{#4}{#3}%
+ }
+ \def\@get@locale@poly@map@variant#1#2{%
+ \@tracklang@nameuse{@local@poly@map@variant@#1@#2}%
+ }
+ \def\@set@locale@poly@map@sublang#1#2#3{%
+ \@tracklang@namedef{@local@poly@map@sublang@#1@#2}{#3}%
+ }
+ \def\@if@locale@poly@map@sublang#1#2#3#4{%
+ \@tracklang@ifundef{@local@poly@map@sublang@#1@#2}{#4}{#3}%
+ }
+ \def\@get@locale@poly@map@sublang#1#2{%
+ \@tracklang@nameuse{@local@poly@map@sublang@#1@#2}%
+ }
+ \@set@locale@poly@map@region{arabic}{IQ}{locale=mashriq}
+ \@set@locale@poly@map@region{arabic}{SY}{locale=mashriq}
+ \@set@locale@poly@map@region{arabic}{JO}{locale=mashriq}
+ \@set@locale@poly@map@region{arabic}{LB}{locale=mashriq}
+ \@set@locale@poly@map@region{arabic}{PS}{locale=mashriq}
+ \@set@locale@poly@map@region{arabic}{LY}{locale=libya}
+ \@set@locale@poly@map@region{arabic}{DZ}{locale=algeria}
+ \@set@locale@poly@map@region{arabic}{TN}{locale=tunisia}
+ \@set@locale@poly@map@region{arabic}{MA}{locale=morocco}
+ \@set@locale@poly@map@region{arabic}{MR}{locale=mauritania}
+ \@set@locale@poly@map@variant{arabic}{islamic}{calendar=islamic}
+ \@set@locale@poly@map@variant{arabic}{maghrib}{numerals=maghrib}
+ \@set@locale@poly@map@variant{arabic}{abjad}{abjadjimnotail}
+ \@set@locale@poly@map@variant{bengali}{western}{numerals=Western}
+ \@set@locale@poly@map@variant{bengali}{devanagari}{numerals=Devanagari}
+ \@set@locale@poly@map@variant{bengali}{bengali}{numerals=Bengali}
+ \@set@locale@poly@map@region{english}{US}{variant=us}
+ \@set@locale@poly@map@region{english}{GB}{variant=uk}
+ \@set@locale@poly@map@region{english}{AU}{variant=australian}
+ \@set@locale@poly@map@region{english}{NZ}{variant=newzealand}
+ \@set@locale@poly@map@variant{farsi}{western}{numerals=western}
+ \@set@locale@poly@map@variant{farsi}{eastern}{numerals=eastern}
+ \@set@locale@poly@map@region{german}{DE}{variant=german}
+ \@set@locale@poly@map@region{german}{AU}{variant=austrian}
+ \@set@locale@poly@map@region{german}{CH}{variant=swiss}
+ \@set@locale@poly@map@variant{german}{1996}{spelling=new}
+ \@set@locale@poly@map@variant{german}{1901}{spelling=old}
+ \@set@locale@poly@map@script{german}{Latf}{script=fraktur}
+ \@set@locale@poly@map@variant{greek}{monoton}{variant=monotonic}
+ \@set@locale@poly@map@variant{greek}{polyton}{variant=polytonic}
+ \@set@locale@poly@map@variant{greek}{ancient}{variant=ancient}
+ \@set@locale@poly@map@variant{greek}{arabic}{numerals=arabic}
+ \@set@locale@poly@map@variant{hebrew}{arabic}{numerals=arabic}
+ \@set@locale@poly@map@variant{hebrew}{gregorian}{calendar=gregorian}
+ \@set@locale@poly@map@variant{hindi}{western}{numerals=Western}
+ \@set@locale@poly@map@variant{hindi}{devanagari}{numerals=Devanagari}
+ \@set@locale@poly@map@variant{latin}{classic}{variant=classic}
+ \@set@locale@poly@map@variant{latin}{modern}{variant=modern}
+ \@set@locale@poly@map@variant{latin}{medieval}{variant=medieval}
+ \@set@locale@poly@map@sublang{russian}{orv}{spelling=old}
+ \@set@locale@poly@map@variant{russian}{luna1918}{spelling=new}
+ \@set@locale@poly@map@script{serbian}{Latn}{script=Latin}
+ \@set@locale@poly@map@script{serbian}{Cyrl}{script=Cyrillic}
+ \@set@locale@poly@map@variant{syriac}{western}{numerals=western}
+ \@set@locale@poly@map@variant{syriac}{eastern}{numerals=eastern}
+% \end{macrocode}
+% Load polyglossia.
+% \begin{macrocode}
+ \RequirePackage{polyglossia}
+ \ForEachTrackedDialect{\this@dialect}%
+ {%
+ \edef\this@root@lang{%
+ \TrackedLanguageFromDialect{\this@dialect}}%
+ \edef\this@sublang{%
+ \GetTrackedDialectSubLang{\this@dialect}}%
+ \edef\this@region{%
+ \TrackedIsoCodeFromLanguage{3166-1}{\this@dialect}}%
+ \edef\this@script{%
+ \GetTrackedDialectScript{\this@dialect}}%
+ \edef\this@variant{%
+ \GetTrackedDialectVariant{\this@dialect}}%
+% \end{macrocode}
+% Try to determine the options. Check the script mappings.
+% \begin{macrocode}
+ \def\@locale@poly@options{}%
+ \ifx\this@script\empty
+ \else
+ \@if@locale@poly@map@script{\this@root@lang}{\this@script}%
+ {%
+ \edef\@locale@poly@options{%
+ \@get@locale@poly@map@script
+ {\this@root@lang}{\this@script}}%
+ }%
+ {}%
+ \fi
+% \end{macrocode}
+% Check the region mappings.
+% \begin{macrocode}
+ \ifx\this@region\empty
+ \else
+ \@if@locale@poly@map@region{\this@root@lang}{\this@region}%
+ {%
+ \ifx\@locale@poly@options\empty
+ \edef\@locale@poly@options{%
+ \@get@locale@poly@map@region{\this@root@lang}{\this@region}}%
+ \else
+ \edef\@locale@poly@options{\@locale@poly@options,%
+ \@get@locale@poly@map@region{\this@root@lang}{\this@region}}%
+ \fi
+ }%
+ {}%
+ \fi
+% \end{macrocode}
+% Check the sub-language mappings.
+% \begin{macrocode}
+ \ifx\this@sublang\empty
+ \else
+ \@if@locale@poly@map@sublang{\this@root@lang}{\this@sublang}%
+ {%
+ \ifx\@locale@poly@options\empty
+ \edef\@locale@poly@options{%
+ \@get@locale@poly@map@sublang
+ {\this@root@lang}{\this@sublang}}%
+ \else
+ \edef\@locale@poly@options{\@locale@poly@options,%
+ \@get@locale@poly@map@sublang
+ {\this@root@lang}{\this@sublang}}%
+ \fi
+ }%
+ {}%
+ \fi
+% \end{macrocode}
+% Check the variant mappings.
+% \begin{macrocode}
+ \ifx\this@subvariant\empty
+ \else
+ \@if@locale@poly@map@variant{\this@root@lang}{\this@variant}%
+ {%
+ \ifx\@locale@poly@options\empty
+ \edef\@locale@poly@options{%
+ \@get@locale@poly@map@variant
+ {\this@root@lang}{\this@variant}}%
+ \else
+ \edef\@locale@poly@options{\@locale@poly@options,%
+ \@get@locale@poly@map@variant
+ {\this@root@lang}{\this@variant}}%
+ \fi
+ }%
+ {}%
+ \fi
+% \end{macrocode}
+% Set the language using either \cs{setmainlanguage} or
+% \cs{setotherlanguage}.
+% \begin{macrocode}
+ \ifx\this@dialect\LocaleMainDialect
+ \edef\@locale@tmp{\noexpand\setmainlanguage
+ [\@locale@poly@options]{\this@root@lang}}%
+ \else
+ \edef\@locale@tmp{\noexpand\setotherlanguage
+ [\@locale@poly@options]{\this@root@lang}}%
+ \fi
+ \@locale@tmp
+ }%
+% \end{macrocode}
+%Redefine command to temporarily switch off punctuation
+%adjustments. For example, when formatting the date or time.
+% \begin{macrocode}
+ \def\localenopolypunct{\@locale@nopolypunct}%
+}
+% \end{macrocode}
+%\iffalse
+% \begin{macrocode}
+%</tex-locale-support.def>
+% \end{macrocode}
+%\fi
+%\Finale
+\endinput
diff --git a/Master/texmf-dist/source/latex/tex-locale/tex-locale.ins b/Master/texmf-dist/source/latex/tex-locale/tex-locale.ins
new file mode 100644
index 00000000000..c4bf34fef3f
--- /dev/null
+++ b/Master/texmf-dist/source/latex/tex-locale/tex-locale.ins
@@ -0,0 +1,39 @@
+% tex-locale.ins generated using makedtx version 1.2 2018/8/26 19:14
+\input docstrip
+
+\preamble
+
+ tex-locale.dtx
+ Copyright 2018 Nicola Talbot
+
+ This work 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 2005/12/01 or later.
+
+ This work has the LPPL maintenance status `maintained'.
+
+ The Current Maintainer of this work is Nicola Talbot.
+
+ This work consists of the files tex-locale.dtx and tex-locale.ins and the derived files tex-locale.sty, tex-locale.tex, tex-locale-scripts-enc.def, tex-locale-encodings.def, tex-locale-support.def.
+
+\endpreamble
+
+\askforoverwritefalse
+
+\generate{\file{tex-locale.sty}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{tex-locale.dtx}{tex-locale.sty,package}}
+\file{tex-locale.tex}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{tex-locale.dtx}{tex-locale.tex,package}}
+\file{tex-locale-scripts-enc.def}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{tex-locale.dtx}{tex-locale-scripts-enc.def,package}}
+\file{tex-locale-encodings.def}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{tex-locale.dtx}{tex-locale-encodings.def,package}}
+\file{tex-locale-support.def}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{tex-locale.dtx}{tex-locale-support.def,package}}
+}
+
+\endbatchfile
diff --git a/Master/texmf-dist/tex/generic/tex-locale/tex-locale.tex b/Master/texmf-dist/tex/generic/tex-locale/tex-locale.tex
new file mode 100644
index 00000000000..32785755692
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/tex-locale/tex-locale.tex
@@ -0,0 +1,1735 @@
+%%
+%% This is file `tex-locale.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tex-locale.dtx (with options: `tex-locale.tex,package')
+%%
+%% tex-locale.dtx
+%% Copyright 2018 Nicola Talbot
+%%
+%% This work 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 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files tex-locale.dtx and tex-locale.ins and the derived files tex-locale.sty, tex-locale.tex, tex-locale-scripts-enc.def, tex-locale-encodings.def, tex-locale-support.def.
+%%
+%% \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
+%% Lower-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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%% arara: xetex: {shell: on}
+%% arara: xetex: {shell: on}
+\ifnum\catcode`\@=11\relax
+ \def\@locale@restore@at{}%
+\else
+ \expandafter\edef\csname @locale@restore@at\endcsname{%
+ \noexpand\catcode`\noexpand\@=\number\catcode`\@\relax
+ }%
+ \catcode`\@=11\relax
+\fi
+\ifx\@locale@parse@query\undefined
+\else
+ \@locale@restore@at
+ \expandafter\endinput
+\fi
+\expandafter\def\csname ver@tex-locale.tex\endcsname{2018/08/26 v1.0
+(NLCT) localisation support}
+\input tracklang
+\input texosquery
+\ifx\PackageError\undefined
+ \def\@locale@err#1#2{%
+ \errhelp{#2}%
+ \errmessage{tex-locale: #1}}
+\else
+ \def\@locale@err#1#2{\PackageError{tex-locale}{#1}{#2}}
+\fi
+\def\@locale@warn{\@tracklang@pkgwarn{tex-locale}}
+\ifx\PackageInfo\undefined
+ \def\@locale@info#1{%
+ {%
+ \newlinechar=`\^^J
+ \def\MessageBreak{^^J}%
+ \message{^^Jtex-locale Info: #1^^J}%
+ }%
+ }
+\else
+ \def\@locale@info#1{\PackageInfo{tex-locale}{#1}}
+\fi
+\ifx\@tracklang@pkgwarn\undefined
+ \@locale@err{tracklang version is too old. At least v1.3.4 required}
+ {You need to update tracklang to at least v1.3.4}%
+\fi
+\ifx\@texosquery@argquote\undefined
+ \@locale@err{texosquery version is too old. At least v1.4 required}
+ {You need to update texosquery to at least v1.4}%
+\fi
+\ifx\LocaleMain\undefined
+ \def\LocaleMain{locale}
+\fi
+\@tracklang@sanitize\LocaleMain
+\ifx\LocaleOther\undefined
+ \def\LocaleOther{}
+\else
+ \@tracklang@sanitize\LocaleOther
+\fi
+\def\@locale@os@tag{}
+\def\@locale@os@default{locale}
+\@tracklang@sanitize\@locale@os@default
+\def\@locale@unknown@currency{XXX}
+\def\@locale@os@region{}
+\def\@locale@os@groupsep{}
+\def\@locale@os@decsep{}
+\def\@locale@os@cursep{}
+\def\@locale@os@exp{}
+\def\@locale@os@usesgroup{}
+\def\@locale@os@currencycode{XXX}
+\def\@locale@os@regionalcurrencycode{XXX}
+\def\@locale@os@currencysym{}
+\def\@locale@os@currencytex{}
+\ifx\LocaleMainFile\undefined
+ \edef\LocaleMainFile{\expandafter\texosquerystripquotes{\jobname}.tex}
+\fi
+\ifx\LocaleIfDateTimePatternsSupported\undefined
+ \def\LocaleIfDateTimePatternsSupported#1#2{#2}
+\fi
+\def\localedatetimefmt#1{#1}
+\ifx\LocaleQueryCodesetParam\undefined
+ \edef\LocaleQueryCodesetParam{\string-C}
+\fi
+\edef\@locale@query@params{%
+ \string-o \string-r \string-a
+ \string-n
+ \string-N
+ \LocaleQueryCodesetParam\space
+}
+\LocaleIfDateTimePatternsSupported
+{%
+ \edef\@locale@query@params{\@locale@query@params \string-M }
+}
+{}
+\ifx\LocaleMainFile\empty
+\else
+ \edef\@locale@query@params{\@locale@query@params
+ \string-d \@texosquery@argquote{\LocaleMainFile}
+ }
+\fi
+\ifx\LocaleMain\@locale@os@default
+ \LocaleIfDateTimePatternsSupported
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \string-Z
+ }
+ }
+ {
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D
+ }
+ }
+\else
+ \LocaleIfDateTimePatternsSupported
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \LocaleMain\space\string-Z \LocaleMain\space
+ }
+ }
+ {
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \LocaleMain\space
+ }
+ }
+\fi
+\@tracklang@for\@locale@tag:=\LocaleOther\do{%
+ \ifx\@locale@tag\@locale@os@default
+ \LocaleIfDateTimePatternsSupported
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \string-Z
+ }
+ }
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D
+ }
+ }
+ \else
+ \LocaleIfDateTimePatternsSupported
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \@locale@tag\space\string-Z \@locale@tag\space
+ }
+ }
+ {%
+ \edef\@locale@query@params{\@locale@query@params
+ \string-D \@locale@tag\space
+ }
+ }
+ \fi
+}
+\csname localeprequery\endcsname
+\ifx\LocaleQueryFile\undefined
+ \TeXOSQuery{\@locale@result}{\@locale@query@params}
+\else
+ \ifx\LocaleQueryFile\empty
+ \TeXOSQuery{\@locale@result}{\@locale@query@params}
+ \else
+ \ifx\TeXOSQueryFromFile\undefined
+ \@locale@err{texosquery too old to support
+ \string\LocaleQueryFile. At least v1.4 required}
+ {You need to update your version of texosquery}
+ \def\@locale@result{}
+ \else
+ \@locale@info{Fetching query results from `\LocaleQueryFile'}%
+ \TeXOSQueryFromFile{\@locale@result}{\LocaleQueryFile}
+ \fi
+ \fi
+\fi
+\global\let\@locale@result\@locale@result
+\csname localepostquery\endcsname
+\def\LocaleSetAttribute#1#2#3{%
+ \expandafter\def\csname locale@#2@#1\endcsname{#3}%
+}
+\def\LocaleAppToAttribute#1#2#3{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\csname locale@#2@#1\expandafter\endcsname
+ \expandafter\expandafter\expandafter{\csname locale@#2@#1\endcsname#3}%
+ }%
+ {\expandafter\def\csname locale@#2@#1\endcsname{#3}}%
+}
+\def\LocaleXpAppToAttribute#1#2#3{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\csname locale@#2@#1\expandafter\endcsname
+ \expandafter\expandafter\expandafter{%
+ \csname locale@#2@#1\expandafter\endcsname#3}%
+ }%
+ {%
+ \expandafter\def\csname locale@#2@#1\expandafter\endcsname\expandafter{#3}%
+ }%
+}
+\def\LocaleAddToAttributeList#1#2#3{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \LocaleIfInAttributeList{#1}{#2}{#3}%
+ {}%
+ {\LocaleAppToAttribute{#1}{#2}{,#3}}%
+ }%
+ {\LocaleSetAttribute{#1}{#2}{#3}}%
+}
+\def\LocaleXpAddToAttributeList#1#2#3{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \LocaleIfXpInAttributeList{#1}{#2}{#3}%
+ {}%
+ {\LocaleXpAppToAttribute{#1}{#2}{\expandafter,#3}}%
+ }%
+ {\expandafter\def\csname locale@#2@#1\expandafter\endcsname\expandafter{#3}}%
+}
+\def\localeshowattribute#1#2{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\show\csname locale@#2@#1\endcsname
+ }%
+ {\@locale@err{Attribute `#2' not defined for `#1'}%
+ {\string\localeshowattribute\space was asked to show this
+ attribute for the given attribute type, but the
+ associated command hasn't been defined}}%
+}
+\def\LocaleProvideAttribute#1#2#3{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {}%
+ {\LocaleSetAttribute{#1}{#2}{#3}}%
+}
+\def\LocaleLetAttribute#1#2#3{%
+ \expandafter\let\csname locale@#2@#1\endcsname#3%
+}
+\def\LocaleGetAttributeOrDefValue#1#2#3{%
+ \@tracklang@ifundef{locale@#2@#1}%
+ {#3\@locale@undef@action{#1}{#2}}%
+ {\csname locale@#2@#1\endcsname}%
+}
+\def\LocaleGetAttribute#1#2{%
+ \LocaleGetAttributeOrDefValue{#1}{#2}{}%
+}
+\def\@locale@undef@action#1#2{}
+\def\LocaleIfHasAttribute#1#2#3#4{%
+ \@tracklang@ifundef{locale@#2@#1}%
+ {#4}%
+ {#3}%
+}
+\def\LocaleForEachInAttributeList#1#2#3#4{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\@tracklang@for\expandafter#3\expandafter:\expandafter
+ =\csname locale@#2@#1\endcsname\do{#4}%
+ }%
+ {}%
+}
+\def\LocaleIfInAttributeList#1#2#3#4#5{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\let\expandafter\@locale@attrlist\csname locale@#2@#1\endcsname
+ \@tracklang@ifinlist{#3}{\@locale@attrlist}{#4}{#5}%
+ }%
+ {#5}%
+}
+\def\LocaleIfXpInAttributeList#1#2#3#4#5{%
+ \LocaleIfHasAttribute{#1}{#2}%
+ {%
+ \expandafter\let\expandafter\@locale@attrlist\csname locale@#2@#1\endcsname
+ \expandafter\@tracklang@ifinlist\expandafter{#3}{\@locale@attrlist}{#4}{#5}%
+ }%
+ {#5}%
+}
+\def\LocaleIfHasNonEmptyAttribute#1#2#3#4{%
+ \@tracklang@ifundef{locale@#2@#1}%
+ {#4}%
+ {%
+ \expandafter\ifx\csname locale@#2@#1\endcsname\empty
+ #4%
+ \else
+ #3%
+ \fi
+ }%
+}
+\def\LocaleIfAttributeEqCs#1#2#3#4#5{%
+ \expandafter\ifx\csname locale@#2@#1\endcsname#3%
+ #4%
+ \else
+ #5%
+ \fi
+}
+\def\LocaleIfAttributeEqCsName#1#2#3#4#5{%
+ \expandafter\ifx
+ \csname locale@#2@#1\expandafter\endcsname
+ \csname #3\endcsname
+ #4%
+ \else
+ #5%
+ \fi
+}
+\def\LocaleIfAttributeEqNum#1#2#3#4#5{%
+ \LocaleIfHasNonEmptyAttribute{#1}{#2}%
+ {%
+ \expandafter\ifnum\csname locale@#2@#1\endcsname=#3
+ #4%
+ \else
+ #5%
+ \fi
+ }%
+ {#5}%
+}
+\def\LocaleIfSameAttributeValues#1#2#3#4#5{%
+ \expandafter\ifx
+ \csname locale@#2@#1\expandafter\endcsname
+ \csname locale@#3@#1\endcsname
+ #4%
+ \else
+ #5%
+ \fi
+}
+\def\localeshowdialectattribute#1#2{%
+ \localeshowattribute{#1}{dialect@#2}%
+}
+\def\LocaleSetDialectAttribute#1#2#3{%
+ \LocaleSetAttribute{#1}{dialect@#2}{#3}%
+}
+\def\LocaleProvideDialectAttribute#1#2#3{%
+ \LocaleProvideAttribute{#1}{dialect@#2}{#3}%
+}
+\def\LocaleLetDialectAttribute#1#2#3{%
+ \LocaleLetAttribute{#1}{dialect@#2}{#3}%
+}
+\def\LocaleAppToDialectAttribute#1#2#3{%
+ \LocaleAppToAttribute{#1}{dialect@#2}{#3}%
+}
+\def\LocaleXpAppToDialectAttribute#1#2#3{%
+ \LocaleXpAppToAttribute{#1}{dialect@#2}{#3}%
+}
+\def\LocaleAddToDialectAttributeList#1#2{%
+ \LocaleAddToAttributeList{#1}{dialect@#2}%
+}
+\def\LocaleXpAddToDialectAttributeList#1#2{%
+ \LocaleXpAddToAttributeList{#1}{dialect@#2}%
+}
+\def\LocaleGetDialectAttribute#1#2{%
+ \LocaleGetAttribute{#1}{dialect@#2}%
+}
+\def\LocaleGetDialectAttributeOrDefValue#1#2{%
+ \LocaleGetAttributeOrDefValue{#1}{dialect@#2}%
+}
+\def\LocaleIfHasDialectAttribute#1#2{%
+ \LocaleIfHasAttribute{#1}{dialect@#2}%
+}
+\def\LocaleForEachInDialectAttributeList#1#2{%
+ \LocaleForEachInAttributeList{#1}{dialect@#2}%
+}
+\def\LocaleIfInDialectAttributeList#1#2{%
+ \LocaleIfInAttributeList{#1}{dialect@#2}%
+}
+\def\LocaleIfXpInDialectAttributeList#1#2{%
+ \LocaleIfXpInAttributeList{#1}{dialect@#2}%
+}
+\def\LocaleIfHasDialectNonEmptyAttribute#1#2{%
+ \LocaleIfHasNonEmptyAttribute{#1}{dialect@#2}%
+}
+\def\LocaleIfDialectAttributeEqCs#1#2#3{%
+ \LocaleIfAttributeEqCs{#1}{dialect@#2}{#3}%
+}
+\def\LocaleIfDialectAttributeEqCsName#1#2#3{%
+ \LocaleIfAttributeEqCsName{#1}{dialect@#2}{#3}%
+}
+\def\LocaleIfDialectAttributeEqNum#1#2#3{%
+ \LocaleIfAttributeEqNum{#1}{dialect@#2}{#3}%
+}
+\def\LocaleIfSameDialectAttributeValues#1#2#3{%
+ \LocaleIfSameAttributeValues{#1}{dialect@#2}{dialect@#3}%
+}
+\def\localeshowregionattribute#1#2{%
+ \localeshowattribute{#1}{region@#2}%
+}
+\def\LocaleSetRegionAttribute#1#2#3{%
+ \LocaleSetAttribute{#1}{region@#2}{#3}%
+}
+\def\LocaleProvideRegionAttribute#1#2#3{%
+ \LocaleProvideAttribute{#1}{region@#2}{#3}%
+}
+\def\LocaleLetRegionAttribute#1#2#3{%
+ \LocaleLetAttribute{#1}{region@#2}{#3}%
+}
+\def\LocaleAppToRegionAttribute#1#2#3{%
+ \LocaleAppToAttribute{#1}{region@#2}{#3}%
+}
+\def\LocaleXpAppToRegionAttribute#1#2#3{%
+ \LocaleXpAppToAttribute{#1}{region@#2}{#3}%
+}
+\def\LocaleAddToRegionAttributeList#1#2{%
+ \LocaleAddToAttributeList{#1}{region@#2}%
+}
+\def\LocaleXpAddToRegionAttributeList#1#2{%
+ \LocaleXpAddToAttributeList{#1}{region@#2}%
+}
+\def\LocaleGetRegionAttribute#1#2{%
+ \LocaleGetAttribute{#1}{region@#2}%
+}
+\def\LocaleGetRegionAttributeOrDefValue#1#2{%
+ \LocaleGetAttributeOrDefValue{#1}{region@#2}%
+}
+\def\LocaleIfHasRegionAttribute#1#2{%
+ \LocaleIfHasAttribute{#1}{region@#2}%
+}
+\def\LocaleForEachInRegionAttributeList#1#2{%
+ \LocaleForEachInAttributeList{#1}{region@#2}%
+}
+\def\LocaleIfInRegionAttributeList#1#2{%
+ \LocaleIfInAttributeList{#1}{region@#2}%
+}
+\def\LocaleIfXpInRegionAttributeList#1#2{%
+ \LocaleIfXpInAttributeList{#1}{region@#2}%
+}
+\def\LocaleIfHasRegionNonEmptyAttribute#1#2{%
+ \LocaleIfHasNonEmptyAttribute{#1}{region@#2}%
+}
+\def\LocaleIfRegionAttributeEqCs#1#2#3{%
+ \LocaleIfAttributeEqCs{#1}{region@#2}{#3}%
+}
+\def\LocaleIfRegionAttributeEqCsName#1#2#3{%
+ \LocaleIfAttributeEqCsName{#1}{region@#2}{#3}%
+}
+\def\LocaleIfRegionAttributeEqNum#1#2#3{%
+ \LocaleIfAttributeEqNum{#1}{region@#2}{#3}%
+}
+\def\LocaleIfSameRegionAttributeValues#1#2#3{%
+ \LocaleIfSameAttributeValues{#1}{region@#2}{region@#3}%
+}
+\def\localeshowcurrencyattribute#1#2{%
+ \localeshowattribute{#1}{currency@#2}%
+}
+\def\LocaleSetCurrencyAttribute#1#2#3{%
+ \LocaleSetAttribute{#1}{currency@#2}{#3}%
+}
+\def\LocaleProvideCurrencyAttribute#1#2#3{%
+ \LocaleProvideAttribute{#1}{currency@#2}{#3}%
+}
+\def\LocaleLetCurrencyAttribute#1#2#3{%
+ \LocaleLetAttribute{#1}{currency@#2}{#3}%
+}
+\def\LocaleAppToCurrencyAttribute#1#2#3{%
+ \LocaleAppToAttribute{#1}{currency@#2}{#3}%
+}
+\def\LocaleXpAppToCurrencyAttribute#1#2#3{%
+ \LocaleXpAppToAttribute{#1}{currency@#2}{#3}%
+}
+\def\LocaleAddToCurrencyAttributeList#1#2{%
+ \LocaleAddToAttributeList{#1}{currency@#2}%
+}
+\def\LocaleXpAddToCurrencyAttributeList#1#2{%
+ \LocaleXpAddToAttributeList{#1}{currency@#2}%
+}
+\def\LocaleGetCurrencyAttribute#1#2{%
+ \LocaleGetAttribute{#1}{currency@#2}%
+}
+\def\LocaleGetCurrencyAttributeOrDefValue#1#2{%
+ \LocaleGetAttributeOrDefValue{#1}{currency@#2}%
+}
+\def\LocaleIfHasCurrencyAttribute#1#2{%
+ \LocaleIfHasAttribute{#1}{currency@#2}%
+}
+\def\LocaleForEachInCurrencyAttributeList#1#2{%
+ \LocaleForEachInAttributeList{#1}{currency@#2}%
+}
+\def\LocaleIfInCurrencyAttributeList#1#2{%
+ \LocaleIfInAttributeList{#1}{currency@#2}%
+}
+\def\LocaleIfXpInCurrencyAttributeList#1#2{%
+ \LocaleIfXpInAttributeList{#1}{currency@#2}%
+}
+\def\LocaleIfHasCurrencyNonEmptyAttribute#1#2{%
+ \LocaleIfHasNonEmptyAttribute{#1}{currency@#2}%
+}
+\def\LocaleIfCurrencyAttributeEqCs#1#2#3{%
+ \LocaleIfAttributeEqCs{#1}{currency@#2}{#3}%
+}
+\def\LocaleIfCurrencyAttributeEqCsName#1#2#3{%
+ \LocaleIfAttributeEqCsName{#1}{currency@#2}{#3}%
+}
+\def\LocaleIfCurrencyAttributeEqNum#1#2#3{%
+ \LocaleIfAttributeEqNum{#1}{currency@#2}{#3}%
+}
+\def\LocaleIfSameCurrencyAttributeValues#1#2#3{%
+ \LocaleIfSameAttributeValues{#1}{currency@#2}{currency@#3}%
+}
+\def\@locale@parse@result#1#2#3#4#5#6{%
+ \def\LocaleOSname{#1}%
+ \def\LocaleOSversion{#2}%
+ \def\LocaleOSarch{#3}%
+ \def\LocaleNowStamp{#4}%
+ \@locale@parse@default#5% remove outer group
+ \def\LocaleOScodeset{#6}%
+ \LocaleIfDateTimePatternsSupported
+ {%
+ \let\@locale@next\@locale@parse@datetimeinfo
+ }%
+ {%
+ \def\LocaleDateTimeInfo{}%
+ \ifx\LocaleMainFile\empty
+ \def\LocaleFileMod{}%
+ \let\@locale@next\@locale@parse@maindata
+ \else
+ \let\@locale@next\@locale@parse@filemod
+ \fi
+ }%
+ \@locale@next
+}
+\def\@locale@parse@datetimeinfo#1{%
+ \def\LocaleDateTimeInfo{#1}%
+ \ifx\LocaleMainFile\empty
+ \def\LocaleFileMod{}%
+ \let\@locale@next\@locale@parse@maindata
+ \else
+ \let\@locale@next\@locale@parse@filemod
+ \fi
+ \@locale@next
+}
+\def\@locale@parse@default#1#2#3#4#5#6#7#8#9{%
+ \def\LocaleOStag{#1}%
+ \@tracklang@parselangtag{#1}%
+ \let\@locale@os@region\@TrackLangEnvTerritory
+ \def\@locale@os@groupsep{#2}%
+ \def\@locale@os@decsep{#3}%
+ \def\@locale@os@exp{#4}%
+ \def\@locale@os@usesgroup{#5}%
+ \def\@locale@os@currencycode{#6}%
+ \def\@locale@os@regionalcurrencycode{#7}%
+ \def\@locale@os@currencysym{#8}%
+ \def\@locale@os@currencytex{#9}%
+ \LocaleSetRegionAttribute{\@locale@os@region}{currency}{#7}%
+ \LocaleProvideCurrencyAttribute{#7}{official}{#6}%
+ \LocaleProvideCurrencyAttribute{#7}{sym}{#8}%
+ \LocaleProvideCurrencyAttribute{#7}{tex}{#9}%
+ \@locale@parse@default@cursep
+}
+\def\@locale@parse@default@cursep#1{%
+ \def\@locale@os@cursep{#1}%
+}
+\def\@locale@parse@filemod#1{%
+ \def\LocaleFileMod{#1}%
+ \@locale@parse@maindata
+}
+\def\@locale@parse@maindata#1{%
+ \@locale@parse@maindatablock#1% remove outer group
+}
+\def\@locale@parse@maindatablock#1{%
+ \@locale@parse@maindatalocaleblock#1% remove outer group
+ \@locale@parse@dateblock
+}
+\def\@locale@parse@maindatalocaleblock#1#2#3#4#5#6#7{%
+ \def\LocaleMain{#1}%
+ \TrackLanguageTag{#1}%
+ \let\LocaleMainDialect\TrackLangLastTrackedDialect
+ \let\@locale@dialect\TrackLangLastTrackedDialect
+ \IfTrackedLanguageHasIsoCode{3166-1}{\@locale@dialect}%
+ {%
+ \edef\@locale@region{%
+ \TrackedIsoCodeFromLanguage{3166-1}{\@locale@dialect}}%
+ }%
+ {\def\@locale@region{}}%
+ \let\LocaleMainRegion\@locale@region
+ \ifx\LocaleMainRegion\empty
+ \else
+ \LocaleLetRegionAttribute{\LocaleMainRegion}{dialect}{\@locale@dialect}%
+ \fi
+ \LocaleSetDialectAttribute{\@locale@dialect}{langtag}{#1}%
+ \LocaleLetAttribute{#1}{tagtodialect}{\@locale@dialect}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{langname}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativelangname}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{regionname}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativeregionname}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{variantname}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativevariantname}{#7}%
+}
+\def\@locale@parse@otherdatalocaleblock#1#2#3#4#5#6#7{%
+ \TrackLanguageTag{#1}%
+ \let\@locale@dialect\TrackLangLastTrackedDialect
+ \IfTrackedLanguageHasIsoCode{3166-1}{\@locale@dialect}%
+ {%
+ \edef\@locale@region{%
+ \TrackedIsoCodeFromLanguage{3166-1}{\@locale@dialect}}%
+ \ifx\@locale@region\empty
+ \else
+ \LocaleXpAddToRegionAttributeList
+ {\@locale@region}{dialect}{\@locale@dialect}%
+ \fi
+ }%
+ {\def\@locale@region{}}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{langtag}{#1}%
+ \LocaleLetAttribute{#1}{tagtodialect}{\@locale@dialect}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{langname}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativelangname}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{regionname}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativeregionname}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{variantname}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{nativevariantname}{#7}%
+}
+\def\@locale@parse@dateblock#1{%
+ \@locale@parse@dates#1% remove outer group
+ \@locale@parse@datefmtblock
+}
+\def\@locale@parse@dates#1#2#3#4#5{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulldate}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longdate}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{meddate}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortdate}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{firstday}{#5}%
+}
+\def\@locale@parse@datefmtblock#1{%
+ \@locale@parse@datefmts#1% remove outer group
+ \@locale@parse@timeblock
+}
+\def\@locale@parse@datefmts#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulldatefmt}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longdatefmt}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{meddatefmt}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortdatefmt}{#4}%
+}
+\def\@locale@parse@timeblock#1{%
+ \@locale@parse@times#1% remove outer group
+ \@locale@parse@timefmtblock
+}
+\def\@locale@parse@times#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulltime}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longtime}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{medtime}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shorttime}{#4}%
+}
+\def\@locale@parse@timefmtblock#1{%
+ \@locale@parse@timefmts#1% remove outer group
+ \@locale@parse@datetimeblock
+}
+\def\@locale@parse@timefmts#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulltimefmt}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longtimefmt}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{medtimefmt}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shorttimefmt}{#3}%
+}
+\def\@locale@parse@datetimeblock#1{%
+ \@locale@parse@datetimes#1% remove outer group
+ \@locale@parse@datetimefmtblock
+}
+\def\@locale@parse@datetimes#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulldatetime}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longdatetime}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{meddatetime}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortdatetime}{#4}%
+}
+\def\@locale@parse@datetimefmtblock#1{%
+ \@locale@parse@datetimefmts#1% remove outer group
+ \@locale@parse@weekdayblock
+}
+\def\@locale@parse@datetimefmts#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{fulldatetimefmt}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{longdatetimefmt}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{meddatetimefmt}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortdatetimefmt}{#4}%
+}
+\def\@locale@parse@weekdayblock#1{%
+ \@locale@parse@weekdays#1% remove outer group
+ \@locale@parse@shortweekdayblock
+}
+\def\@locale@parse@weekdays#1#2#3#4#5#6#7{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.0}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.1}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.2}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.3}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.4}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.5}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{day.6}{#7}%
+}
+\def\@locale@parse@shortweekdayblock#1{%
+ \@locale@parse@shortweekdays#1% remove outer group
+ \@locale@parse@monthblock
+}
+\def\@locale@parse@shortweekdays#1#2#3#4#5#6#7{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.0}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.1}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.2}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.3}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.4}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.5}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortday.6}{#7}%
+}
+\def\@locale@parse@monthblock#1{%
+ \@locale@parse@months#1% remove outer group
+ \@locale@parse@shortmonthblock
+}
+\def\@locale@parse@months#1#2#3#4#5#6#7#8#9{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.1}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.2}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.3}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.4}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.5}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.6}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.7}{#7}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.8}{#8}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.9}{#9}%
+ \@locale@parse@endmonths
+}
+\def\@locale@parse@endmonths#1#2#3{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.10}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.11}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{month.12}{#3}%
+}
+\def\@locale@parse@shortmonthblock#1{%
+ \@locale@parse@shortmonths#1% remove outer group
+ \@locale@parse@standalone@weekdayblock
+}
+\def\@locale@parse@shortmonths#1#2#3#4#5#6#7#8#9{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.1}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.2}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.3}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.4}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.5}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.6}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.7}{#7}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.8}{#8}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.9}{#9}%
+ \@locale@parse@endshortmonths
+}
+\def\@locale@parse@endshortmonths#1#2#3{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.10}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.11}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.12}{#3}%
+}
+\def\@locale@parse@standalone@weekdayblock#1{%
+ \@locale@parse@standalone@weekdays#1% remove outer group
+ \@locale@parse@standalone@shortweekdayblock
+}
+\def\@locale@parse@standalone@weekdays#1#2#3#4#5#6#7{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.0}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.1}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.2}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.3}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.4}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.5}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.6}{#7}%
+}
+\def\@locale@parse@standalone@shortweekdayblock#1{%
+ \@locale@parse@standalone@shortweekdays#1% remove outer group
+ \@locale@parse@standalone@monthblock
+}
+\def\@locale@parse@standalone@shortweekdays#1#2#3#4#5#6#7{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.0}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.1}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.2}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.3}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.4}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.5}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.6}{#7}%
+}
+\def\@locale@parse@standalone@monthblock#1{%
+ \@locale@parse@standalone@months#1% remove outer group
+ \@locale@parse@standalone@shortmonthblock
+}
+\def\@locale@parse@standalone@months#1#2#3#4#5#6#7#8#9{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.1}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.2}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.3}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.4}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.5}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.6}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.7}{#7}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.8}{#8}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.9}{#9}%
+ \@locale@parse@endstandalone@months
+}
+\def\@locale@parse@endstandalone@months#1#2#3{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.10}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.11}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.12}{#3}%
+}
+\def\@locale@parse@standalone@shortmonthblock#1{%
+ \@locale@parse@standalone@shortmonths#1% remove outer group
+ \@locale@parse@numericblock
+}
+\def\@locale@parse@standalone@shortmonths#1#2#3#4#5#6#7#8#9{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.1}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.2}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.3}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.4}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.5}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.6}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.7}{#7}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.8}{#8}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.9}{#9}%
+ \@locale@parse@endstandalone@shortmonths
+}
+\def\@locale@parse@endstandalone@shortmonths#1#2#3{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.10}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.11}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.12}{#3}%
+}
+\def\@locale@parse@numericblock#1{%
+ \@locale@parse@numeric#1% remove outer group
+ \@locale@parse@numericfmtblock
+}
+\def\@locale@parse@numeric#1#2#3#4#5#6#7#8#9{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{groupsep}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{decsep}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{exp}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{usesgroup}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{currency}{#5}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{regionalcurrency}{#6}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{currencysym}{#7}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{currencytex}{#8}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{currencysep}{#9}%
+ \LocaleProvideCurrencyAttribute{#6}{official}{#5}%
+ \LocaleProvideCurrencyAttribute{#6}{sym}{#7}%
+ \LocaleProvideCurrencyAttribute{#6}{tex}{#8}%
+ \LocaleAddToAttributeList{currencies}{official}{#5}%
+ \LocaleAddToAttributeList{currencies}{regional}{#6}%
+ \ifx\@locale@region\empty
+ \else
+ \LocaleProvideRegionAttribute{\@locale@region}{currency}{#6}%
+ \LocaleXpAddToCurrencyAttributeList{#5}{region}{\@locale@region}%
+ \LocaleIfSameDialectAttributeValues{\@locale@dialect}%
+ {regionalcurrency}{currency}%
+ {}%
+ {%
+ \LocaleXpAddToCurrencyAttributeList{#6}{region}{\@locale@region}%
+ }%
+ \fi
+ \@locale@parse@persym
+}
+\def\@locale@parse@persym#1#2{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{percent}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{permill}{#2}%
+}
+\def\@locale@parse@numericfmtblock#1{%
+ \@locale@parse@numericfmt#1% remove outer group
+ \LocaleIfDateTimePatternsSupported
+ {\@locale@parse@timezones}%
+ {\@locale@parse@otherdata}%
+}
+\def\@locale@parse@numericfmt#1#2#3#4{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{decfmt}{#1}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{intfmt}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{curfmt}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{perfmt}{#4}%
+}
+\def\@locale@parse@timezones#1{%
+ \@locale@parse@timezonemap#1\relax
+ \@locale@parse@otherdata
+}
+\def\@locale@parse@timezonemap#1{%
+ \ifx\relax#1\relax
+ \let\@locale@next\relax
+ \else
+ \@locale@save@timezonemap#1%
+ \let\@locale@next\@locale@parse@timezonemap
+ \fi
+ \@locale@next
+}%
+\def\@locale@save@timezonemap#1#2#3#4#5{%
+ \LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.short}{#2}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.long}{#3}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.shortdst}{#4}%
+ \LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.longdst}{#5}%
+ \LocaleAddToAttributeList{timezone}{id}{#1}%
+}
+\def\@locale@endparse@result{}
+\def\@locale@parse@otherdata#1{%
+ \ifx\@locale@endparse@result#1\relax
+ \let\@locale@next\relax
+ \else
+ \def\@locale@next{\@locale@parse@otherdata@localeblock#1}%
+ \fi
+ \@locale@next
+}
+\def\@locale@parse@otherdata@localeblock#1{%
+ \@locale@parse@otherdatalocaleblock#1% remove outer group
+ \@locale@parse@dateblock
+}
+\ifx\@locale@result\empty
+ \ifTeXOSQueryDryRun
+ \@locale@warn{Dry run mode on. No data provided by texosquery. Check
+ TeX's shell escape status}%
+ \else
+ \@locale@warn{No data provided by texosquery. Check
+ TeX's shell escape status and texosquery's setup}%
+ \fi
+ \def\LocaleOSname{}%
+ \def\LocaleOSversion{}%
+ \def\LocaleOSarch{}%
+ \def\LocaleNowStamp{}%
+ \def\LocaleOStag{}%
+ \def\LocaleOScodeset{}%
+ \def\LocaleFileMod{}%
+ \def\LocaleMain{}%
+ \def\LocaleMainDialect{}%
+ \def\LocaleMainRegion{}%
+ \def\LocaleDateTimeInfo{}%
+\else
+ \expandafter\@locale@parse@result\@locale@result\@locale@endparse@result
+\fi
+\def\LocaleLanguageTag#1{%
+ \LocaleGetDialectAttribute{#1}{langtag}%
+}
+\def\LocaleLanguageName#1{%
+ \LocaleGetDialectAttribute{#1}{langname}%
+}
+\def\LocaleLanguageNativeName#1{%
+ \LocaleGetDialectAttribute{#1}{nativelangname}%
+}
+\def\LocaleRegionName#1{%
+ \LocaleGetDialectAttribute{#1}{regionname}%
+}
+\def\LocaleRegionNativeName#1{%
+ \LocaleGetDialectAttribute{#1}{nativeregionname}%
+}
+\def\LocaleVariantName#1{%
+ \LocaleGetDialectAttribute{#1}{variantname}%
+}
+\def\LocaleVariantNativeName#1{%
+ \LocaleGetDialectAttribute{#1}{nativevariantname}%
+}
+\def\LocaleFullDate#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{fulldate}}%
+}
+\def\LocaleLongDate#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{longdate}}%
+}
+\def\LocaleMediumDate#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{meddate}}%
+}
+\def\LocaleShortDate#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{shortdate}}%
+}
+\def\LocaleFirstDayIndex#1{%
+ \LocaleGetDialectAttributeOrDefValue{#1}{firstday}{-1}%
+}
+\def\dtmMondayIndex{0}
+\def\dtmTuesdayIndex{1}
+\def\dtmWednesdayIndex{2}
+\def\dtmThursdayIndex{3}
+\def\dtmFridayIndex{4}
+\def\dtmSaturdayIndex{5}
+\def\dtmSundayIndex{6}
+\def\LocaleDayIndexFromZeroMonToOneSun#1{%
+ \ifcase#1
+ 2% Monday 0 -> 2
+ \or
+ 3% Tuesday 1 -> 3
+ \or
+ 4% Wednesday 2 -> 4
+ \or
+ 5% Thursday 3 -> 5
+ \or
+ 6% Friday 4 -> 6
+ \or
+ 7% Saturday 5 -> 7
+ \or
+ 1% Sunday 6 -> 1
+ \else
+ -1% invalid
+ \fi
+}
+\def\LocaleDayIndexFromZeroMonToOneMon#1{%
+ \ifcase#1
+ 1% Monday 0 -> 1
+ \or
+ 2% Tuesday 1 -> 2
+ \or
+ 3% Wednesday 2 -> 3
+ \or
+ 4% Thursday 3 -> 4
+ \or
+ 5% Friday 4 -> 5
+ \or
+ 6% Saturday 5 -> 6
+ \or
+ 7% Sunday 6 -> 7
+ \else
+ -1% invalid
+ \fi
+}
+\def\LocaleDayIndexFromOneSunToZeroMon#1{%
+ \ifcase#1
+ % no 0
+ \or
+ 6% Sunday 1 -> 6
+ \or
+ 0% Monday 2 -> 0
+ \or
+ 1% Tuesday 3 -> 1
+ \or
+ 2% Wednesday 4 -> 2
+ \or
+ 3% Thursday 5 -> 3
+ \or
+ 4% Friday 6 -> 4
+ \or
+ 5% Saturday 7 -> 5
+ \else
+ -1% invalid
+ \fi
+}
+\def\LocaleDayIndexFromOneMonToZeroMon#1{%
+ \ifcase#1
+ % no 0
+ \or
+ 0% Monday 1 -> 0
+ \or
+ 1% Tuesday 2 -> 1
+ \or
+ 2% Wednesday 3 -> 2
+ \or
+ 3% Thursday 4 -> 3
+ \or
+ 4% Friday 5 -> 4
+ \or
+ 5% Saturday 6 -> 5
+ \or
+ 6% Sunday 7 -> 6
+ \else
+ -1% invalid
+ \fi
+}
+\def\LocaleDayIndexFromRegion#1#2{%
+ \ifcase\LocaleFirstDayIndex{#1}
+ \LocaleDayIndexFromOneMonToZeroMon{#2}%
+ \or
+ \ifnum#2=7 % Monday
+ 0%
+ \else
+ #2%
+ \fi
+ \or
+ \ifcase#1
+ % no 0
+ \or
+ 2% Wednesday 1 -> 2
+ \or
+ 3% Thursday 2 -> 3
+ \or
+ 4% Friday 3 -> 4
+ \or
+ 5% Saturday 4 -> 5
+ \or
+ 6% Sunday 5 -> 6
+ \or
+ 0% Monday 6 -> 0
+ \or
+ 1% Tuesday 7 -> 1
+ \else
+ -1% invalid
+ \fi
+ \or
+ \ifcase#1
+ % no 0
+ \or
+ 3% Thursday 1 -> 3
+ \or
+ 4% Friday 2 -> 4
+ \or
+ 5% Saturday 3 -> 5
+ \or
+ 6% Sunday 4 -> 6
+ \or
+ 0% Monday 5 -> 0
+ \or
+ 1% Tuesday 6 -> 1
+ \or
+ 2% Wednesday 7 -> 2
+ \else
+ -1% invalid
+ \fi
+ \or
+ \ifcase#1
+ % no 0
+ \or
+ 4% Friday 1 -> 4
+ \or
+ 5% Saturday 2 -> 5
+ \or
+ 6% Sunday 3 -> 6
+ \or
+ 0% Monday 4 -> 0
+ \or
+ 1% Tuesday 5 -> 1
+ \or
+ 2% Wednesday 6 -> 2
+ \or
+ 3% Thursday 7 -> 3
+ \else
+ -1% invalid
+ \fi
+ \or
+ \ifcase#1
+ % no 0
+ \or
+ 5% Saturday 1 -> 5
+ \or
+ 6% Sunday 2 -> 6
+ \or
+ 0% Monday 3 -> 0
+ \or
+ 1% Tuesday 4 -> 1
+ \or
+ 2% Wednesday 5 -> 2
+ \or
+ 3% Thursday 6 -> 3
+ \or
+ 4% Friday 7 -> 4
+ \else
+ -1% invalid
+ \fi
+ \or
+ \LocaleDayIndexFromOneSunToZeroMon{#2}%
+ \else
+ #2%
+ \fi
+}
+\def\LocaleDayIndexToRegion#1#2{%
+ \ifcase\LocaleFirstDayIndex{#1}
+ \LocaleDayIndexFromZeroMonToOneMon{#2}%
+ \or
+ \ifnum#2=0 % Monday
+ 7%
+ \else
+ #2%
+ \fi
+ \or
+ \ifcase#1
+ 6% Monday 0 -> 6
+ \or
+ 7% Tuesday 1 -> 7
+ \or
+ 1% Wednesday 2 -> 1
+ \or
+ 2% Thursday 3 -> 2
+ \or
+ 3% Friday 4 -> 3
+ \or
+ 4% Saturday 5 -> 4
+ \or
+ 5% Sunday 6 -> 5
+ \else
+ -1% invalid
+ \fi
+ \or
+ \ifcase#1
+ 5% Monday 0 -> 5
+ \or
+ 6% Tuesday 1 -> 6
+ \or
+ 7% Wednesday 2 -> 7
+ \or
+ 1% Thursday 3 -> 1
+ \or
+ 2% Friday 4 -> 2
+ \or
+ 3% Saturday 5 -> 3
+ \or
+ 4% Sunday 6 -> 4
+ \else
+ -1% invalid
+ \fi
+ \or
+ \ifcase#1
+ 4% Monday 0 -> 4
+ \or
+ 5% Tuesday 1 -> 5
+ \or
+ 6% Wednesday 2 -> 6
+ \or
+ 7% Thursday 3 -> 7
+ \or
+ 1% Friday 4 -> 1
+ \or
+ 2% Saturday 5 -> 2
+ \or
+ 3% Sunday 6 -> 3
+ \else
+ -1% invalid
+ \fi
+ \or
+ \ifcase#1
+ 3% Monday 0 -> 3
+ \or
+ 4% Tuesday 1 -> 4
+ \or
+ 5% Wednesday 2 -> 5
+ \or
+ 6% Thursday 3 -> 6
+ \or
+ 7% Friday 4 -> 7
+ \or
+ 1% Saturday 5 -> 1
+ \or
+ 2% Sunday 6 -> 2
+ \else
+ -1% invalid
+ \fi
+ \or
+ \LocaleDayIndexFromZeroMonToOneSun{#2}%
+ \else
+ #2%
+ \fi
+}
+\def\LocaleFullTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{fulltime}}%
+}
+\def\LocaleLongTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{longtime}}%
+}
+\def\LocaleMediumTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{medtime}}%
+}
+\def\LocaleShortTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{shorttime}}%
+}
+\def\LocaleFullDateTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{fulldatetime}}%
+}
+\def\LocaleLongDateTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{longdatetime}}%
+}
+\def\LocaleMediumDateTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{meddatetime}}%
+}
+\def\LocaleShortDateTime#1{%
+ \localedatetimefmt{\LocaleGetDialectAttribute{#1}{shortdatetime}}%
+}
+\def\LocaleDayName#1#2{%
+ \LocaleGetDialectAttribute{#1}{day.\number#2}%
+}
+\def\LocaleShortDayName#1#2{%
+ \LocaleGetDialectAttribute{#1}{shortday.\number#2}%
+}
+\def\LocaleMonthName#1#2{%
+ \LocaleGetDialectAttribute{#1}{month.\number#2}%
+}
+\def\LocaleShortMonthName#1#2{%
+ \LocaleGetDialectAttribute{#1}{shortmonth.\number#2}%
+}
+\def\LocaleStandaloneDayName#1#2{%
+ \LocaleGetDialectAttribute{#1}{standalone.day.\number#2}%
+}
+\def\LocaleStandaloneShortDayName#1#2{%
+ \LocaleGetDialectAttribute{#1}{standalone.shortday.\number#2}%
+}
+\def\LocaleStandaloneMonthName#1#2{%
+ \LocaleGetDialectAttribute{#1}{standalone.month.\number#2}%
+}
+\def\LocaleStandaloneShortMonthName#1#2{%
+ \LocaleGetDialectAttribute{#1}{standalone.shortmonth.\number#2}%
+}
+\def\LocaleNumericGroupSep#1{%
+ \LocaleGetDialectAttribute{#1}{groupsep}%
+}
+\def\LocaleNumericDecimalSep#1{%
+ \LocaleGetDialectAttribute{#1}{decsep}%
+}
+\def\LocaleNumericMonetarySep#1{%
+ \LocaleGetDialectAttribute{#1}{currencysep}%
+}
+\def\LocaleNumericExponent#1{%
+ \LocaleGetDialectAttribute{#1}{exp}%
+}
+\def\LocaleCurrencyLabel#1{%
+ \LocaleIfDialectAttributeEqCs{#1}{currency}{\@locale@unknown@currency}%
+ {%
+ \ifx\LocaleMainRegion\empty
+ \@locale@os@currencycode
+ \else
+ \LocaleGetDialectAttributeOrDefValue{\LocaleMainDialect}{currency}%
+ {\@locale@os@currencycode}%
+ \fi
+ }%
+ {\LocaleGetDialectAttribute{#1}{currency}}%
+}
+\def\LocaleCurrencyRegionalLabel#1{%
+ \LocaleIfDialectAttributeEqCs{#1}{regionalcurrency}%
+ {\@locale@unknown@currency}%
+ {%
+ \ifx\LocaleMainRegion\empty
+ \@locale@os@regionalcurrencycode
+ \else
+ \LocaleGetDialectAttributeOrDefValue{\LocaleMainDialect}{regionalcurrency}%
+ {\@locale@os@regionalcurrencycode}%
+ \fi
+ }%
+ {\LocaleGetDialectAttribute{#1}{regionalcurrency}}%
+}
+\def\LocaleCurrencySymbol#1{%
+ \LocaleIfDialectAttributeEqCs{#1}{currency}{\@locale@unknown@currency}%
+ {%
+ \ifx\LocaleMainRegion\empty
+ \ifx\@locale@os@currencysym\empty
+ \LocaleGetDialectAttribute{#1}{currencysym}%
+ \else
+ \@locale@os@currencysym
+ \fi
+ \else
+ \LocaleGetDialectAttributeOrDefValue{\LocaleMainDialect}{currencysym}%
+ {\LocaleGetDialectAttribute{#1}{currencysym}}%
+ \fi
+ }%
+ {%
+ \LocaleIfSameDialectAttributeValues{#1}%
+ {currency}{currencysym}%
+ {%
+ \LocaleGetCurrencyAttributeOrDefValue
+ {\LocaleGetDialectAttribute{#1}{currency}}{sym}%
+ {\LocaleGetDialectAttribute{#1}{currencysym}}%
+ }%
+ {%
+ \LocaleGetDialectAttribute{#1}{currencysym}%
+ }%
+ }%
+}
+\def\LocaleCurrencyTeXSymbol#1{%
+ \LocaleIfDialectAttributeEqCs{#1}{currency}{\@locale@unknown@currency}%
+ {%
+ \ifx\LocaleMainRegion\empty
+ \ifx\@locale@os@currencytex\empty
+ \LocaleGetDialectAttribute{#1}{currencytex}%
+ \else
+ \@locale@os@currencytex
+ \fi
+ \fi
+ }%
+ {%
+ \LocaleIfSameDialectAttributeValues{#1}%
+ {currency}{currencytex}%
+ {%
+ \LocaleGetCurrencyAttributeOrDefValue
+ {\LocaleGetDialectAttribute{#1}{currency}}{tex}%
+ {\LocaleGetDialectAttribute{#1}{currencytex}}%
+ }%
+ {%
+ \LocaleGetDialectAttribute{#1}{currencytex}%
+ }%
+ }%
+}
+\def\LocaleNumericPercent#1{%
+ \LocaleGetDialectAttribute{#1}{percent}%
+}
+\def\LocaleNumericPermill#1{%
+ \LocaleGetDialectAttribute{#1}{permill}%
+}
+\def\LocaleApplyDateTimePattern#1#2#3{%
+ \LocaleIfHasDialectNonEmptyAttribute{#1}{#2}%
+ {%
+ \ifx\empty#3\empty
+ \@locale@warn{No date-time data for pattern
+ (attribute `#2', dialect `#1')}%
+ \else
+ \localedatetimefmt
+ {\expandafter\texosqueryfmtdatetime
+ \csname locale@dialect@#2@#1\expandafter\endcsname#3}%
+ \fi
+ }%
+ {%
+ \@locale@warn{No date-time pattern attribute `#2' for dialect `#1'}%
+ }%
+}
+\LocaleIfDateTimePatternsSupported
+{%
+ \def\texosqueryfmtpatMMM#1{%
+ \CurrentLocaleShortMonthName{#1}%
+ }
+ \def\texosqueryfmtpatMMMM#1{%
+ \CurrentLocaleMonthName{#1}%
+ }
+ \def\texosqueryfmtpatLLL#1{%
+ \CurrentLocaleStandaloneShortMonthName{#1}%
+ }
+ \def\texosqueryfmtpatLLLL#1{%
+ \CurrentLocaleStandaloneMonthName{#1}%
+ }
+ \def\texosqueryfmtpatEEE#1{%
+ \CurrentLocaleShortDayName{\LocaleDayIndexFromOneMonToZeroMon{#1}}%
+ }
+ \def\texosqueryfmtpatEEEE#1{%
+ \CurrentLocaleDayName{\LocaleDayIndexFromOneMonToZeroMon{#1}}%
+ }
+ \def\texosquerytimezonefmt#1{#1}
+ \def\texosqueryshorttimezone#1{%
+ \texosquerytimezonefmt
+ {\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.short}}%
+ }
+ \def\texosqueryshortdstzone#1{%
+ \texosquerytimezonefmt
+ {\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.shortdst}}%
+ }
+ \def\texosquerylongtimezone#1{%
+ \texosquerytimezonefmt
+ {\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.long}}%
+ }
+ \def\texosquerylongdstzone#1{%
+ \texosquerytimezonefmt
+ {\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.longdst}}%
+ }
+}
+{}
+\def\texosquerypatfmtgroupsep{\CurrentLocaleNumericGroupSep}
+\def\texosquerypatfmtdecsep{\CurrentLocaleDecimalSep}
+\def\texosquerypatfmtcurdecsep{\CurrentLocaleMonetarySep}
+\def\texosquerypatfmtexp{\CurrentLocaleExponent}
+\def\texosquerypatfmtcurrencysign{\CurrentLocaleCurrency}
+\def\texosquerypatfmtpercentsign{\CurrentLocalePercent}
+\def\texosquerypatfmtpermillsign{\CurrentLocalePermill}
+\def\LocaleIfNumericUsesGroup#1{%
+ \LocaleIfDialectAttributeEqNum{#1}{usesgroup}{1}%
+}
+\def\LocaleIfHasLanguageName#1{%
+ \LocaleIfHasDialectNonEmptyAttribute{#1}{langname}%
+}
+\def\LocaleIfHasRegionName#1{%
+ \LocaleIfHasDialectNonEmptyAttribute{#1}{regionname}%
+}
+\def\LocaleIfHasVariantName#1{%
+ \LocaleIfHasDialectNonEmptyAttribute{#1}{variantname}%
+}
+\ifx\@locale@postparse@hook\undefined
+\else
+ \@locale@postparse@hook
+\fi
+\def\CurrentLocaleLanguageName{}%
+\def\CurrentLocaleLanguageNativeName{}%
+\def\CurrentLocaleRegionName{}%
+\def\CurrentLocaleRegionNativeName{}%
+\def\CurrentLocaleVariantName{}%
+\def\CurrentLocaleVariantNativeName{}%
+\def\CurrentLocaleFirstDayIndex{-1}%
+\def\CurrentLocaleDayIndexFromRegion{-1}%
+\def\CurrentLocaleDayName{}%
+\def\CurrentLocaleShortDayName{}%
+\def\CurrentLocaleStandaloneDayName{}%
+\def\CurrentLocaleStandaloneShortDayName{}%
+\def\CurrentLocaleMonthName{}%
+\def\CurrentLocaleShortMonthName{}%
+\def\CurrentLocaleStandaloneMonthName{}%
+\def\CurrentLocaleStandaloneShortMonthName{}%
+\def\CurrentLocaleFullDate{}%
+\def\CurrentLocaleLongDate{}%
+\def\CurrentLocaleMediumDate{}%
+\def\CurrentLocaleShortDate{}%
+\def\CurrentLocaleFullTime{}%
+\def\CurrentLocaleLongTime{}%
+\def\CurrentLocaleMediumTime{}%
+\def\CurrentLocaleShortTime{}%
+\def\CurrentLocaleFullDateTime{}%
+\def\CurrentLocaleLongDateTime{}%
+\def\CurrentLocaleMediumDateTime{}%
+\def\CurrentLocaleShortDateTime{}%
+\def\CurrentLocaleDate{}%
+\def\CurrentLocaleTime{}%
+\def\CurrentLocaleCurrency{}%
+\def\CurrentLocaleNumericGroupSep{}%
+\def\CurrentLocaleIfNumericUsesGroup{}%
+\def\CurrentLocaleDecimalSep{}%
+\def\CurrentLocaleMonetarySep{}%
+\def\CurrentLocaleExponent{}%
+\def\CurrentLocalePercent{}%
+\def\CurrentLocalePermill{}%
+\def\CurrentLocaleIntegerPattern{}%
+\def\CurrentLocaleDecimalPattern{}%
+\def\CurrentLocaleCurrencyPattern{}%
+\def\CurrentLocalePercentPattern{}%
+\def\CurrentLocaleApplyDateTimePattern{}%
+\def\CurrentTrackedDialect{}%
+\def\@locale@select#1{%
+ \SetCurrentTrackedDialect{#1}%
+ \def\CurrentLocaleLanguageName{\LocaleLanguageName{#1}}%
+ \def\CurrentLocaleLanguageNativeName{\LocaleLanguageNativeName{#1}}%
+ \def\CurrentLocaleRegionName{\LocaleRegionName{#1}}%
+ \def\CurrentLocaleRegionNativeName{\LocaleRegionNativeName{#1}}%
+ \def\CurrentLocaleVariantName{\LocaleVariantName{#1}}%
+ \def\CurrentLocaleVariantNativeName{\LocaleVariantNativeName{#1}}%
+ \def\CurrentLocaleFirstDayIndex{\LocaleFirstDayIndex{#1}}%
+ \def\CurrentLocaleDayIndexFromRegion{\LocaleDayIndexFromRegion{#1}}%
+ \def\CurrentLocaleDayName{\LocaleDayName{#1}}%
+ \def\CurrentLocaleShortDayName{\LocaleShortDayName{#1}}%
+ \def\CurrentLocaleStandaloneDayName{%
+ \LocaleStandaloneDayName{#1}}%
+ \def\CurrentLocaleStandaloneShortDayName{%
+ \LocaleStandaloneShortDayName{#1}}%
+ \def\CurrentLocaleMonthName{\LocaleMonthName{#1}}%
+ \def\CurrentLocaleShortMonthName{\LocaleShortMonthName{#1}}%
+ \def\CurrentLocaleStandaloneMonthName{%
+ \LocaleStandaloneMonthName{#1}}%
+ \def\CurrentLocaleStandaloneShortMonthName{%
+ \LocaleStandaloneShortMonthName{#1}}%
+ \def\CurrentLocaleFullDate{\LocaleFullDate{#1}}%
+ \def\CurrentLocaleLongDate{\LocaleLongDate{#1}}%
+ \def\CurrentLocaleMediumDate{\LocaleMediumDate{#1}}%
+ \def\CurrentLocaleShortDate{\LocaleShortDate{#1}}%
+ \def\CurrentLocaleFullTime{\LocaleFullTime{#1}}%
+ \def\CurrentLocaleLongTime{\LocaleLongTime{#1}}%
+ \def\CurrentLocaleMediumTime{\LocaleMediumTime{#1}}%
+ \def\CurrentLocaleShortTime{\LocaleShortTime{#1}}%
+ \def\CurrentLocaleFullDateTime{\LocaleFullDateTime{#1}}%
+ \def\CurrentLocaleLongDateTime{\LocaleLongDateTime{#1}}%
+ \def\CurrentLocaleMediumDateTime{\LocaleMediumDateTime{#1}}%
+ \def\CurrentLocaleShortDateTime{\LocaleShortDateTime{#1}}%
+ \def\CurrentLocaleDate{%
+ \localedatechoice
+ {\LocaleFullDate{#1}}%
+ {\LocaleLongDate{#1}}%
+ {\LocaleMediumDate{#1}}%
+ {\LocaleShortDate{#1}}%
+ }%
+ \def\CurrentLocaleTime{%
+ \localetimechoice
+ {\LocaleFullTime{#1}}%
+ {\LocaleLongTime{#1}}%
+ {\LocaleMediumTime{#1}}%
+ {\LocaleShortTime{#1}}%
+ }%
+ \def\CurrentLocaleCurrency{%
+ \localecurrchoice
+ {\LocaleCurrencyLabel{#1}}%
+ {\LocaleCurrencyRegionalLabel{#1}}%
+ {\LocaleCurrencySymbol{#1}}%
+ {\LocaleCurrencyTeXSymbol{#1}}%
+ }%
+ \def\CurrentLocaleNumericGroupSep{%
+ \LocaleNumericGroupSep{#1}%
+ }%
+ \def\CurrentLocaleIfNumericUsesGroup{%
+ \LocaleIfNumericUsesGroup{#1}%
+ }%
+ \def\CurrentLocaleDecimalSep{%
+ \LocaleNumericDecimalSep{#1}%
+ }%
+ \def\CurrentLocaleMonetarySep{%
+ \LocaleNumericMonetarySep{#1}%
+ }%
+ \def\CurrentLocaleExponent{%
+ \LocaleNumericExponent{#1}%
+ }%
+ \def\CurrentLocalePercent{%
+ \LocaleNumericPercent{#1}%
+ }%
+ \def\CurrentLocalePermill{%
+ \LocaleNumericPermill{#1}%
+ }%
+ \def\CurrentLocaleIntegerPattern{%
+ \LocaleGetDialectAttribute{#1}{intfmt}%
+ }%
+ \def\CurrentLocaleDecimalPattern{%
+ \LocaleGetDialectAttribute{#1}{decfmt}%
+ }%
+ \def\CurrentLocaleCurrencyPattern{%
+ \LocaleGetDialectAttribute{#1}{curfmt}%
+ }%
+ \def\CurrentLocalePercentPattern{%
+ \LocaleGetDialectAttribute{#1}{perfmt}%
+ }%
+ \def\CurrentLocaleApplyDateTimePattern{%
+ \LocaleApplyDateTimePattern{#1}%
+ }%
+}
+\ifx\localedatechoice\undefined
+ \def\localedatechoice#1#2#3#4{#2}
+\fi
+\ifx\localetimechoice\undefined
+ \def\localetimechoice#1#2#3#4{#3}
+\fi
+\ifx\localecurrchoice\undefined
+ \def\localecurrchoice#1#2#3#4{#2}
+\fi
+\def\CurrentLocaleDateTime{\CurrentLocaleDate\space\CurrentLocaleTime}
+\def\localenumfmt#1#2{%
+ \@locale@decfmt#2\empty.0E0\relax
+ \ifnum\@locale@decfmt@int<0
+ \let\@localenum@fmt\localenumfmtneg
+ \else
+ \ifnum\@locale@decfmt@int=0
+ \ifnum\@locale@decfmt@frac=0
+ \ifnum\@locale@decfmt@exp=0
+ \let\@localenum@fmt\localenumfmtzero
+ \else
+ \let\@localenum@fmt\localenumfmtpos
+ \fi
+ \else
+ \let\@localenum@fmt\localenumfmtpos
+ \fi
+ \else
+ \let\@localenum@fmt\localenumfmtpos
+ \fi
+ \fi
+ \@localenum@fmt
+ {%
+ \texosqueryfmtnumber{#1}%
+ {\@locale@decfmt@int}%
+ {\@locale@decfmt@frac}%
+ {\@locale@decfmt@exp}%
+ }%
+}
+\def\localenumfmtpos#1{#1}
+\def\localenumfmtneg#1{#1}
+\def\localenumfmtzero#1{#1}
+\def\localeint#1{%
+ \localenumfmt{\CurrentLocaleIntegerPattern}{#1}%
+}
+\def\localedec#1{%
+ \localenumfmt{\CurrentLocaleDecimalPattern}{#1}%
+}
+\def\localecur#1{%
+ \localenumfmt{\CurrentLocaleCurrencyPattern}{#1}%
+}
+\def\localeper#1{%
+ \localenumfmt{\CurrentLocalePercentPattern}{#1}%
+}
+\def\@locale@decfmt#1.#2E#3\relax{%
+ \@locale@decfmt@split#1E\empty\relax
+ \ifx\@locale@decfmt@exp\empty
+ \edef\@locale@decfmt@frac{\@locale@gobbleemptytorelax#2\empty\relax}%
+ \edef\@locale@decfmt@exp{\@locale@gobbleemptytorelax#3\empty\relax}%
+ \else
+ \def\@locale@decfmt@frac{0}%
+ \fi
+}
+\def\@locale@gobbleemptytorelax#1\empty#2\relax{#1}
+\def\@locale@decfmt@split#1E#2\empty#3\relax{%
+ \edef\@locale@decfmt@int{\@locale@gobbleemptytorelax#1\empty\relax}%
+ \edef\@locale@decfmt@exp{\@locale@gobbleemptytorelax#2\empty\relax}%
+}
+\ForEachTrackedDialect{\locale@this@dialect}{%
+ \SetCurrentTrackedDialect{\locale@this@dialect}%
+ \expandafter\@TrackLangAddToHook\expandafter
+ {\expandafter\@locale@select\expandafter{\locale@this@dialect}}
+ {captions}%
+}
+\def\selectlocale#1{%
+ \ifx\selectlanguage\undefined
+ \IfTrackedDialect{#1}%
+ {\@locale@select{#1}}%
+ {%
+ \LocaleIfHasAttribute{#1}{tagtodialect}
+ {%
+ \edef\@locale@dialect{\LocaleGetAttribute{#1}{tagtodialect}}%
+ \expandafter\@locale@select\expandafter{\@locale@dialect}%
+ }%
+ {%
+ \ifTeXOSQueryDryRun
+ \@locale@warn{Unknown locale `#1'}%
+ \else
+ \@locale@err{Unknown locale `#1'}%
+ {The argument to \string\selectlocale\space must be either a
+ tracklang dialect label or a tracked dialect language tag}%
+ \fi
+ }%
+ }%
+ \else
+ \IfTrackedDialect{#1}%
+ {%
+ \@locale@select@dialect{#1}%
+ }%
+ {%
+ \LocaleIfHasAttribute{#1}{tagtodialect}
+ {\@locale@select@dialect{\LocaleGetAttribute{#1}{tagtodialect}}}%
+ {%
+ \ifTeXOSQueryDryRun
+ \@locale@warn{Unknown locale `#1'}%
+ \else
+ \@locale@err{Unknown locale `#1'}%
+ {The argument to \string\selectlocale\space must be either a
+ tracklang dialect label or a tracked dialect language tag}%
+ \fi
+ }%
+ }%
+ \fi
+}
+\def\@locale@select@dialect#1{%
+ \IfTrackedDialectHasMapping{#1}%
+ {\edef\@locale@dialect{\GetTrackedDialectToMapping{#1}}}%
+ {\edef\@locale@dialect{#1}}%
+ \@tracklang@ifundef{date\@locale@dialect}%
+ {%
+ \edef\@locale@dialect{\TrackedLanguageFromDialect{#1}}%
+ \@tracklang@ifundef{date\@locale@dialect}%
+ {%
+ \@locale@warn{Can't determine correct label for
+ \string\selectlanguage\space from tracklang dialect `#1'}%
+ \SetCurrentTrackedDialect{#1}%
+ }%
+ {\expandafter\selectlanguage\expandafter{\@locale@dialect}}%
+ }%
+ {\expandafter\selectlanguage\expandafter{\@locale@dialect}}%
+}
+\ifx\LocaleMainDialect\empty
+\else
+ \expandafter\@locale@select\expandafter{\LocaleMainDialect}
+\fi
+\@locale@restore@at
+
+\endinput
+%%
+%% End of file `tex-locale.tex'.
diff --git a/Master/texmf-dist/tex/latex/tex-locale/tex-locale-encodings.def b/Master/texmf-dist/tex/latex/tex-locale/tex-locale-encodings.def
new file mode 100644
index 00000000000..3e7931bfe0e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tex-locale/tex-locale-encodings.def
@@ -0,0 +1,66 @@
+%%
+%% This is file `tex-locale-encodings.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tex-locale.dtx (with options: `tex-locale-encodings.def,package')
+%%
+%% tex-locale.dtx
+%% Copyright 2018 Nicola Talbot
+%%
+%% This work 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 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files tex-locale.dtx and tex-locale.ins and the derived files tex-locale.sty, tex-locale.tex, tex-locale-scripts-enc.def, tex-locale-encodings.def, tex-locale-support.def.
+%%
+%% \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
+%% Lower-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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%% arara: xetex: {shell: on}
+%% arara: xetex: {shell: on}
+\def\@locale@newencmap#1#2{%
+ \@tracklang@namedef{@locale@encmap@#1}{#2}}
+\def\@locale@ifhasencmap#1#2#3{%
+ \@tracklang@ifundef{@locale@encmap@#1}{#3}{#2}}
+\def\@locale@getencmap#1{%
+ \@tracklang@nameuse{@locale@encmap@#1}}
+\@locale@newencmap{iso88591}{latin1}
+\@locale@newencmap{iso88592}{latin2}
+\@locale@newencmap{iso88593}{latin3}
+\@locale@newencmap{iso88594}{latin4}
+\@locale@newencmap{iso88595}{latin5}
+\@locale@newencmap{iso88599}{latin9}
+\@locale@newencmap{windows1250}{cp1250}
+\@locale@newencmap{windows1252}{cp1252}
+\@locale@newencmap{windows1257}{cp1257}
+\@locale@newencmap{ibm850}{cp850}
+\@locale@newencmap{ibm852}{cp852}
+\@locale@newencmap{ibm437}{cp437}
+\@locale@newencmap{ibm865}{cp865}
+\@locale@newencmap{usascii}{ascii}
+\@locale@newencmap{xmaccentraleurope}{macce}
+\endinput
+%%
+%% End of file `tex-locale-encodings.def'.
diff --git a/Master/texmf-dist/tex/latex/tex-locale/tex-locale-scripts-enc.def b/Master/texmf-dist/tex/latex/tex-locale/tex-locale-scripts-enc.def
new file mode 100644
index 00000000000..2e0cdf1a1d1
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tex-locale/tex-locale-scripts-enc.def
@@ -0,0 +1,79 @@
+%%
+%% This is file `tex-locale-scripts-enc.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tex-locale.dtx (with options: `tex-locale-scripts-enc.def,package')
+%%
+%% tex-locale.dtx
+%% Copyright 2018 Nicola Talbot
+%%
+%% This work 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 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files tex-locale.dtx and tex-locale.ins and the derived files tex-locale.sty, tex-locale.tex, tex-locale-scripts-enc.def, tex-locale-encodings.def, tex-locale-support.def.
+%%
+%% \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
+%% Lower-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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%% arara: xetex: {shell: on}
+%% arara: xetex: {shell: on}
+\def\@locale@scriptenc@map#1#2{%
+ \@tracklang@namedef{@locale@scriptenc@map@#1}{#2}%
+}
+\def\@locale@get@scriptenc@map#1{%
+ \@tracklang@ifundef{@locale@scriptenc@map@#1}%
+ {}%
+ {\csname @locale@scriptenc@map@#1\endcsname}%
+}
+\def\@locale@if@scriptenc@map#1#2#3{%
+ \@tracklang@ifundef{@locale@scriptenc@map@#1}%
+ {#3}% false
+ {#2}% true
+}
+\def\@locale@langenc@map#1#2{%
+ \@tracklang@namedef{@locale@langenc@map@#1}{#2}%
+}
+\def\@locale@if@langenc@map#1#2#3{%
+ \@tracklang@ifundef{@locale@langenc@map@#1}%
+ {#3}% false
+ {#2}% true
+}
+\def\@locale@get@langenc@map#1{%
+ \@tracklang@ifundef{@locale@langenc@map@#1}%
+ {}%
+ {\csname @locale@langenc@map@#1\endcsname}%
+}
+\@locale@scriptenc@map{Latn}{T1}
+\@locale@scriptenc@map{Latf}{T1}
+\@locale@scriptenc@map{Latg}{T1}
+\@locale@scriptenc@map{Cyrl}{T2A,T2B,T2C}
+\@locale@langenc@map{vietnamese}{T5}
+\@locale@langenc@map{polish}{OT4}
+\@locale@langenc@map{armenian}{OT6}
+\@locale@langenc@map{greek}{LGR}
+\endinput
+%%
+%% End of file `tex-locale-scripts-enc.def'.
diff --git a/Master/texmf-dist/tex/latex/tex-locale/tex-locale-support.def b/Master/texmf-dist/tex/latex/tex-locale/tex-locale-support.def
new file mode 100644
index 00000000000..2a8ab8c192c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tex-locale/tex-locale-support.def
@@ -0,0 +1,308 @@
+%%
+%% This is file `tex-locale-support.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tex-locale.dtx (with options: `tex-locale-support.def,package')
+%%
+%% tex-locale.dtx
+%% Copyright 2018 Nicola Talbot
+%%
+%% This work 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 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files tex-locale.dtx and tex-locale.ins and the derived files tex-locale.sty, tex-locale.tex, tex-locale-scripts-enc.def, tex-locale-encodings.def, tex-locale-support.def.
+%%
+%% \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
+%% Lower-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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%% arara: xetex: {shell: on}
+%% arara: xetex: {shell: on}
+\@locale@ifsupportbabelorpoly
+{}
+{%
+ \def\@locale@providemap#1#2{%
+ \IfTrackedDialectHasMapping{#1}%
+ {}%
+ {\SetTrackedDialectLabelMap{#1}{#2}}%
+ }%
+ \@locale@providemap{bahasa}{bahasa}%
+ \@locale@providemap{indonesian}{indonesian}%
+ \@locale@providemap{indon}{indon}%
+ \@locale@providemap{bahasam}{bahasam}%
+ \@locale@providemap{malay}{malay}%
+ \@locale@providemap{melayu}{melayu}%
+ \@locale@providemap{USenglish}{USenglish}%
+ \@locale@providemap{american}{american}%
+ \@locale@providemap{UKenglish}{UKenglish}%
+ \@locale@providemap{british}{british}%
+ \@locale@providemap{canadian}{canadian}%
+ \@locale@providemap{australian}{australian}%
+ \@locale@providemap{newzealand}{newzealand}%
+ \@locale@providemap{francais}{francais}%
+ \@locale@providemap{canadien}{canadien}%
+ \@locale@providemap{acadian}{acadian}%
+ \@locale@providemap{austrian}{austrian}%
+ \@locale@providemap{germanb}{germanb}%
+ \@locale@providemap{ngerman}{ngerman}%
+ \@locale@providemap{naustrian}{naustrian}%
+ \@locale@providemap{nswissgerman}{nswissgerman}%
+ \@locale@providemap{swissgerman}{swissgerman}%
+ \@locale@providemap{polutonikogreek}{greek}%
+ \@locale@providemap{nynorsk}{nynorsk}%
+ \@locale@providemap{portuguese}{portuguese}%
+ \@locale@providemap{brazilian}{brazilian}%
+ \@locale@providemap{brazil}{brazil}%
+ \def\@locale@bbl@options{}%
+ \ForEachTrackedDialect{\this@dialect}%
+ {%
+ \edef\this@root@lang{%
+ \TrackedLanguageFromDialect{\this@dialect}}%
+ \IfFileExists{\this@root@lang.ldf}
+ {%
+ \ifdefstring{\this@root@lang}{serbian}%
+ {%
+ \@locale@loadscripts
+ \IfTrackedDialectIsScriptCs{\this@dialect}%
+ {\TrackLangScriptLatn}%
+ {\def\locale@bbl@dialect{serbian}}%
+ {\def\locale@bbl@dialect{serbianc}}%
+ }%
+ {%
+ \IfFileExists{\this@dialect.ldf}%
+ {%
+ \let\locale@bbl@dialect\this@dialect
+ }%
+ {%
+ \IfTrackedDialectHasMapping{\this@dialect}%
+ {%
+ \edef\locale@bbl@dialect{%
+ \GetTrackedDialectToMapping{\this@dialect}}%
+ }%
+ {%
+ \let\locale@bbl@dialect\this@root@lang
+ }%
+ }%
+ }%
+ \SetTrackedDialectLabelMap{\this@dialect}{\locale@bbl@dialect}%
+ \ifx\this@dialect\LocaleMainDialect
+ \ifx\@locale@bbl@options\empty
+ \edef\@locale@bbl@options{main=\locale@bbl@dialect}%
+ \else
+ \edef\@locale@bbl@options{\@locale@bbl@options,%
+ main=\locale@bbl@dialect}%
+ \fi
+ \else
+ \ifx\@locale@bbl@options\empty
+ \edef\@locale@bbl@options{\locale@bbl@dialect}%
+ \else
+ \edef\@locale@bbl@options{\@locale@bbl@options,%
+ \locale@bbl@dialect}%
+ \fi
+ \fi
+ }%
+ {}%
+ }%
+ \ifx\@locale@bbl@options\@empty
+ \ifTeXOSQueryDryRun
+ \@locale@err{Can't determine `babel' package
+ options\MessageBreak (texosquery's dry run mode is on)}{}
+ \else
+ \@locale@err{Can't determine `babel' package
+ options (perhaps the shell escape failed, check
+ `\jobname.log')}{}
+ \fi
+ \else
+ \expandafter\PassOptionsToPackage\expandafter
+ {\@locale@bbl@options}{babel}
+ \RequirePackage{babel}%
+ \fi
+}%
+{%
+ \def\@set@locale@poly@map@script#1#2#3{%
+ \@tracklang@namedef{@local@poly@map@script@#1@#2}{#3}%
+ }
+ \def\@if@locale@poly@map@script#1#2#3#4{%
+ \@tracklang@ifundef{@local@poly@map@script@#1@#2}{#4}{#3}%
+ }
+ \def\@get@locale@poly@map@script#1#2{%
+ \@tracklang@nameuse{@local@poly@map@script@#1@#2}%
+ }
+ \def\@set@locale@poly@map@region#1#2#3{%
+ \@tracklang@namedef{@local@poly@map@region@#1@#2}{#3}%
+ }
+ \def\@if@locale@poly@map@region#1#2#3#4{%
+ \@tracklang@ifundef{@local@poly@map@region@#1@#2}{#4}{#3}%
+ }
+ \def\@get@locale@poly@map@region#1#2{%
+ \@tracklang@nameuse{@local@poly@map@region@#1@#2}%
+ }
+ \def\@set@locale@poly@map@variant#1#2#3{%
+ \@tracklang@namedef{@local@poly@map@variant@#1@#2}{#3}%
+ }
+ \def\@if@locale@poly@map@variant#1#2#3#4{%
+ \@tracklang@ifundef{@local@poly@map@variant@#1@#2}{#4}{#3}%
+ }
+ \def\@get@locale@poly@map@variant#1#2{%
+ \@tracklang@nameuse{@local@poly@map@variant@#1@#2}%
+ }
+ \def\@set@locale@poly@map@sublang#1#2#3{%
+ \@tracklang@namedef{@local@poly@map@sublang@#1@#2}{#3}%
+ }
+ \def\@if@locale@poly@map@sublang#1#2#3#4{%
+ \@tracklang@ifundef{@local@poly@map@sublang@#1@#2}{#4}{#3}%
+ }
+ \def\@get@locale@poly@map@sublang#1#2{%
+ \@tracklang@nameuse{@local@poly@map@sublang@#1@#2}%
+ }
+ \@set@locale@poly@map@region{arabic}{IQ}{locale=mashriq}
+ \@set@locale@poly@map@region{arabic}{SY}{locale=mashriq}
+ \@set@locale@poly@map@region{arabic}{JO}{locale=mashriq}
+ \@set@locale@poly@map@region{arabic}{LB}{locale=mashriq}
+ \@set@locale@poly@map@region{arabic}{PS}{locale=mashriq}
+ \@set@locale@poly@map@region{arabic}{LY}{locale=libya}
+ \@set@locale@poly@map@region{arabic}{DZ}{locale=algeria}
+ \@set@locale@poly@map@region{arabic}{TN}{locale=tunisia}
+ \@set@locale@poly@map@region{arabic}{MA}{locale=morocco}
+ \@set@locale@poly@map@region{arabic}{MR}{locale=mauritania}
+ \@set@locale@poly@map@variant{arabic}{islamic}{calendar=islamic}
+ \@set@locale@poly@map@variant{arabic}{maghrib}{numerals=maghrib}
+ \@set@locale@poly@map@variant{arabic}{abjad}{abjadjimnotail}
+ \@set@locale@poly@map@variant{bengali}{western}{numerals=Western}
+ \@set@locale@poly@map@variant{bengali}{devanagari}{numerals=Devanagari}
+ \@set@locale@poly@map@variant{bengali}{bengali}{numerals=Bengali}
+ \@set@locale@poly@map@region{english}{US}{variant=us}
+ \@set@locale@poly@map@region{english}{GB}{variant=uk}
+ \@set@locale@poly@map@region{english}{AU}{variant=australian}
+ \@set@locale@poly@map@region{english}{NZ}{variant=newzealand}
+ \@set@locale@poly@map@variant{farsi}{western}{numerals=western}
+ \@set@locale@poly@map@variant{farsi}{eastern}{numerals=eastern}
+ \@set@locale@poly@map@region{german}{DE}{variant=german}
+ \@set@locale@poly@map@region{german}{AU}{variant=austrian}
+ \@set@locale@poly@map@region{german}{CH}{variant=swiss}
+ \@set@locale@poly@map@variant{german}{1996}{spelling=new}
+ \@set@locale@poly@map@variant{german}{1901}{spelling=old}
+ \@set@locale@poly@map@script{german}{Latf}{script=fraktur}
+ \@set@locale@poly@map@variant{greek}{monoton}{variant=monotonic}
+ \@set@locale@poly@map@variant{greek}{polyton}{variant=polytonic}
+ \@set@locale@poly@map@variant{greek}{ancient}{variant=ancient}
+ \@set@locale@poly@map@variant{greek}{arabic}{numerals=arabic}
+ \@set@locale@poly@map@variant{hebrew}{arabic}{numerals=arabic}
+ \@set@locale@poly@map@variant{hebrew}{gregorian}{calendar=gregorian}
+ \@set@locale@poly@map@variant{hindi}{western}{numerals=Western}
+ \@set@locale@poly@map@variant{hindi}{devanagari}{numerals=Devanagari}
+ \@set@locale@poly@map@variant{latin}{classic}{variant=classic}
+ \@set@locale@poly@map@variant{latin}{modern}{variant=modern}
+ \@set@locale@poly@map@variant{latin}{medieval}{variant=medieval}
+ \@set@locale@poly@map@sublang{russian}{orv}{spelling=old}
+ \@set@locale@poly@map@variant{russian}{luna1918}{spelling=new}
+ \@set@locale@poly@map@script{serbian}{Latn}{script=Latin}
+ \@set@locale@poly@map@script{serbian}{Cyrl}{script=Cyrillic}
+ \@set@locale@poly@map@variant{syriac}{western}{numerals=western}
+ \@set@locale@poly@map@variant{syriac}{eastern}{numerals=eastern}
+ \RequirePackage{polyglossia}
+ \ForEachTrackedDialect{\this@dialect}%
+ {%
+ \edef\this@root@lang{%
+ \TrackedLanguageFromDialect{\this@dialect}}%
+ \edef\this@sublang{%
+ \GetTrackedDialectSubLang{\this@dialect}}%
+ \edef\this@region{%
+ \TrackedIsoCodeFromLanguage{3166-1}{\this@dialect}}%
+ \edef\this@script{%
+ \GetTrackedDialectScript{\this@dialect}}%
+ \edef\this@variant{%
+ \GetTrackedDialectVariant{\this@dialect}}%
+ \def\@locale@poly@options{}%
+ \ifx\this@script\empty
+ \else
+ \@if@locale@poly@map@script{\this@root@lang}{\this@script}%
+ {%
+ \edef\@locale@poly@options{%
+ \@get@locale@poly@map@script
+ {\this@root@lang}{\this@script}}%
+ }%
+ {}%
+ \fi
+ \ifx\this@region\empty
+ \else
+ \@if@locale@poly@map@region{\this@root@lang}{\this@region}%
+ {%
+ \ifx\@locale@poly@options\empty
+ \edef\@locale@poly@options{%
+ \@get@locale@poly@map@region{\this@root@lang}{\this@region}}%
+ \else
+ \edef\@locale@poly@options{\@locale@poly@options,%
+ \@get@locale@poly@map@region{\this@root@lang}{\this@region}}%
+ \fi
+ }%
+ {}%
+ \fi
+ \ifx\this@sublang\empty
+ \else
+ \@if@locale@poly@map@sublang{\this@root@lang}{\this@sublang}%
+ {%
+ \ifx\@locale@poly@options\empty
+ \edef\@locale@poly@options{%
+ \@get@locale@poly@map@sublang
+ {\this@root@lang}{\this@sublang}}%
+ \else
+ \edef\@locale@poly@options{\@locale@poly@options,%
+ \@get@locale@poly@map@sublang
+ {\this@root@lang}{\this@sublang}}%
+ \fi
+ }%
+ {}%
+ \fi
+ \ifx\this@subvariant\empty
+ \else
+ \@if@locale@poly@map@variant{\this@root@lang}{\this@variant}%
+ {%
+ \ifx\@locale@poly@options\empty
+ \edef\@locale@poly@options{%
+ \@get@locale@poly@map@variant
+ {\this@root@lang}{\this@variant}}%
+ \else
+ \edef\@locale@poly@options{\@locale@poly@options,%
+ \@get@locale@poly@map@variant
+ {\this@root@lang}{\this@variant}}%
+ \fi
+ }%
+ {}%
+ \fi
+ \ifx\this@dialect\LocaleMainDialect
+ \edef\@locale@tmp{\noexpand\setmainlanguage
+ [\@locale@poly@options]{\this@root@lang}}%
+ \else
+ \edef\@locale@tmp{\noexpand\setotherlanguage
+ [\@locale@poly@options]{\this@root@lang}}%
+ \fi
+ \@locale@tmp
+ }%
+ \def\localenopolypunct{\@locale@nopolypunct}%
+}
+\endinput
+%%
+%% End of file `tex-locale-support.def'.
diff --git a/Master/texmf-dist/tex/latex/tex-locale/tex-locale.sty b/Master/texmf-dist/tex/latex/tex-locale/tex-locale.sty
new file mode 100644
index 00000000000..10bcb55eb6c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tex-locale/tex-locale.sty
@@ -0,0 +1,640 @@
+%%
+%% This is file `tex-locale.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tex-locale.dtx (with options: `tex-locale.sty,package')
+%%
+%% tex-locale.dtx
+%% Copyright 2018 Nicola Talbot
+%%
+%% This work 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 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files tex-locale.dtx and tex-locale.ins and the derived files tex-locale.sty, tex-locale.tex, tex-locale-scripts-enc.def, tex-locale-encodings.def, tex-locale-support.def.
+%%
+%% \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
+%% Lower-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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%% arara: xetex: {shell: on}
+%% arara: xetex: {shell: on}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{tex-locale}[2018/08/26 v1.0 (NLCT) localisation support]
+\RequirePackage{etoolbox}
+\RequirePackage{xfor}
+\RequirePackage{tracklang}[2016/11/03]
+\AnyTrackedLanguages
+{%
+ \ForEachTrackedDialect{\locale@this@dialect}
+ {
+ \ifx\LocaleMain\undefined
+ \edef\LocaleMain{\GetTrackedLanguageTag{\locale@this@dialect}}
+ \let\@locale@trackedmain\LocaleMain
+ \else
+ \ifx\LocaleOther\undefined
+ \edef\LocaleOther{\GetTrackedLanguageTag{\locale@this@dialect}}
+ \else
+ \edef\LocaleOther{\LocaleOther,\GetTrackedLanguageTag{\locale@this@dialect}}
+ \fi
+ \fi
+ }
+}
+{}
+\RequirePackage{ifxetex}
+\RequirePackage{ifluatex}
+\ifxetex
+ \newcommand*{\@locale@ifxeorlua}[2]{#1}
+\else
+ \ifluatex
+ \newcommand*{\@locale@ifxeorlua}[2]{#1}
+ \else
+ \newcommand*{\@locale@ifxeorlua}[2]{#2}
+ \fi
+\fi
+\RequirePackage{xkeyval}
+\newcommand*{\@locale@declareoption}[2]{%
+ \DeclareOptionX{#1}{#2}%
+ \DeclareOption{#1}{#2}%
+}
+\define@key{tex-locale.sty}{main}{%
+ \ifx\@locale@trackedmain\undefined
+ \else
+ \ifx\LocaleOther\undefined
+ \let\LocaleOther\@locale@trackedmain
+ \else
+ \edef\LocaleOther{\@locale@trackedmain,\LocaleOther}%
+ \fi
+ \let\@locale@trackedmain\undefined
+ \fi
+ \def\LocaleMain{#1}%
+}
+\define@key{tex-locale.sty}{other}{%
+ \ifx\LocaleOther\undefined
+ \def\LocaleOther{#1}%
+ \else
+ \edef\LocaleOther{\LocaleOther,#1}%
+ \fi
+}
+\@locale@ifxeorlua{\def\@locale@symbols{none}}{\def\@locale@symbols{textcomp}}
+\define@key{tex-locale.sty}{symbols}{\def\@locale@symbols{#1}}
+\newcount\@locale@supportopt
+\@ifpackageloaded{polyglossia}
+{\@locale@supportopt=0\relax}
+{
+ \@ifpackageloaded{babel}
+ {\@locale@supportopt=0\relax}
+ {
+ \@ifpackageloaded{CJK}
+ {\@locale@supportopt=0\relax}
+ {\@locale@supportopt=1\relax}
+ }
+}
+\define@choicekey{tex-locale.sty}{support}%
+ [\@locale@support@val\@locale@support@nr]%
+ {none,auto,babel,polyglossia,cjk}
+{\@locale@supportopt=\@locale@support@nr\relax}
+\define@boolkey{tex-locale.sty}[@locale@]{fontspec}[true]{}
+\@locale@ifxeorlua{\@locale@fontspectrue}{\@locale@fontspecfalse}
+\define@key{tex-locale.sty}{fontenc}{%
+ \edef\@locale@fontenc{#1}%
+ \ifdefstring{\@locale@fontenc}{false}{\def\@locale@fontenc{none}}{}%
+}
+\@ifpackageloaded{fontenc}
+{\def\@locale@fontenc{none}}
+{\def\@locale@fontenc{auto}}
+\define@key{tex-locale.sty}{inputenc}{%
+ \edef\@locale@inputenc{#1}%
+ \ifdefstring{\@locale@inputenc}{false}{\def\@locale@inputenc{none}}{}%
+}
+\@ifpackageloaded{inputenc}
+{\def\@locale@inputenc{none}}
+{\def\@locale@inputenc{auto}}
+\@ifpackageloaded{datetime2}
+{
+ \newcommand\@locale@load@dtm{}
+}
+{
+ \newcommand\@locale@load@dtm{%
+ \IfFileExists{datetime2.sty}%
+ {\@locale@load@regional@dtm}%
+ {\@locale@set@today}%
+ }%
+}
+\newcommand\@locale@load@regional@dtm{%
+ \localedatechoice
+ {%full
+ \PassOptionsToPackage{showdow}{datetime2}%
+ \PassOptionsToPackage{useregional=text}{datetime2}%
+ }%
+ {%long
+ \PassOptionsToPackage{useregional=text}{datetime2}%
+ }%
+ {%medium
+ \PassOptionsToPackage{useregional=text}{datetime2}%
+ }%
+ {%short
+ \PassOptionsToPackage{useregional=numeric}{datetime2}%
+ }%
+ \RequirePackage{datetime2}%
+ \localedatechoice{}{}{\DTMlangsetup*{abbr}}{}%
+}%
+\newcommand*{\@locale@set@today}{%
+ \ifdefempty\CurrentLocaleDate
+ {}%
+ {%
+ \renewcommand{\today}{\CurrentLocaleDate}%
+ \ForEachTrackedDialect{\locale@this@dialect}
+ {%
+ \SetCurrentTrackedDialect{\locale@this@dialect}%
+ \@TrackLangAddToHook
+ {\renewcommand{\today}{\CurrentLocaleDate}}
+ {date}%
+ }%
+ }%
+}
+\define@choicekey{tex-locale.sty}{datetime}%
+ [\@locale@datetime@val\@locale@datetime@nr]%
+ {false,iso,text,num,numeric,locale}
+{%
+ \ifcase\@locale@datetime@nr
+ \def\@locale@load@dtm{}%
+ \or
+ \def\@locale@load@dtm{%
+ \PassOptionsToPackage{useregional=false}{datetime2}%
+ \RequirePackage{datetime2}%
+ \DTMsetstyle{iso}%
+ }%
+ \or
+ \def\@locale@load@dtm{%
+ \@locale@load@regional@dtm
+ }%
+ \or
+ \def\@locale@load@dtm{%
+ \PassOptionsToPackage{useregional=numeric}{datetime2}%
+ \RequirePackage{datetime2}%
+ }%
+ \or
+ \def\@locale@load@dtm{%
+ \PassOptionsToPackage{useregional=numeric}{datetime2}%
+ \RequirePackage{datetime2}%
+ }%
+ \or
+ \def\@locale@load@dtm{\@locale@set@today}%
+ \fi
+}
+\@locale@declareoption{iso}{%
+ \def\@locale@load@dtm{%
+ \PassOptionsToPackage{useregional=false}{datetime2}%
+ \RequirePackage{datetime2}%
+ \DTMsetstyle{iso}%
+ }%
+}
+\define@choicekey{tex-locale.sty}{date}%
+[\@locale@date@val\@locale@date@nr]{full,long,medium,short}
+{%
+ \ifcase\@locale@date@nr
+ \def\localedatechoice##1##2##3##4{##1}%
+ \or
+ \def\localedatechoice##1##2##3##4{##2}%
+ \or
+ \def\localedatechoice##1##2##3##4{##3}%
+ \or
+ \def\localedatechoice##1##2##3##4{##4}%
+ \fi
+}
+\newcommand*{\localedatechoice}[4]{#2}%
+\define@choicekey{tex-locale.sty}{time}%
+[\@locale@time@val\@locale@time@nr]{full,long,medium,short}
+{%
+ \ifcase\@locale@time@nr
+ \def\localetimechoice##1##2##3##4{##1}%
+ \or
+ \def\localetimechoice##1##2##3##4{##2}%
+ \or
+ \def\localetimechoice##1##2##3##4{##3}%
+ \or
+ \def\localetimechoice##1##2##3##4{##4}%
+ \fi
+}
+\newcommand*{\localetimechoice}[4]{#3}%
+\define@choicekey{tex-locale.sty}{timedata}%
+[\@locale@timedata@val\@locale@timedata@nr]{true,false}[true]
+{%
+ \ifcase\@locale@timedata@nr
+ \def\LocaleIfDateTimePatternsSupported##1##2{##1}%
+ \or
+ \def\LocaleIfDateTimePatternsSupported##1##2{##2}%
+ \fi
+}
+\define@choicekey{tex-locale.sty}{currency}%
+[\@locale@currency@val\@locale@currency@nr]%
+{official,unofficial,sym,tex}
+{%
+ \ifcase\@locale@currency@nr
+ \def\localecurrchoice##1##2##3##4{##1}%
+ \or
+ \def\localecurrchoice##1##2##3##4{##2}%
+ \or
+ \def\localecurrchoice##1##2##3##4{##3}%
+ \or
+ \def\localecurrchoice##1##2##3##4{##4}%
+ \fi
+}
+\@locale@ifxeorlua
+ {\newcommand*{\localecurrchoice}[4]{#3}}
+ {\newcommand*{\localecurrchoice}[4]{#4}}
+\@for\CurrentOption:=\@declaredoptions\do{%
+ \ifx\CurrentOption\@empty
+ \else
+ \@expandtwoargs
+ \in@{,\CurrentOption,}{,\@classoptionslist,\@curroptions,}%
+ \ifin@
+ \@use@ption
+ \expandafter\let\csname ds@\CurrentOption\endcsname\@empty
+ \fi
+ \fi
+}
+\ProcessOptionsX
+\@ifpackageloaded{babel}
+{%
+ \@locale@supportopt=0\relax
+}
+{}
+\ifx\LocaleMain\undefined
+ \def\LocaleMain{locale}
+\fi
+\ifx\LocaleOther\undefined
+ \def\LocaleOther{}
+\fi
+\newcommand*{\@locale@postparse@hook}{%
+ \input{tex-locale-support.def}%
+}
+\ifdefstring{\@locale@symbols}{none}
+{}
+{\RequirePackage{\@locale@symbols}}
+\RequirePackage{texosquery}
+\newcommand\@locale@trackall{%
+ \ifdefstring\LocaleMain{locale}%
+ {%
+ \ifx\LocaleOStag\empty
+ \PackageWarning{tex-locale}{Unable to determine locale
+ (check shell escape)}%
+ \else
+ \TrackLanguageTag{\LocaleOStag}%
+ \fi
+ }%
+ {\TrackLanguageTag{\LocaleMain}}%
+ \@for\locale@this@dialect:=\LocaleOther\do{%
+ \ifdefstring\locale@this@dialect{locale}
+ {%
+ \ifx\LocaleOStag\empty
+ \PackageWarning{tex-locale}{Unable to determine locale
+ (check shell escape)}%
+ \else
+ \TrackLanguageTag{\LocaleOStag}%
+ \fi
+ }%
+ {\TrackLanguageTag{\locale@this@dialect}}%
+ }%
+ \let\@locale@trackall\relax
+}
+\newcommand{\@locale@loadinputenc}{}
+\newcommand*\@locale@pre@query@params{}%
+\newcommand*\@locale@pre@query@parsetag{%
+ \ifx\LocaleStyQueryFile\undefined
+ \TeXOSQuery{\@locale@result}{\@locale@pre@query@params}%
+ \else
+ \ifx\LocaleStyQueryFile\empty
+ \TeXOSQuery{\@locale@result}{\@locale@pre@query@params}%
+ \else
+ \ifx\TeXOSQueryFromFile\undefined
+ \PackageError{locale}{texosquery too old to support
+ \string\LocaleStyQueryFile. At least v1.4 required}
+ {You need to update your version of texosquery}
+ \def\@locale@result{}%
+ \else
+ \PackageInfo{locale}{Fetching query results from `\LocaleStyQueryFile'}%
+ \TeXOSQueryFromFile{\@locale@result}{\LocaleStyQueryFile}%
+ \fi
+ \fi
+ \fi
+ \edef\LocaleOStag{\@locale@result}%
+}%
+\newcommand*\@locale@pre@query@parsecodeset{%
+ \TeXOSQuery{\@locale@result}{\@locale@pre@query@params}%
+ \edef\LocaleOScodeset{\@locale@result}%
+}%
+\newcommand*\@locale@pre@query@parsetagcodeset{%
+ \def\LocaleOStag{}%
+ \def\LocaleOScodeset{}%
+ \TeXOSQuery{\@locale@result}{\@locale@pre@query@params}%
+ \ifx\@locale@result\@empty
+ \else
+ \edef\LocaleOStag{\expandafter\@firstoftwo\@locale@result}%
+ \edef\LocaleOScodeset{\expandafter\@secondoftwo\@locale@result}%
+ \fi
+}%
+\let\@locale@pre@query@parse\relax
+\@locale@ifxeorlua
+{%
+ \if@locale@fontspec\RequirePackage{fontspec}\fi
+ \ifnum\@locale@supportopt=1\relax
+ \ifdefstring\LocaleMain{locale}
+ {%
+ \def\@locale@pre@query@params{\string-b }%
+ \let\@locale@pre@query@parse\@locale@pre@query@parsetag
+ }%
+ {%
+ \@for\locale@this@dialect:=\LocaleOther\do{%
+ \ifdefstring\locale@this@dialect{locale}
+ {%
+ \def\@locale@pre@query@params{\string-b }%
+ \let\@locale@pre@query@parse\@locale@pre@query@parsetag
+ \@endfortrue
+ }%
+ {}%
+ }%
+ }%
+ \@locale@pre@query@parse
+ \fi
+}
+{%
+ \ifdefstring{\@locale@fontenc}{auto}
+ {%
+ \ifdefstring\LocaleMain{locale}
+ {%
+ \def\@locale@pre@query@params{\string-b }%
+ \let\@locale@pre@query@parse\@locale@pre@query@parsetag
+ }%
+ {%
+ \@for\locale@this@dialect:=\LocaleOther\do{%
+ \ifdefstring\locale@this@dialect{locale}
+ {%
+ \def\@locale@pre@query@params{\string-b }%
+ \let\@locale@pre@query@parse\@locale@pre@query@parsetag
+ \@endfortrue
+ }%
+ {}%
+ }%
+ }%
+ }%
+ {}%
+ \ifdefstring{\@locale@inputenc}{auto}
+ {%
+ \ifx\@locale@pre@query@params\@empty
+ \let\@locale@pre@query@parse\@locale@pre@query@parsecodeset
+ \else
+ \let\@locale@pre@query@parse\@locale@pre@query@parsetagcodeset
+ \fi
+ \edef\@locale@pre@query@params{\@locale@pre@query@params\string-C}%
+ }%
+ {}%
+ \@locale@pre@query@parse
+ \ifdefstring{\@locale@fontenc}{none}
+ {}
+ {%
+ \ifdefstring{\@locale@fontenc}{auto}
+ {%
+ \input{tex-locale-scripts-enc.def}%
+ \@locale@trackall
+ \ForEachTrackedDialect{\locale@this@dialect}%
+ {
+ \edef\@locale@lang{\TrackedLanguageFromDialect{\locale@this@dialect}}%
+ \@locale@if@langenc@map{\locale@this@dialect}%
+ {%
+ \edef\@locale@fontenc@opt{%
+ \@locale@get@langenc@map{\locale@this@dialect}}%
+ \expandafter\PassOptionsToPackage\expandafter
+ {\@locale@fontenc@opt}{fontenc}%
+ }%
+ {%
+ \@locale@if@langenc@map{\@locale@lang}%
+ {%
+ \edef\@locale@fontenc@opt{%
+ \@locale@get@langenc@map{\@locale@lang}}%
+ \expandafter\PassOptionsToPackage\expandafter
+ {\@locale@fontenc@opt}{fontenc}%
+ }%
+ {%
+ \edef\@locale@script{\GetTrackedDialectScript{\locale@this@dialect}}%
+ \ifx\@locale@script\empty
+ \edef\@locale@script{\TrackLangGetDefaultScript{\@locale@lang}}%
+ \fi
+ \@locale@if@scriptenc@map{\@locale@script}%
+ {%
+ \edef\@locale@fontenc@opt{%
+ \@locale@get@scriptenc@map{\@locale@script}}%
+ \expandafter\PassOptionsToPackage\expandafter
+ {\@locale@fontenc@opt}{fontenc}%
+ }%
+ {}%
+ }%
+ }%
+ }%
+ \ifx\@locale@fontenc@opt\empty
+ \PackageWarning{tex-locale}{Option `fontenc=auto' failed.
+ Can't determine an appropriate font encoding for dialect(s).
+ (Dialect list: \@tracklang@dialects.)
+ Either set the encoding explicitly or switch to XeLaTeX%
+ }%
+ \else
+ \RequirePackage{fontenc}%
+ \fi
+ }
+ {%
+ \expandafter\PassOptionsToPackage\expandafter{\@locale@fontenc}{fontenc}%
+ \RequirePackage{fontenc}%
+ }
+ }
+ \ifdefstring{\@locale@inputenc}{none}
+ {}
+ {%
+ \ifdefstring{\@locale@inputenc}{auto}
+ {%
+ \ifx\LocaleOScodeset\empty
+ \PackageWarning{tex-locale}{Option `inputenc=auto' failed.
+ (Check shell escape.) Default file encoding unavailable}
+ \else
+ \IfFileExists{\LocaleOScodeset.def}%
+ {%
+ \renewcommand{\@locale@loadinputenc}{%
+ \RequirePackage{inputenc}%
+ \inputencoding{\LocaleOScodeset}%
+ }
+ \let\@locale@inputenc\LocaleOScodeset
+ }%
+ {%
+ \input{tex-locale-encodings.def}%
+ \@locale@ifhasencmap{\LocaleOScodeset}
+ {
+ \edef\@locale@inputenc{\@locale@getencmap\LocaleOScodeset}
+ \renewcommand{\@locale@loadinputenc}{%
+ \RequirePackage{inputenc}%
+ \inputencoding{\@locale@inputenc}%
+ }
+ }
+ {%
+ \PackageWarning{tex-locale}{Option `inputenc=auto' failed.
+ Don't know how to interpret codeset `\LocaleOScodeset'}%
+ }%
+ }
+ \fi
+ }
+ {%
+ \renewcommand{\@locale@loadinputenc}{%
+ \RequirePackage{inputenc}%
+ \inputencoding{\@locale@inputenc}%
+ }
+ }
+ }
+}
+\newcommand{\@locale@loadscripts}{%
+ \RequirePackage{tracklang-scripts}%
+ \let\@locale@loadscripts\relax
+}
+\providecommand*{\@secondofthree}[3]{#2}
+\newcommand*{\@locale@ifsupportbabelorpoly}[3]{#1}
+\newcommand*{\@locale@ifsupportcjk}[2]{#2}
+\newcommand*{\@locale@ifsupportpinyin}[2]{#2}
+\newcommand*{\@locale@cjklist}{}
+\listadd{\@locale@cjklist}{chinese}
+\listadd{\@locale@cjklist}{japanese}
+\listadd{\@locale@cjklist}{korean}
+\listadd{\@locale@cjklist}{thai}
+\newcommand*{\@locale@ifcjk}[1]{%
+ \xifinlist{#1}{\@locale@cjklist}%
+}
+\newcommand*{\@locale@iflatinscript}[1]{%
+ \ifcsstring{@tracklang@script@#1}{Latn}%
+}
+\ifcase\@locale@supportopt
+\or
+ \@locale@trackall
+ \ForEachTrackedDialect{\locale@this@dialect}%
+ {%
+ \edef\this@root@lang{\TrackedLanguageFromDialect{\locale@this@dialect}}%
+ \@locale@ifcjk{\this@root@lang}%
+ {
+ \let\@locale@ifsupportcjk\@firstoftwo
+ \@locale@iflatinscript{\locale@this@dialect}%
+ {\let\@locale@ifsupportpinyin\@firstoftwo}%
+ {}
+ }
+ {}
+ \@locale@ifxeorlua
+ {
+ \@locale@ifsupportbabelorpoly
+ {
+ \IfFileExists{gloss-\this@root@lang.ldf}
+ {
+ \let\@locale@ifsupportbabelorpoly\@thirdofthree
+ }
+ {
+ \IfFileExists{\this@root@lang.ldf}
+ {\let\@locale@ifsupportbabelorpoly\@secondofthree}
+ {}
+ }
+ }
+ {}
+ {
+ \IfFileExists{gloss-\this@root@lang.ldf}
+ {}
+ {
+ \IfFileExists{\this@root@lang.ldf}
+ {\let\@locale@ifsupportbabelorpoly\@secondofthree}
+ {}
+ }
+ }
+ }
+ {
+ \IfFileExists{\this@root@lang.ldf}
+ {\let\@locale@ifsupportbabelorpoly\@secondofthree}
+ {}
+ }
+ }
+\or
+ \let\@locale@ifsupportbabelorpoly\@secondofthree
+\or
+ \let\@locale@ifsupportbabelorpoly\@thirdofthree
+\or
+ \let\@locale@currentiscjk\@secondoftwo
+ \ForEachTrackedDialect{\locale@this@dialect}%
+ {%
+ \edef\this@root@lang{\TrackedLanguageFromDialect{\locale@this@dialect}}%
+ \@locale@ifcjk{\this@root@lang}%
+ {
+ \@locale@iflatinscript{\locale@this@dialect}%
+ {\let\@locale@ifsupportpinyin\@firstoftwo}%
+ {}
+ }
+ {}
+ }
+\fi
+\@locale@ifsupportcjk
+{
+ \@locale@ifxeorlua
+ {
+ \RequirePackage{xeCJK}%
+ }
+ {
+ \ifdefstring\@locale@inputenc{utf8}%
+ {%
+ \RequirePackage{CJKutf8}%
+ \renewcommand{\@locale@loadinputenc}{}%
+ \newcommand*{\localeprequery}{\begin{CJK}{UTF8}{}\makeatletter}
+ \newcommand*{\localepostquery}{\end{CJK}}
+ }%
+ {%
+ \RequirePackage{CJK}%
+ \PackageWarning{tex-locale}{Unsupported encoding `\@locale@loadinputenc'}%
+ }%
+ }
+ \@locale@ifsupportpinyin
+ {\RequirePackage{pinyin}}%
+ {}%
+}
+{}
+
+\@locale@loadinputenc
+\newcommand{\localenopolypunct}[1]{{#1}}
+\newrobustcmd{\@locale@nopolypunct}[1]{%
+ {%
+ \@tracklang@ifundef{no\languagename @punctuation}{}%
+ {\csname no\languagename @punctuation\endcsname}%
+ #1%
+ }%
+}
+\input{tex-locale}
+\@locale@load@dtm
+\@ifpackageloaded{polyglossia}
+{\newcommand{\LocaleSupportPackageCase}[3]{#2}}
+{%
+ \@ifpackageloaded{babel}
+ {\newcommand{\LocaleSupportPackageCase}[3]{#1}}%
+ {\newcommand{\LocaleSupportPackageCase}[3]{#3}}%
+}
+\endinput
+%%
+%% End of file `tex-locale.sty'.
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index a71d78e7469..92df2fa8431 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -623,7 +623,7 @@ my @TLP_working = qw(
tengwarscript
tensor termcal termcal-de termlist termmenu testhyphens testidx teubner
tex-ewd tex-font-errors-cheatsheet tex-gyre tex-gyre-math tex-ini-files
- tex-label tex-overview tex-ps tex-refs tex-virtual-academy-pl
+ tex-label tex-locale tex-overview tex-ps tex-refs tex-virtual-academy-pl
tex4ebook texapi texbytopic texcount
texdate texdef texdiff texdirflatten texdoc texdraw
texfot texilikechaps texilikecover
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index 817dc9e6e68..92de91f0864 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -1072,6 +1072,7 @@ depend termlist
depend testhyphens
depend testidx
depend tex-label
+depend tex-locale
depend texlogos
depend texmate
depend texments
diff --git a/Master/tlpkg/tlpsrc/tex-locale.tlpsrc b/Master/tlpkg/tlpsrc/tex-locale.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/tex-locale.tlpsrc