%\iffalse
% polyglossia.dtx generated using mkpolyglossiadtx.pl
% (derived from makedtx.pl version 0.94b (c) Nicola Talbot)
% 
% To extract the files, use xetex polyglossia.dtx or luatex polyglossia.dtx
% 
%<*internal>
\iffalse
%</internal>
%<*README>

   ¦----------------------------------------------¦
   ¦                                              ¦
   ¦       THE POLYGLOSSIA PACKAGE v1.44          ¦
   ¦                                              ¦
   ¦     Modern multilingual typesetting          ¦
   ¦        with XeLaTeX and LuaLaTeX             ¦
   ¦                                              ¦
   ¦----------------------------------------------¦

This package provides an alternative to Babel for users of XeLaTeX and LuaLaTeX
(with a few languages incompletely supported for the latter). This version
includes support for 78 different languages.

Polyglossia makes it possible to automate the following tasks:

* Loading the appropriate hyphenation patterns.
* Setting the script and language tags of the current font (if possible and
  available), using the package fontspec.
* Switching to a font assigned by the user to a particular script or language.
* Adjusting some typographical conventions in function of the current language
  (such as afterindent, frenchindent, spaces before or after punctuation marks,
  etc.).
* Redefining the document strings (like “chapter”, “figure”, “bibliography”).
* Adapting the formatting of dates (for non-gregorian calendars via external
  packages bundled with polyglossia: currently the Hebrew, Islamic and Farsi
  calendars are supported).
* For languages that have their own numeration system, modifying the formatting
  of numbers appropriately.
* Ensuring the proper directionality if the document contains languages
  written from right to left (via the package bidi, available separately).

LICENSE

Copyright (c) 2008-2010 François Charette, 2013 Élie Roux, 2011-2019 Arthur Reutenauer

Polyglossia is placed under the terms of the LaTeX Project Public Licence
(LPPL), either version 1.3, or, at your option, any later version.  See
LICENCE.txt for the text of the LPPL v1.3c, or
http://www.latex-project.org/lppl.txt for the latest version.

This work has the LPPL maintenance status ‘maintained’.  The current maintainer is Arthur Reutenauer.

BUGS

Polyglossia is full of bugs.  If you run into one, or suspect you do, or you
have a request or comment, please use the GitHub issue tracker:
http://github.com/reutenauer/polyglossia/issues

This is more efficient than contacting me by email as it allows me to track the
issues and follow progress.
%</README>
%<*internal>
\fi
%</internal>
%
%<*internal>
\begingroup
%</internal>
%<*batchfile>
\input docstrip.tex
\keepsilent
\let\MetaPrefix\relax
\preamble
  ____________________________

  The polyglossia package         
  (C) 2008–2010 François Charette    
  (C) 2011-2019 Arthur Reutenauer
  (C) 2013 Elie Roux
  License information appended


\endpreamble
\postamble

 Copyright (C) 2019 by Arthur Reutenauer <arthur 'dot' reutenauer 'at' normalesup 'dot' org> 

 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3
 of this license of (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 Arthur Reutenauer.


\endpostamble
\let\MetaPrefix\DoubleperCent
\askforoverwritefalse
\generate{\file{gloss-albanian.ldf}{\from{polyglossia.dtx}{gloss-albanian.ldf}}}
\generate{\file{gloss-amharic.ldf}{\from{polyglossia.dtx}{gloss-amharic.ldf}}}
\generate{\file{gloss-arabic.ldf}{\from{polyglossia.dtx}{gloss-arabic.ldf}}}
\generate{\file{gloss-armenian.ldf}{\from{polyglossia.dtx}{gloss-armenian.ldf}}}
\generate{\file{gloss-asturian.ldf}{\from{polyglossia.dtx}{gloss-asturian.ldf}}}
\generate{\file{gloss-bahasai.ldf}{\from{polyglossia.dtx}{gloss-bahasai.ldf}}}
\generate{\file{gloss-bahasam.ldf}{\from{polyglossia.dtx}{gloss-bahasam.ldf}}}
\generate{\file{gloss-basque.ldf}{\from{polyglossia.dtx}{gloss-basque.ldf}}}
\generate{\file{gloss-bengali.ldf}{\from{polyglossia.dtx}{gloss-bengali.ldf}}}
\generate{\file{gloss-brazil.ldf}{\from{polyglossia.dtx}{gloss-brazil.ldf}}}
\generate{\file{gloss-breton.ldf}{\from{polyglossia.dtx}{gloss-breton.ldf}}}
\generate{\file{gloss-bulgarian.ldf}{\from{polyglossia.dtx}{gloss-bulgarian.ldf}}}
\generate{\file{gloss-catalan.ldf}{\from{polyglossia.dtx}{gloss-catalan.ldf}}}
\generate{\file{gloss-classiclatin.ldf}{\from{polyglossia.dtx}{gloss-classiclatin.ldf}}}
\generate{\file{gloss-coptic.ldf}{\from{polyglossia.dtx}{gloss-coptic.ldf}}}
\generate{\file{gloss-croatian.ldf}{\from{polyglossia.dtx}{gloss-croatian.ldf}}}
\generate{\file{gloss-czech.ldf}{\from{polyglossia.dtx}{gloss-czech.ldf}}}
\generate{\file{gloss-danish.ldf}{\from{polyglossia.dtx}{gloss-danish.ldf}}}
\generate{\file{gloss-divehi.ldf}{\from{polyglossia.dtx}{gloss-divehi.ldf}}}
\generate{\file{gloss-dutch.ldf}{\from{polyglossia.dtx}{gloss-dutch.ldf}}}
\generate{\file{gloss-english.ldf}{\from{polyglossia.dtx}{gloss-english.ldf}}}
\generate{\file{gloss-esperanto.ldf}{\from{polyglossia.dtx}{gloss-esperanto.ldf}}}
\generate{\file{gloss-estonian.ldf}{\from{polyglossia.dtx}{gloss-estonian.ldf}}}
\generate{\file{gloss-farsi.ldf}{\from{polyglossia.dtx}{gloss-farsi.ldf}}}
\generate{\file{gloss-finnish.ldf}{\from{polyglossia.dtx}{gloss-finnish.ldf}}}
\generate{\file{gloss-french.ldf}{\from{polyglossia.dtx}{gloss-french.ldf}}}
\generate{\file{gloss-friulan.ldf}{\from{polyglossia.dtx}{gloss-friulan.ldf}}}
\generate{\file{gloss-galician.ldf}{\from{polyglossia.dtx}{gloss-galician.ldf}}}
\generate{\file{gloss-german.ldf}{\from{polyglossia.dtx}{gloss-german.ldf}}}
\generate{\file{gloss-greek.ldf}{\from{polyglossia.dtx}{gloss-greek.ldf}}}
\generate{\file{gloss-hebrew.ldf}{\from{polyglossia.dtx}{gloss-hebrew.ldf}}}
\generate{\file{gloss-hindi.ldf}{\from{polyglossia.dtx}{gloss-hindi.ldf}}}
\generate{\file{gloss-icelandic.ldf}{\from{polyglossia.dtx}{gloss-icelandic.ldf}}}
\generate{\file{gloss-interlingua.ldf}{\from{polyglossia.dtx}{gloss-interlingua.ldf}}}
\generate{\file{gloss-irish.ldf}{\from{polyglossia.dtx}{gloss-irish.ldf}}}
\generate{\file{gloss-italian.ldf}{\from{polyglossia.dtx}{gloss-italian.ldf}}}
\generate{\file{gloss-japanese.ldf}{\from{polyglossia.dtx}{gloss-japanese.ldf}}}
\generate{\file{gloss-kannada.ldf}{\from{polyglossia.dtx}{gloss-kannada.ldf}}}
\generate{\file{gloss-khmer.ldf}{\from{polyglossia.dtx}{gloss-khmer.ldf}}}
\generate{\file{gloss-korean.ldf}{\from{polyglossia.dtx}{gloss-korean.ldf}}}
\generate{\file{gloss-lao.ldf}{\from{polyglossia.dtx}{gloss-lao.ldf}}}
\generate{\file{gloss-latin.ldf}{\from{polyglossia.dtx}{gloss-latin.ldf}}}
\generate{\file{gloss-latvian.ldf}{\from{polyglossia.dtx}{gloss-latvian.ldf}}}
\generate{\file{gloss-lithuanian.ldf}{\from{polyglossia.dtx}{gloss-lithuanian.ldf}}}
\generate{\file{gloss-liturgicallatin.ldf}{\from{polyglossia.dtx}{gloss-liturgicallatin.ldf}}}
\generate{\file{gloss-lsorbian.ldf}{\from{polyglossia.dtx}{gloss-lsorbian.ldf}}}
\generate{\file{gloss-macedonian.ldf}{\from{polyglossia.dtx}{gloss-macedonian.ldf}}}
\generate{\file{gloss-magyar.ldf}{\from{polyglossia.dtx}{gloss-magyar.ldf}}}
\generate{\file{gloss-malayalam.ldf}{\from{polyglossia.dtx}{gloss-malayalam.ldf}}}
\generate{\file{gloss-marathi.ldf}{\from{polyglossia.dtx}{gloss-marathi.ldf}}}
\generate{\file{gloss-nko.ldf}{\from{polyglossia.dtx}{gloss-nko.ldf}}}
\generate{\file{gloss-norsk.ldf}{\from{polyglossia.dtx}{gloss-norsk.ldf}}}
\generate{\file{gloss-nynorsk.ldf}{\from{polyglossia.dtx}{gloss-nynorsk.ldf}}}
\generate{\file{gloss-occitan.ldf}{\from{polyglossia.dtx}{gloss-occitan.ldf}}}
\generate{\file{gloss-piedmontese.ldf}{\from{polyglossia.dtx}{gloss-piedmontese.ldf}}}
\generate{\file{gloss-polish.ldf}{\from{polyglossia.dtx}{gloss-polish.ldf}}}
\generate{\file{gloss-portuges.ldf}{\from{polyglossia.dtx}{gloss-portuges.ldf}}}
\generate{\file{gloss-romanian.ldf}{\from{polyglossia.dtx}{gloss-romanian.ldf}}}
\generate{\file{gloss-romansh.ldf}{\from{polyglossia.dtx}{gloss-romansh.ldf}}}
\generate{\file{gloss-russian.ldf}{\from{polyglossia.dtx}{gloss-russian.ldf}}}
\generate{\file{gloss-samin.ldf}{\from{polyglossia.dtx}{gloss-samin.ldf}}}
\generate{\file{gloss-sanskrit.ldf}{\from{polyglossia.dtx}{gloss-sanskrit.ldf}}}
\generate{\file{gloss-scottish.ldf}{\from{polyglossia.dtx}{gloss-scottish.ldf}}}
\generate{\file{gloss-serbian.ldf}{\from{polyglossia.dtx}{gloss-serbian.ldf}}}
\generate{\file{gloss-slovak.ldf}{\from{polyglossia.dtx}{gloss-slovak.ldf}}}
\generate{\file{gloss-slovenian.ldf}{\from{polyglossia.dtx}{gloss-slovenian.ldf}}}
\generate{\file{gloss-spanish.ldf}{\from{polyglossia.dtx}{gloss-spanish.ldf}}}
\generate{\file{gloss-swedish.ldf}{\from{polyglossia.dtx}{gloss-swedish.ldf}}}
\generate{\file{gloss-syriac.ldf}{\from{polyglossia.dtx}{gloss-syriac.ldf}}}
\generate{\file{gloss-tamil.ldf}{\from{polyglossia.dtx}{gloss-tamil.ldf}}}
\generate{\file{gloss-telugu.ldf}{\from{polyglossia.dtx}{gloss-telugu.ldf}}}
\generate{\file{gloss-thai.ldf}{\from{polyglossia.dtx}{gloss-thai.ldf}}}
\generate{\file{gloss-tibetan.ldf}{\from{polyglossia.dtx}{gloss-tibetan.ldf}}}
\generate{\file{gloss-turkish.ldf}{\from{polyglossia.dtx}{gloss-turkish.ldf}}}
\generate{\file{gloss-turkmen.ldf}{\from{polyglossia.dtx}{gloss-turkmen.ldf}}}
\generate{\file{gloss-ukrainian.ldf}{\from{polyglossia.dtx}{gloss-ukrainian.ldf}}}
\generate{\file{gloss-urdu.ldf}{\from{polyglossia.dtx}{gloss-urdu.ldf}}}
\generate{\file{gloss-usorbian.ldf}{\from{polyglossia.dtx}{gloss-usorbian.ldf}}}
\generate{\file{gloss-vietnamese.ldf}{\from{polyglossia.dtx}{gloss-vietnamese.ldf}}}
\generate{\file{gloss-welsh.ldf}{\from{polyglossia.dtx}{gloss-welsh.ldf}}}
\generate{\file{arabicdigits.map}{\from{polyglossia.dtx}{arabicdigits.map}}}
\generate{\file{bengalidigits.map}{\from{polyglossia.dtx}{bengalidigits.map}}}
\generate{\file{devanagaridigits.map}{\from{polyglossia.dtx}{devanagaridigits.map}}}
\generate{\file{farsidigits.map}{\from{polyglossia.dtx}{farsidigits.map}}}
\generate{\file{thaidigits.map}{\from{polyglossia.dtx}{thaidigits.map}}}
\def\MetaPrefix{-- }
\generate{\file{polyglossia-frpt.lua}{\from{polyglossia.dtx}{polyglossia-frpt.lua}}}
\generate{\file{polyglossia-tibt.lua}{\from{polyglossia.dtx}{polyglossia-tibt.lua}}}
\generate{\file{polyglossia.lua}{\from{polyglossia.dtx}{polyglossia.lua}}}
\let\MetaPrefix\DoubleperCent
%</batchfile>
%<batchfile>\endbatchfile
%<*internal>
\generate{\file{polyglossia.ins}{\from{polyglossia.dtx}{batchfile}}}
\nopreamble\nopostamble
\generate{\file{../README}{\from{polyglossia.dtx}{../README}}}
\generate{\file{Changelog}{\from{polyglossia.dtx}{Changelog}}}
\generate{\file{examples.tex}{\from{polyglossia.dtx}{examples.tex}}}
\generate{\file{example-arabic.tex}{\from{polyglossia.dtx}{example-arabic.tex}}}
\generate{\file{example-thai.tex}{\from{polyglossia.dtx}{example-thai.tex}}}
\endgroup
%</internal>
%
%<*driver>
\documentclass[11pt]{ltxdoc}
\usepackage{color}
\usepackage{xspace,fancyvrb}
\usepackage[neverdecrease]{paralist}
\definecolor{myblue}{rgb}{0.02,0.04,0.48}
\definecolor{lightblue}{rgb}{0.61,.8,.8}
\definecolor{myred}{rgb}{0.65,0.04,0.07}
\usepackage[
    bookmarks=true,
    colorlinks=true,
    linkcolor=myblue,
    urlcolor=myblue,
    citecolor=myblue,
    hyperindex=false,
    hyperfootnotes=false,
    pdftitle={Polyglossia: An alternative to Babel for XeLaTeX and LuaLaTeX},
    pdfauthor={F Charette, A Reutenauer},
    pdfkeywords={xetex, xelatex, luatex, lualatex, multilingual, babel, hyphenation}
    ]{hyperref}
\usepackage{metalogo}
\let\XeTeX\undefined
\let\XeLaTeX\undefined
\usepackage[babelshorthands]{polyglossia}
\usepackage{farsical}
\setmainlanguage[variant=british,ordinalmonthday=false]{english}
\setotherlanguages{arabic,hebrew,syriac,greek,russian,catalan}
\usepackage[protrusion]{microtype}
\newcommand*\Cmd[1]{\cmd{#1}\DescribeMacro{#1}\xspace}
\newcommand*\pkg[1]{\textsf{\color{myblue}#1}}
\newcommand*\file[1]{\texttt{\color{myblue}#1}}
\newcommand*\TR[1]{\textcolor{myred}{#1}}
\newcommand*\TX[1]{\hyperref[#1]{\textcolor{myred}{#1}}}
\newcommand*\TB[1]{\textcolor{myblue}{\bf #1}}
\newcommand*\link[1]{\href{#1}{#1}}
\def\eg{\textit{e.g.,}\xspace}
\def\ie{\textit{i.e.,}\xspace}
\def\ca{\textit{ca.}\@\xspace}
\def\Eg{\textit{E.g.,}\xspace}
\def\Ie{\textit{I.e.,}\xspace}
\def\etc{\@ifnextchar.{\textit{etc}}{\textit{etc.}\@\xspace}}

%% Sidenotes  << copied from fontspec.dtx
\newcommand\new[1]{%
  \edef\thisversion{#1}%
  \ifhmode\unskip~\fi{\ifx\thisversion\fileversion\color{blue}\else\color[gray]{0.5}\fi
  $\leftarrow$}%
  \marginpar{\centering
    \small\ifx\thisversion\fileversion\color{blue}\else\color[gray]{0.5}\fi
    \textsf{#1}}}
\newcommand\displaycmd[2]{%
  \\\DescribeMacro{#2}\centerline{\cmd{#1}}}
\renewenvironment{itemize}{\begin{compactitem}[\char"2023]}%[{\fontspec{DejaVu Sans}\char"25BB}]}%
		{\end{compactitem}}
\renewenvironment{enumerate}{\begin{compactenum}}{\end{compactenum}}

%% fontspec declarations:
\setmainfont{Linux Libertine O}
\setsansfont{Linux Biolinum O}
\setmonofont[Scale=MatchLowercase]{DejaVu Sans Mono}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\newfontfamily\syriacfont[Script=Syriac]{Serto Jerusalem}
\newfontfamily\hebrewfont[Script=Hebrew]{Ezra SIL}

\linespread{1.05}
\frenchspacing
\EnableCrossrefs
\CodelineIndex
\RecordChanges
% COMMENT THE NEXT LINE TO INCLUDE THE CODE
\AtBeginDocument{\OnlyDescription}
\begin{document}
\ifxetex
  \DocInput{polyglossia.dtx}
\fi
\end{document}
%</driver>
% 
% \fi
% 
% \errorcontextlines=999
% \makeatletter
% 
% \hyphenation{Kha-li-ghi}
% \GetFileInfo{polyglossia.sty}
% 
% \title{\textcolor{lightblue}{\Huge\fontspec[LetterSpace=40]{GFS Ambrosia} Πολυγλωσσια}
% \\[16pt]
% \color{myblue}Polyglossia: An Alternative to Babel for \XeLaTeX\ and \LuaLaTeX}
% \author{\scshape\color{myblue}François Charette\\\color{myblue}Current maintainer: \scshape Arthur Reutenauer}
% \date{\filedate \qquad \fileversion\\
% \footnotesize (\textsc{pdf} file generated on \today)}
% 
% \maketitle
% \tableofcontents
% 
% 
% \DeleteShortVerb{\|}
% \MakeShortVerb{\¦}
% 
% ^^A\begin{abstract}
% ^^ABlablabla
% ^^A\end{abstract}
% 
% 
% \section{Introduction}
% 
% Polyglossia is a package for facilitating multilingual typesetting with
% \XeLaTeX\ and (at an early stage) \LuaLaTeX.  Basically, it
% can be used as an alternative to \pkg{babel} for performing the following
% tasks automatically:
% 
% \begin{enumerate}
% \item Loading the appropriate hyphenation patterns.
% \item Setting the script and language tags of the current font (if possible and
%       available), via the package \pkg{fontspec}.
% \item Switching to a font assigned by the user to a particular script or language.
% \item Adjusting some typographical conventions according to the current language
%       (such as afterindent, frenchindent, spaces before or after punctuation marks,
%       etc.).
% \item Redefining all document strings (like “chapter”, “figure”, “bibliography”).
% \item Adapting the formatting of dates (for non-Gregorian calendars via external
%       packages bundled with polyglossia: currently the Hebrew, Islamic and Farsi
%       calendars are supported).
% \item For languages that have their own numbering system, modifying the formatting
%       of numbers appropriately (this also includes redefining the alphabetic sequence
%       for non-Latin alphabets).\footnote{ %
%         For the Arabic script this is now done by the bundled package \pkg{arabicnumbers}.}
% \item Ensuring proper directionality if the document contains languages
%       that are written from right to left (via the package \pkg{bidi},
%       available separately).
% \end{enumerate}
% 
% Several features of \pkg{babel} that do not make sense in the \XeTeX\ world (like font
% encodings, shorthands, etc.) are not supported.
% Generally speaking, \pkg{polyglossia} aims to remain as compatible as possible
% with the fundamental features of \pkg{babel} while being cleaner, light-weight,
% and modern. The package \pkg{antomega} has been very beneficial in our attempt to
% reach this objective.
% 
% \paragraph{Requirements:} The current version of \pkg{polyglossia} makes use of some convenient
% macros defined in the \pkg{etoolbox} package by Philipp Lehmann. Being designed
% for \XeLaTeX\ and \LuaLaTeX, it obviously also relies on \pkg{fontspec} by Will
% Robertson. For languages written from right to left, it needs the package \pkg{bidi}
% by Vafa Khalighi (\textarabic{وفا خليقي}). Polyglossia also bundles three packages for calendaric
% computations (\pkg{hebrewcal}, \pkg{hijrical}, and \pkg{farsical}).
% 
% \section{Loading language definition files}
% 
% \subsection{The recommended way}
% You can determine the default language by means of the command:
% 	\displaycmd{\setdefaultlanguage[⟨options⟩]\{lang\}}{\setdefaultlanguage}
% (or equivalently \Cmd\setmainlanguage).
% Secondary languages can be loaded with
% 	\displaycmd{\setotherlanguage[⟨options⟩]\{lang\}.}{\setotherlanguage}
% These commands have the advantage of being explicit and of allowing you to set
% language-specific options.\footnote{ %
% 	More on language-specific options below.}
% It is also possible to load a series of secondary languages at once using
% 	\displaycmd{\setotherlanguages\{lang1,lang2,lang3,…\}.}{\setotherlanguages}
% Language-specific options can be set or changed at any time by means of
% 	\displaycmd{\setkeys\{⟨lang⟩\}\{opt1=value1,opt2=value2,…\}.}{\setkeys}
% 
% 
% \subsection{The “Babel way” – obsolete}
% \new{v1.2.0}
% {\color{red}\bfseries Warning}: \pkg{polyglossia} no longer supports loading
% language definition files as package options!
% ^^AAs with \pkg{babel}, \pkg{polyglossia} also allows you to load language definition files
% ^^Aas package options. In most cases, option \texttt{⟨lang⟩} will load the file
% ^^A\file{gloss-⟨lang⟩.ldf}. Note however that the \textit{first} language listed in \\
% ^^A\centerline{\cmd{\usepackage[lang1,lang2,…]{polyglossia}}}
% ^^Awill be the default language for the document, which
% ^^Ais the opposite convention of \pkg{babel}.
% ^^ANote also that this method may not work in some cases, and should be
% ^^Aconsidered deprecated.
% 
% \subsection{Supported languages}
% 
% Table~\ref{tab:lang} lists all languages currently supported.
% Those in red have specific options and/or commands
% that are explained in section \ref{specific} below.
% 
% \begin{table}[h]\centering
% \label{tab:lang}
% ^^A Produced with tools/insert-language-list.rb -- AR, 2015-07-14
% ^^A Edited by hand -- AR 2019-04-04
% \begin{tabular}{lllll}
% \hline
% albanian       & danish         & interlingua    & nko            & \TX{slovenian}\\
% amharic        & divehi         & irish          & norsk          & spanish       \\
% \TX{arabic}    & \TX{dutch}     & \TX{italian}   & nynorsk        & swedish       \\
% armenian       & \TX{english}   & kannada        & occitan        & \TX{syriac}   \\
% asturian       & \TX{esperanto} & khmer          & piedmontese    & tamil         \\
% bahasai        & estonian       & \TX{korean}    & polish         & telugu        \\
% bahasam        & \TX{farsi}     & \TX{lao}       & portuges       & \TX{thai}     \\
% basque         & finnish        & \TX{latin}     & romanian       & tibetan       \\
% \TX{bengali}   & french         & latvian        & romansh        & turkish       \\
% brazil[ian]    & friulan        & lithuanian     & \TX{russian}   & turkmen       \\
% breton         & galician       & \TX{lsorbian}  & samin          & \TX{ukrainian}\\
% bulgarian      & \TX{german}    & \TX{magyar}    & \TX{sanskrit}  & urdu          \\
% \TX{catalan}   & \TX{greek}     & macedonian     & scottish       & \TX{usorbian} \\
% coptic         & \TX{hebrew}    & malayalam      & \TX{serbian}   & vietnamese    \\
% croatian       & \TX{hindi}     & marathi        & slovak         & \TX{welsh}    \\
% czech          & icelandic      \\
% \hline
% \end{tabular}
% \caption{Languages currently supported in \pkg{polyglossia}}
% \end{table}
% 
% \textit{NB:} The support for Amharic\new{v1.0.1} should be considered an experimental attempt to
% port the package \pkg{ethiop}.\footnote{ Feedback is welcome.}
% Version 1.1.1\new{v1.1.1} added support for Asturian, %\footnote{ Provided by Kevin Godby and Xuacu Saturio.}, 
% Lithuanian, %\footnote{ Provided by Kevin Godby and Paulius Sladkevičius.},
% and Urdu. %\footnote{ Provided by Kamal Abdali.}
% ^^A
% Version 1.2\new{v1.2.0} adds support for Armenian, Occitan, Bengali,
% Lao, Malayalam, Marathi, Tamil, Telugu, and Turkmen.\footnote{ %
%   See acknowledgements at the end for due credit to the various contributors.}
% 
% 
% 
% Polyglossia can also be loaded with the option
% ‘babelshorthands’\new{v1.1.1}, which globally activates \pkg{babel}
% shorthands whenever available. Currently shorthands are implemented for
% Catalan, Dutch, German, Italian, and Russian: see these respective
% languages for details.
% 
% Another option (turned off by default) is ‘localmarks’, which
% redefines the internal \LaTeX\ macros \cmd\markboth\ and \cmd\markright.
% \new{v1.2.0}Note that this was formerly turned on by default, but we
% now realize that it causes more problems than otherwise. For backwards-compatibility
% the opposite option ‘nolocalmarks’ is still available.
% 
% There is also the option ‘quiet’ which turns off most info messages and some of the warnings
% issued by \LaTeX, \pkg{fontspec} and \pkg{polyglossia}.
% 
% \section{Language-switching commands}
% 
% Whenever a language definition file \file{gloss-⟨lang⟩.ldf} is loaded,
% the command \cmd{\text⟨lang⟩[⟨options⟩]\{…\}} \DescribeMacro{\text⟨lang⟩}
% becomes available for short insertions of text in that language.
% For example ¦\textrussian{\today}¦ yields \textrussian{\today}
% Longer passages are better put between the environment ¦⟨lang⟩¦
% (again with the possibility of setting language options locally.
% \DescribeEnv{⟨lang⟩}
% For instance the following allows us to quote the beginning
% of Homer’s \textit{Iliad}:
% 
% \begin{Verbatim}[formatcom=\color{myblue}]
% \begin{greek}[variant=ancient]
% μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος οὐλομένην, ἣ μυρί' Ἀχαιοῖς ἄλγε'
% ἔθηκε, πολλὰς δ' ἰφθίμους ψυχὰς Ἄϊδι προί̈αψεν ἡρώων, αὐτοὺς δὲ ἑλώρια
% τεῦχε κύνεσσιν οἰωνοῖσί τε πᾶσι, Διὸς δ' ἐτελείετο βουλή, ἐξ οὗ δὴ τὰ
% πρῶτα διαστήτην ἐρίσαντε Ἀτρεί̈δης τε ἄναξ ἀνδρῶν καὶ δῖος Ἀχιλλεύς.
% \end{greek}
% \end{Verbatim}
% 
% \begin{greek}[variant=ancient]
% μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος οὐλομένην, ἣ μυρί' Ἀχαιοῖς ἄλγε' ἔθηκε,
% πολλὰς δ' ἰφθίμους ψυχὰς Ἄϊδι προί̈αψεν ἡρώων, αὐτοὺς δὲ ἑλώρια τεῦχε κύνεσσιν
% οἰωνοῖσί τε πᾶσι, Διὸς δ' ἐτελείετο βουλή, ἐξ οὗ δὴ τὰ πρῶτα διαστήτην ἐρίσαντε
% Ἀτρεί̈δης τε ἄναξ ἀνδρῶν καὶ δῖος Ἀχιλλεύς.
% \end{greek}
% \bigskip
% 
% Note that for Arabic one cannot use the environment ¦arabic¦,
% as \cmd\arabic\ is defined internally by \LaTeX. In this case
% we need to use the environment ¦Arabic¦ instead\DescribeEnv{Arabic}.
% 
% \subsection{Other commands}
% The following commands are probably of lesser interest to the end user, but
% ought to be mentioned here.
% \begin{itemize}
% \item \Cmd\selectbackgroundlanguage: this selects the global font setup and
% 	the numbering definitions for the default language.
% 
% \item \Cmd\resetdefaultlanguage\ (experimental):
% 	completely switches the default language
% 	to another one in the middle of a document: \textit{this may have adverse effects}!
% 
% \item \Cmd\normalfontlatin: in an environment where \cmd\normalfont\ has been redefined
% 	to a non-latin script, this will call the font defined with \cmd\setmainfont\ etc.
% 	Likewise it is possible to use \Cmd\rmfamilylatin, \Cmd\sffamilylatin,
% 	and \Cmd\ttfamilylatin.
% 
% \item Some macros defined in \pkg{babel}’s \file{hyphen.cfg} (and thus usually
% 	compiled into the \XeLaTeX\ and \LuaLaTeX\ format) are redefined, but keep a similar
% 	behaviour, namely \Cmd\selectlanguage, \Cmd\foreignlanguage,
% 	and the environment ¦otherlanguage¦\DescribeEnv{otherlanguage}.
% \end{itemize}
% ^^A
% Since the \XeLaTeX\ and \LuaLaTeX\ format incorporate \pkg{babel}’s \file{hyphen.cfg},
% the low-level commands for hyphenation and language switching
% defined there are also accessible.
% 
% \section{Font setup}
% 
% With polyglossia it is possible to associate a specific font with any script or language
% that occurs in the document. That font should always be defined as
% ¦\⟨script⟩font¦\ or ¦\⟨language⟩font¦.
% For instance, if the default font defined by \cmd\setmainfont\
% does not support Greek, then one can define the font used to display Greek with:\\
% \centerline{ \cmd\newfontfamily\cmd{\greekfont[Script=Greek,⟨…⟩]\{⟨font⟩\}}. }
% Note that polyglossia will use the font thus defined as is.
% for instance if ¦\arabicfont¦ is explicitly defined, then one should take care of
% including the option ¦Script=Arabic¦ in that definition.
% See the \pkg{fontspec} documentation for more information.
% If a specific sans or monospace font is needed for a particular script or language,
% it can be defined by means of \new{v1.2.0}
% ¦\⟨script⟩fontsf¦\ or ¦\⟨language⟩fontsf¦ and ¦\⟨script⟩fonttt¦\ or ¦\⟨language⟩fonttt¦, respectively.
% 
% Whenever a new language is activated, \pkg{polyglossia} will first check whether
% a font has been defined for that language or – for languages in non-Latin scripts –
% for the script it uses. If it is not defined, it will use the currently active font
% and – in the case of OpenType fonts – will attempt to turn on the appropriate
% OpenType tags for the script and language used, in case these are available in
% the font, by means of \pkg{fontspec}’s \cmd\addfontfeature. If the current font
% does not appear to support the script of that language, an error message is
% displayed.
% 
% \section{Hyphenation disabling}
% 
% In some very specific contexts (such as music score creation), \TeX{} hyphenation
% is something to avoid as it may cause troubles. \pkg{polyglossia} provides two
% functions: \cmd\disablehyphenation{} and \cmd\enablehyphenation . Note that when
% you select a new language, hyphenation will be in the same state (enabled or
% disabled) as before. When you reenable it, it will take the last selected
% language.
% 
% \section{Language-specific options and commands}\label{specific}
% 
% This section gives a list of all languages for which options and end-user commands are defined.
% The default value of each option is given in italic.
% 
% ^^A\subsection{amharic}\label{amharic}
% 
% \subsection{arabic}\label{arabic}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{calendar} = \textit{gregorian} or islamic (= hijri)
% 	\item \TB{locale} = \textit{default},\footnote{ %
% 			For Egypt, Sudan, Yemen and the Gulf states.}
% 		mashriq,\footnote{ %
% 			For Iraq, Syria, Jordan, Lebanon and Palestine.}
% 		libya, algeria, tunisia, morocco, or mauritania.
% 		This setting influences the spelling of the month names for the Gregorian calendar,
% 		as well as the form of the numerals (unless overriden by the following option).
% 	\item \TB{numerals} = \textit{mashriq} or maghrib
% 		(the latter is the default when locale = algeria, tunisia or morocco)
%   \item \TB{abjadjimnotail} = \textit{false} or true. \new{v1.0.3}
%     Set this to true if you want the \textit{abjad} form of the number three to be \textarabic{ج‍} – as in the manuscript tradition – instead of the modern usage \textarabic{ج}.
% 	\end{itemize}
% \textbf{Commands}:
% 	\begin{itemize}
% 	\item \Cmd\abjad and \Cmd\abjadmaghribi (see section \ref{abjad})
%   \item \Cmd\aemph to emphasize text with ¦\overline¦.\new{v1.2.0}
%     ¦\textarabic{\aemph{اب}}¦ yields \textarabic{\aemph{اب}}.
%     This command is also available for Farsi, Urdu, etc.
% 	\end{itemize}
% 
% \subsection{bengali}\label{bengali}\new{v1.2.0}
% \textbf{Options}:
% 	\begin{itemize}
% 		\item \TB{numerals} = Western, Bengali or \textit{Devanagari}
% 		\item \TB{changecounternumbering} = true or \textit{false} (use specified
% 			numerals for headings and page numbers)
% 	\end{itemize}
% 
% \subsection{catalan}\label{catalan}
% \textbf{Options:}
% \begin{itemize}
%   \item \TB{babelshorthands} = \textit{false} or true. \new{v1.1.1}
%     Activates the shorthands \texttt{"l} and \texttt{"L} to type geminated l’s.
% \end{itemize}
% \textbf{Commands}:
% \begin{itemize}
%   \item \Cmd{\l.l} and \Cmd{\L.L} behave as in \pkg{babel} to type a geminated l, as in \textit{co\l.laborar}. \new{v1.1.1}
%     In polyglossia the same can also be achieved with \Cmd{\l·l} and \Cmd{\L·L}.\footnote{ %
%         NB: · is the glyph U+00B7 MIDDLE DOT.}
% \end{itemize}
% 
% \subsection{dutch}\label{dutch}
% \textbf{Options:}
% \begin{itemize}
%   \item \TB{babelshorthands} = \textit{false} or true. \new{v1.1.1}
% 		if this is turned on, all shorthands defined in \pkg{babel}
% 		for fine-tuning the hyphenation of Dutch words are activated.
% 		\begin{itemize}
% 		\item ¦"-¦ for an explicit hyphen sign, allowing hyphenation in the rest of the word
% 		\item ¦"~¦ for a compound word mark without a breakpoint
% 		\item ¦"|¦ disables the ligature at this position
% 		\item ¦""¦ is like ¦"-¦, but produces no hyphen sign
% 			(for compound words with a hyphen, e.g., ¦foo-""bar¦)
% 		\item ¦"/¦ to enable hyphenation in two words written together but separated by a slash.
%     \item In addition, the macro \Cmd\- is redefined to allow hyphens in the rest of the word.
% 		\end{itemize}
% \end{itemize}
% 
% \subsection{english}\label{english}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{variant} = \textit{american} (= us), usmax (same as ‘american’ but with additional hyphenation patterns), british (= uk), australian or newzealand
% 	\item \TB{ordinalmonthday} = true/\textit{false} (true by default only when variant = british)
% 	\end{itemize}
% 
% \subsection{esperanto}\label{esperanto}
% \textbf{Commands}:
% 	\begin{itemize}
% 	\item \Cmd\hodiau\ and \Cmd\hodiaun are special forms of \cmd\today\ (see the \pkg{babel} documentation)
% 	\end{itemize}
% 
% \subsection{farsi}\label{farsi}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{numerals} = western or \textit{eastern}
% 	\item \TB{locale} (not yet implemented)
% 	\item \TB{calendar} (not yet implemented)
% 	\end{itemize}
% \textbf{Commands}:
% 	\begin{itemize}
% 	\item \Cmd\abjad (see section \ref{abjad})
%   \item \Cmd\aemph (see section \ref{arabic}).
% 	\end{itemize}
% 
% \subsection{french}\label{french}\new{v1.5.0}
% \textbf{Options}:
% 	\begin{itemize}
% 		\item \TB{automaticspacesaroundguillemets} = true or \textit{false} (default value = true. Adds space after the opening guillemets and before the closing guillemets. Such space is usually not typed in source code, and you should let polyglossia add it. However, if your source code contains such space, you can set this option to false.)
% 		\item \TB{frenchfootnote} = true or \textit{false} (default value = true. Determines whether the footnote mark starting the footnote is normal script followed by a dot (default) or superscript without a dot.)
% 	\end{itemize}
% 
% \subsection{german}\label{german}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item\TB{variant} = \textit{german}, austrian or swiss.\new{v1.33.4}
% 		Setting variant=austrian or variant=swiss uses some lexical variants.
% 		With spelling=old, variant=swiss furthermore loads specific hyphenation
% 		patterns.
% 	\item \TB{spelling} = \textit{new} (= 1996) or old (= 1901):
% 		indicates whether hyphenation patterns for traditional (1901) or reformed
% 		(1996) orthography should be used. The latter is the default.
% 	\item \TB{latesthyphen} = \textit{false} or true: if this option is set to true,
% 		the latest (experimental) hyphenation patterns ‘(n)german-x-latest’
% 		will be loaded instead of ‘german’ or ‘ngerman’. NB: This is based on
% 		the file \texttt{language.dat} that comes with \TeX Live 2008 and later.
% 	\item\TB{babelshorthands} = \textit{false} or true: \new{v1.0.3}
% 		if this is turned on, all shorthands defined in \pkg{babel}
% 		for fine-tuning the hyphenation of German words are activated.
% 		\begin{itemize}
% 		\item  ¦"ck¦ for ¦ck¦ to be hyphenated as ¦k-k¦
% 		\item  ¦"ff¦ for ¦ff¦ to be hyphenated as ¦ff-f¦; this is also available for the letters l, m, n, p, r and t
% 		\item ¦"|¦ disables the ligature at this position
% 		\item ¦"-¦ for an explicit hyphen sign, allowing hyphenation in the rest of the word
% 		\item ¦""¦ is like ¦"-¦, but produces no hyphen sign
% 			(for compound words with a hyphen, e.g., ¦foo-""bar¦)
% 		\item ¦"~¦ for a compound word mark without a breakpoint
% 		\item ¦"=¦ for a compound word mark with a breakpoint,
% 			allowing hyphenation in the composing words.
% 		\item ¦"/¦ a slash that allows for a line break and maintains hyphenation points.
% 		\end{itemize}
% 
% 		There are also four shorthands for quotation signs:
% 		\begin{itemize}
% 		\item  ¦"`¦ for German left double quotes („)
% 		\item  ¦"'¦ for German right double quotes (“)
% 		\item  ¦"<¦ for French left double quotes («)
% 		\item  ¦">¦ for French right double quotes (»).
% 		\end{itemize}
% 	\item\TB{script} = \textit{latin} or fraktur.\new{v1.2.0}
% 		Setting script=fraktur modifies the captions for typesetting German in Fraktur.
% 	\end{itemize}
% 
% \subsection{greek}\label{greek}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{variant} = \textit{monotonic} (= mono), polytonic (= poly), or ancient
% 	\item \TB{numerals} = \textit{greek} or arabic
% 	\item \TB{attic} = \textit{false}/true
% 	\end{itemize}
% \textbf{Commands}:
% 	\begin{itemize}
% 	\item \Cmd\Greeknumber and \Cmd\greeknumber \ (see section \ref{abjad}).
% 	\item The command \Cmd\atticnumeral (= \Cmd\atticnum) (activated with
% 	  the option ¦attic=true¦), displays numbers using the acrophonic
%           numbering system (defined in the Unicode range
% 	  \textsf{U+10140–U+10174}).\footnote{ %
% 	  	See the documentation of the \pkg{xgreek} package for more details.}
% 	\end{itemize}
% 
% \subsection{hebrew}\label{hebrew}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{numerals} = hebrew or \textit{arabic}
% 	\item \TB{calendar} = hebrew or \textit{gregorian}
% 	\end{itemize}
% \textbf{Commands}:
% 	\begin{itemize}
% 	\item \Cmd\hebrewnumeral\ (= \Cmd\hebrewalph) (see section \ref{abjad}).
%   \item \Cmd\aemph (see section \ref{arabic}).
% 	\end{itemize}
% 
% \subsection{hindi}\label{hindi}\new{v1.2.0}
% \textbf{Options}:
% 	\begin{itemize}
%     \item \TB{numerals} = Western or \textit{Devanagari}
% 	\end{itemize}
% 
% \subsection{italian}\label{italian}
% \textbf{Option:}
% \begin{itemize}
%   \item \TB{babelshorthands} = \textit{false} or true. \new{v1.2.0cc}% TODO: check version
% 	Activates the ¦"¦ character as a switch to perform etymological
% 	hyphenation when followed by a letter, or other tasks when followed by
% 	certain analphabetic characters; in particular ¦""¦ is used to enter
% 	double raised open quotes (the Italian keyboard misses the backtick),
% 	and ¦"<¦  and ¦">¦ to insert open and closed guillemets without any
% 	spacing after the open or before the closed sign. ¦"/¦ is made
% 	equivalent to \slash allowing a linebreak after the slash without any
% 	hyphen sign; ¦"-¦ produces  a short rule/hyphen and a discretional line
% 	break alowing line breaks in the second compound word fragment.
% \end{itemize}
% 
% \subsection{korean}\label{korean}\new{v1.40.0}
% The language definition file includes U. S. hyphenation patterns in order to
% enable hyphenation when writing English within Korean text.
% 
% \subsection{lao}\label{lao}\new{v1.2.0}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{numerals} = lao or \textit{arabic}
% 	\end{itemize}
% 
% \subsection{latin}\label{latin}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{variant} = classic, medieval or \textit{modern}
% 	\end{itemize}
% 
% \subsection{lsorbian and usorbian}\label{lsorbian}\label{usorbian}
% \textbf{Commands}:
% 	\begin{itemize}
% 	\item \Cmd\oldtoday : see the \pkg{babel} documentation.
% 	\end{itemize}
% 
% \subsection{magyar}\label{magyar}
% \textbf{Commands}:
% 	\begin{itemize}
% 	\item \Cmd\ontoday\ (= \Cmd\ondatemagyar): special forms of \cmd\today\
% 		(see the \pkg{babel} documentation).
% 	\end{itemize}
% 
% 
% \subsection{russian}\label{russian}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{babelshorthands} = \textit{false} or true. % TODO check and document!
% 	\item \TB{spelling} = \textit{modern} or old (for captions and date only, not for hyphenation)
% 	\end{itemize}
% 
% \textbf{Commands}:
% 	\begin{itemize}
% 	\item \Cmd\Asbuk: produces the uppercase Russian alphabet, for
% 	environments such as ¦enumerate¦
% 	\item \Cmd\asbuk: same in lowercase
% 	\end{itemize}
% 
% \subsection{sanskrit}\label{sanskrit}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{Script} (default = Devanagari). \new{v1.0.2}
% 	The value is passed to \pkg{fontspec} in cases where ¦\sanskritfont¦ or
% 	¦\devanagarifont¦ are not defined. This can be useful if you typeset
% 	Sanskrit texts in scripts other than Devanagari.
% ^^ATODO \item Numerals <<<<
% 	\end{itemize}
%   \pkg{polyglossia} currently supports the typesetting of Sanskrit in the
%   following writing systems: Devanagari, Gujarati, Malayalam, Bengali, Kannada,
%   Telugu, and Latin.  Use the ¦Script=¦ option to select the writing system 
%   you want, and enter your input in that script.
%  
% \subsection{serbian}\label{serbian}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{script} = \textit{cyrillic} or latin
% 	\end{itemize}
% 
% \subsection{slovenian}\label{slovenian}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{localaph} = true \textit{false}
% 	\end{itemize}
% 
% \subsection{syriac}\label{syriac}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{numerals} = \textit{western} (i.e., 1234567890), eastern
% 		(for which the Oriental Arabic numerals are used: \textarabic{١٢٣٤٥٦٧٨٩٠}),
% 		or abjad. \new{v1.0.1}.
% 	\end{itemize}
% \textbf{Commands}:
% 	\begin{itemize}
% 	\item \Cmd\abjadsyriac (see section \ref{abjad})
%   \item \Cmd\aemph (see section \ref{arabic}).
% 	\end{itemize}
% 
% \subsection{thai}\label{thai}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{numerals} = thai or \textit{arabic}
% 	\end{itemize}
% 
% To insert the word breaks, you need to use an external processor.
% See the documentation to \pkg{thai-latex} and the file \file{testthai.tex}
% that comes with this package.
% 
% \subsection{ukrainian}\label{russian}
% \textbf{Commands}:
% 	\begin{itemize}
% 	\item \Cmd\Asbuk: produces the uppercase Ukrainian alphabet, for
% 	environments such as ¦enumerate¦
% 	\item \Cmd\asbuk: same in lowercase
% 	\end{itemize}
% 
% \subsection{welsh}\label{welsh}
% \textbf{Options}:
% 	\begin{itemize}
% 	\item \TB{date} = long or \textit{short}
% 	\end{itemize}
% 
% \section{Modifying or extending captions and date formats}
% 
% To redefine internal macros, you can use the command ¦\gappto¦ from the package
% \pkg{etoolbox}. For compatibility with \pkg{babel} the command ¦\addto¦ is also available
% with the same effect. For instance, to change the ¦\chaptername¦ for language ¦lingua¦,
% you can do this:
% \begin{verbatim}
% \gappto\captionslingua{\renewcommand{\chaptername}{Caput}}
% \end{verbatim}
% 
% \section{Non-Western decimal digits}
% 
% Several scripts have their own versions of the decimal digits commonly called
% ‘Arabic numerals’.  With the appropriate language option set, \pkg{polyglossia}
% will automatically convert the output of internal \LaTeX\ counters to their
% localized forms, for instance to display page, chapter and section numbers.
% 
% In previous versions this conversion was achieved my means of TECKit fontmappings.
% If needed they can be activated with the fontspec ¦Mapping¦ option,
% using ¦arabicdigits¦, ¦farsidigits¦ or ¦thaidigits¦.
% For instance if \cmd\arabicfont\ is defined with the option ¦Mapping=arabicdigits¦,
% then by typing ¦\textarabic{2010}¦ one will obtain \textarabic{٢٠١٠}.
% 
% With version v1.1.1\new{v1.1.1} the same conversion is achieved directly by
% simple \TeX\ macros. This prevents some problems that occur when the value of a
% counter has to be written and read from auxiliary files.\footnote{ %
%   For instance the package \pkg{lastpage} did not work with \pkg{polyglossia} in situations
%   where the display of counters was redefined to include a font-switching command.}
% These macros (currently \Cmd\arabicdigits, \Cmd\farsidigits\ and \Cmd\thaidigits\ are provided)
% are also available to the users. For instance in an Arabic environment
% ¦\arabicdigits{9182/738543-X}¦ yields
% \textarabic{\arabicdigits{9182/738543-X}}.
% 
% \section{Alphabetic numbering in Greek, Arabic, Hebrew, Syriac and Farsi}\label{abjad}
% 
% In certain languages, numbers can be represented
% by a special alphanumerical notation.\footnote{ %
% 	See, e.g., \url{http://en.wikipedia.org/wiki/Greek_numerals},
% 	\url{http://en.wikipedia.org/wiki/Abjad_numerals},
% 	and \url{http://en.wikipedia.org/wiki/Hebrew_numerals}.}
% ^^A \url{http://en.wikipedia.org/wiki/Syriac_alphabet}
% 
% The Greek numerals are obtained with \Cmd\greeknumeral (or \Cmd\Greeknumeral\ in uppercase).
% Example: ¦\greeknumeral{1863}¦ yields \textgreek{\greeknumeral{1863}}.
% 
% The Arabic \textit{abjad} numbers can be generated with the command \Cmd\abjad.
% Example: ¦\abjad{1863}¦ yields \textarabic{\abjad{1863}}.
% In the Maghrib the conventions are somewhat different, and the maghribi forms
% of the \textit{abjad} numerals are obtained with the \Cmd\abjadmaghribi\ command.
% Example: ¦\abjadmaghribi{1863}¦ yields \textarabic{\abjadmaghribi{1863}}.
% 
% The code for Hebrew numerals, which was incorrect in previous versions, was
% ported from the implementation in \pkg{babel} with v1.1.1\new{v1.1.1}, and the
% user interface is identical to the one in \pkg{babel}.
% The commands \Cmd\hebrewnumeral, \Cmd\Hebrewnumeral and \Cmd\Hebrewnumeralfinal\ behave exactly
% as they do in \pkg{babel}: the second command prints the number with \textit{gereshayim} before
% the last letter, and the latter uses in addition the final forms of Hebrew letters.
% Examples:
% ¦\hebrewnumeral{1750}¦ yields \texthebrew{\hebrewnumeral{1750}},
% ¦\Hebrewnumeral{1750}¦ yields \texthebrew{\Hebrewnumeral{1750}},
% and ¦\Hebrewnumeralfinal{1750}¦ yields \texthebrew{\Hebrewnumeralfinal{1750}}.
% 
% 
% Support is also provided for Syriac abjad numerals, which can be generated
% with \Cmd\abjadsyriac.\footnote{ %
% A fine guide to numerals in Syriac can be found at \link{http://www.garzo.co.uk/documents/syriac-numerals.pdf}.}
% Example: ¦\abjadsyriac{463}¦ yields \textsyriac{\abjadsyriac{463}}.
% 
% 
% \section{Calendars}
% 
% \subsection{Hebrew calendar (hebrewcal.sty)}
% The package \file{hebrewcal.sty} is almost a verbatim copy of \file{hebcal.sty}
% that comes with \pkg{babel}.
% The command \Cmd\Hebrewtoday\ formats the current date in the Hebrew calendar
% (depending of the current writing direction this will automatically set either
% in Hebrew script or in roman transliteration).
% 
% \subsection{Islamic calendar (hijrical.sty)}
% This package computes dates in the lunar Islamic (Hijra) calendar.\footnote{ %
% 	It makes use of the arithmetical algorithm in chapter 6 of
% 	Reingold \& Gershowitz, \textit{Calendrical calculation: the Millenium edition}
% 	(Cambridge University Press, 2001).\label{reingold}}
% It provides two macros for the end-user.
% The command
% 	\displaycmd{\HijriFromGregorian\{⟨year⟩\}\{⟨month⟩\}\{⟨day⟩\}}{\HijriFromGregorian}
% sets the counters ¦Hijriday¦, ¦Hijrimonth¦ and ¦Hijriyear¦.
% \Cmd\Hijritoday\ formats the Hijri date for the current day.
% This command is now locale-aware\new{v1.1.1}: its output will differ depending on the
% currently active language. Presently \pkg{polyglossia}’s language definition files
% for Arabic, Farsi, Urdu, Turkish, Bahasa Indonesia and Bahasa Melayu
% provide a localized version of ¦\Hijritoday¦.
% If the formatting macro for the current language is undefined, the Hijri date will be formatted
% in Arabic or in roman transliteration, depending of the current writing direction.
% You can define a new format or redefine one with the command
%   \displaycmd{\DefineHijriDateFormat\{<lang>\}\{<code>\}.}{\DefineHijriDateFormat}
% 
% The command ¦\Hijritoday¦ also accepts an optional argument to add or subtract a correction
% (in days) to the date computed by the arithmetical algorithm.\footnote{ %
% 	The Islamic calendar is indeed a purely lunar calendar based on the observation
% 	of the first visibility of the lunar crescent at the beginning of the lunar month,
% 	so there can be differences between different localities, as well as between
% 	civil and religious authorities.}
% For instance if ¦\Hijritoday¦ yields the date “7 Rajab 1429” (which is the date that was
% displayed on the front page of \href{http://www.aljazeera.net}{aljazeera.net} on
% 11th July 2008), ¦\Hijritoday[1]¦ would rather print “8 Rajab 1429” (the date
% indicated the same day on the site \href{http://www.gulfnews.com}{gulfnews.com}).
% 
% \subsection{Farsi (jalālī) calendar (farsical.sty)}
% This package is an almost verbatim copy of ¦Arabiftoday.sty¦ (in the \pkg{Arabi} package),
% itself a slight modification of ¦ftoday.sty¦ in Farsi\TeX.\footnote{ %
% 	One day I may rewrite \pkg{farsical} from scratch using the algorithm in
% 	Reingold \& Gershowitz (ref.~n.~\ref{reingold}).}
% Here we have renamed the command \cmd\ftoday\ to
% \Cmd\Jalalitoday.
% Example: today is \Jalalitoday.
% 
% 
% ^^A\section{Varia}
% 
% 
% \section{Acknowledgements (by François Charette)}
% \pkg{Polyglossia} is notable for being a recycle box of previous contributions
% by other people. I take this opportunity to thank the following individuals,
% whose splendid work has made my task almost trivial in comparision: Johannes
% Braams and the numerous contributors to the \pkg{babel}{} package (in particular
% Boris Lavva and others for its Hebrew support), Alexej Kryukov (\pkg{antomega}), Will
% Robertson (\pkg{fontspec}), Apostolos Syropoulos (\pkg{xgreek}), Youssef Jabri
% (\pkg{arabi}), and Vafa Khalighi (\pkg{xepersian} and \pkg{bidi}).
% The work of Mojca Miklavec and Arthur Reutenauer on hyphenation patterns with their package
% \pkg{hyph-utf8} is of course invaluable. I should also thank other
% individuals for their assistance in supporting specific languages: Yves Codet
% (Sanskrit), Zdenek Wagner (Hindi), Mikhal Oren (Hebrew), Sergey Astanin (Russian),
% Khaled Hosny (Arabic), Sertaç Ö. Yıldız (Turkish), Kamal Abdali (Urdu),
% and several other members of the \XeTeX\ user community, notably Enrico Gregorio, who
% has sent me many useful suggestions and corrections and contributed the ¦\newXeTeXintercharclass¦
% mechanism in xelatex.ini which is now used by polyglossia.
% More recently, Kevin Godby of the \href{http://ubuntu-manual.org}{Ubuntu Manual} project has
% contributed very useful feedback, bug hunting and, with the help of translators,
% new language definition files for Asturian, Lithuanian, Occitan, Bengali, Malayalam, Marathi, Tamil, and Telugu.
% It is particularly heartening to realize that this package is used to typeset a widely-read
% document in dozens of different languages!
% Support for Lao was also added thanks to Brian Wilson.
% I also thank Alan Munn for kindly proof-reading the penultimate version of this documentation.
% And of course my gratitude also goes to Jonathan Kew, the formidable author of \XeTeX!
% 
% \section{More acknowledgements (by Arthur Reutenauer)}
% Many thanks to all the people who have contributed bugfixes and new features to
% Polyglossia since I took over.  Most of them can be identified from the version
% control log on \href{https://github.com/reutenauer/polyglossia}{GitHub} and I won’t try to name them
% all (maybe, one day ...); among the ones who sent contributions directly to me
% I would like to especially thank Claudio Beccari, the indefatigable champion of
% Romance languages, and beyond!
% 
% 
% 
% 
% \StopEventually{}
% \section{Implementation}
% \iffalse
%<*gloss-albanian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-albanian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-albanian.ldf}[polyglossia: module for albanian]

\PolyglossiaSetup{albanian}{
  hyphennames={albanian},
  hyphenmins={2,2},
  indentfirst=true,
  fontsetup=true,
}

\def\captionsalbanian{%
   \def\refname{Referencat}%
   \def\abstractname{Përmbledhja}%
   \def\bibname{Bibliografia}%
   \def\prefacename{Parathenia}%
   \def\chaptername{Kapitulli}%
   \def\appendixname{Shtesa}%
   \def\contentsname{Përmbajta}%
   \def\listfigurename{Figurat}%
   \def\listtablename{Tabelat}%
   \def\indexname{Indeksi}%
   \def\figurename{Figura}%
   \def\tablename{Tabela}%
   %\def\thepart{}%
   \def\partname{Pjesa}%
   \def\pagename{Faqe}%
   \def\seename{shiko}%
   \def\alsoname{shiko dhe}%
   %\def\enclname{}%
   %\def\ccname{}%
   %\def\headtoname{}%
   \def\proofname{Vërtetim}%
   \def\glossaryname{Përhasja e Fjalëve}%
   }
\def\datealbanian{%
   \def\today{{\number\day~\ifcase\month\or
    Janar\or Shkurt\or Mars\or Prill\or Maj\or
    Qershor\or Korrik\or Gusht\or Shtator\or Tetor\or Nëntor\or
    Dhjetor\fi \space \number\year}}}

%    \end{macrocode}
% \iffalse
%</gloss-albanian.ldf>
%<*gloss-amharic.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-amharic.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-amharic.ldf}[polyglossia: module for amharic]
\PolyglossiaSetup{amharic}{
  script=Ethiopic,
  scripttag=ethi,
  langtag=AMH,
  hyphennames={amharic,nohyphenation},
  %hyphenmins={2,2},
  fontsetup=true,
  %TODO localalph=ethnum
}

\def\captionsamharic{%
   \def\refname{የነሥ ጹሁፍ ምንጭ}%
   \def\abstractname{አኅጽተሮ ጽሁፍ}%
   \def\bibname{ቢዋ መጽሃፍት}%
   \def\prefacename{መቅድም}%
   \def\chaptername{ክፍል}%
   \def\appendixname{መድበል}%
   \def\contentsname{ይዘት}%
   \def\listfigurename{የሥዕችሎ ማውጫ}%
   \def\listtablename{የሰንጠዥረ ማውጫ}%
   \def\indexname{ምህጻር ቃል}%
   \def\figurename{ሥዕል}%
   \def\tablename{ሰንጠረዥ}%
   %\def\thepart{}%
   \def\partname{ንዑስ ክፍል}%
   \def\pagename{ገጽ}%
   \def\seename{ይመልከቱ}%
   \def\alsoname{ይህምን ይመልከቱ}%
   \def\enclname{አባሪዎች}%
   \def\ccname{ግልባጭ}%
   \def\headtoname{ለ}%
   \def\proofname{ማረጋገጫ}%
   %\def\glossaryname{<++>}%
   }

\newcommand{\eth@monthname}[1]{\ifcase#1\or
  መስከረም\or
  ጥቅምት\or
  ህዳር\or
  ታህሳስ\or
  ጥር\or
  የካቲት\or
  መጋቢት\or
  ሚያዝያ\or
  ግንቦት\or
  ሰኔ\or
  ሐምሌ\or
  ነሐሴ\or
  ጰጉሜን\fi
}
\newcount\ethcnt@temp
\newcount\ethcnt@modtemp
\newcount\ethcnt@leap
\newcount\ethcnt@yminone
\newcount\ethcnt@days
\newcount\ethcnt@jdn
\newcount\ethcnt@cycle
\newcount\ethcnt@ethdays
\newcount\ethcnt@ethyear
\newcount\ethcnt@ethmonth
\newcount\ethcnt@ethday
\newcommand{\eth@modulo}[2]{%
  \ethcnt@modtemp=#1%
  \divide\ethcnt@modtemp by #2%
  \multiply\ethcnt@modtemp by #2%
  \advance#1 by -\ethcnt@modtemp
}
\def\dateamharic{%
  \def\today{{%
    \ethcnt@yminone=\year
    \advance\ethcnt@yminone by -1
    \ethcnt@leap=\year
    \divide\ethcnt@leap by 4
    \ethcnt@temp=\ethcnt@yminone
    \divide\ethcnt@temp by 4
    \advance\ethcnt@leap by -\ethcnt@temp
    \ethcnt@temp=\year
    \divide\ethcnt@temp by 100
    \advance\ethcnt@leap by -\ethcnt@temp
    \ethcnt@temp=\ethcnt@yminone
    \divide\ethcnt@temp by 100
    \advance\ethcnt@leap by \ethcnt@temp
    \ethcnt@temp=\year
    \divide\ethcnt@temp by 400
    \advance\ethcnt@leap by \ethcnt@temp
    \ethcnt@temp=\ethcnt@yminone
    \divide\ethcnt@temp by 400
    \advance\ethcnt@leap by -\ethcnt@temp
    \ifnum\month<3
      \ethcnt@days=\month
      \advance\ethcnt@days by -1
      \multiply\ethcnt@days by 31
      \advance\ethcnt@days by \day
      \advance\ethcnt@days by -1
    \else
      \ethcnt@days=\month
      \advance\ethcnt@days by -1
      \multiply\ethcnt@days by 30
      \advance\ethcnt@days by \day
      \advance\ethcnt@days by \ethcnt@leap
      \advance\ethcnt@days by -3
      \ethcnt@temp=\month
      \multiply\ethcnt@temp by 3
      \advance\ethcnt@temp by -2
      \divide\ethcnt@temp by 5
      \advance\ethcnt@days by \ethcnt@temp
    \fi
    \ethcnt@jdn=\ethcnt@days
    \advance\ethcnt@jdn by 1721426
    \ethcnt@temp=\ethcnt@yminone
    \multiply\ethcnt@temp by 365
    \advance\ethcnt@jdn by \ethcnt@temp
    \ethcnt@temp=\ethcnt@yminone
    \divide\ethcnt@temp by 4
    \advance\ethcnt@jdn by \ethcnt@temp
    \ethcnt@temp=\ethcnt@yminone
    \divide\ethcnt@temp by 100
    \advance\ethcnt@jdn by -\ethcnt@temp
    \ethcnt@temp=\ethcnt@yminone
    \divide\ethcnt@temp by 400
    \advance\ethcnt@jdn by \ethcnt@temp
    \ethcnt@cycle=\ethcnt@jdn
    \advance\ethcnt@cycle by -1723856
    \eth@modulo{\ethcnt@cycle}{1461}%
    \ethcnt@ethdays=\ethcnt@cycle
    \eth@modulo{\ethcnt@ethdays}{365}%
    \ethcnt@temp=\ethcnt@cycle
    \divide\ethcnt@temp by 1460
    \multiply\ethcnt@temp by 365
    \advance\ethcnt@ethdays by \ethcnt@temp
    \ethcnt@ethyear=\ethcnt@jdn
    \advance\ethcnt@ethyear by -1723856
    \divide\ethcnt@ethyear by 1461
    \multiply\ethcnt@ethyear by 4
    \ethcnt@temp=\ethcnt@cycle
    \divide\ethcnt@temp by 365
    \advance\ethcnt@ethyear by \ethcnt@temp
    \divide\ethcnt@cycle by 1460
    \advance\ethcnt@ethyear by -\ethcnt@cycle
    \ethcnt@ethmonth=\ethcnt@ethdays
    \divide\ethcnt@ethmonth by 30
    \advance\ethcnt@ethmonth by 1
    \ethcnt@ethday=\ethcnt@ethdays
    \eth@modulo{\ethcnt@ethday}{30}%
    \advance\ethcnt@ethday by 1%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \eth@monthname{\ethcnt@ethmonth}\relax\space%
      \number\ethcnt@ethday\relax\space%
      \number\ethcnt@ethyear%
  }}%
}

\def\ethiop#1{\expandafter\@ethiop\csname c@#1\endcsname}
\def\@ethiop#1{{%
  \ifnum#1<1\relax\ethnum@err{#1}%
  \else\ifnum#1<10\relax\expandafter\ethnum@one\number #1%
  \else\ifnum#1<100\relax\expandafter\ethnum@two\number #1%
  \else\ifnum#1<1000\relax\expandafter\ethnum@three\number #1%
  \else\ifnum#1<10000\relax\expandafter\ethnum@four\number #1%
  \else\ifnum#1<100000\relax\expandafter\ethnum@five\number #1%
  \else\ifnum#1<1000000\relax\expandafter\ethnum@six\number #1%
  \else%
    \ethnum@err%
    \number#1%
  \fi\fi\fi\fi\fi\fi\fi%
}}
\let\ethnum\@ethiop
\newcommand{\ethnum@tens}[1]{%
  \ifcase#1\or ፲\or ፳\or ፴%
           \or ፵\or ፶\or ፷%
           \or ፸\or ፹\or ፺\fi%
}%
\newcommand{\ethnum@one}[1]{%
  \ifcase#1\or ፩\or ፪\or ፫%
           \or ፬\or ፭\or ፮%
           \or ፯\or ፰\or ፱\fi%
}%
\newcommand{\ethnum@two}[1]{%
  \ethnum@tens#1%
  \ethnum@one%
}
\newcommand{\ethnum@three}[1]{%
  \ifnum#1>1\relax\ethnum@one#1\fi%
  \ifnum#1>0\relax ፻\fi%
  \ethnum@two%
}
\newcommand{\ethnum@four}[1]{%
  \ethnum@tens#1%
  \ifnum#1>0\relax ፻\fi%
  \ethnum@three%
}
\newcommand{\ethnum@five}[1]{%
  \ifnum#1>1\relax\ethnum@one#1\fi%
  \ifnum#1>0\relax ፼\fi%
  \ethnum@four%
}
\newcommand{\ethnum@six}[1]{%
  \ethnum@tens#1%
  \ifnum#1>0\relax ፼\fi%
  \ethnum@five%
}

%    \end{macrocode}
% \iffalse
%</gloss-amharic.ldf>
%<*gloss-arabic.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-arabic.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-arabic.ldf}[polyglossia: module for arabic]
\ifluatex
  \xpg@warning{Arabic is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\RequireBidi
\RequirePackage{arabicnumbers}
\RequirePackage{hijrical}

\PolyglossiaSetup{arabic}{
  script=Arabic,
  direction=RL,
  langtag=ARA,
  scripttag=arab,
  hyphennames={nohyphenation},
  fontsetup=true
  %TODO localalph={abjad,abjad}
  %TODO localnumber=arabicnumber
}

\newif\ifeastern@numerals
\def\tmp@mashriq{mashriq}
\def\tmp@maghrib{maghrib}
\define@key{arabic}{numerals}[mashriq]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@mashriq%
    \eastern@numeralstrue%
  \else
    \ifx\@tmpa\tmp@maghrib\eastern@numeralsfalse\fi%
  \fi}

%this is needed for \abjad in arabicnumbers.sty
\def\tmp@true{true}
\define@key{arabic}{abjadjimnotail}[true]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@true\abjad@jim@notailtrue%
  \else
    \abjad@jim@notailfalse
  \fi}

\def\tmp@morocco{morocco}
\def\tmp@algeria{algeria}
\define@key{arabic}{locale}[default]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@morocco%
    \eastern@numeralsfalse%
  \else
    \ifx\@tmpa\tmp@algeria%
      \eastern@numeralsfalse%
    \fi%
  \fi%
  \gdef\@@arabic@month{\@arabic@month{#1}}}

\newif\if@hijrical
\def\tmp@hijri{hijri}
\def\tmp@islamic{islamic}
\define@key{arabic}{calendar}[gregorian]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@hijri\@hijricaltrue%
  \else
    \ifx\@tmpa\tmp@islamic\@hijricaltrue%
    \else\@hijricalfalse%
    \fi
  \fi}

\define@key{arabic}{hijricorrection}[0]{%
  \gdef\@hijri@correction{#1}}%

% This should set the defaults
\setkeys{arabic}{locale,calendar,numerals,hijricorrection,abjadjimnotail=false}

\def\arabicgregmonth@default#1{\ifcase#1%
  % Egypt, Sudan, Yemen and Golf states
  \or يناير\or فبراير\or مارس\or أبريل\or مايو\or يونيو\or يوليو\or أغسطس\or سبتمبر\or أكتوبر\or نوفمبر\or ديسمبر\fi}
\def\arabicgregmonth@mashriq#1{\ifcase#1%
  % Iraq Syria Jordan Lebanon Palestine
  \or  كانون الثاني\or شباط\or آذار\or نيسان\or أيار\or حزيران\or تموز\or آب\or أيلول\or تشرين الأول\or تشرين الثاني\or كانون الأول\fi}
\def\arabicgregmonth@libya#1{\ifcase#1%
  %Lybia «تعرف في ليبيا بأسماء عربية وضعها معمر القذافي ترمز إلى فصول السنة وبعض الشخصيات التاريخية» (ar.wikipedia.org)
  \or أي النار\or النوار\or الربيع\or الطير\or الماء\or الصيف\or ناصر\or هانيبال\or الفاتح\or التمور\or الحرث\or الكانون\fi}
\def\arabicgregmonth@morocco#1{\ifcase#1%
  \or يناير\or فبراير\or مارس\or أبريل\or ماي\or يونيو\or يوليوز\or غشت\or شتنبر\or أكتوبر\or نونبر\or دجنبر\fi}
\def\arabicgregmonth@algeria#1{\ifcase#1%
  % Tunisia and Algeria
  \or جانفي\or فيفري\or مارس\or أفريل\or ماي\or جوان\or جويلية\or أوت\or سبتمبر\or أكتوبر\or نوفمبر\or ديسمبر\fi}
\let\arabicgregmonth@tunisia\arabicgregmonth@algeria
\def\arabicgregmonth@mauritania#1{\ifcase#1%
  \or يناير\or فبراير\or مارس\or إبريل\or مايو\or يونيو\or يوليو\or أغشت\or شتمبر\or أكتوبر\or نوفمبر\or دجمبر\fi}

\def\@arabic@month#1{\ifcsdef{arabicgregmonth@#1}{\expandafter\csname arabicgregmonth@#1\endcsname}%
{\xpg@warning{Option `locale=#1' is not defined for Arabic: using `default' instead}%
\arabicgregmonth@default}}

%\Hijritoday is now locale-aware and will format the date with this macro:
\DefineFormatHijriDate{arabic}{\@ensure@RTL{\arabicnumber{\value{Hijriday}}%
  \space\HijriMonthArabic{\value{Hijrimonth}}\space\arabicnumber{\value{Hijriyear}}}}

\def\captionsarabic{%
  \def\prefacename{\@ensure@RTL{مدخل}}%
  \def\refname{\@ensure@RTL{المراجع}}%
  \def\abstractname{\@ensure@RTL{ملخص}}%
  \def\bibname{\@ensure@RTL{المصادر}}%
  \def\chaptername{\@ensure@RTL{باب}}%
  \def\appendixname{\@ensure@RTL{الملاحق}}%
  \def\contentsname{\@ensure@RTL{المحتويات}}%
  %\def\contentsname{\@ensure@RTL{الفهرس}}%
  \def\listfigurename{\@ensure@RTL{قائمة الأشكال}}%
  \def\listtablename{\@ensure@RTL{قائمة الجداول}}%
  \def\indexname{\@ensure@RTL{الفهرس}}%
  \def\figurename{\@ensure@RTL{شكل}}%
  \def\tablename{\@ensure@RTL{جدول}}%
  \def\partname{\@ensure@RTL{القسم}}%
  \def\enclname{\@ensure@RTL{المرفقات}}%<-- Needs translation
  \def\ccname{\@ensure@RTL{نسخة ل‬}}% <<
  \def\headtoname{\@ensure@RTL{إلى}}%<-- Needs translation
  \def\pagename{\@ensure@RTL{صفحة}}%
  \def\seename{\@ensure@RTL{راجع}}%\alefhamza\nun\za\ra
  \def\alsoname{\@ensure@RTL{راجع أيضًا}}%<<\alefhamza\nun\za\ra
  \def\proofname{\@ensure@RTL{برهان}}%
  \def\glossaryname{\@ensure@RTL{قاموس}}%<<
}
\def\datearabic{%
 \def\today{%
  \if@hijrical%
    \Hijritoday[\@hijri@correction]%
  \else%
    \if@RTL%
       \arabicnumber\day\space\@@arabic@month{\month}%
        \space\arabicnumber\year%
    \else% in LR environment we format the gregorian date within \textenglish
       \ifcsdef{english@loaded}{\textenglish{\today}}%else US format
       {\normalfontlatin\ifcase\month\or January\or February\or March\or April\or May\or June\or%
       July\or August\or September\or October\or November\or December\fi%
       \space\number\day,\space\number\year}%
    \fi%
 \fi}}

\def\arabicnumber#1{%
  \ifeastern@numerals
    \arabicdigits{\number#1}%
  \else
    %%\RL{\protect\reset@font\number#1}%
    \number#1%
  \fi}

\def\@ornatebracearabic#1{\RL{\char"FD3F\@arabic#1\char"FD3E}}
\def\@ornatebracealph#1{\RL{\char"FD3F\@alph#1\char"FD3E}}

\def\abjadmaghribi#1{%
\ifnum#1>1999\xpg@ill@value{#1}{abjad}%
\else
  \ifnum#1<\z@\space\xpg@ill@value{#1}{abjad}%
  \else
    \ifnum#1<10\expandafter\abj@num@i\number#1%
    \else
      \ifnum#1<100\expandafter\abj@maghribi@num@ii\number#1%
      \else
        \ifnum#1<\@m\expandafter\abj@maghribi@num@iii\number#1%
        \else
          \ifnum#1<\@M\expandafter\abj@maghribi@num@iv\number#1%
          \fi
        \fi
      \fi
    \fi
  \fi
\fi
}

%maghribi س -> ص ص -> ض ش -> س ض -> ظ ظ -> غ غ -> ش
\def\abj@maghribi@num@ii#1{%
  \ifcase#1\or ي\or ك\or ل\or م\or ن%
           \or ص\or ع\or ف\or ض\fi
  \ifnum#1=\z@\abjad@zero\fi\abj@num@i}
\def\abj@maghribi@num@iii#1{%
  \ifcase#1\or ق\or ر\or س\or ت\or ث%
           \or خ\or ذ\or ظ\or غ\fi
  \ifnum#1=\z@\fi\abj@maghribi@num@ii}
\def\abj@maghribi@num@iv#1{%
  \ifcase#1\or ش\fi
  \ifnum#1=\z@\fi\abj@maghribi@num@iii}

\def\arabic@numbers{%
   \let\@origalph\@alph%
   \let\@origAlph\@Alph%
   \let\@alph\abjad%
   \let\@Alph\abjad%
}
\def\noarabic@numbers{%
  \let\@alph\@origalph%
  \let\@Alph\@origAlph%
  }

\def\arabic@globalnumbers{%
  \let\orig@arabic\@arabic%
  \let\@arabic\arabicnumber%
  \renewcommand\thefootnote{\protect\arabicnumber{\c@footnote}}%
  }

\def\noarabic@globalnumbers{
   \let\@arabic\orig@arabic%
   \renewcommand\thefootnote{\protect\number{\c@footnote}}%
   }

\def\blockextras@arabic{%
   \let\orig@MakeUppercase\MakeUppercase%
   \def\MakeUppercase##1{##1}%
   % TODO disable \@Roman and \@roman ?
   }
\def\noextras@arabic{%
   \let\MakeUppercase\orig@MakeUppercase%
   }

%    \end{macrocode}
% \iffalse
%</gloss-arabic.ldf>
%<*gloss-armenian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-armenian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-armenian.ldf}[polyglossia: module for armenian]

\PolyglossiaSetup{armenian}{
  script=Armenian,
  scripttag=armn,
  langtag=HYE,
  hyphennames={armenian},
  hyphenmins={2,2},
  fontsetup=true
}

%\def\captionsarmenian{%
%   \def\refname{}%
%   \def\abstractname{}%
%   \def\bibname{}%
%   \def\prefacename{}%
%   \def\chaptername{}%
%   \def\appendixname{}%
%   \def\contentsname{}%
%   \def\listfigurename{}%
%   \def\listtablename{}%
%   \def\indexname{}%
%   \def\authorname{}%
%   \def\figurename{}%
%   \def\tablename{}%
%   %\def\thepart{}%
%   \def\partname{}%
%   \def\pagename{}%
%   \def\seename{}%
%   \def\alsoname{}%
%   \def\enclname{}%
%   \def\ccname{}%
%   \def\headtoname{}%
%   \def\proofname{}%
%   \def\glossaryname{}%
%}
\def\datearmenian{%
   \def\today{\ifcase\month\or
    Յունուար\or
    Փետրուար\or
    Մարտ\or
    Ապրիլ\or
    Մայիս\or
    Յունիս\or
    Յուլիս\or
    Օգոստոս\or
    Սեպտեմբեր\or
    Հոկտեմբեր\or
    Նոյեմբեր\or
    Դեկտեմբեր\fi
    \number\day,\space\number\year}}
%    \end{macrocode}
% \iffalse
%</gloss-armenian.ldf>
%<*gloss-asturian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-asturian.ldf}
%    \begin{macrocode}
% Translated by Xuacu <xuacusk8 at gmail dot com>
% Contributed by Kevin Godby <godbyk at gmail dot com>
%
\ProvidesFile{gloss-asturian.ldf}[polyglossia: module for asturian]
\PolyglossiaSetup{asturian}{
  hyphennames={asturian,catalan},
  hyphenmins={2,2},
  frenchspacing=true,
  indentfirst=true,
  fontsetup=true,
}

\def\captionsasturian{%
   \def\prefacename{Entamu}%
   \def\refname{Referencies}%
   \def\abstractname{Sumariu}%
   \def\bibname{Bibliografía}%
   \def\chaptername{Capítulu}%
   \def\appendixname{Apéndiz}%
   \def\contentsname{Conteníu}%
   \def\listfigurename{Llista de figures}%
   \def\listtablename{Llista de tables}%
   \def\indexname{Índiz}%
   \def\figurename{Figura}%
   \def\tablename{Tabla}%
   \def\partname{Parte}%
   \def\enclname{incl.}%
   \def\ccname{cc}%
   \def\headtoname{Pa}%
   \def\pagename{Páxina}%
   \def\seename{ver}%
   \def\alsoname{ver tamién}%
   \def\proofname{Demostración}%
   \def\glossaryname{Glosariu}%
   }
\def\dateasturian{%
   \def\today{\number\day~\ifcase\month\or
    de~xineru\or de~febreru\or de~marzu\or d'abril\or de~mayu\or de~xunu\or
    de~xunetu\or d'agostu\or de~setiembre\or d'ochobre\or de~payares\or
    d'avientu\fi\space de~\number\year}%
}

%    \end{macrocode}
% \iffalse
%</gloss-asturian.ldf>
%<*gloss-bahasai.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-bahasai.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-bahasai.ldf}[polyglossia: module for bahasa indonesia]
\RequirePackage{hijrical}

\PolyglossiaSetup{bahasai}{%
  language=Bahasa Indonesia,
  hyphennames={indonesian,indon,bahasai,bahasa,bahasam,malay,melayu},
  hyphenmins={2,2},
  fontsetup=true}

\def\captionsbahasai{%
   \def\refname{Pustaka}%
   \def\abstractname{Ringkasan}%
   \def\bibname{Bibliografi}%
   \def\prefacename{Pendahuluan}%
   \def\chaptername{Bab}%
   \def\appendixname{Lampiran}%
   \def\contentsname{Daftar Isi}%
   \def\listfigurename{Daftar Gambar}%
   \def\listtablename{Daftar Tabel}%
   \def\indexname{Indeks}%
   \def\figurename{Gambar}%
   \def\tablename{Tabel}%
   %\def\thepart{}%
   \def\partname{Bagian}%
   \def\pagename{Halaman}%
   \def\seename{lihat}%
   \def\alsoname{lihat juga}%
   \def\enclname{Lampiran}%
   \def\ccname{cc}%
   \def\headtoname{Kepada}%
   \def\proofname{Bukti}%
   \def\glossaryname{Daftar Istilah}%
   }
\def\datebahasai{%
   \def\today{\number\day~\ifcase\month\or
    Januari\or Pebruari\or Maret\or April\or Mei\or Juni\or
    Juli\or Agustus\or September\or Oktober\or Nopember\or Desember\fi
    \space \number\year}}

\def\hijrimonthbahasai#1{\ifcase#1%
\or Muharram\or Safar\or Rabiul awal\or Rabiul akhir\or Jumadil awal\or Jumadil akhir\or Rajab%
\or Sya'ban\or Ramadhan\or Syawal\or Dzulkaidah\or Dzulhijjah\fi}
\DefineFormatHijriDate{bahasai}{%
\number\value{Hijriday}\space\hijrimonthbahasai{\value{Hijrimonth}}\space\number\value{Hijriyear}}

%    \end{macrocode}
% \iffalse
%</gloss-bahasai.ldf>
%<*gloss-bahasam.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-bahasam.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-bahasam.ldf}[polyglossia: module for bahasa melayu]
\RequirePackage{hijrical}
\PolyglossiaSetup{bahasam}{%
  language=Bahasa Melayu,
  hyphennames={malay,melayu,bahasam,bahasa,bahasai,indonesian,indon},
  hyphenmins={2,2},
  fontsetup=true}

\def\captionsbahasam{%
   \def\refname{Rujukan}%
   \def\abstractname{Abstrak}%
   \def\bibname{Bibliografi}%
   \def\prefacename{Pendahuluan}%
   \def\chaptername{Bab}%
   \def\appendixname{Lampiran}%
   \def\contentsname{Kandungan}%
   \def\listfigurename{Senarai Rajah}%
   \def\listtablename{Senarai Jadual}%
   \def\indexname{Indeks}%
   \def\figurename{Rajah}%
   \def\tablename{Jadual}%
   \def\thepart{}%
   \def\partname{Bahagian}%
   \def\pagename{Halaman}%
   \def\seename{lihat}%
   \def\alsoname{lihat juga}%
   \def\enclname{Lampiran}%
   \def\ccname{salinan kpd}%
   \def\headtoname{Kepada}%
   \def\proofname{Bukti}%
   \def\glossaryname{Senarai Istilah}%
   }
\def\datebahasam{%
   \def\bahasam@day{%
      \ifcase\day\or%
        1hb\or 2hb\or 3hb\or 4hb\or 5hb\or%
        6hb\or 7hb\or 8hb\or 9hb\or 10hb\or%
        11hb\or 12hb\or 13hb\or 14hb\or 15hb\or%
        16hb\or 17hb\or 18hb\or 19hb\or 20hb\or%
        21hb\or 22hb\or 23hb\or 24hb\or 25hb\or%
        26hb\or 27hb\or 28hb\or 29hb\or 30hb\or%
        31hb\fi}%
   \def\today{\bahasam@day~\ifcase\month\or
    Januari\or Februari\or Mac\or April\or Mei\or Jun\or
    Julai\or Ogos\or September\or Oktober\or November\or Disember\fi
    \space \number\year}}

\def\hijrimonthbahasam#1{\ifcase#1%
\or Muharram\or Safar\or Rabiulawal\or Rabiulakhir\or Jamadilawal\or Jamadilakhir\or Rejab%
\or Syaaban\or Ramadan\or Syawal\or Zulkaedah\or Zulhijah\fi}
\DefineFormatHijriDate{bahasam}{%
\number\value{Hijriday}\space\hijrimonthbahasam{\value{Hijrimonth}}\space\number\value{Hijriyear}}

%    \end{macrocode}
% \iffalse
%</gloss-bahasam.ldf>
%<*gloss-basque.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-basque.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-basque.ldf}[polyglossia: module for basque]
\PolyglossiaSetup{basque}{
  hyphennames={basque},
  hyphenmins={2,2},
  indentfirst=true,
  fontsetup=true,
}

\def\captionsbasque{%
   \def\refname{Erreferentziak}%
   \def\abstractname{Laburpena}%
   \def\bibname{Bibliografia}%
   \def\prefacename{Hitzaurrea}%
   \def\chaptername{Kapitulua}%
   \def\appendixname{Eranskina}%
   \def\contentsname{Gaien Aurkibidea}%
   \def\listfigurename{Irudien Zerrenda}%
   \def\listtablename{Taulen Zerrenda}%
   \def\indexname{Kontzeptuen Aurkibidea}%
   \def\figurename{Irudia}%
   \def\tablename{Taula}%
   \def\thepart{}%
   \def\partname{Atala}%
   \def\pagename{Orria}%
   \def\seename{Ikusi}%
   \def\alsoname{Ikusi, halaber}%
   \def\enclname{Erantsia}%
   \def\ccname{Kopia}%
   \def\headtoname{Nori}%
   \def\proofname{Frogapena}%
   \def\glossaryname{Glosarioa}%
   }
\def\datebasque{%
   \def\today{\number\year.eko\space\ifcase\month\or
    urtarrilaren\or otsailaren\or martxoaren\or apirilaren\or
    maiatzaren\or ekainaren\or uztailaren\or abuztuaren\or
    irailaren\or urriaren\or azaroaren\or
    abenduaren\fi~\number\day}}

%    \end{macrocode}
% \iffalse
%</gloss-basque.ldf>
%<*gloss-bengali.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-bengali.ldf}
%    \begin{macrocode}
% Translations provided by সাজেদুর রহিম জোয়ারদার <toshazed@gmail.com>
% TODO implement Bengali calendar

\ProvidesFile{gloss-bengali.ldf}[polyglossia: module for bengali]
\ifluatex
  \xpg@warning{Bengali is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\RequirePackage{devanagaridigits}
\RequirePackage{bengalidigits}

\PolyglossiaSetup{bengali}{
  script=Bengali,
  scripttag=beng,
  langtag=BEN,
  hyphennames={bengali},
  hyphenmins={2,2},%CHECK
  fontsetup=true,
  %TODO nouppercase=true,
  %TODO localnumber=bengalinumber
}

\def\tmp@western{Western}
\newif\ifbengali@devanagari@numerals
\bengali@devanagari@numeralstrue
\def\tmp@bengali{Bengali}
\newif\ifbengali@bengali@numerals
\bengali@bengali@numeralsfalse % Implied, but you never know


\define@key{bengali}{numerals}[Devanagari]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@western
    \bengali@devanagari@numeralsfalse
  \else\ifx\@tmpa\tmp@bengali
    \bengali@devanagari@numeralsfalse
    \bengali@bengali@numeralstrue\fi
  \fi}

\def\extras@bengali{}
\def\noextras@bengali{}

\define@boolkey{bengali}[bengali@]{changecounternumbering}{
  \def\@tmpa{#1}
  \def\@tmptrue{true}
  \ifx\@tmpa\@tmptrue
    \def\extras@bengali{%
      % FIXME Tied to the article class!  And horrible coding style
      \let\savethepage\thepage
      \let\savethesection\thesection
      \let\savethesubsection\thesubsection
      \let\savethesubsubsection\thesubsubsection
      \let\savetheparagraph\theparagraph
      \let\savethesubparagraph\thesubparagraph
      \def\thepage{\bengalinumeral{page}}
      \def\thesection{\bengalinumeral{section}}
      \def\thesubsection{\bengalinumeral{subsection}}
      \def\thesubsubsection{\bengalinumeral{subsubsection}}
      \def\theparagraph{\bengalinumeral{paragraph}}
      \def\thesubparagraph{\bengalinumeral{subparagraph}}
    }
    \def\noextras@bengali{%
      \let\thepage\savethepage
      \let\thesection\savethesection
      \let\thesubsection\savethesubsection
      \let\thesubsubsection\savethesubsubsection
      \let\theparagraph\savetheparagraph
      \let\thesubparagraph\savethesubparagraph
    }
  \fi
}

\def\captionsbengali{%
  \def\refname{তথ্যসুত্রসমূহ}%
  \def\abstractname{সারসংক্ষেপ}%
  \def\bibname{তথ্যবিবরণ}%
  \def\prefacename{পূর্বকথা}%
  \def\chaptername{অধ্যায়}%
  \def\appendixname{পরিশিষ্ট}%
  \def\contentsname{সূচীপত্র}%
  \def\listfigurename{ছবি/নকশা সমূহের তালিকা}%
  \def\listtablename{তালিকাসারণী}%
  \def\indexname{সূচক/নির্দেশক}%
  \def\figurename{ছবি/নকশা}%
  \def\tablename{সারনী}%
  %\def\thepart{}% TODO
  \def\partname{খন্ড}%
  \def\pagename{পৃষ্ঠা}%
  \def\seename{দেখুন}%
  \def\alsoname{আরও দেখুন}%
  \def\enclname{সংযুক্তি}%
  \def\ccname{অনুলিপি}%
  \def\headtoname{প্রতি}%
  \def\proofname{প্রমাণ}%
  \def\glossaryname{পরিভাষার শব্দসম্ভার}%
}
\def\datebengali{%
  \def\bengalimonth{%
    \ifcase\month\or
      জানুয়ারী\or
      ফেব্রুয়ারী\or
      মার্চ\or
      এপ্রিল\or
      মে\or
      জুন\or
      জুলাই\or
      আগষ্ট\or
      সেপ্টেম্বর\or
      অক্টোবর\or
      নভেম্বর\or
      ডিসেম্বর\fi}%
  \def\today{\bengalinumber\day\space\bengalimonth\space\bengalinumber\year}%
}

\def\bengalinumber#1{%
  \ifbengali@devanagari@numerals
    \devanagaridigits{\number#1}%
  \else
    \ifbengali@bengali@numerals
      \bengalidigits{\number#1}%
    \else % Assumed Western
      \number#1%
    \fi
  \fi}

\def\bengalinumber#1{\bengalidigits{\number#1}}% Takes number
\def\bengalinumeral#1{\bengalinumber{\csname c@#1\endcsname}}% Takes counter

\def\blockextras@bengali{\extras@bengali}
\def\inlineextras@bengali{\extras@bengali}

%    \end{macrocode}
% \iffalse
%</gloss-bengali.ldf>
%<*gloss-brazil.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-brazil.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-brazil.ldf}[polyglossia: module for portuguese]
\PolyglossiaSetup{brazil}{
  language=Brazilian Portuguese,
  hyphennames={brazil,portuguese,portuges},
  hyphenmins={2,3},
  fontsetup=true,
}

\def\captionsbrazil{%
   \def\refname{Referências}%
   \def\abstractname{Resumo}%
   \def\bibname{Referências Bibliográficas}%
   \def\prefacename{Prefácio}%
   \def\chaptername{Capítulo}%
   \def\appendixname{Apêndice}%
   \def\contentsname{Sumário}%
   \def\listfigurename{Lista de Figuras}%
   \def\listtablename{Lista de Tabelas}%
   \def\indexname{Índice Remissivo}%
   \def\figurename{Figura}%
   \def\tablename{Tabela}%
   %\def\thepart{}%
   \def\partname{Parte}%
   \def\pagename{Página}%
   \def\seename{veja}%
   \def\alsoname{veja também}%
   \def\enclname{Anexo}%
   \def\ccname{Cópia para}%
   \def\headtoname{Para}%
   \def\proofname{Demonstração}%
   \def\glossaryname{Glossário}%
   }
\def\datebrazil{%   
   \def\today{\number\day\space de\space\ifcase\month\or
      janeiro\or fevereiro\or março\or abril\or maio\or junho\or
      julho\or agosto\or setembro\or outubro\or novembro\or dezembro%
      \fi\space de\space\number\year}%
      }
     
%    \end{macrocode}
% \iffalse
%</gloss-brazil.ldf>
%<*gloss-breton.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-breton.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-breton.ldf}[polyglossia: module for breton]
\PolyglossiaSetup{breton}{
  hyphennames={breton},
  hyphenmins={2,2},
  frenchspacing=true,
  indentfirst=true,
  fontsetup=true,
}

\ifluatex
  % TODO
\else
  \newXeTeXintercharclass\breton@punctthin % ! ? ;
  \newXeTeXintercharclass\breton@punctthick % :
\fi

\def\breton@punctthinspace{{\unskip\thinspace}}
\def\breton@punctthickspace{{\unskip\nobreakspace}}

\def\breton@punctuation{%
  \ifluatex
    % TODO
  \else
    \XeTeXinterchartokenstate=1%
    \XeTeXcharclass `\! \breton@punctthin
    \XeTeXcharclass `\? \breton@punctthin
    \XeTeXcharclass `\; \breton@punctthin
    \XeTeXcharclass `\: \breton@punctthick
    \XeTeXinterchartoks \z@ \breton@punctthin = \breton@punctthinspace
    \XeTeXinterchartoks \z@ \breton@punctthick = \breton@punctthickspace
  \fi
}

\def\nobreton@punctuation{%
  \ifluatex
    % TODO
  \else
    \XeTeXcharclass `\! \z@
    \XeTeXcharclass `\? \z@
    \XeTeXcharclass `\; \z@
    \XeTeXcharclass `\: \z@
    \XeTeXinterchartokenstate=0%
  \fi
}


\def\captionsbreton{%
   \def\refname{Daveennoù}%
   \def\abstractname{Dvierrañ}%
   \def\bibname{Lennadurezh}%
   \def\prefacename{Rakskrid}%
   \def\chaptername{Pennad}%
   \def\appendixname{Stagadenn}%
   \def\contentsname{Taolenn}%
   \def\listfigurename{Listenn ar Figurennoù}%
   \def\listtablename{Listenn an taolennoù}%
   \def\indexname{Meneger}%
   \def\figurename{Figurenn}%
   \def\tablename{Taolenn}%
   \def\thepart{}%
   \def\partname{Lodenn}%
   \def\pagename{Pajenn}%
   \def\seename{Gwelout}%
   \def\alsoname{Gwelout ivez}%
   \def\enclname{Dielloù kevret}%
   \def\ccname{Eilskrid da}%
   \def\headtoname{evit}%
   \def\proofname{Proof}%
   \def\glossaryname{Glossary}%
   }
\def\datebreton{%
   \def\today{\ifnum\day=1\relax 1\/\textsuperscript{añ}\else
    \number\day\fi \space a\space viz\space\ifcase\month\or
    Genver\or C'hwevrer\or Meurzh\or Ebrel\or Mae\or Mezheven\or
    Gouere\or Eost\or Gwengolo\or Here\or Du\or Kerzu\fi
    \space\number\year}}

\def\noextras@breton{%
   \nobreton@punctuation%
   }

\def\blockextras@breton{%
   \breton@punctuation%
   }

\def\inlineextras@breton{%
   \breton@punctuation%
   }

%    \end{macrocode}
% \iffalse
%</gloss-breton.ldf>
%<*gloss-bulgarian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-bulgarian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-bulgarian.ldf}[polyglossia: module for bulgarian]
\PolyglossiaSetup{bulgarian}{
  script=Cyrillic,
  scripttag=cyrl,
  langtag=BGR,
  hyphennames={bulgarian},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup
  %TODO localalph=bulgarian@alph
}

\def\bulgarian@Alph#1{%
   \ifcase#1\or
   А\or Б\or В\or Г\or Д\or Е\or Ж\or
   З\or И\or Й\or К\or Л\or М\or Н\or
   О\or П\or Р\or С\or Т\or У\or Ф\or
   Х\or Ц\or Ч\or Ш\or Щ\or Ъ\or
   Ю\or Я\else
   \xpg@ill@value{#1}{bulgarian@Alph}\fi}%

\def\bulgarian@alph#1{%
   \ifcase#1\or
   а\or б\or в\or г\or д\or е\or ж\or
   з\or и\or й\or к\or л\or м\or н\or
   о\or п\or р\or с\or т\or у\or ф\or
   х\or ц\or ч\or ш\or щ\or ъ\or ь\or
   ю\or я\else
   \xpg@ill@value{#1}{bulgarian@alph}\fi}%

\def\bulgarian@numbers{%
   \let\latin@Alph\@Alph%
   \let\latin@alph\@alph%
   \let\@Alph\bulgarian@Alph%
   \let\@alph\bulgarian@alph%
 }

\def\nobulgarian@numbers{%
   \let\@Alph\latin@Alph%
   \let\@alph\latin@alph%
}

\def\captionsbulgarian{%
   \def\refname{Литература}%
   \def\abstractname{Абстракт}%
   \def\bibname{Библиография}%
   \def\prefacename{Предговор}%
   \def\chaptername{Глава}%
   \def\appendixname{Приложение}%
   \def\contentsname{Съдържание}%
   \def\listfigurename{Списък на фигурите}%
   \def\listtablename{Списък на таблиците}%
   \def\indexname{Азбучен указател}%
   \def\figurename{Фигура}%
   \def\tablename{Таблица}%
   %\def\thepart{}%
   %\def\partname{}%
   \def\pagename{Стр.}%
   \def\seename{вж.}%
   \def\alsoname{вж.\ също и}%
   \def\enclname{Приложения}%
   \def\ccname{копия}%
   %\def\headtoname{}%
   \def\proofname{Proof}%
   \def\glossaryname{Glossary}%
   }
\def\datebulgarian{%
   \def\today{\number\day~\ifcase\month\or
       януари\or
       февруари\or
       март\or
       април\or
       май\or
       юни\or
       юли\or
       август\or
       септември\or
       октомври\or
       ноември\or
       декември\fi%
       \ \number\year~г.}%
    \def\month@Roman{\expandafter\@Roman\month}%
    \def\todayRoman{\number\day.\,\month@Roman.\,\number\year~г.}%
    }

%    \end{macrocode}
% \iffalse
%</gloss-bulgarian.ldf>
%<*gloss-catalan.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-catalan.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-catalan.ldf}[polyglossia: module for catalan]
\PolyglossiaSetup{catalan}{
  hyphennames={catalan},
  hyphenmins={2,2},
  frenchspacing=true,
  indentfirst=true,
  fontsetup=true,
}

\define@boolkey{catalan}[catalan@]{babelshorthands}[true]{}
\ifsystem@babelshorthands
  \setkeys{catalan}{babelshorthands=true}
\else
  \setkeys{catalan}{babelshorthands=false}
\fi
\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
}{}

%%% adapted from Babel's catalan.ldf
\newdimen\leftllkern \newdimen\rightllkern \newdimen\raiselldim
% we check if char · exists, and use it instead of raised dot:
\def\xpg@raiseddot{%
  \ifluatex %
    \expandafter\ifnum\directlua{polyglossia.check_char(183)} > 0\hbox{\char"00B7}%
    \else\raise\raiselldim\hbox{.}%
    \fi %
  \else %
    \ifnum\XeTeXcharglyph"00B7 > 0\hbox{\char"00B7}% why a hbox here?
      \else\raise\raiselldim\hbox{.}%
    \fi %
  \fi %
  }
\def\lgem{%
  \ifmmode
    \csname normal@char\string"\endcsname l%
  \else
    \leftllkern=0pt\rightllkern=0pt\raiselldim=0pt%
    \setbox0\hbox{l}\setbox1\hbox{l\/}%
    \ifluatex %
      \expandafter\ifnum\directlua{polyglossia.check_char(183)} > 0\setbox2\hbox{\char"00B7}%
      \else\setbox2\hbox{.}%
      \fi %
    \else %
      \ifnum\XeTeXcharglyph"00B7 > 0\setbox2\hbox{\char"00B7}%
        \else\setbox2\hbox{.}%
      \fi %
    \fi %
    \advance\raiselldim by \the\fontdimen5\the\font
    \advance\raiselldim by -\ht2%
    \leftllkern=-.25\wd0%
    \advance\leftllkern by \wd1%
    \advance\leftllkern by -\wd0%
    \rightllkern=-.25\wd0%
    \advance\rightllkern by -\wd1%
    \advance\rightllkern by \wd0%
    \allowhyphens\discretionary{l-}{l}%
    {\hbox{l}\kern\leftllkern\xpg@raiseddot%
      \kern\rightllkern\hbox{l}}\allowhyphens
  \fi
}
\def\Lgem{%
  \ifmmode
    \csname normal@char\string"\endcsname L%
  \else
    \leftllkern=0pt\rightllkern=0pt\raiselldim=0pt%
    \setbox0\hbox{L}\setbox1\hbox{L\/}%
    \ifluatex %
      \expandafter\ifnum\directlua{polyglossia.check_char(183)} > 0\setbox2\hbox{\char"00B7}%
      \else\setbox2\hbox{.}%
      \fi %
    \else %
      \ifnum\XeTeXcharglyph"00B7 > 0\setbox2\hbox{\char"00B7}%
        \else\setbox2\hbox{.}%
      \fi %
    \fi %
    \advance\raiselldim by .5\ht0%
    \advance\raiselldim by -.5\ht2%
    \leftllkern=-.125\wd0%
    \advance\leftllkern by \wd1%
    \advance\leftllkern by -\wd0%
    \rightllkern=-\wd0%
    \divide\rightllkern by 6%
    \advance\rightllkern by -\wd1%
    \advance\rightllkern by \wd0%
    \allowhyphens\discretionary{L-}{L}%
    {\hbox{L}\kern\leftllkern\xpg@raiseddot%
      \kern\rightllkern\hbox{L}}\allowhyphens
  \fi
}
\AtBeginDocument{%
  \let\lslash\l
  \let\Lslash\L
  \DeclareRobustCommand\l{\@ifnextchar.\bbl@l{\@ifnextchar·\bbl@l\lslash}}
  \DeclareRobustCommand\L{\@ifnextchar.\bbl@L{\@ifnextchar·\bbl@L\Lslash}}}
\def\bbl@l#1#2{\lgem}
\def\bbl@L#1#2{\Lgem}

\def\catalan@shorthands{%
  \bbl@activate{"}%
  \def\language@group{catalan}%
  \declare@shorthand{catalan}{"l}{\lgem{}}
  \declare@shorthand{catalan}{"L}{\Lgem{}}
}

\def\nocatalan@shorthands{%
    \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
}

\def\captionscatalan{%
   \def\refname{Referències}%
   \def\abstractname{Resum}%
   \def\bibname{Bibliografia}%
   \def\prefacename{Pròleg}%
   \def\chaptername{Capítol}%
   \def\appendixname{Apèndix}%
   \def\contentsname{Índex}%
   \def\listfigurename{Índex de figures}%
   \def\listtablename{Índex de taules}%
   \def\indexname{Índex alfabètic}%
   \def\figurename{Figura}%
   \def\tablename{Taula}%
   %\def\thepart{}%
   \def\partname{Part}%
   \def\pagename{Pàgina}%
   \def\seename{Vegeu}%
   \def\alsoname{Vegeu també}%
   \def\enclname{Adjunt}%
   \def\ccname{Còpies a}%
   \def\headtoname{A}%
   \def\proofname{Demostració}%
   \def\glossaryname{Glossari}%
   }
\def\datecatalan{%
   \def\today{\number\day~\ifcase\month\or
    de gener\or de febrer\or de març\or d'abril\or de maig\or
    de juny\or de juliol\or d'agost\or de setembre\or d'octubre\or
    de novembre\or de desembre\fi
    \space de~\number\year}}

\def\noextras@catalan{%
   \nocatalan@shorthands%
}

\def\blockextras@catalan{%
   \ifcatalan@babelshorthands\catalan@shorthands\fi%
}

\def\inlineextras@catalan{%
   \ifcatalan@babelshorthands\catalan@shorthands\fi%
}
%    \end{macrocode}
% \iffalse
%</gloss-catalan.ldf>
%<*gloss-classiclatin.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-classiclatin.ldf}
%    \begin{macrocode}
%%
%% This is file `gloss-classiclatin.ldf',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gloss-latin.dtx  (with options: `laclassic')
%%   ------------------------------------------------------------------
%%   Latin module for polyglossia
%%   Copyright (C) Claudio Beccari 2013-2016
%%   Copyright (C) Élie Roux 2016
%%   This work is distributed under the MIT License.
%% 
%%   See the postamble.
%%   ------------------------------------------------------------------
\ProvidesFile{gloss-classiclatin.ldf}
        [2016/09/10 v.1.03 Latin support from polyglossia]
%%


\PolyglossiaSetup{classiclatin}{%
      hyphennames={classiclatin},
      hyphenmins={2,2},
      frenchspacing=true,
      fontsetup=true,
}
\def\classicuclccodes{\lccode`\V=`\u \uccode`\u=`\V}
\def\noclassicuclccodes{\lccode`\V=`\v \uccode`\u=`\U}
\def\classiclatincaptions{%
   \def\prefacename{Praefatio}%
   \def\refname{Conspectus librorum}%
   \def\abstractname{Summarium}%
   \def\bibname{Conspectus librorum}%
   \def\chaptername{Caput}%
   \def\appendixname{Additamentum}%
   \def\contentsname{Index}%
   \def\listfigurename{Conspectus descriptionum}%
   \def\listtablename{Conspectus tabularum}%
   \def\indexname{Index rerum notabilium}%
   \def\figurename{Descriptio}%
   \def\tablename{Tabula}%
   \def\partname{Pars}%
   \def\enclname{Additur}%
   \def\ccname{Exemplar}%
   \def\headtoname{\ignorespaces}%
   \def\pagename{charta}%
   \def\seename{cfr.}%
   \def\alsoname{cfr.}%
   \def\proofname{Demonstratio}%
   \def\glossaryname{Glossarium}%
   }

\def\classiclatindate{%
   \def\today{\uppercase\expandafter{\romannumeral\day}%
      \space \ifcase\month
      \or Januarii\or Februarii\or Martii\or Aprilis\or Maii\or Junii\or
      Julii\or Augusti\or Septembris\or Octobris\or Nouembris\or
      Decembris\fi
      \space \uppercase\expandafter{\romannumeral\year}}}

\define@boolkey{classiclatin}[classiclatin@]{babelshorthands}[true]{}

\ifsystem@babelshorthands
  \setkeys{classiclatin}{babelshorthands=true}
\else
  \setkeys{classiclatin}{babelshorthands=false}
\fi

\ifcsundef{initiate@active@char}{%
    \input{babelsh.def}\initiate@active@char{"}}{}

\def\classiclatin@shorthands{%
  \def\language@group{classiclatin}%
  \bbl@activate{"}%
  \declare@shorthand{classiclatin}{"}{\relax
    \ifmmode
      \def\xpgcla@next{''}%
    \else
      \def\xpgcla@nextdq{\futurelet\xpgla@temp\xpgla@cwm}%
    \fi
  \xpgcla@nextdq}%
}

\def\xpgcla@allowhyphens{\bbl@allowhyphens\discretionary{-}{}{}\bbl@allowhyphens}
\newcommand*{\xpgcla@cwm}{\let\xpgcla@@nextdq\relax
  \ifcat\noexpand\xpgcla@temp a%
    \let\xpgcla@@nextdq\xpgcla@allowhyphens
  \else
    \ifx\xpgcla@temp\ae
        \let\xpgcla@@nextdq\xpgcla@allowhyphens
    \else
        \ifx\xpgcla@temp\oe
           \let\xpgcla@@nextdq\xpgcla@allowhyphens
        \else
           \if\noexpand\xpgla@temp\string|%
              \def\xpgcla@@nextdq{\xpgcla@allowhyphens\@gobble}%
           \fi
        \fi
    \fi
  \fi
  \xpgla@@nextdq}%
\def\noclassiclatin@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
}

\let\xpgcla@savedvalues\empty
\AtEndPreamble{%
  \edef\xpgcla@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}%
}

\def\noextras@classiclatin{%
   \lccode\string"2019=\z@
   \noclassiclatin@shorthands
   \noclassicuclccodes
   \xpgcla@savedvalues
}

\def\blockextras@classiclatin{%
   \lccode\string"2019=\string"2019
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000
   \finalhyphendemerits=50000000
   \classicuclccodes
   \ifclassiclatin@babelshorthands\classiclatin@shorthands\fi
}

\def\inlineextras@classiclatin{%
   \lccode\string"2019=\string"2019
   \classicuclccodes
   \ifclassiclatin@babelshorthands\classiclatin@shorthands\fi
}
%%   Copyright (C) Claudio Beccari 2013-2016
%%   Copyright (C) Élie Roux 2016
%% 
%%   Permission is hereby granted, free of charge, to any person obtaining
%%   a copy of this software and associated documentation files
%%   (the "Software"), to deal in the Software without restriction, including
%%   without limitation the rights to use, copy, modify, merge, publish,
%%   distribute, sublicense, and/or sell copies of the Software, and to permit
%%   persons to whom the Software is furnished to do so, subject to the following
%%   conditions:
%% 
%%   The above copyright notice and this permission notice shall be included in
%%   all copies or substantial portions of the Software.
%% 
%%   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%%   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%%   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
%%   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%%   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%%   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
%%   IN THE SOFTWARE.
%%
%% End of file `gloss-classiclatin.ldf'.
%    \end{macrocode}
% \iffalse
%</gloss-classiclatin.ldf>
%<*gloss-coptic.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-coptic.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-coptic.ldf}[polyglossia: module for coptic]
\PolyglossiaSetup{coptic}{
  script=Coptic,
  scripttag=copt,
  langtag=COP,
  hyphennames={coptic},
  hyphenmins={2,2},
  fontsetup=true
}

%\def\captionscoptic{%
%   \def\refname{<++>}%
%   \def\abstractname{<++>}%
%   \def\bibname{<++>}%
%   \def\prefacename{<++>}%
%   \def\chaptername{<++>}%
%   \def\appendixname{<++>}%
%   \def\contentsname{<++>}%
%   \def\listfigurename{<++>}%
%   \def\listtablename{<++>}%
%   \def\indexname{<++>}%
%   \def\figurename{<++>}%
%   \def\tablename{<++>}%
%   \def\thepart{}%
%   \def\partname{<++>}%
%   \def\pagename{<++>}%
%   \def\seename{<++>}%
%   \def\alsoname{<++>}%
%   \def\enclname{<++>}%
%   \def\ccname{<++>}%
%   \def\headtoname{<++>}%
%   \def\proofname{<++>}%
%   \def\glossaryname{<++>}%
%   }
%\def\datecoptic{%
%   \def\today{<++>}%
%   }

%    \end{macrocode}
% \iffalse
%</gloss-coptic.ldf>
%<*gloss-croatian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-croatian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-croatian.ldf}[polyglossia: module for croatian]
\PolyglossiaSetup{croatian}{
  hyphennames={croatian},
  hyphenmins={2,2}, % aligned with https://ctan.org/pkg/hrhyph patterns and http://lebesgue.math.hr/~nenad/Diplomski/Maja_Ribaric_2011.pdf
  indentfirst=false, % recommendation from Damir Bralić
  fontsetup=true
}

\def\captionscroatian{%
  \def\prefacename{Predgovor}%
  \def\refname{Literatura}%
  \def\abstractname{Sažetak}%
  \def\bibname{Bibliografija}%
  \def\chaptername{Poglavlje}%
  \def\appendixname{Dodatak}%
  \def\contentsname{Sadržaj}%
  \def\listfigurename{Popis slika}%
  \def\listtablename{Popis tablica}%
  \def\indexname{Kazalo}%
  \def\figurename{Slika}%
  \def\tablename{Tablica}%
  \def\partname{Dio}%
  \def\enclname{Prilozi}%
  \def\ccname{Kopija}%
  \def\headtoname{Prima}%
  \def\pagename{Stranica}%
  \def\seename{Vidjeti}%
  \def\alsoname{Također vidjeti}%
  \def\proofname{Dokaz}%
  \def\glossaryname{Pojmovnik}%
}
\def\datecroatian{%
  \def\today{\number\day.~\ifcase\month\or
    siječnja\or veljače\or ožujka\or travnja\or svibnja\or
    lipnja\or srpnja\or kolovoza\or rujna\or listopada\or studenoga\or
    prosinca\fi \space \number\year.}}

%    \end{macrocode}
% \iffalse
%</gloss-croatian.ldf>
%<*gloss-czech.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-czech.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-czech.ldf}[polyglossia: module for czech]
\PolyglossiaSetup{czech}{
  hyphennames={czech},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true,
}

\def\captionsczech{%
   \def\refname{Reference}%
   \def\abstractname{Abstrakt}%
   \def\bibname{Literatura}%
   \def\prefacename{Předmluva}%
   \def\chaptername{Kapitola}%
   \def\appendixname{Dodatek}%
   \def\contentsname{Obsah}%
   \def\listfigurename{Seznam obrázků}%
   \def\listtablename{Seznam tabulek}%
   \def\indexname{Index}%
   \def\figurename{Obrázek}%
   \def\tablename{Tabulka}%
   %\def\thepart{}%
   \def\partname{Část}%
   \def\pagename{Strana}%
   \def\seename{viz}%
   \def\alsoname{viz}%
   \def\enclname{Příloha}%
   \def\ccname{Na vědomí:}%
   \def\headtoname{Komu}%
   \def\proofname{Důkaz}%
   \def\glossaryname{Slovník}%was Glosář
   }
\def\dateczech{%
   \def\today{\number\day.~\ifcase\month\or
    ledna\or února\or března\or dubna\or května\or
    června\or července\or srpna\or září\or
    října\or listopadu\or prosince\fi
    \space \number\year}}

%    \end{macrocode}
% \iffalse
%</gloss-czech.ldf>
%<*gloss-danish.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-danish.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-danish.ldf}[polyglossia: module for danish]
\PolyglossiaSetup{danish}{
  hyphennames={danish},
  hyphenmins={2,3},
  frenchspacing=true,
  fontsetup=true,
}

\def\captionsdanish{%
  \def\prefacename{Forord}%
  \def\refname{Litteratur}%
  \def\abstractname{Resumé}%
  \def\bibname{Litteratur}%
  \def\chaptername{Kapitel}%
  \def\appendixname{Bilag}%
  \def\contentsname{Indhold}%
  \def\listfigurename{Figurer}%
  \def\listtablename{Tabeller}%
  \def\indexname{Indeks}%
  \def\figurename{Figur}%
  \def\tablename{Tabel}%
  \def\partname{Del}%
  \def\enclname{Vedlagt}%
  \def\ccname{Kopi til}%   or    Kopi sendt til
  \def\headtoname{Til}% in letter
  \def\pagename{Side}%
  \def\seename{Se}%
  \def\alsoname{Se også}}%
  \def\proofname{Bevis}%
  \def\glossaryname{Gloseliste}%
  \def\today{\number\day.~\ifcase\month\or
    januar\or februar\or marts\or april\or maj\or juni\or
    juli\or august\or september\or oktober\or november\or december\fi
    \space\number\year}

%    \end{macrocode}
% \iffalse
%</gloss-danish.ldf>
%<*gloss-divehi.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-divehi.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-divehi.ldf}[polyglossia: module for divehi]
\ifluatex
  \xpg@warning{Divehi is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\RequireBidi
\PolyglossiaSetup{divehi}{
  script=Thaana,
  scripttag=thaa,
  direction=RL,
  hyphennames={nohyphenation},
  fontsetup=true
}

%\def\captionsdivehi{%
%   \def\refname{<++>}%
%   \def\abstractname{<++>}%
%   \def\bibname{<++>}%
%   \def\prefacename{<++>}%
%   \def\chaptername{<++>}%
%   \def\appendixname{<++>}%
%   \def\contentsname{<++>}%
%   \def\listfigurename{<++>}%
%   \def\listtablename{<++>}%
%   \def\indexname{<++>}%
%   \def\figurename{<++>}%
%   \def\tablename{<++>}%
%   \def\thepart{}%
%   \def\partname{<++>}%
%   \def\pagename{<++>}%
%   \def\seename{<++>}%
%   \def\alsoname{<++>}%
%   \def\enclname{<++>}%
%   \def\ccname{<++>}%
%   \def\headtoname{<++>}%
%   \def\proofname{<++>}%
%   \def\glossaryname{<++>}%
%   }
%\def\datedivehi{\def\today{<++>}}

\def\blockextras@divehi{%
   \let\@@MakeUppercase\MakeUppercase%
   \def\MakeUppercase##1{##1}%
   }
\def\noextras@divehi{%
   \let\MakeUppercase\@@MakeUppercase%
   }

%    \end{macrocode}
% \iffalse
%</gloss-divehi.ldf>
%<*gloss-dutch.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-dutch.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-dutch.ldf}[polyglossia: module for dutch]
\PolyglossiaSetup{dutch}{
  hyphennames={dutch},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true,
}

\define@boolkey{dutch}[dutch@]{babelshorthands}[true]{}

\ifsystem@babelshorthands
  \setkeys{dutch}{babelshorthands=true}
\else
  \setkeys{dutch}{babelshorthands=false}
\fi

\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
}{}

\def\dutch@shorthands{%
  \bbl@activate{"}%
  \def\language@group{dutch}%
  \declare@shorthand{dutch}{"-}{\nobreak-\bbl@allowhyphens}
  \declare@shorthand{dutch}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
  \declare@shorthand{dutch}{"|}{%
    \textormath{\discretionary{-}{}{\kern.03em}}{}}
  \declare@shorthand{dutch}{""}{\hskip\z@skip}
  \declare@shorthand{dutch}{"/}{\textormath
    {\bbl@allowhyphens\discretionary{/}{}{/}\bbl@allowhyphens}{}}%
  \def\-{\bbl@allowhyphens\discretionary{-}{}{}\bbl@allowhyphens}%
}

\def\nodutch@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
  \def\-{\discretionary{-}{}{}}% << original def in latex.ltx
}

\def\captionsdutch{%
    \def\prefacename{Voorwoord}%
    \def\refname{Referenties}%
    \def\abstractname{Samenvatting}%
    \def\bibname{Bibliografie}%
    \def\chaptername{Hoofdstuk}%
    \def\appendixname{Bijlage}%
    \def\contentsname{Inhoudsopgave}%
    \def\listfigurename{Lijst van figuren}%
    \def\listtablename{Lijst van tabellen}%
    \def\indexname{Index}%
    \def\figurename{Figuur}%
    \def\tablename{Tabel}%
    \def\partname{Deel}%
    \def\enclname{Bijlage(n)}%
    \def\ccname{cc}%
    \def\headtoname{Aan}%
    \def\pagename{Pagina}%
    \def\seename{zie}%
    \def\alsoname{zie ook}%
    \def\proofname{Bewijs}%
    \def\glossaryname{Verklarende woordenlijst}%
    \def\today{\number\day~\ifcase\month%
      \or januari\or februari\or maart\or april\or mei\or juni\or
      juli\or augustus\or september\or oktober\or november\or
      december\fi
      \space \number\year}}

\def\noextras@dutch{%
  \nodutch@shorthands%
}

\def\blockextras@dutch{%
  \ifdutch@babelshorthands\dutch@shorthands\fi%
}

\def\inlineextras@dutch{%
  \ifdutch@babelshorthands\dutch@shorthands\fi%
}

%    \end{macrocode}
% \iffalse
%</gloss-dutch.ldf>
%<*gloss-english.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-english.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-english.ldf}[polyglossia: module for english]
\PolyglossiaSetup{english}{
  hyphennames={english,american,usenglish,USenglish},
  hyphenmins={2,3},
  fontsetup=true,
}

\newif\if@british@locale
\@british@localefalse
\providebool{@british@hyphen}
\providebool{english@ordinalmonthday}

\define@boolkey{english}[english@]{ordinalmonthday}[true]{}

%% English is a special case in that \l@english is reserved for US English, so
%% we need to handle it differently
\define@key{english}{variant}{%
  %needs to be reset for loop over hyphennames below:
  \def\do##1{%
      \xpg@ifdefined{#1}%
        {\csletcs{l@english}{l@#1}\listbreak}%
        {}%
  }%
  \ifstrequal{#1}{uk}%
    {\@british@localetrue
     \xpg@info{Option: english variant=british}}%
    {\ifstrequal{#1}{british}%
      {\@british@localetrue
      \xpg@info{Option: english variant=british}}%
        {\ifstrequal{#1}{us}% these patterns are the default so we don't need to reset them
          {\@british@hyphenfalse\english@ordinalmonthdayfalse
           \xpg@info{Option: english variant=american}}%
          {\ifstrequal{#1}{american}%
            {\@british@hyphenfalse\english@ordinalmonthdayfalse
            \xpg@info{Option: english variant=american}}%
            {\ifstrequal{#1}{usmax}%
              {\@british@hyphenfalse\english@ordinalmonthdayfalse
                \ifluatex\else\setkeys[xpg@setup]{english}{hyphennames={usenglishmax}}\fi
                \xpg@info{Option: english variant=american (with additional patterns)}%
                \xpg@ifdefined{usenglishmax}{}%
                  {\xpg@warning{No hyphenation patterns were loaded for "US English Max"\MessageBreak
                    I will use the standard patterns for US English instead}%
                  \adddialect\l@usenglishmax\l@english\relax}%
                \gdef\english@language{\language=\l@usenglishmax}}%
                {\ifstrequal{#1}{australian}%
                  {\@british@hyphentrue\english@ordinalmonthdayfalse
                  \xpg@info{Option: english variant=australian}}%
                  {\ifstrequal{#1}{newzealand}%
                    {\@british@hyphentrue\english@ordinalmonthdayfalse
                      \xpg@info{Option: english variant=newzealand}}%
                      {\xpg@warning{Unknown English variant `#1'}}%
  }}}}}}%
  \if@british@locale\@british@hyphentrue\english@ordinalmonthdaytrue\fi
  \if@british@hyphen
    \ifluatex\else\setkeys[xpg@setup]{english}{hyphennames={ukenglish,british,UKenglish}}\fi
    \xpg@ifdefined{ukenglish}{}%
      {\xpg@warning{No hyphenation patterns were loaded for British English\MessageBreak
         I will use the patterns for US English instead}%
       \adddialect\l@ukenglish\l@english\relax}%
    \gdef\english@language{\language=\l@ukenglish\xpg@set@language@luatex@ii{ukenglish}}%
  \fi
  % and we reset \do to its previous definition here:
  \def\do##1{\setotherlanguage{#1}}%
}

\def\captionsenglish{%
   \def\prefacename{Preface}%
   \def\refname{References}%
   \def\abstractname{Abstract}%
   \def\bibname{Bibliography}%
   \def\chaptername{Chapter}%
   \def\appendixname{Appendix}%
   \def\contentsname{Contents}%
   \def\listfigurename{List of Figures}%
   \def\listtablename{List of Tables}%
   \def\indexname{Index}%
   \def\figurename{Figure}%
   \def\tablename{Table}%
   \def\partname{Part}%
   \def\enclname{encl}%
   \def\ccname{cc}%
   \def\headtoname{To}%
   \def\pagename{Page}%
   \def\seename{see}%
   \def\alsoname{see also}%
   \def\proofname{Proof}%
}
\def\dateenglish{%
   \def\english@day{%
     \ifenglish@ordinalmonthday
       \ifcase\day\or
        1st\or 2nd\or 3rd\or 4th\or 5th\or
        6th\or 7th\or 8th\or 9th\or 10th\or
        11th\or 12th\or 13th\or 14th\or 15th\or
        16th\or 17th\or 18th\or 19th\or 20th\or
        21st\or 22nd\or 23rd\or 24th\or 25th\or
        26th\or 27th\or 28th\or 29th\or 30th\or
        31st\fi
     \else\number\day\fi}%
     \def\english@month{\ifcase\month\or
      January\or February\or March\or April\or May\or June\or
      July\or August\or September\or October\or November\or December\fi}%
   \def\today{%
    \if@british@locale
      \english@day\space\english@month\space\number\year
    \else
      \english@month\space\english@day,\space\number\year
    \fi}%
}

%    \end{macrocode}
% \iffalse
%</gloss-english.ldf>
%<*gloss-esperanto.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-esperanto.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-esperanto.ldf}[polyglossia: module for esperanto]
\PolyglossiaSetup{esperanto}{
  hyphennames={esperanto},
  hyphenmins={2,2},
  fontsetup=true,
  %TODO localalph={esperanto@alph,esperanto@Alph}
}

\def\captionsesperanto{%
   \def\refname{Citaĵoj}%
   \def\abstractname{Resumo}%
   \def\bibname{Bibliografio}%
   \def\prefacename{Antaŭparolo}%
   \def\chaptername{Ĉapitro}%
   \def\appendixname{Apendico}%
   \def\contentsname{Enhavo}%
   \def\listfigurename{Listo de figuroj}%
   \def\listtablename{Listo de tabeloj}%
   \def\indexname{Indekso}%
   \def\figurename{Figuro}%
   \def\tablename{Tabelo}%
   %\def\thepart{}%
   %\def\partname{}%
   \def\pagename{Paĝo}%
   \def\seename{vidu}%
   \def\alsoname{Parto}%
   \def\enclname{Aldono(j)}%
   \def\ccname{Kopie al}%
   \def\headtoname{Al}%
   \def\proofname{Pruvo}%
   \def\glossaryname{Glosaro}%
   }
\def\dateesperanto{%   
   \def\today{\number\day{–a}~de~\ifcase\month\or
    januaro\or februaro\or marto\or aprilo\or majo\or junio\or
    julio\or aŭgusto\or septembro\or oktobro\or novembro\or
    decembro\fi,\space \number\year}%
   \def\hodiau{la \today}%
   \def\hodiaun{la \number\day{–an}~de~\ifcase\month\or
      januaro\or februaro\or marto\or aprilo\or majo\or junio\or
      julio\or aŭgusto\or septembro\or oktobro\or novembro\or
      decembro\fi, \space \number\year}%
    }
\def\esperanto@alph#1{%
   \ifcase#1\or a\or b\or c\or ĉ\or d\or e\or f\or g\or ĝ\or
     h\or ĥ\or i\or j\or ĵ\or k\or l\or m\or n\or o\or
     p\or r\or s\or ŝ\or t\or u\or ŭ\or v\or z\else\xpg@ill@value{#1}{esperanto@alph}\fi}%
\def\esperanto@Alph#1{%
   \ifcase#1\or A\or B\or C\or Ĉ\or D\or E\or F\or G\or Ĝ\or
     H\or Ĥ\or I\or J\or Ĵ\or K\or L\or M\or N\or O\or
     P\or R\or S\or Ŝ\or T\or U\or Ŭ\or V\or Z\else\xpg@ill@value{#1}{esperanto@Alph}\fi}%

\def\esperanto@numbers{%
   \let\latin@Alph\@Alph%
   \let\latin@alph\@alph%
   \let\@Alph\esperanto@Alph%
   \let\@alph\esperanto@alph%
 }

\def\noesperanto@numbers{%
   \let\@Alph\latin@Alph% 
   \let\@alph\latin@alph%
}

%    \end{macrocode}
% \iffalse
%</gloss-esperanto.ldf>
%<*gloss-estonian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-estonian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-estonian.ldf}[polyglossia: module for estonian]
\PolyglossiaSetup{estonian}{
  hyphennames={estonian},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true,
}

\def\captionsestonian{%
   \def\refname{Viited}%
   \def\abstractname{Kokkuvõte}%
   \def\bibname{Kirjandus}%
   \def\prefacename{Sissejuhatus}%
   \def\chaptername{Peatükk}%
   \def\appendixname{Lisa}%
   \def\contentsname{Sisukord}%
   \def\listfigurename{Joonised}%
   \def\listtablename{Tabelid}%
   \def\indexname{Indeks}%
   \def\figurename{Joonis}%
   \def\tablename{Tabel}%
   %\def\thepart{}%
   \def\partname{Osa}%
   \def\pagename{Lk.}%
   \def\seename{vt.}%
   \def\alsoname{vt. ka}%
   \def\enclname{Lisa(d)}%
   \def\ccname{Koopia(d)}%
   %\def\headtoname{}%
   \def\proofname{Korrektuur}%
   \def\glossaryname{Glossary}% <-- need translation
   }
\def\dateestonian{%
   \def\today{\number\day.\space\ifcase\month\or
    jaanuar\or veebruar\or märts\or aprill\or mai\or juuni\or
    juuli\or august\or september\or oktoober\or november\or
    detsember\fi\space\number\year.\space a.}}

%    \end{macrocode}
% \iffalse
%</gloss-estonian.ldf>
%<*gloss-farsi.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-farsi.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-farsi.ldf}[polyglossia: module for farsi]
\ifluatex
  \xpg@warning{Farsi is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\RequireBidi
\RequirePackage{arabicnumbers}
\RequirePackage{farsical}
\RequirePackage{hijrical}
\PolyglossiaSetup{farsi}{
  script=Arabic,
  direction=RL,
  scripttag=arab,
  langtag=FAR,
  hyphennames={nohyphenation},
  fontsetup=true
}

\newif\if@western@numerals
\def\tmp@western{western}
\define@key{farsi}{numerals}[eastern]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@western\@western@numeralstrue\else%
    \@western@numeralsfalse%
  \fi}

%this is needed for \abjad in arabicnumbers.sty
\def\tmp@true{true}
\define@key{farsi}{abjadjimnotail}[true]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@true\abjad@jim@notailtrue%
  \else
    \abjad@jim@notailfalse
  \fi}

% NOT YET USED
\define@key{farsi}{locale}[default]{%
  \def\@farsi@locale{#1}}

%TODO add option for CALENDAR

\setkeys{farsi}{locale,numerals}

\def\farsigregmonth#1{\ifcase#1%
  \or ژانویه\or فوریه\or مارس\or آوریل\or مه\or ژوئن\or ژوئیه\or اوت\or سپتامبر\or اکتبر\or نوامبر\or دسامبر\fi}
\def\farsimonth#1{\ifcase#1%
  \or کانون ثانی\or شباط\or اذار%%or ادار
    \or نیسان\or ایار\or حزیران\or تموز\or آب\or ایلول\or تشرین اول\or تشرین ثانی\or کانون اول\fi}

%\Hijritoday is now locale-aware and will format the date with this macro:
\DefineFormatHijriDate{farsi}{\@ensure@RTL{%
\farsinumber{\value{Hijriday}}\space\HijriMonthArabic{\value{Hijrimonth}}\space\farsinumber{\value{Hijriyear}}}}

\def\captionsfarsi{%
\def\prefacename{\@ensure@RTL{پیشگفتار}}%
\def\refname{\@ensure@RTL{مراجع}}%
\def\abstractname{\@ensure@RTL{چکیده}}%
\def\bibname{\@ensure@RTL{کتاب‌نامه}}%
\def\chaptername{\@ensure@RTL{فصل}}%
\def\appendixname{\@ensure@RTL{پیوست}}%
\def\contentsname{\@ensure@RTL{فهرست مطالب}}%
\def\listfigurename{\@ensure@RTL{لیست تصاویر}}%
\def\listtablename{\@ensure@RTL{لیست جداول}}%
\def\indexname{\@ensure@RTL{نمایه}}%
\def\figurename{\@ensure@RTL{شكل}}%
\def\tablename{\@ensure@RTL{جدول}}%
\def\partname{\@ensure@RTL{بخش}}%
\def\enclname{\@ensure@RTL{پیوست}}%
\def\ccname{\@ensure@RTL{رونوشت}}%
\def\headtoname{\@ensure@RTL{به}}%
\def\pagename{\@ensure@RTL{صفحة}}%
\def\seename{\@ensure@RTL{ببینید}}%
\def\alsoname{\@ensure@RTL{نیز ببینید}}%
\def\proofname{\@ensure@RTL{برهان}}%
\def\glossaryname{\@ensure@RTL{دانش‌نامه}}%
}
\def\datefarsi{%
   \def\today{\@ensure@RTL{\farsinumber\day\space\farsigregmonth{\month}\space\farsinumber\year}}%
}

\def\farsinumber#1{%
  \if@western@numerals
    \number#1%
  \else
    \ifnum\XeTeXcharglyph"06F0 > 0%
      \farsidigits{\number#1}%
      %%{\protect\addfontfeature{Mapping=farsidigits}\number#1}%
    \else%
      \arabicdigits{\number#1}%
      %%{\protect\addfontfeature{Mapping=arabicdigits}\number#1}%
    \fi
  \fi}

%\def\farsinum#1{\expandafter\farsinumber\csname c@#1\endcsname}
%\def\farsibracenum#1{(\expandafter\farsinumber\csname c@#1\endcsname)}
%\def\farsiornatebracenum#1{\char"FD3E\expandafter\farsinumber\csname c@#1\endcsname\char"FD3F}
%\def\farsialph#1{\expandafter\@farsialph\csname c@#1\endcsname}

\def\farsi@numbers{%
   \let\@latinalph\@alph%
   \let\@latinAlph\@Alph%
   \let\@alph\abjad%
   \let\@Alph\abjad%
}
\def\nofarsi@numbers{%
  \let\@alph\@latinalph%
  \let\@Alph\@latinAlph%
  }

\def\farsi@globalnumbers{%
   \let\orig@arabic\@arabic%
   \let\@arabic\farsinumber%
   % For some reason \thefootnote needs to be set separately:
   \renewcommand\thefootnote{\protect\farsinumber{\c@footnote}}%
   }

\def\nofarsi@globalnumbers{
   \let\@arabic\orig@arabic%
   \renewcommand\thefootnote{\protect\number{\c@footnote}}%
   }

\def\blockextras@farsi{%
   \let\@@MakeUppercase\MakeUppercase%
   \def\MakeUppercase##1{##1}%
   }
\def\noextras@farsi{%
   \let\MakeUppercase\@@MakeUppercase%
   }
%    \end{macrocode}
% \iffalse
%</gloss-farsi.ldf>
%<*gloss-finnish.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-finnish.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-finnish.ldf}[polyglossia: module for finnish]
\PolyglossiaSetup{finnish}{
  hyphennames={finnish},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true,
}

\def\captionsfinnish{%
   \def\refname{Viitteet}%
   \def\abstractname{Tiivistelmä}%
   \def\bibname{Kirjallisuutta}%
   \def\prefacename{Esipuhe}%
   \def\chaptername{Luku}%
   \def\appendixname{Liite}%
   \def\contentsname{Sisältö}%
   \def\listfigurename{Kuvat}%
   \def\listtablename{Taulukot}%
   \def\indexname{Hakemisto}%
   \def\figurename{Kuva}%
   \def\tablename{Taulukko}%
   %\def\thepart{}%
   \def\partname{Osa}%
   \def\pagename{Sivu}%
   \def\seename{katso}%
   \def\alsoname{katso myös}%
   \def\enclname{Liitteet}%
   \def\ccname{Jakelu}%
   \def\headtoname{Vastaanottaja}%
   \def\proofname{Todistus}%
   \def\glossaryname{Sanasto}%
   }
\def\datefinnish{%
   \def\today{\number\day.~\ifcase\month\or
    tammikuuta\or helmikuuta\or maaliskuuta\or huhtikuuta\or
    toukokuuta\or kesäkuuta\or heinäkuuta\or elokuuta\or
    syyskuuta\or lokakuuta\or marraskuuta\or joulukuuta\fi
    \space\number\year}}

%    \end{macrocode}
% \iffalse
%</gloss-finnish.ldf>
%<*gloss-french.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-french.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-french.ldf}[polyglossia: module for french]

\PolyglossiaSetup{french}{%
  language=French,
  script=Latin,
  hyphennames={french,francais},
  frenchspacing=true,
  indentfirst=true,
  hyphenmins={2,2},
  fontsetup=true}

\ifluatex
  \newluatexattribute\xpg@frpt %
  \directlua{polyglossia.load_frpt()}%
\else
  \newXeTeXintercharclass\french@openbrackets % ( ] {
  \newXeTeXintercharclass\french@closebrackets % ( ] {
  \newXeTeXintercharclass\french@punctthin % ! ? ; et autres
  \newXeTeXintercharclass\french@punctthick % :
  \newXeTeXintercharclass\french@punctguillstart % « ‹
  \newXeTeXintercharclass\french@punctguillend % » ›
\fi

\def\xpg@unskip{\ifhmode\ifdim\lastskip>\z@\unskip\fi\fi}
\def\xpg@nospace#1{#1}

\ifx\@makefntext\undefined\else
  \let\nofrench@makefntext\@makefntext
  \long\def\french@makefntext#1{\parindent1em \noindent\quad\ifx\@thefnmark\empty\else\@thefnmark.\space\fi #1}
  \let\@makefntext\french@makefntext
  \define@boolkey{french}[french@]{frenchfootnote}[true]{%
  	\def\@tmpa{#1}
    \def\@tmptrue{true}
    \ifx\@tmpa\@tmptrue
    	\let\@makefntext\french@makefntext
		\else 
			\let\@makefntext\nofrench@makefntext
    \fi
  }
\fi


\newif\iffrench@automaticspacesaroundguillemets
\define@boolkey{french}[french@]{automaticspacesaroundguillemets}[true]{%
  %\def\tmp@true{true}%
  %\def\@tmpa{#1}%
  %\ifx\@tmpa\tmp@true
}
\french@automaticspacesaroundguillemetstrue

\def\french@punctuation{%
    \lccode"2019="2019
    \ifluatex
      \global\xpg@frpt=1\relax %
      \directlua{polyglossia.activate_frpt()}%
    \else
      \XeTeXinterchartokenstate=1
      \XeTeXcharclass `\! \french@punctthin
      \XeTeXcharclass `\? \french@punctthin
      \XeTeXcharclass `\‼ \french@punctthin
      \XeTeXcharclass `\⁇ \french@punctthin
      \XeTeXcharclass `\⁈ \french@punctthin
      \XeTeXcharclass `\⁉ \french@punctthin
      \XeTeXcharclass `\; \french@punctthin
      \XeTeXcharclass `\: \french@punctthick
      \XeTeXcharclass `\« \french@punctguillstart
      \XeTeXcharclass `\» \french@punctguillend
      \XeTeXcharclass `\‹ \french@punctguillstart
      \XeTeXcharclass `\› \french@punctguillend
      \XeTeXcharclass `\( \french@openbrackets
      \XeTeXcharclass `\) \french@closebrackets
      \XeTeXcharclass `\] \french@openbrackets
      \XeTeXcharclass `\[ \french@closebrackets
      \XeTeXcharclass `\{ \french@openbrackets
      \XeTeXcharclass `\} \french@closebrackets
      \XeTeXinterchartoks \z@ \french@punctthin = {\nobreak\thinspace}%
      \XeTeXinterchartoks \z@ \french@punctthick = {\nobreakspace}%
      \XeTeXinterchartoks \xpg@boundaryclass \french@punctthin = {\xpg@unskip\nobreak\thinspace}%
      \XeTeXinterchartoks \xpg@boundaryclass \french@punctthick = {\xpg@unskip\nobreakspace}%
      \XeTeXinterchartoks \french@punctguillstart \z@ = {\nobreakspace}% "«a" -> "« a"
  %   \XeTeXinterchartoks \z@ \french@punctguillstart = {\nobreakspace}% "a«" unchanged?
  %   \XeTeXinterchartoks \french@punctguillend \z@ = {\nobreakspace}% "»a" unchanged?
      \XeTeXinterchartoks \z@ \french@punctguillend = {\nobreakspace}% "a»" -> "a »"
      \iffrench@automaticspacesaroundguillemets
        \XeTeXinterchartoks \french@punctguillstart \xpg@boundaryclass = {\nobreakspace\xpg@nospace\relax}% "«  " -> "«~"
        \XeTeXinterchartoks \xpg@boundaryclass \french@punctguillend = {\xpg@unskip\nobreakspace}% "  »" -> "~»"
      \fi
      \XeTeXinterchartoks \french@punctguillend \french@punctthin = {\nobreak\thinspace}% "»;" -> "» ;"
      \XeTeXinterchartoks \french@punctguillend \french@punctthick = {\nobreakspace}% "»:" -> "» :"
      \XeTeXinterchartoks \french@punctthin \french@punctguillend  = {\nobreakspace}% "?»" -> "? »"
     \XeTeXinterchartoks \french@openbrackets \french@punctthin = {\xpg@unskip}% "(?" -> "(?" and not "( ?"      
     \XeTeXinterchartoks \french@punctthin \french@closebrackets = {\xpg@unskip}% "?)" -> "?)" (code not need, just for symetry with previous one)
     \XeTeXinterchartoks \french@closebrackets \french@punctthin = {\nobreak\thinspace}% ")?" -> ") ?"
     \XeTeXinterchartoks \french@closebrackets \french@punctthick = {\nobreakspace}% "):" -> ") :"
    \fi
    }

\def\nofrench@punctuation{%
    \lccode"2019=\z@
    \ifluatex
      \global\xpg@frpt=0\relax %
      % Though it would make compilation slightly faster, it is not possible to
      % safely uncomment the following line. Imagine the following case: you start
      % a paragraph by some french text, then, in the same paragraph, you change
      % the language to something else, and thus call the following line. This means
      % that, at then end of the paragraph, the function won't be in the callback,
      % so the beginning of the paragraph won't be processed by it.
      %\directlua{polyglossia.desactivate_frpt()}
    \else
      \XeTeXcharclass `\! \z@
      \XeTeXcharclass `\? \z@
      \XeTeXcharclass `\‼ \z@
      \XeTeXcharclass `\⁇ \z@
      \XeTeXcharclass `\⁈ \z@
      \XeTeXcharclass `\⁉ \z@
      \XeTeXcharclass `\; \z@
      \XeTeXcharclass `\: \z@
      \XeTeXcharclass `\« \z@
      \XeTeXcharclass `\» \z@
      \XeTeXcharclass `\‹ \z@
      \XeTeXcharclass `\› \z@
      \XeTeXinterchartokenstate=0
    \fi
    }

\def\captionsfrench{%
   \def\refname{Références}%
   \def\abstractname{Résumé}%
   \def\bibname{Bibliographie}%
   \def\prefacename{Préface}%
   \def\chaptername{Chapitre}%
   \def\appendixname{Annexe}%
   \def\contentsname{Table des matières}%
   \def\listfigurename{Table des figures}%
   \def\listtablename{Liste des tableaux}%
   \def\indexname{Index}%
   \def\figurename{\textsc{Fig.}}%
   \def\tablename{\textsc{Tab.}}%
   \def\@Fpt{\ifcase\value{part}\or Première\or Deuxième\or
   Troisième\or Quatrième\or Cinquième\or Sixième\or
   Septième\or Huitième\or Neuvième\or Dixième\or Onzième\or
   Douzième\or Treizième\or Quatorzième\or Quinzième\or
   Seizième\or Dix-septième\or Dix-huitième\or Dix-neuvième\or
   Vingtième\fi\space}%
   \def\thepart{\@Fpt partie}%
   \def\partname{}%
   \def\pagename{page}%
   \def\seename{\emph{voir}}%
   \def\alsoname{\emph{voir aussi}}%
   \def\enclname{P.~J. }%
   \def\ccname{Copie à }%
   \def\headtoname{}%
   \def\proofname{Démonstration}%
   }
\def\datefrench{%
   \def\today{\ifx\ier\undefined\def\ier{er}\fi
      \ifnum\day=1\relax 1\ier%
      \else \number\day\fi
      \space \ifcase\month%
      \or janvier\or février\or mars\or avril\or mai\or juin\or
      juillet\or août\or septembre\or octobre\or novembre\or
      décembre\fi
      \space \number\year}}

\def\noextras@french{%
   \nofrench@punctuation%
   }

\def\blockextras@french{%
   \french@punctuation%
   }

\def\inlineextras@french{%
   \french@punctuation%
   }

\def\ier{\textsuperscript{er}}
\def\iers{\textsuperscript{ers}}
\def\iere{\textsuperscript{re}}
\def\ieres{\textsuperscript{res}}
\def\ieme{\textsuperscript{e}}
\def\iemes{\textsuperscript{es}}
\def\nd{\textsuperscript{nd}}
\def\nds{\textsuperscript{nds}}
\def\nde{\textsuperscript{nde}}
\def\ndes{\textsuperscript{ndes}}
\def\no{\textsuperscript{o}}
\def\nos{\textsuperscript{os}}

\def\mme{M\textsuperscript{me}\space}
\def\mmes{M\textsuperscript{mes}\space}
\def\mr{M.\space}
\def\mrs{MM.\space}

%    \end{macrocode}
% \iffalse
%</gloss-french.ldf>
%<*gloss-friulan.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-friulan.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-friulan.ldf}[polyglossia: module for friulan]
\makeatletter
\PolyglossiaSetup{friulan}{%
  hyphennames={friulan,furlan},
  hyphenmins={2,2},
  indentfirst=false,
  fontsetup=true,
  frenchspacing=true,
}


\def\captionsfriulan{%
    \def\prefacename{Prefazion}%
    \def\refname{Riferiments}%
    \def\abstractname{Somari}%
    \def\bibname{Bibliografie}%
    \def\chaptername{Cjapitul}%
    \def\appendixname{Zonte}%
    \def\contentsname{Tabele gjenerâl}%
    \def\listfigurename{Liste des figuris}%
    \def\listtablename{Liste des tabelis}%
    \def\indexname{Tabele analitiche}%
    \def\figurename{Figure}%
    \def\tablename{Tabele}%
    \def\partname{Part}%
    \def\enclname{Zonte(is)}%
    \def\ccname{Cun copie a}%
    \def\headtoname{Par}%
    \def\pagename{Pagjine}%
    \def\seename{cjale}%
    \def\alsoname{cjale ancje}%
    \def\proofname{Dimostrazion}%
    \def\glossaryname{Glossari}%
  }
  
\def\datefriulan{%
  \def\today{\number\day\space di\space\ifcase\month\or
      Genâr\or Fevrâr\or Març\or Avril\or Mai\or Jugn\or
      Lui\or Avost\or Setembar\or Otobar\or Novembar\or Dicembar%
      \fi\space dal\space\number\year}}

\AtEndPreamble{% the user or the class might define different values
  \edef\xpgfu@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}
}


\def\noextras@friulan{%
   \lccode\string"2019=\z@
}

\def\blockextras@friulan{%
   \lccode\string"2019=\string"2019
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000
   \finalhyphendemerits=50000000
}

\def\inlineextras@friulan{%
   \lccode\string"2019=\string"2019
}

%    \end{macrocode}
% \iffalse
%</gloss-friulan.ldf>
%<*gloss-galician.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-galician.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-galician.ldf}[polyglossia: module for galician]
\PolyglossiaSetup{galician}{
  hyphennames={galician},
  hyphenmins={2,2},
  indentfirst=true,
  fontsetup=true,
}

\def\captionsgalician{%
   \def\refname{Referencias}%
   \def\abstractname{Resumo}%
   \def\bibname{Bibliografía}%
   \def\prefacename{Prefacio}%
   \def\chaptername{Capítulo}%
   \def\appendixname{Apéndice}%
   \def\contentsname{Índice Xeral}%
   \def\listfigurename{Índice de Figuras}%
   \def\listtablename{Índice de Táboas}%
   \def\indexname{Índice de Materias}%
   \def\figurename{Figura}%
   \def\tablename{Táboa}%
   %\def\thepart{}%
   \def\partname{Parte}%
   \def\pagename{Páxina}%
   \def\seename{véxase}%
   \def\alsoname{véxase tamén}%
   \def\enclname{Adxunto}%
   \def\ccname{Copia a}%
   \def\headtoname{A}%
   \def\proofname{Demostración}%
   \def\glossaryname{Glosario}%
   }
\def\dategalician{%
   \def\today{\number\day~de\space\ifcase\month\or
    xaneiro\or febreiro\or marzo\or abril\or maio\or xuño\or
    xullo\or agosto\or setembro\or outubro\or novembro\or decembro\fi
    \space de~\number\year}}

%    \end{macrocode}
% \iffalse
%</gloss-galician.ldf>
%<*gloss-german.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-german.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-german.ldf}[polyglossia: module for german]
\PolyglossiaSetup{german}{
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true,
}

\def\tmp@old{old}
\def\tmp@oldyr{1901}
\newif\if@german@oldspelling
\@german@oldspellingfalse
\define@key{german}{spelling}[new]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@oldyr\def\@tmpa{old}\fi
  \ifx\@tmpa\tmp@old
    \xpg@ifdefined{german}{}{%
      \xpg@nopatterns{german}%
      \adddialect\l@german\l@nohyphenation
    }
    \@german@oldspellingtrue
  \else % try ngerman
    \xpg@ifdefined{ngerman}{%
      \@german@oldspellingfalse
    }{% fall back to german
      \xpg@ifdefined{german}{%
        \xpg@warning{You asked for `ngerman' but only `german' hyphenation is available!}%
        \@german@oldspellingtrue
      }{%
        \xpg@nopatterns{ngerman}%
        \adddialect\l@ngerman\l@nohyphenation
      }%
    }%
  \fi
}

\newif\if@austrian@locale
\@austrian@localefalse
\newif\if@swiss@locale
\@swiss@localefalse
\def\tmp@austrian{austrian}
\def\tmp@swiss{swiss}
\define@key{german}{variant}[german]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@austrian\@austrian@localetrue\else
	  \@austrian@localefalse%
	\fi
	\ifx\@tmpa\tmp@swiss\@swiss@localetrue
	  \xpg@ifdefined{swissgerman}{}%
	    {\xpg@warning{No hyphenation patterns were loaded for "Swiss German (Old Spelling)"\MessageBreak
	      I will use the standard patterns for German (old spelling) instead}%
	    \adddialect\l@swissgerman\l@german\relax}%
	\else
	  \@swiss@localefalse%
	\fi}

\newif\if@german@fraktur
\def\tmp@fraktur{fraktur}
\define@key{german}{script}[latin]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@fraktur\@german@frakturtrue\else
	  \@german@frakturfalse%
	\fi}

\define@boolkey{german}[german@]{latesthyphen}[false]{}

\define@boolkey{german}[german@]{babelshorthands}[true]{}

\setkeys{german}{spelling,latesthyphen,script,variant}

\ifsystem@babelshorthands
  \setkeys{german}{babelshorthands=true}
\else
  \setkeys{german}{babelshorthands=false}
\fi

\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
}{}

\def\german@shorthands{%
  \bbl@activate{"}%
  \def\language@group{german}%
  \declare@shorthand{german}{"`}{„}%
  \declare@shorthand{german}{"'}{“}%
  \declare@shorthand{german}{"<}{«}%
  \declare@shorthand{german}{">}{»}%
  \declare@shorthand{german}{"c}{\textormath{\bbl@disc@german ck}{c}}%
  \declare@shorthand{german}{"C}{\textormath{\bbl@disc@german CK}{C}}%
  \declare@shorthand{german}{"F}{\textormath{\bbl@disc@german F{FF}}{F}}%
  \declare@shorthand{german}{"l}{\textormath{\bbl@disc@german l{ll}}{l}}%
  \declare@shorthand{german}{"L}{\textormath{\bbl@disc@german L{LL}}{L}}%
  \declare@shorthand{german}{"m}{\textormath{\bbl@disc@german m{mm}}{m}}%
  \declare@shorthand{german}{"M}{\textormath{\bbl@disc@german M{MM}}{M}}%
  \declare@shorthand{german}{"n}{\textormath{\bbl@disc@german n{nn}}{n}}%
  \declare@shorthand{german}{"N}{\textormath{\bbl@disc@german N{NN}}{N}}%
  \declare@shorthand{german}{"p}{\textormath{\bbl@disc@german p{pp}}{p}}%
  \declare@shorthand{german}{"P}{\textormath{\bbl@disc@german P{PP}}{P}}%
  \declare@shorthand{german}{"r}{\textormath{\bbl@disc@german r{rr}}{r}}%
  \declare@shorthand{german}{"R}{\textormath{\bbl@disc@german R{RR}}{R}}%
  \declare@shorthand{german}{"t}{\textormath{\bbl@disc@german t{tt}}{t}}%
  \declare@shorthand{german}{"T}{\textormath{\bbl@disc@german T{TT}}{T}}%
  \declare@shorthand{german}{"f}{\textormath{\bbl@discff}{f}}%
  \def\bbl@discff{\penalty\@M
    \afterassignment\bbl@insertff \let\bbl@nextff= }%
  \def\bbl@insertff{%
    \if f\bbl@nextff
      \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
    {\relax\discretionary{ff-}{f}{ff}\allowhyphens}{f\bbl@nextff}}%
  \let\bbl@nextff=f%
  \declare@shorthand{german}{"-}{\nobreak\-\nobreak\hskip\z@skip}%
  \declare@shorthand{german}{"|}{\textormath{\penalty\@M\discretionary{-}{}{\kern.03em}}{}}%
  \declare@shorthand{german}{""}{\hskip\z@skip}%
  \declare@shorthand{german}{"~}{\textormath{\leavevmode\hbox{-}}{-}}%
  \declare@shorthand{german}{"=}{\penalty\@M-\hskip\z@skip}%
  \declare@shorthand{german}{"/}{\textormath
    {\bbl@allowhyphens\discretionary{/}{}{/}\bbl@allowhyphens}{}}%
  \def\ck{\allowhyphens\discretionary{k-}{k}{ck}\allowhyphens}%
}

\def\nogerman@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
}

\def\captions@german{%
  \def\prefacename{Vorwort}%
  \def\refname{Literatur}%
  \def\abstractname{Zusammenfassung}%
  \def\bibname{Literaturverzeichnis}%
  \def\chaptername{Kapitel}%
  \def\appendixname{Anhang}%
  \def\contentsname{Inhaltsverzeichnis}%
  \def\listfigurename{Abbildungsverzeichnis}%
  \def\listtablename{Tabellenverzeichnis}%
  \def\indexname{Index}%
  \def\figurename{Abbildung}%
  \def\tablename{Tabelle}%
  \def\partname{Teil}%
  \def\enclname{Anlage(n)}%
  \def\ccname{Verteiler}%
  \def\headtoname{An}%
  \def\pagename{Seite}%
  \def\seename{siehe}%
  \def\alsoname{siehe auch}%
  \def\proofname{Beweis}%
  \def\glossaryname{Glossar}%
}
\def\date@german{%   
  \def\today{\number\day.%
    \space \ifcase\month%
    \or\if@austrian@locale Jänner\else Januar\fi\or Februar\or März\or%
    April\or Mai\or Juni\or Juli\or August\or September\or Oktober\or%
    November\or Dezember\fi
    \space \number\year}%
}

\def\captions@german@austrian{%
  \def\enclname{Beilage(n)}%
}

\def\captions@german@swiss{%
  \def\enclname{Beilage(n)}%
}

%%Strings for Fraktur contributed by Gerrit <z0idberg . gmx . de>
\def\captions@german@fraktur{%
  \captions@german%
  \def\abstractname{Zuſammenfaſſung}%
  \def\seename{ſiehe}%
  \def\alsoname{ſiehe auch}%
  \def\glossaryname{Gloſſar}%
}

\def\date@german@fraktur{%
  \def\today{\number\day.%
    \space \ifcase\month%
    \or\if@austrian@locale Jänner\else Januar\fi\or Februar\or März\or%
    April\or Mai\or Juni\or Juli\or Auguſt\or September\or Oktober\or%
    November\or Dezember\fi
    \space \number\year}%
}

\def\captionsgerman{%
  \if@german@fraktur\captions@german@fraktur\else\captions@german\fi
  \if@austrian@locale\captions@german@austrian\fi
  \if@swiss@locale\captions@german@swiss\fi
}

\def\dategerman{%
  \if@german@fraktur\date@german@fraktur\else\date@german\fi
}

\def\german@language{\ifxetex\language=%
  \csname l@%
    \if@swiss@locale
       \if@german@oldspelling
           swissgerman%
       \else
            ngerman%
            \ifgerman@latesthyphen
                -x-latest
            \fi
        \fi
    \else% (german, austrian)
      \if@german@oldspelling\else n\fi german\ifgerman@latesthyphen -x-latest\fi
    \fi
  \endcsname\else\ifluatex
  % LuaTeX
  \ifgerman@latesthyphen
    \if@german@oldspelling
        \if@swiss@locale
            \xpg@set@language@luatex@iv{swissgerman}%
        \else
            \xpg@set@language@luatex@iv{german-x-latest}%
        \fi
    \else
        \xpg@set@language@luatex@iv{ngerman-x-latest}%
    \fi
  \else% (latesthyphen=false)
    \if@german@oldspelling
        \if@swiss@locale
            \xpg@set@language@luatex@iv{swissgerman}%
        \else
            \xpg@set@language@luatex@iv{german}%
        \fi
    \else
        \xpg@set@language@luatex@iv{ngerman}%
    \fi
  \fi\fi\fi
}

\def\noextras@german{%
  \nogerman@shorthands%
}

\def\blockextras@german{%
  \ifgerman@babelshorthands\german@shorthands\fi
}

\def\inlineextras@german{%
  \ifgerman@babelshorthands\german@shorthands\fi
}

%    \end{macrocode}
% \iffalse
%</gloss-german.ldf>
%<*gloss-greek.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-greek.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-greek.ldf}[polyglossia: module for greek]
\PolyglossiaSetup{greek}{
  script=Greek,
  scripttag=grek,
  frenchspacing=true,
  indentfirst=true,
  fontsetup=true,
  %TODO localalph={greek@alph,greek@Alph}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The code in this file was initially adapted from the antomega
%% module for greek. Currently large parts of it derive from the 
%% package xgreek.sty (c) Apostolos Syropoulos 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% this file imported from xgreek fixes the \lccode and \uccode of Greek letters:
\input{xgreek-fixes.def}

%TODO: set these in \define@key instead:
\ifx\l@greek\@undefined
  \ifx\l@polygreek\@undefined
    \xpg@nopatterns{Greek}%
    \adddialect\l@greek\l@nohyphenation
  \else
    \let\l@greek\l@polygreek
  \fi
\fi
\ifx\l@monogreek\@undefined
  \xpg@warning{No hyphenation patterns were loaded for Monotonic Greek\MessageBreak
         I will use the patterns loaded for \string\l@greek instead}
  \adddialect\l@monogreek\l@greek
\fi
\ifx\l@ancientgreek\@undefined
  \xpg@warning{No hyphenation patterns were loaded for Ancient Greek\MessageBreak
         I will use the patterns loaded for \string\l@greek instead}
  \adddialect\l@ancientgreek\l@greek
\fi

%set monotonic as default
\def\greek@variant{\l@monogreek}% monotonic
\def\captionsgreek{\monogreekcaptions}%
\def\dategreek{\datemonogreek}%

\def\tmp@mono{mono}
\def\tmp@monotonic{monotonic}
\def\tmp@poly{poly}
\def\tmp@polytonic{polytonic}
\def\tmp@ancient{ancient}
\def\tmp@ancientgreek{ancientgreek}

\define@key{greek}{variant}[monotonic]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@poly\def\@tmpa{polytonic}\fi
  \ifx\@tmpa\tmp@ancientgreek\def\@tmpa{ancient}\fi
  \ifx\@tmpa\tmp@polytonic%
    \def\greek@variant{\l@polygreek}%
    \def\captionsgreek{\polygreekcaptions}%
    \def\dategreek{\datepolygreek}%
    \xpg@info{Option: Polytonic Greek}%
  \else
    \ifx\@tmpa\tmp@ancient
      \def\greek@variant{\l@ancientgreek}%
      \def\captionsgreek{\ancientgreekcaptions}%
      \def\dategreek{\dateancientgreek}%
      \xpg@info{Option: Ancient Greek}%
    \else %monotonic
      \def\greek@variant{\l@monogreek}% monotonic
      \def\captionsgreek{\monogreekcaptions}%
      \def\dategreek{\datemonogreek}%
      \xpg@info{Option: Monotonic Greek}%
    \fi
  \fi}

\def\greek@language{\language=\greek@variant}

\newif\if@greek@numerals
\define@key{greek}{numerals}[greek]{%
\ifstrequal{#1}{arabic}{\@greek@numeralsfalse}{\@greek@numeralstrue}}

\define@boolkey{greek}{attic}[true]{\xpg@warning{Greek option `attic' is no longer required.}}

% This sets the defaults
\setkeys{greek}{numerals}

\def\monogreekcaptions{%
   \def\refname{Αναφορές}%
   \def\abstractname{Περίληψη}%
   \def\bibname{Βιβλιογραφία}%
   \def\prefacename{Πρόλογος}%
   \def\chaptername{Κεφάλαιο}%
   \def\appendixname{Παράρτημα}%
   \def\contentsname{Περιεχόμενα}%
   \def\listfigurename{Κατάλογος σχημάτων}%
   \def\listtablename{Κατάλογος πινάκων}%
   \def\indexname{Ευρετήριο}%
   \def\figurename{Σχήμα}%
   \def\tablename{Πίνακας}%
   \def\partname{Μέρος}%
   \def\pagename{Σελίδα}%
   \def\seename{βλέπε}%
   \def\alsoname{βλέπε επίσης}%
   \def\enclname{Συνημμένα}%
   \def\ccname{Κοινοποίηση}%
   \def\headtoname{Προς}%
   \def\proofname{Απόδειξη}%
   \def\glossaryname{Γλωσσάρι}}%

\def\datemonogreek{%   
   \def\today{\number\day\space%
      \greek@month%
      \space\number\year}%
   \def\greektoday{\greeknumber\day\space%
      \greek@month%
      \space\greeknumber\year}%
   \def\Greektoday{\Greeknumber\day\space%
      \greek@month%
      \space\Greeknumber\year}%
   \def\greek@month{\ifcase\month\or%
      Ιανουαρίου\or
      Φεβρουαρίου\or
      Μαρτίου\or
      Απριλίου\or
      Μαΐου\or
      Ιουνίου\or
      Ιουλίου\or
      Αυγούστου\or
      Σεπτεμβρίου\or
      Οκτωβρίου\or
      Νοεμβρίου\or
      Δεκεμβρίου\fi}}%

\def\polygreekcaptions{%
   \def\refname{Ἀναφορές}%
   \def\abstractname{Περίληψη}%
   \def\bibname{Βιβλιογραφία}%
   \def\prefacename{Πρόλογος}%
   \def\chaptername{Κεφάλαιο}%
   \def\appendixname{Παράρτημα}%
   \def\contentsname{Περιεχόμενα}%
   \def\listfigurename{Κατάλογος σχημάτων}%
   \def\listtablename{Κατάλογος πινάκων}%
   \def\indexname{Εὑρετήριο}%
   \def\figurename{Σχῆμα}%
   \def\tablename{Πίνακας}%
   \def\partname{Μέρος}%
   \def\pagename{Σελίδα}%
   \def\seename{βλέπε}%
   \def\alsoname{βλέπε ἐπίσης}%
   \def\enclname{Συνημμένα}%
   \def\ccname{Κοινοποίηση}%
   \def\headtoname{Πρὸς}%
   \def\proofname{Ἀπόδειξη}}%

\def\datepolygreek{%   
   \def\today{\number\day\space%
      \greek@month%
      \space\number\year}%
   \def\greektoday{\greeknumber\day\space%
      \greek@month%
      \space\greeknumber\year}%
   \def\Greektoday{\Greeknumber\day\space%
      \greek@month%
      \space\Greeknumber\year}%
   \def\greek@month{\ifcase\month\or%
      Ἰανουαρίου\or
      Φεβρουαρίου\or
      Μαρτίου\or
      Ἀπριλίου\or
      Μαΐου\or
      Ἰουνίου\or
      Ἰουλίου\or
      Αὐγούστου\or
      Σεπτεμβρίου\or
      Ὀκτωβρίου\or
      Νοεμβρίου\or
      Δεκεμβρίου\fi}}%

% this is copied verbatim from xgreek.sty:      
\def\ancientgreekcaptions{%
  \def\prefacename{Προοίμιον}%
  \def\refname{Αναφοραί}%
  \def\abstractname{Περίληψις}%
  \def\bibname{Βιβλιογραφία}%
  \def\chaptername{Κεφάλαιον}%
  \def\appendixname{Παράρτημα}%
  \def\contentsname{Περιεχόμενα}%
  \def\listfigurename{Κατάλογος σχημάτων}%
  \def\listtablename{Κατάλογος πινάκων}%
  \def\indexname{Εὑρετήριον}%
  \def\figurename{Σχήμα}%
  \def\tablename{Πίναξ}%
  \def\partname{Μέρος}%
  \def\enclname{Συνημμένως}%
  \def\ccname{Κοινοποίησις}%
  \def\headtoname{Πρὸς}%
  \def\pagename{Σελὶς}%
  \def\seename{ὃρα}%
  \def\alsoname{ὃρα ὡσαύτως}%
  \def\proofname{Ἀπόδειξις}%
  \def\glossaryname{Γλωσσάριον}%
  \def\refname{Ἀναφοραὶ}%
  \def\indexname{Εὑρετήριο}%
  \def\figurename{Σχῆμα}%
  \def\headtoname{Πρὸς}}%

\def\dateancientgreek{%
  \def\today{\number\day\space%
      \greek@month%
      \space\number\year}%
   \def\greektoday{\greeknumber\day\space%
      \greek@month%
      \space\greeknumber\year}%
   \def\Greektoday{\Greeknumber\day\space%
      \greek@month%
      \space\Greeknumber\year}%
   \def\greek@month{\ifcase\month\or%
      Ἰανουαρίου\or
      Φεβρουαρίου\or
      Μαρτίου\or
      Ἀπριλίου\or
      Μαΐου\or
      Ἰουνίου\or
      Ἰουλίου\or
      Αὐγούστου\or
      Σεπτεμβρίου\or
      Ὀκτωβρίου\or
      Νοεμβρίου\or
      Δεκεμβρίου\fi}}

% the code for alphabetic numbers and attic numerals 
% is copied verbatim from xgreek.sty
\DeclareRobustCommand\anw@false{%
  \DeclareRobustCommand\anw@print{}}
\DeclareRobustCommand\anw@true{%
  \DeclareRobustCommand\anw@print{ʹ}}
\anw@true

\def\greeknumber#1{%
  \ifnum#1<\@ne\space\gr@ill@value{#1}%
  \else
    \ifnum#1<10\expandafter\gr@num@i\number#1%
    \else
      \ifnum#1<100\expandafter\gr@num@ii\number#1%
      \else
        \ifnum#1<\@m\expandafter\gr@num@iii\number#1%
        \else
          \ifnum#1<\@M\expandafter\gr@num@iv\number#1%
          \else
            \ifnum#1<100000\expandafter\gr@num@v\number#1%
            \else
              \ifnum#1<1000000\expandafter\gr@num@vi\number#1%
              \else
                \space\gr@ill@value{#1}%
              \fi
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi
}
\def\Greeknumber#1{%
  \expandafter\MakeUppercase\expandafter{\greeknumber{#1}}}
\let\greeknumeral=\greeknumber
\let\Greeknumeral=\Greeknumber
\def\gr@num@i#1{%
  \ifcase#1\or α\or β\or γ\or δ\or ε\or Ϛ\or ζ\or η\or θ\fi
  \ifnum#1=\z@\else\anw@true\fi\anw@print}
\def\gr@num@ii#1{%
  \ifcase#1\or ι\or κ\or λ\or μ\or ν\or ξ\or ο\or π\or ϟ\fi
  \ifnum#1=\z@\else\anw@true\fi\gr@num@i}
\def\gr@num@iii#1{%
  \ifcase#1\or ρ\or σ\or τ\or υ\or φ\or χ\or ψ\or ω\or ϡ\fi
  \ifnum#1=\z@\anw@false\else\anw@true\fi\gr@num@ii}
\def\gr@num@iv#1{%
  \ifnum#1=\z@\else ͵\fi
  \ifcase#1\or α\or β\or γ\or δ\or ε\or Ϛ\or ζ\or η\or θ\fi
  \gr@num@iii}
\def\gr@num@v#1{%
  \ifnum#1=\z@\else ͵\fi
  \ifcase#1\or ι\or κ\or λ\or μ\or ν\or ξ\or ο\or π\or ϟ\fi
  \gr@num@iv}
\def\gr@num@vi#1{%
  ͵\ifcase#1\or ρ\or σ\or τ\or υ\or φ\or χ\or ψ\or ω\or ϡ\fi
  \gr@num@v}

%%%% Attic numerals (no longer optional)
\newcount\@attic@num
\DeclareRobustCommand*{\@@atticnum}[1]{%
        \@attic@num#1\relax
        \ifnum\@attic@num<\@ne%
          \space%
          \xpg@warning{Illegal value (\the\@attic@num) for acrophonic Attic numeral}%
        \else\ifnum\@attic@num>249999%
          \space%
	  \xpg@warning{Illegal value (\the\@attic@num) for acrophonic Attic numeral}%
        \else
            \@whilenum\@attic@num>49999\do{%
               \char"10147\advance\@attic@num-50000}%
            \@whilenum\@attic@num>9999\do{%
               M\advance\@attic@num-\@M}%
            \ifnum\@attic@num>4999%
               \char"10146\advance\@attic@num-5000%
            \fi\relax
            \@whilenum\@attic@num>999\do{%
               Χ\advance\@attic@num-\@m}%
            \ifnum\@attic@num>499%
               \char"10145\advance\@attic@num-500%
            \fi\relax
            \@whilenum\@attic@num>99\do{%
               Η\advance\@attic@num-100}%
            \ifnum\@attic@num>49%
               \char"10144\advance\@attic@num-50%
            \fi\relax
            \@whilenum\@attic@num>9\do{%
               Δ\advance\@attic@num by-10}%
            \@whilenum\@attic@num>4\do{%
               Π\advance\@attic@num-5}%
            \ifcase\@attic@num\or Ι\or ΙΙ\or ΙΙΙ\or ΙΙΙΙ\fi%
   \fi\fi}
\def\@atticnum#1{%
     \expandafter\@@atticnum\expandafter{\the#1}}
\def\atticnumeral#1{%
     \@attic@num#1\relax
     \@atticnum{\@attic@num}}
\let\atticnum=\atticnumeral

\def\greek@numbers{%
   \let\latin@alph\@alph%
   \let\latin@Alph\@Alph%
   \if@greek@numerals
      \def\greek@alph##1{\protect\greeknumber{##1}}%
      \def\greek@Alph##1{\protect\Greeknumber{##1}}%
      \let\@alph\greek@alph%
      \let\@Alph\greek@Alph%
   \fi}

\def\nogreek@numbers{%
  \let\@alph\latin@alph%
  \let\@Alph\latin@Alph%
  \let\greek@alph\@undefined%
  \let\greek@Alph\@undefined%
  }

%    \end{macrocode}
% \iffalse
%</gloss-greek.ldf>
%<*gloss-hebrew.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-hebrew.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-hebrew.ldf}[polyglossia: module for hebrew]
\ifluatex
  \xpg@warning{Hebrew is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\RequireBidi
\RequirePackage{hebrewcal}

\providebool{@hebrew@marcheshvan}

\PolyglossiaSetup{hebrew}{
  script=Hebrew,
  direction=RL,
  scripttag=hebr,
  hyphennames={nohyphenation},
  fontsetup=true,
  %TODO localalph={hebrewnumeral,Hebrewnumeral}
  %digits = hebrewnumber
}

\newif\if@calendar@hebrew
\def\tmp@hebrew{hebrew}
\define@key{hebrew}{calendar}[gregorian]{%
	\message{Setting \string\if@calendar@hebrew}
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@hebrew%
    \@calendar@hebrewtrue%
	\else%
    \@calendar@hebrewfalse%
	\fi}

\define@boolkey{hebrew}[@xpg@hebrew@]{marcheshvan}[false]{%
  \def\@tmpa{#1}%
  \def\@tmptrue{true}%
  \ifx\@tmpa\@tmptrue
    \@xpg@hebrew@marcheshvantrue
  \else
    \@xpg@hebrew@marcheshvanfalse
  \fi}

\setkeys{hebrew}{marcheshvan}

% hebrewcal.sty also defines the boolean key fullyear (default=false)

\newif\if@hebrew@numerals
\def\tmp@hebrew{hebrew}
\define@key{hebrew}{numerals}[arabic]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@hebrew%
	  \@hebrew@numeralstrue%
	\else%
    \@hebrew@numeralsfalse%
	\fi}

\setkeys{hebrew}{numerals}

\def\captionshebrew{%
  \def\prefacename{מבוא}%
  \def\refname{מקורות}%
  \def\abstractname{תקציר}%
  \def\bibname{ביבליוגרפיה}%
  \def\chaptername{פרק}%
  \def\appendixname{נספח}%
  \def\contentsname{תוכן העניינים}%
  \def\listfigurename{רשימת האיורים}%
  \def\listtablename{רשימת הטבלאות}%
  \def\indexname{מפתח}%
  \def\figurename{איור}%
  \def\tablename{טבלה}%
  \def\partname{חלק}%
  \def\enclname{רצ"ב}%
  \def\ccname{העתקים}%
  \def\headtoname{אל}%
  \def\pagename{עמוד}%
  \def\psname{נ.ב.}%
  \def\seename{ראה}%
  \def\alsoname{ראה גם}% check
  \def\proofname{הוכחה}
  \def\glossaryname{מילון מונחים}% check
}
\def\datehebrew{%
  \def\today{%
    \if@calendar@hebrew%
      \hebrewtoday%
    \else%
      \hebrewnumber\day%
      \space ב\hebrewgregmonth{\month}\space%
      \hebrewnumber\year%
     \fi}%
}

\def\hebrewgregmonth#1{\ifcase#1%
  \or ינואר% יאנואר
    \or פברואר\or מרץ% מרס / מארס
    \or אפריל\or מאי% מי
    \or יוני\or יולי\or אוגוסט %אבגוסט
    \or ספטמבר\or אוקטובר\or נובמבר\or דצמבר\fi}

\input{babel-hebrewalph.def}

\def\hebrewnumber#1{%
   \if@hebrew@numerals
     \protect\hebrewnumeral{#1}%
   \else
     \number#1%
   \fi
}

\def\hebrew@numbers{%
   \let\@origalph\@alph%
   \let\@origAlph\@Alph%
   \let\@alph\hebrewnumeral%
   \let\@Alph\Hebrewnumeral%
}
\def\nohebrew@numbers{%
  \let\@alph\@origalph%
  \let\@Alph\@origAlph%
}

\def\hebrew@globalnumbers{%
   \let\orig@arabic\@arabic%
   \let\@arabic\hebrewnumber%
   \renewcommand\thefootnote{\protect\hebrewnumber{\c@footnote}}%
}
\def\nohebrew@globalnumbers{%
  \let\@arabic\orig@arabic%
  \renewcommand\thefootnote{\protect\number{\c@footnote}}%
}

\def\blockextras@hebrew{%
   \let\@@MakeUppercase\MakeUppercase%
   \def\MakeUppercase##1{##1}%
   }
\def\noextras@hebrew{%
   \let\MakeUppercase\@@MakeUppercase%
   }

%    \end{macrocode}
% \iffalse
%</gloss-hebrew.ldf>
%<*gloss-hindi.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-hindi.ldf}
%    \begin{macrocode}
% UTF-8 strings kindly provided by Zdenek Wagner, 10-03-2008
% with corrections and additional contributions by Anshuman Pandey
% TODO: add option for velthuis transliteration with link to
% Velthuis Devanagari project.

\ProvidesFile{gloss-hindi.ldf}[polyglossia: module for hindi]
\ifluatex
  \xpg@warning{Hindi is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\RequirePackage{devanagaridigits}
\PolyglossiaSetup{hindi}{
  script=Devanagari,
  scripttag=deva,
  langtag=HIN,
%%  hyphennames={hindi,!sanskrit}, TODO: implement fallback patterns (with ! prefix)
  fontsetup=true
  %TODO nouppercase=true,
  %TODO localnumber=hindinumber
}

\ifx\l@hindi\@undefined%
  \ifx\l@sanskrit\@undefined%
    \xpg@nopatterns{Hindi}%
    \adddialect\l@hindi\l@nohyphenation%
  \else
    \xpg@warning{No hyphenation patterns were loaded for Hindi\MessageBreak
    I will use the patterns for Sanskrit instead}
    \adddialect\l@hindi\l@sanskrit%
  \fi
\fi

\def\hindi@language{\language=\l@hindi}

\def\tmp@western{Western}
\newif\ifhindi@devanagari@numerals
\hindi@devanagari@numeralstrue

\define@key{hindi}{numerals}[Devanagari]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@western
    \hindi@devanagari@numeralsfalse
  \fi}

\def\hindinumber#1{%
  \ifhindi@devanagari@numerals
    \devanagaridigits{\number#1}%
  \else
    \number#1%
  \fi}

\def\captionshindi{%
     \def\abstractname{सारांश}%
     \def\appendixname{परिशिष्ट}%
     \def\bibname{संदर्भ ग्रन्थ}%
     \def\ccname{}%
     \def\chaptername{अध्याय}%
     \def\contentsname{विषय सूची}%
     \def\enclname{}%
     \def\figurename{चित्र}% रेखाचित्र
     \def\headpagename{पृषठ}%
     \def\headtoname{}%
     \def\indexname{सूची}%
     %              सूचक
     %              अनुक्रमणिका
     %              अनुक्रमणि
     \def\listfigurename{चित्रों की सूची}%
     \def\listtablename{तालिकाओं की सूची}%
     \def\pagename{पृषठ}%
     \def\partname{खणड}%
     \def\prefacename{प्रस्तावना}% प्राक्कथन
     \def\refname{हवाले}%
     \def\tablename{तालिका}%
     \def\seename{देखिए}%
     \def\alsoname{और देखिए}%
     \def\alsoseename{और देखिए}%
}
\def\datehindi{%
  \def\today{\hindinumber\day\space\ifcase\month\or
    जनवरी\or
    फ़रवरी\or
    मार्च\or
    अपरैल\or
    मई\or
    जून\or
    जलाई\or
    अगस्त\or
    सितम्बर\or
    अक्तूबर\or
    नवम्बर\or
    दिसम्बर\fi
    \space\hindinumber\year}%
}

\def\blockextras@hindi{%
  \let\@@MakeUppercase\MakeUppercase%
  \def\MakeUppercase##1{##1}%
}
\def\noextras@hindi{%
  \let\MakeUppercase\@@MakeUppercase%
}

%    \end{macrocode}
% \iffalse
%</gloss-hindi.ldf>
%<*gloss-icelandic.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-icelandic.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-icelandic.ldf}[polyglossia: module for icelandic]
\PolyglossiaSetup{icelandic}{
  hyphennames={icelandic},
  hyphenmins={2,2},
  fontsetup=true,
}

\def\captionsicelandic{%
   \def\refname{Heimildir}%
   \def\abstractname{Útdráttur}%
   \def\bibname{Heimildir}%
   \def\prefacename{Formáli}%
   \def\chaptername{Kafli}%
   \def\appendixname{Viðauki}%
   \def\contentsname{Efnisyfirlit}%
   \def\listfigurename{Myndaskrá}%
   \def\listtablename{Töfluskrá}%
   \def\indexname{Atriðisorðaskrá}%
   \def\figurename{Mynd}%
   \def\tablename{Tafla}%
   %\def\thepart{}%
   \def\partname{Hluti}%
   \def\pagename{Blaðsíða}%
   \def\seename{Sjá}%
   \def\alsoname{Sjá einnig}%
   \def\enclname{Hjálagt}%
   \def\ccname{Samrit}%
   \def\headtoname{Til:}%
   \def\proofname{Sönnun}%
   \def\glossaryname{Orðalisti}%
   }

\def\dateicelandic{%
   \def\today{\number\day.~\ifcase\month\or
    janúar\or febrúar\or mars\or apríl\or maí\or
    júní\or júlí\or ágúst\or september\or
    október\or nóvember\or desember\fi
    \space\number\year}%
    }

%    \end{macrocode}
% \iffalse
%</gloss-icelandic.ldf>
%<*gloss-interlingua.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-interlingua.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-interlingua.ldf}[polyglossia: module for interlingua]
\PolyglossiaSetup{interlingua}{
  hyphennames={interlingua},
  hyphenmins={2,2},
  frenchspacing=true,
  indentfirst=true,
  fontsetup=true,
}

\def\captionsinterlingua{%
   \def\refname{Referentias}%
   \def\abstractname{Summario}%
   \def\bibname{Bibliographia}%
   \def\prefacename{Prefacio}%
   \def\chaptername{Capitulo}%
   \def\appendixname{Appendice}%
   \def\contentsname{Contento}%
   \def\listfigurename{Lista de figuras}%
   \def\listtablename{Lista de tabellas}%
   \def\indexname{Indice}%
   \def\figurename{Figura}%
   \def\tablename{Tabella}%
   \def\partname{Parte}%
   %\def\thepart{}%
   \def\pagename{Pagina}%
   \def\seename{vide}%
   \def\alsoname{vide etiam}%
   \def\enclname{Incluso}%
   \def\ccname{Copia}%
   \def\headtoname{A}%
   \def\proofname{Prova}%
   \def\glossaryname{Glossario}%
   }
\def\dateinterlingua{%
   \def\today{le~\number\day\space de \ifcase\month\or
    januario\or februario\or martio\or april\or maio\or junio\or
    julio\or augusto\or septembre\or octobre\or novembre\or
    decembre\fi
    \space \number\year}}

%    \end{macrocode}
% \iffalse
%</gloss-interlingua.ldf>
%<*gloss-irish.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-irish.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-irish.ldf}[polyglossia: module for irish]
\PolyglossiaSetup{irish}{
  hyphennames={irish},
  hyphenmins={2,2},
  fontsetup=true,
}

\def\captionsirish{%
   \def\refname{Tagairtí}%
   \def\abstractname{Achoimre}%
   \def\bibname{Leabharliosta}%
   \def\prefacename{Réamhrá}%    <-- also "Brollach"
   \def\refname{Tagairtí}%
   \def\chaptername{Tagairtí}%
   \def\appendixname{Aguisín}%
   \def\contentsname{Clár Ábhair}%
   \def\listfigurename{Léaráidí}%
   \def\listtablename{Táblaí}%
   \def\indexname{Innéacs}%
   \def\figurename{Léaráid}%
   \def\tablename{Tábla}%
   %\def\thepart{}%
   \def\partname{Cuid}%
   \def\pagename{Leathanach}%
   \def\seename{féach}%
   \def\alsoname{féach freisin}%
   \def\enclname{faoi iamh}%
   \def\ccname{cc}%
   \def\headtoname{Go}%
   \def\proofname{Cruthúnas}%
   \def\glossaryname{Glossary}%
   }
\def\dateirish{%
   \def\today{%
    \number\day\space \ifcase\month\or
    Eanáir\or Feabhra\or Márta\or Aibreán\or
    Bealtaine\or Meitheamh\or Iúil\or Lúnasa\or
    Meán Fómhair\or Deireadh Fómhair\or
    Mí na Samhna\or Mí na Nollag\fi
    \space \number\year}}

%    \end{macrocode}
% \iffalse
%</gloss-irish.ldf>
%<*gloss-italian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-italian.ldf}
%    \begin{macrocode}
% !TEX encoding = UTF-8 Unicode
\ProvidesFile{gloss-italian.ldf}[polyglossia: module for italian]
\PolyglossiaSetup{italian}{
  hyphennames={italian},
  hyphenmins={2,2},
  frenchspacing=true,
  indentfirst=true,
  fontsetup=true,
}


%%% CHANGES START %%% by Enrico Gregorio
\define@boolkey{italian}[italian@]{babelshorthands}[true]{}

\ifsystem@babelshorthands
  \setkeys{italian}{babelshorthands=true}
\else
  \setkeys{italian}{babelshorthands=false}
\fi

\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
}{}

\def\italian@shorthands{%
  \bbl@activate{"}%
  \def\language@group{italian}%
  \declare@shorthand{italian}{"}{%
    \relax\ifmmode
      \def\xpgit@next{''}%
    \else
      \def\xpgit@next{\futurelet\xpgit@temp\xpgit@cwm}%
    \fi
  \xpgit@next}%
}

%%% By Enrico Gregorio and Claudio Beccari %%%
\def\xpgit@@cwm{\nobreak\discretionary{-}{}{}\nobreak\hskip\z@skip}
\def\xpgit@cwm{\let\xpgit@@next\relax
  \ifcat\noexpand\xpgit@temp a%
    \def\xpgit@@next{\xpgit@@cwm}%
  \else
    \if\noexpand\xpgit@temp \string|%
      \def\xpgit@@next##1{\xpgit@@cwm}%
    \else
      \if\noexpand\xpgit@temp \string<%
        \def\xpgit@@next##1{«\ignorespaces}%
      \else
        \if\noexpand\xpgit@temp \string>%
          \def\xpgit@@next##1{\unskip »}%
        \else
          \if\noexpand\xpgit@temp\string/%
            \def\xpgit@@next##1{\slash}%
          \else
            \ifx\xpgit@temp"%
              \def\xpgit@@next##1{?}%
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi
  \xpgit@@next}

\def\noitalian@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
}
%%% CHANGES END %%%

%%% ORIGINAL %%% by Claudio Beccari
\def\captionsitalian{%
  \def\prefacename{Prefazione}%
  \def\refname{Riferimenti bibliografici}%
  \def\abstractname{Sommario}%
  \def\bibname{Bibliografia}%
  \def\chaptername{Capitolo}%
  \def\appendixname{Appendice}%
  \def\contentsname{Indice}%
  \def\listfigurename{Elenco delle figure}%
  \def\listtablename{Elenco delle tabelle}%
  \def\indexname{Indice analitico}%
  \def\figurename{Figura}%
  \def\tablename{Tabella}%
  \def\partname{Parte}%
  \def\enclname{Allegati}%
  \def\ccname{e~p.~c.}%
  \def\headtoname{Per}%
  \def\pagename{Pag.}%    % in Italian the abbreviation is preferred
  \def\seename{vedi}%
  \def\alsoname{vedi anche}%
  \def\proofname{Dimostrazione}%
  \def\glossaryname{Glossario}%
   }
\def\dateitalian{%
   \def\today{\number\day~\ifcase\month\or
    gennaio\or febbraio\or marzo\or aprile\or maggio\or giugno\or
    luglio\or agosto\or settembre\or ottobre\or novembre\or
    dicembre\fi\space \number\year}}
%%% ORIGINAL END %%%

%%% CHANGES START %%% by Enrico Gregorio
\let\xpgit@savedvalues\empty
\AtEndPreamble{% the user or the class might define different values
  \edef\xpgit@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}
}


\def\noextras@italian{%
   \lccode\string"2019=\z@
   \noitalian@shorthands
   \xpgit@savedvalues
}

\def\blockextras@italian{%
   \lccode\string"2019=\string"2019
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000
   \finalhyphendemerits=50000000
   \ifitalian@babelshorthands\italian@shorthands\fi
}

\def\inlineextras@italian{%
   \lccode\string"2019=\string"2019
   \ifitalian@babelshorthands\italian@shorthands\fi
}
%%% CHANGES END %%%
%    \end{macrocode}
% \iffalse
%</gloss-italian.ldf>
%<*gloss-japanese.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-japanese.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-japanese.ldf}[polyglossia: module for japanese]
\PolyglossiaSetup{japanese}{
	script=CJK,
	language=Japanese,
	langtag=JAN,
	hyphennames={nohyphenation},
	frenchspacing=false,
	fontsetup=true
}

\def\japanese@capsformat{%
	\def\@seccntformat##1{%
		\csname pre##1\endcsname%
		\csname the##1\endcsname%
		\csname post##1\endcsname%
	}
	\def\postsection{節\space}%
	\def\postsubsection{節\space}%
	\def\postsubsubsection{節\space}%
	\def\presection{第}%
	\def\presubsection{第}%
	\def\presubsubsection{第}%
}

\def\captionsjapanese{%
	\def\refname{参考文献}%
	\def\abstractname{概要}%
	\def\bibname{文献目録}%
	\def\prefacename{端書き}%
	\def\chaptername##1##2{第##1##2 章}%
	\def\appendixname{付録}%
	\def\contentsname{目次}%
	\def\listfigurename{図目次}%
	\def\listtablename{表目次}%
	\def\indexname{索引}%
	\def\figurename{図}%
	\def\tablename{表}%
	\def\partname##1##2{第##1##2 部}%
	\def\pagename##1##2{第##1##2 頁}%
	\def\seename{参照}%
	\def\alsoname{参照}%
	\def\enclname{添付}%
	\def\ccname{同報}%
	\def\headtoname{宛先}%
	\def\proofname{証明}%
	\def\glossaryname{用語集}%
 }

\newif\if@WameiReki \@WameiRekifalse%
\newif\if@WameiTosi \@WameiTosifalse%
\newif\if@WameiTuki \@WameiTukifalse%
\newif\if@WameiHi \@WameiHifalse%
\newif\if@IzumoTuki \@IzumoTukifalse%
\newcount\c@TempJNum%

\def\@JapaneseDigit#1{
	\ifcase#1\or 一\or 二\or 三\or 四\or 五\or
		六\or 七\or 八\or 九\or 十\or
		十一\or 十二\or 十三\or 十四\or 十五\or
		十六\or 十七\or 十八\or 十九\or 廿\or
		廿一\or 廿二\or 廿三\or 廿四\or 廿五\or
		廿六\or 廿七\or 廿八\or 廿九\or 丗\or
		丗一\or 丗二\or 丗三\or 丗四\or 丗五\or
		丗六\or 丗七\or 丗八\or 丗九\or 四十\or
		四十一\or 四十二\or 四十三\or 四十四\or 四十五\or
		四十六\or 四十七\or 四十八\or 四十九\or 五十\or
		五十一\or 五十二\or 五十三\or 五十四\or 五十五\or
		五十六\or 五十七\or 五十八\or 五十九\or 六十\or
		六十一\or 六十二\or 六十三\or 六十四\or 六十五\or
		六十六\or 六十七\or 六十八\or 六十九\or 七十\or
		七十一\or 七十二\or 七十三\or 七十四\or 七十五\or
		七十六\or 七十七\or 七十八\or 七十九\or 八十\or
		八十一\or 八十二\or 八十三\or 八十四\or 八十五\or
		八十六\or 八十七\or 八十八\or 八十九\or 九十\or
		九十一\or 九十二\or 九十三\or 九十四\or 九十五\or
		九十六\or 九十七\or 九十八\or 九十九
	\else
		\@ctrerr
	\fi\relax
}

\def\@JapaneseNum#1{
	\c@TempJNum=#1\divide\c@TempJNum by 1000\relax%
	\ifnum\c@TempJNum=\z@\c@TempJNum=#1%
		\divide\c@TempJNum by 100\relax%
		\ifnum\c@TempJNum=\z@\@JapaneseDigit{#1}\relax%
		\else
			\ifcase\c@TempJNum\or 百\or 二百\or 三百\or 四百\or 五百\or
				六百\or 七百\or 八百\or 九百%
			\fi
			\c@TempJNum=#1\divide\c@TempJNum by 100\multiply\c@TempJNum by -100\advance\c@TempJNum#1\@JapaneseDigit\c@TempJNum\relax%
		\fi
	\else
		\ifcase\c@TempJNum\or 千\or 二千\or 三千\or 四千\or 五千\or
			六千\or 七千\or 八千\or 九千%
		\fi
		\c@TempJNum=#1\divide\c@TempJNum by 1000\multiply\c@TempJNum by -1000\advance\c@TempJNum#1\divide\c@TempJNum by 100\relax%
		\ifnum\c@TempJNum=\z@\c@TempJNum=#1%
			\divide\c@TempJNum by 100\multiply\c@TempJNum by -100\advance\c@TempJNum#1\@JapaneseDigit\c@TempJNum\relax%
		\else
			\ifcase\c@TempJNum\or 百\or 二百\or 三百\or 四百\or 五百\or
				六百\or 七百\or 八百\or 九百%
			\fi
			\c@TempJNum=#1\divide\c@TempJNum by 100\multiply\c@TempJNum by -100\advance\c@TempJNum#1\@JapaneseDigit\c@TempJNum\relax%
		\fi
	\fi
}

\def\@japanesenumber#1{
	\@tempcnta=#1%
	\ifnum\@tempcnta=\z@{〇}%
	\else
		\ifnum\@tempcnta<\z@{負}%
			\multiply\@tempcnta by -1%
		\fi
		\@tempcntb=\@tempcnta\divide\@tempcntb by 10000\relax%
		\ifnum\@tempcntb=\z@\@JapaneseNum%
			\@tempcnta%
		\else
			\@tempcntb=\@tempcnta\divide\@tempcntb by 100000000\relax%
			\ifnum\@tempcntb=\z@\@tempcntb=\@tempcnta%
				\divide\@tempcntb by 10000%
				\@JapaneseNum\@tempcntb{万}\@tempcntb=\@tempcnta%
				\divide\@tempcntb by 10000\multiply\@tempcntb by -10000%
				\advance\@tempcntb\@tempcnta\relax\@JapaneseNum\@tempcntb%
			\else
				\@JapaneseNum\@tempcntb{億}\@tempcntb=\@tempcnta%
				\divide\@tempcntb by 100000000\multiply\@tempcntb by -100000000%
				\advance\@tempcntb\@tempcnta\divide\@tempcntb by 10000\relax%
				\ifnum\@tempcntb=\z@%
				\else
					\@JapaneseNum\@tempcntb{万}%
				\fi
				\@tempcntb=\@tempcnta\divide\@tempcntb by 10000%
				\multiply\@tempcntb by -10000\advance\@tempcntb\@tempcnta%
				\@JapaneseNum\@tempcntb%
			\fi
		\fi
	\fi
}

\def\japanesenumber#1{
	\expandafter\@japanesenumber\csname c@#1\endcsname%
}

\def\datejapanese{
	{
		\ifnum\year<1868%
			\xdef\the@WarekiCur{}%
		\else
			\ifnum\year<1912%
				\xdef\the@WarekiCur{明治}\advance\year-1867\relax%
			\else
				\ifnum\year<1926%
					\xdef\the@WarekiCur{大正}\advance\year-1911\relax%
  				\else
					\ifnum\year<1989%
						\xdef\the@WarekiCur{昭和}\advance\year-1925\relax%
  					\else
						\xdef\the@WarekiCur{平成}\advance\year-1988\relax%
					\fi
				\fi
			\fi
		\fi
		\xdef\the@WameiTosi{\the\year}%
	}
	\def\西暦{\@WameiRekifalse \@WameiTukifalse \@WameiHifalse}%
	\def\和暦{\@WameiRekitrue \@WameiTosifalse \@WameiTukifalse \@WameiHifalse}%
	\def\和名暦{\@WameiTositrue \@WameiTukitrue \@WameiHitrue}%
	\def\数字暦{\@WameiTosifalse \@WameiTukifalse \@WameiHifalse}%
	\def\出雲月{\@IzumoTukitrue}%
	\def\大和月{\@IzumoTukifalse}%
	\def\today{
		\if@WameiReki%
			\the@WarekiCur%
			\if@WameiTosi%
				\@JapaneseNum\the@WameiTosi%
			\else
				\,\the@WameiTosi%
			\fi
		\else
			\number\year\,%
		\fi
		{年}%
		\if@WameiTuki%
			\ifcase\month\or 睦月\or 如月\or 弥生\or 卯月\or 皐月\or
				水無月\or 文月\or 葉月\or 長月\or
				\if@IzumoTuki 神在月\else 神無月\fi
				\or 霜月\or 師走%
			\fi
		\else
			\,\number\month\,%
		{月}%
		\fi
		\if@WameiHi%
			\@JapaneseNum\day%
		\else
			\,\number\day\,%
		\fi
		{日}
	}
}

\def\noextras@japanese{%
	\japanese@capsformat%
}

\def\blockextras@japanese{%
	\japanese@capsformat%
}

\def\inlineextras@japanese{%
	\japanese@capsformat%
}
% Based on contributions of Toru Inagaki, Norio Iwase, François Charette

%    \end{macrocode}
% \iffalse
%</gloss-japanese.ldf>
%<*gloss-kannada.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-kannada.ldf}
%    \begin{macrocode}
%% gloss-kannada.ldf
%% Copyright 2011 Aravinda VK <hallimanearavind AT gmail.com>,
%%                Shankar Prasad <prasad.mvs AT gmail.com>,
%%                Team Sanchaya <dev AT lists.sanchaya.net>
%
% 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 Aravinda VK <hallimanearavind AT gmail.com>.
%
% This work consists of the file gloss-kannada.ldf
\ProvidesFile{gloss-kannada.ldf}[polyglossia: module for kannada]
\ifluatex
  \xpg@warning{Kannada is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\PolyglossiaSetup{kannada}{
  script=Kannada,
  scripttag=knda,
  langtag=KNDA,
  hyphennames={kannada},
  hyphenmins={2,2}, 
  fontsetup=true
}

%% Defining Kannada digits equivalents to english
\def\kannadadigits#1{\expandafter\@kannada@digits #1@}
\def\@kannada@digits#1{%
  \ifx @#1% then terminate
  \else
    \ifx0#1೦\else\ifx1#1೧\else\ifx2#1೨\else\ifx3#1೩\else\ifx4#1೪\else\ifx5#1೫\else\ifx6#1೬\else\ifx7#1೭\else\ifx8#1೮\else\ifx9#1೯\else#1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
    \expandafter\@kannada@digits
  \fi
}

%% \kannada@numerals variable will be set to true or false depending on the option provided in \setmainlanguage
%% \kannada@numerals true by default or when we set \setmainlanguage[numerals=Kannada]{kannada}
%% \kannada@numerals false when we set \setmainlanguage[numerals=Western]{kannada}
\def\tmp@western{Western}
\newif\ifkannada@numerals
\kannada@numeralstrue

\define@key{kannada}{numerals}[Kannada]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@western
    \kannada@numeralsfalse
  \fi}

  
\def\captionskannada{%
  \def\prefacename{ಮುನ್ನುಡಿ}%
  \def\refname{ಉಲ್ಲೇಖಗಳು}%
  \def\abstractname{ಸಾರಾಂಶ}%
  \def\bibname{ಗ್ರಂಥಸೂಚಿ}%
  \def\chaptername{ಅಧ್ಯಾಯ}%
  \def\appendixname{ಅನುಬಂಧ}%
  \def\contentsname{ವಿಷಯಗಳು}%
  \def\listfigurename{ಚಿತ್ರಗಳ ಪಟ್ಟಿ}%
  \def\listtablename{ಕೋಷ್ಟಕಗಳ ಪಟ್ಟಿ}%
  \def\indexname{ಸೂಚಿ}%
  \def\figurename{ಚಿತ್ರ}%
  \def\tablename{ಕೋಷ್ಟಕ}%
  \def\partname{ಭಾಗ}%
  \def\enclname{encl}%
  \def\ccname{cc}%
  \def\headtoname{ಗೆ}%
  \def\pagename{ಪುಟ}%
  \def\seename{ನೋಡು}%
  \def\alsoname{ಇದನ್ನೂ ಸಹ ನೋಡು}%
  \def\proofname{ಕರಡುಪ್ರತಿ}%
}

\def\datekannada{%
  \def\kannadamonth{%
    \ifcase\month\or
    ಜನವರಿ\or
    ಫೆಬ್ರವರಿ\or
    ಮಾರ್ಚ್\or
    ಏಪ್ರಿಲ್\or
    ಮೇ\or
    ಜೂನ್\or
    ಜುಲೈ\or
    ಆಗಷ್ಟ್\or
    ಸೆಪ್ಟೆಂಬರ್\or
    ಅಕ್ಟೋಬರ್\or
    ನವಂಬರ್\or
    ಡಿಸಂಬರ್\fi}%
  \def\today{\kannadanumber\day\space\kannadamonth\space\kannadanumber\year}%
}

%% Based on the settings displays rrespective numbers
\def\kannadanumber#1{%
  \ifkannada@numerals
  \kannadadigits{\number#1}%
  \else
  \number#1%
  \fi
}

%    \end{macrocode}
% \iffalse
%</gloss-kannada.ldf>
%<*gloss-khmer.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-khmer.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-khmer.ldf}[polyglossia: module for Khmer]
\PolyglossiaSetup{khmer}{
	script=Khmer,%
	scripttag=khmr,%
	langtag=KHM,%
	hyphennames={nohyphenation},%
	fontsetup=true%
}
\newif\if@khmer@numerals
\def\tmp@khmer{khmer}
\define@key{khmer}{numerals}[arabic]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@khmer\@khmer@numeralstrue%
	\else\@khmer@numeralsfalse\fi%
}
\setkeys{khmer}{numerals}
\def\captionskhmer{%
	\def\prefacename{អារម្ភកថា}%
	\def\refname{ឯកសារយោង}%
	\def\abstractname{សង្ខេប}%
	\def\bibname{គន្ថនិទ្ទេស}%
	\def\chaptername{ជំពូក}%
	\def\appendixname{សេចក្ដីបន្ថែម}%
	\def\contentsname{មាតិការ}%
	\def\listfigurename{បញ្ជីរូបភាព}%
	\def\listtablename{បញ្ជីតារាង}%
	\def\indexname{សន្ទស្សន៍}%
	\def\figurename{រូប}%
	\def\tablename{តារាង}%
	\def\partname{ផ្នែក}%
	\def\pagename{ទំព័រ}%
	\def\seename{មើល}%
	\def\alsoname{មើលបន្ថែម}%
	\def\enclname{ឯកសារភ្ជាប់}%
	\def\ccname{ចម្លងជួន}%
	\def\headtoname{ផ្ញើរទៅ}%
	\def\proofname{សម្រាយ}%
	\def\glossaryname{សទានុក្រម}%
}
\def\datekhmer{%
	\def\khmer@month{%
		\ifcase\month\or%
		មករា\or%
		កុម្ភៈ\or%
		មិនា\or%
		មេសា\or%
		ឧសភា\or%
		មិថុនា\or%
		កក្កដា\or%
		សីហា\or%
		កញ្ញា\or%
		តុលា\or%
		វិច្ឆិកា\or%
		ធ្នូ\fi}%
	\def\today{\khmernumber\day\space\khmer@month\space\khmernumber\year}%
}
\def\khmerdigits#1{\expandafter\@khmer@digits #1@}
\def\@khmer@digits#1{%
	\ifx @#1% then terminate
	\else\ifx0#1០%
	\else\ifx1#1១%
	\else\ifx2#1២%
	\else\ifx3#1៣%
	\else\ifx4#1៤%
	\else\ifx5#1៥%
	\else\ifx6#1៦%
	\else\ifx7#1៧%
	\else\ifx8#1៨%
	\else\ifx9#1៩%
	\else#1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
    \expandafter\@khmer@digits%
    \fi
}
\def\khmernumber#1{%
	\if@khmer@numerals%
		\khmerdigits{\number#1}%
	\else%
		\number#1%
	\fi}
\def\khmer@globalnumbers{%
	\let\orig@arabic\@arabic%
	\let\@arabic\khmernumber%
	\renewcommand{\thefootnote}{\protect\khmernumber{\c@footnote}}%
}
\def\nokhmer@globalnumbers{%
	\let\@arabic\orig@arabic%
	\renewcommand\thefootnote{\protect\number{\c@footnote}}%
}
\def\thepart{\arabic{part}}
\def\@khmeralph#1{%
\ifcase#1%
\or ក\or ខ\or គ\or ឃ\or ង%
\or ច\or ឆ\or ជ\or ឈ\or ញ%
\or ដ\or ឋ\or ឌ\or ឍ\or ណ%
\or ត\or ថ\or ទ\or ធ\or ន%
\or ប\or ផ\or ព\or ភ\or ម%
\or យ\or រ\or ល\or វ\or ស\or ហ\or ឡ\or អ%
\else\xpg@ill@value{#1}{@khmeralph}\fi}
\def\khmerAlph#1{\expandafter\@khmerAlph\csname c@#1\endcsname}
\def\@khmerAlph#1{%
\ifcase#1%
\or ក\or ខ\or គ\or ឃ\or ង%
\or ច\or ឆ\or ជ\or ឈ\or ញ%
\or ដ\or ឋ\or ឌ\or ឍ\or ណ%
\or ត\or ថ\or ទ\or ធ\or ន%
\or ប\or ផ\or ព\or ភ\or ម%
\or យ\or រ\or ល\or វ\or ស\or ហ\or ឡ\or អ%
\else\xpg@ill@value{#1}{@khmeralph}\fi}
\def\khmer@numbers{%
	\let\@latinalph\@alph%
	\let\@latinAlph\@Alph%
	\if@khmer@numerals
		\let\@alph\@khmeralph%
		\let\@Alph\@khmerAlph%
	\fi%
}
\def\nokhmer@numbers{%
	\let\@alph\@latinalph%
	\let\@Alph\@latinAlph%
}
\def\blockextras@khmer{%
	\XeTeXlinebreaklocale "kh" % 
	\XeTeXlinebreakskip = 0pt plus 1pt minus 1pt
%	\let\orig@baselinestretch\baselinestretch%
%	\renewcommand{\baselinestretch}{1.2}% not work
}
\def\noblockextras@khmer{% 
	\XeTeXlinebreaklocale "en"%
%	\let\baselinestretch\orig@baselinestretch%
}
\@ifclassloaded{beamer}{%
	\usefonttheme{professionalfonts}%
	\def\factname{ស្វ័យសត្យ}%
	\def\lemmaname{បទគន្លិះ}%
	\def\theoremname{ទ្រឹស្ដីបទ}%
	\def\corollaryname{អនុសាធ្យ}%
	\def\problemname{ចំណោទ}%
	\def\solutionname{ដំណោះស្រាយ}%
	\def\definitionname{និយមន័យ}%
	\def\examplename{ឧទាហរណ៏}%
	\uselanguage{khmer}%
	\languagepath{khmer}%
	\deftranslation[to=khmer]{Fact}{\factname}%
	\deftranslation[to=khmer]{Lemma}{\lemmaname}%
	\deftranslation[to=khmer]{Theorem}{\theoremname}%
	\deftranslation[to=khmer]{Corollary}{\corollaryname}%
	\deftranslation[to=khmer]{Problem}{\problemname}%
	\deftranslation[to=khmer]{Solution}{\solutionname}%
	\deftranslation[to=khmer]{Definition}{\definitionname}%
	\deftranslation[to=khmer]{Definitions}{\definitionname}%
	\deftranslation[to=khmer]{Example}{\examplename}%
	\deftranslation[to=khmer]{Examples}{\examplename}%
	\AtEndDocument{\immediate\write\@auxout{\string\@writefile{nav}%
		{\noexpand\headcommand{\noexpand\def\noexpand%
		\inserttotalframenumber{\khmernumber{\the\c@framenumber}}}}}}%
}{}
%    \end{macrocode}
% \iffalse
%</gloss-khmer.ldf>
%<*gloss-korean.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-korean.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-korean.ldf}[polyglossia: module for Korean]

\PolyglossiaSetup{korean}{
    script=Hangul,
    scripttag=hang,
    language=Korean,
    langtag=KOR,
    hyphennames={english,USenglish},
    hyphenmins={2,3},
    frenchspacing=true,
    fontsetup=true
}

% variant : plain (0), classic (1), or modern (2)
\define@choicekey{korean}{variant}[\val\nr]{plain,classic,modern}[plain]{%
    \let\xpg@korean@variant\nr
}
% captions : hangul (0) or hanja (1)
\define@choicekey{korean}{captions}[\val\nr]{hangul,hanja}[hangul]{%
    \let\xpg@korean@captions\nr
}
\setkeys{korean}{variant,captions}

\def\captionskorean{%
    \ifcase\xpg@korean@captions\relax
        \captions@korean@hangul
    \else
        \captions@korean@hanja
    \fi
    \def\seename{$rightarrow$}%
    \def\alsoname{$Rightarrow$}%
}
\def\captions@korean@hangul{%
    \def\koreanTHEname{제}%
    \def\partname##1##2{제##1##2 편}%
    \def\chaptername{장}%
    \def\refname{참고문헌}%
    \def\abstractname{요약}%
    \def\bibname{참고문헌}%
    \def\prefacename{서문}%
    \def\appendixname{부록}%
    \def\contentsname{차례}%
    \def\listfigurename{그림 차례}%
    \def\listtablename{표 차례}%
    \def\indexname{찾아보기}%
    \def\figurename{그림}%
    \def\tablename{표}%
    \def\pagename{페이지}%
    \def\enclname{동봉}%
    \def\proofname{증명}%
    \def\headtoname{수신:}%
    \def\ccname{사본}%
}
\def\captions@korean@hanja{%
    \def\koreanTHEname{第}%
    \def\partname##1##2{第##1##2 篇}%
    \def\chaptername{章}%
    \def\refname{參考文獻}%
    \def\abstractname{要約}%
    \def\bibname{參考文獻}%
    \def\prefacename{序文}%
    \def\appendixname{附錄}%
    \def\contentsname{目次}%
    \def\listfigurename{圖版 目次}%
    \def\listtablename{表 目次}%
    \def\indexname{索引}%
    \def\figurename{圖版}%
    \def\tablename{表}%
    \def\pagename{面}%
    \def\enclname{同封}%
    \def\proofname{證明}%
    \def\headtoname{受信:}%
    \def\ccname{寫本}%
}

\def\datekorean{%
    \ifcase\xpg@korean@captions\relax
        \def\today{\the\year 년 \the\month 월 \the\day 일}%
    \else
        \def\today{\the\year 年 \the\month 月 \the\day 日}%
    \fi
}

\def\koreanAlph#1{\expandafter\@koreanAlph\csname c@#1\endcsname}
\def\@koreanAlph#1{%
    \ifcase#1\or 가\or 나\or 다\or 라\or 마\or 바\or 사\or 아\or 자\or
    차\or 카\or 타\or 파\or 하\else\xpg@ill@value{#1}{@koreanAlph}\fi
}

\def\koreanalph#1{\expandafter\@koreanalph\csname c@#1\endcsname}
\def\@koreanalph#1{%
    \ifcase#1\or ㄱ\or ㄴ\or ㄷ\or ㄹ\or ㅁ\or ㅂ\or ㅅ\or ㅇ\or ㅈ\or
    ㅊ\or ㅋ\or ㅌ\or ㅍ\or ㅎ\else\xpg@ill@value{#1}{@koreanalph}\fi
}

\def\korean@numbers{%
    \let\@orig@alph\@alph
    \let\@orig@Alph\@Alph
    \let\@alph\@koreanalph
    \let\@Alph\@koreanAlph
}
\def\nokorean@numbers{%
    \let\@alph\@orig@alph
    \let\@Alph\@orig@Alph
}
\let\nokorean@globalnumbers\nokorean@numbers

\ifxetex
    \def\inlineextras@korean{%
        \ifcase\xpg@korean@variant\relax
            \XeTeXinterchartokenstate\z@
            \XeTeXlinebreakpenalty 50
        \or
            \setvariantkoreaninterchartoks
            \setvariantkoreancharclasses
            \def\XPGKOhalfdim{\dimexpr.5em\relax}%
            \XeTeXinterchartokenstate\@ne
            \XeTeXlinebreakpenalty \z@
        \else
            \setvariantkoreaninterchartoks
            \setvariantkoreancharclasses
            \def\XPGKOhalfdim{\dimexpr.5\fontdimen\tw@\font\relax}%
            \XeTeXinterchartokenstate\@ne
            \XeTeXlinebreakpenalty 50
        \fi
        \XeTeXlinebreakskip 0pt plus.05em minus .01em
        \XeTeXlinebreaklocale "ko"
    }
    \def\noextras@korean{%
        \ifcase\xpg@korean@variant\relax
        \else
            \unsetvariantkoreaninterchartoks
            \unsetvariantkoreancharclasses
        \fi
        \XeTeXinterchartokenstate\z@
        \XeTeXlinebreakpenalty\z@
        \XeTeXlinebreakskip\z@skip
        \XeTeXlinebreaklocale ""
        \noextras@korean@common
    }
\else % luatex
    \def\inlineextras@korean{\xpg@attr@korean\xpg@korean@variant\relax}
    \def\noextras@korean{%
        \unsetattribute\xpg@attr@korean
        \noextras@korean@common
    }
\fi

\def\blockextras@korean{%
    \inlineextras@korean
    \ifdefined\@chapapp
        \long\def\@tmpa{\chaptername}\def\@tmpb{\chaptername}%
        \ifnum0\ifx\@chapapp\@tmpa1\else\ifx\@chapapp\@tmpb1\fi\fi>\z@
            \let\xpg@orig@@chapapp\@chapapp
            \def\@chapapp##1##2{\koreanTHEname ##1##2##1\chaptername}%
        \fi
    \fi
    \ifdefined\baselinestretch
        \let\xpg@orig@linestretch\baselinestretch
        \def\baselinestretch{1.3888}\selectfont
    \fi
    \ifdefined\footnotesep
        \edef\xpg@orig@footnotesep{\noexpand\footnotesep=\the\footnotesep\relax}%
        \footnotesep=1.3888\footnotesep
    \fi
}

\def\noextras@korean@common{%
    \ifdefined\xpg@orig@footnotesep \xpg@orig@footnotesep \fi
    \ifdefined\xpg@orig@linestretch \let\baselinestretch\xpg@orig@linestretch \fi
    \ifdefined\xpg@orig@@chapapp    \let\@chapapp\xpg@orig@@chapapp \fi
}

\ifxetex % XeTeX
% user commands for Josa
% Josa : particles in Korean grammar that immediately follow a noun or pronoun.
%        Josa might vary depending on previous character.
\protected\def\jong {\global\let\XPGKO@let@josa=0}\jong
\protected\def\rieul{\global\let\XPGKO@let@josa=1}
\protected\def\jung {\global\let\XPGKO@let@josa=2}
\protected\def\가{\xpg@make@josa 가이}
\protected\def\이{\futurelet\@let@token\xpg@make@josa@I}
\protected\def\은{\xpg@make@josa 는은} \let\는\은
\protected\def\을{\xpg@make@josa 를을} \let\를\을
\protected\def\와{\xpg@make@josa 와과} \let\과\와
\protected\def\으{\xpg@make@josa \empty 으}
\protected\def\로{\으 로}
\protected\def\라{\xpg@make@josa 라{이라}}
\def\xpg@make@josa@II{\xpg@make@josa\relax 이}
\def\xpg@make@josa@I{%
    \ifcat\@let@token\xpg@catcode@letter
        \expandafter\expandafter\expandafter\count@\expandafter
        \xpg@letter@to@num\meaning\@let@token\relax
        \ifnum 0\ifnum\count@>"ABFF \ifnum\count@<"D7A4 1\fi\fi>\z@
            \expandafter\expandafter\expandafter\xpg@make@josa@II
        \else
            \expandafter\expandafter\expandafter\가
        \fi
    \else
        \expandafter\가
    \fi
}
\def\xpg@make@josa#1#2{%
    \ifcat\xpg@catcode@letter\XPGKO@let@josa
        \expandafter\expandafter\expandafter\count@\expandafter
        \xpg@letter@to@num\meaning\XPGKO@let@josa\relax
    \else\ifcat\xpg@catcode@other\XPGKO@let@josa
        \expandafter\expandafter\expandafter\count@\expandafter
        \xpg@character@to@num\meaning\XPGKO@let@josa\relax
    \fi\fi
    \ifnum\count@<"3260
    \else\ifnum\count@<"3280 \advance\count@-"60
    \else\ifnum\count@<"AC00
    \else\ifnum\count@<"D7A4 % Hangul syllables
        \advance\count@-"AC00
        \@tempcnta\count@ \divide\@tempcnta28 \multiply\@tempcnta28
        \advance\count@-\@tempcnta \advance\count@"11A7
    \else\ifnum\count@<"FF00
    \else\ifnum\count@<"FF5B \advance\count@-"FEE0
    \fi\fi\fi\fi\fi \fi
    \ifnum\count@<"11A8
        \ifnum      "30=\count@ \count@\z@  % 0
        \else\ifnum "31=\count@ \count@\@ne % 1
        \else\ifnum "33=\count@ \count@\z@  % 3
        \else\ifnum "36=\count@ \count@\z@  % 6
        \else\ifnum "37=\count@ \count@\@ne % 7
        \else\ifnum "38=\count@ \count@\@ne % 8
        \else\ifnum "4C=\count@ \count@\@ne % L
        \else\ifnum "4D=\count@ \count@\z@  % M
        \else\ifnum "4E=\count@ \count@\z@  % N
        \else\ifnum "6C=\count@ \count@\@ne % l
        \else\ifnum "6D=\count@ \count@\z@  % m
        \else\ifnum "6E=\count@ \count@\z@  % n
        \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi
    \else\ifnum\count@<"1200
        \ifnum\count@="11AF \count@\@ne \else \count@\z@ \fi
    \else\ifnum\count@<"3131
    \else\ifnum\count@<"318F
        \ifnum     \count@="3139 \count@\@ne
        \else\ifnum\count@<"314F \count@\z@
        \else\ifnum\count@>"3164
             \ifnum\count@<"3187 \count@\z@ \fi
        \fi\fi\fi
    \else\ifnum\count@<"3200
    \else\ifnum\count@<"321F
        \ifnum     \count@="3203 \count@\@ne
        \else\ifnum\count@<"320E \count@\z@
        \fi\fi
    \else\ifnum\count@<"D7CB
    \else\ifnum\count@<"D7FC \count@\z@
    \fi\fi\fi\fi\fi \fi\fi\fi
    \ifcase\count@ #2% jong
    \or \ifx#1\empty\else#2\fi% rieul
    \else #1% jung
    \fi
}
\expandafter\def\expandafter\xpg@character@to@num\detokenize{the character} #1#2\relax{`#1\relax}
\expandafter\def\expandafter\xpg@letter@to@num\detokenize{the letter} #1#2\relax{`#1\relax}
\begingroup
\catcode`A=11 \catcode`0=12
\global\let\xpg@catcode@letter=A \global\let\xpg@catcode@other=0
\endgroup
% macros for interchartoks (Josa selection)
\def\XPGKOstartID{\global\futurelet\XPGKO@let@josa\XPGKO@skipID}
\def\XPGKOstartAA{\global\futurelet\XPGKO@let@josa\XPGKO@skipAA}
\def\XPGKO@skipID{\XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassID{\empty}}
\def\XPGKO@skipAA{\XeTeXinterchartoks\XeTeXcharclassBoundary\XPGKOcharclassAA{\empty}}
\def\XPGKOstopID {\XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassID{\XPGKOstartID}}
\def\XPGKOstopAA {\XeTeXinterchartoks\XeTeXcharclassBoundary\XPGKOcharclassAA{\XPGKOstartAA}}
% macros for interchartoks (CJK punctuations)
\def\XPGKOstartOP{\leavevmode\hbox to.5em\bgroup\hss}%
\def\XPGKOstopOP {\egroup}%
\def\XPGKOstartCL{\leavevmode\hbox to.5em\bgroup}%
\def\XPGKOstopCL {\hss\egroup}%
\let\XPGKOstartFS\XPGKOstartCL \let\XPGKOstopFS\XPGKOstopCL
\let\XPGKOstartMD\XPGKOstartOP \let\XPGKOstopMD\XPGKOstopCL
\let\XPGKOnobreak          \nobreak
\def\XPGKOhalfzero         {\hskip   \XPGKOhalfdim \relax}%
\def\XPGKOhalfhalf         {\hskip   \XPGKOhalfdim minus  \XPGKOhalfdim \relax}%
\def\XPGKOhalfquarter      {\hskip   \XPGKOhalfdim minus.5\XPGKOhalfdim \relax}%
\def\XPGKOquarterquarter   {\hskip .5\XPGKOhalfdim minus.5\XPGKOhalfdim \relax}%
\def\XPGKOiiiquarterquarter{\hskip1.5\XPGKOhalfdim minus.5\XPGKOhalfdim \relax}%
\def\XPGKOlatincjk         {\hskip .5\XPGKOhalfdim plus.25\XPGKOhalfdim minus.125\XPGKOhalfdim}%
% user macro to force zero skip
\let\inhibitglue\relax
% initialize interchartoks and classes
\ifdim\the\XeTeXversion\XeTeXrevision pt<0.99994pt
    \let\XeTeXcharclassIgnore  \@cclvi
    \let\XeTeXcharclassBoundary\@cclv
\else
    \chardef\XeTeXcharclassIgnore  =4096
    \chardef\XeTeXcharclassBoundary=4095
\fi
\ifdefined\XeTeXcharclassID\else
    \ifdefined\xtxHanGlue
        \let\XeTeXcharclassID\@ne
        \let\XeTeXcharclassOP\tw@
        \let\XeTeXcharclassCL\thr@@
    \else % email from JW
        \newXeTeXintercharclass\XeTeXcharclassID
        \newXeTeXintercharclass\XeTeXcharclassOP
        \newXeTeXintercharclass\XeTeXcharclassCL
        \global\let\XeTeXcharclassCJ\XeTeXcharclassID
        \global\let\XeTeXcharclassEX\XeTeXcharclassCL
        \global\let\XeTeXcharclassIS\XeTeXcharclassCL
        \global\let\XeTeXcharclassNS\XeTeXcharclassCL
        \global\let\XeTeXcharclassCM\XeTeXcharclassIgnore
        \input load-unicode-xetex-classes %
    \fi
\fi
% assign Hangul
\count@="AC00 \loop
    \XeTeXcharclass\count@\XeTeXcharclassID
    \ifnum\count@<"D7A3
    \advance\count@\@ne
    \repeat
\count@="1100 \loop
    \XeTeXcharclass\count@\XeTeXcharclassID
    \ifnum\count@<"11FF
    \advance\count@\@ne
    \repeat
\count@="A960 \loop
    \XeTeXcharclass\count@\XeTeXcharclassID
    \ifnum\count@<"A97C
    \advance\count@\@ne
    \repeat
\count@="D7B0 \loop
    \XeTeXcharclass\count@\XeTeXcharclassID
    \ifnum\count@<"D7FB
    \advance\count@\@ne
    \repeat
% more classes
\newXeTeXintercharclass\XPGKOcharclassMD % ・ ： ；
\newXeTeXintercharclass\XPGKOcharclassFS % 。 ．
\newXeTeXintercharclass\XPGKOcharclassLD % ― … ‥
\newXeTeXintercharclass\XPGKOcharclassEX % ？ ！
\newXeTeXintercharclass\XPGKOcharclassAO % ascii (
\newXeTeXintercharclass\XPGKOcharclassAC % ascii )
\newXeTeXintercharclass\XPGKOcharclassAA % ascii letters/numbers
% unset all interchartoks
\def\unsetvariantkoreaninterchartoks{%
    \@tfor\@tmpa :=\XeTeXcharclassID\XeTeXcharclassOP\XeTeXcharclassCL\XPGKOcharclassMD\XPGKOcharclassFS
                   \XPGKOcharclassLD\XPGKOcharclassEX\XPGKOcharclassAO\XPGKOcharclassAC\XPGKOcharclassAA
    \do{\count@\XeTeXcharclassBoundary \loop
            \XeTeXinterchartoks\@tmpa\count@{}%
            \XeTeXinterchartoks\count@\@tmpa{}%
            \ifnum\count@=\XeTeXcharclassBoundary \count@\m@ne \fi
            \ifnum\count@<\xe@alloc@intercharclass
            \advance\count@\@ne
            \repeat
    }%
}
% interchartoks for classic/modern variants
\def\setvariantkoreaninterchartoks{%
    \count@\XeTeXcharclassBoundary \loop
        \ifnum\count@=\XeTeXcharclassID\else
        \ifnum\count@=\XeTeXcharclassOP\else
        \ifnum\count@=\XeTeXcharclassCL\else
        \ifnum\count@=\XPGKOcharclassMD\else
        \ifnum\count@=\XPGKOcharclassFS\else
        \ifnum\count@=\XPGKOcharclassAA\else
            \XeTeXinterchartoks\count@\XeTeXcharclassID{\XPGKOstartID}%
            \XeTeXinterchartoks\count@\XeTeXcharclassOP{\XPGKOstartOP}%
            \XeTeXinterchartoks\count@\XeTeXcharclassCL{\XPGKOstartCL}%
            \XeTeXinterchartoks\count@\XPGKOcharclassMD{\XPGKOstartMD}%
            \XeTeXinterchartoks\count@\XPGKOcharclassFS{\XPGKOstartFS}%
            \XeTeXinterchartoks\count@\XPGKOcharclassAA{\XPGKOstartAA}%
            \XeTeXinterchartoks\XeTeXcharclassID\count@{\XPGKOstopID}%
            \XeTeXinterchartoks\XeTeXcharclassOP\count@{\XPGKOstopOP}%
            \XeTeXinterchartoks\XeTeXcharclassCL\count@{\XPGKOstopCL}%
            \XeTeXinterchartoks\XPGKOcharclassMD\count@{\XPGKOstopMD}%
            \XeTeXinterchartoks\XPGKOcharclassFS\count@{\XPGKOstopFS}%
            \XeTeXinterchartoks\XPGKOcharclassAA\count@{\XPGKOstopAA}%
        \fi\fi\fi\fi\fi\fi
        \ifnum\count@=\XeTeXcharclassBoundary \count@\m@ne \fi
        \ifnum\count@<\xe@alloc@intercharclass
        \advance\count@\@ne
        \repeat
    %
    \XeTeXinterchartoks\XPGKOcharclassAA\XeTeXcharclassID{\XPGKOstopAA\XPGKOlatincjk\XPGKOstartID}%
    \XeTeXinterchartoks\XPGKOcharclassAA\XeTeXcharclassOP{\XPGKOstopAA\XPGKOhalfhalf\XPGKOstartOP}%
    \XeTeXinterchartoks\XPGKOcharclassAA\XeTeXcharclassCL{\XPGKOstopAA\XPGKOstartCL}%
    \XeTeXinterchartoks\XPGKOcharclassAA\XPGKOcharclassMD{\XPGKOstopAA\XPGKOnobreak\XPGKOquarterquarter\XPGKOstartMD}%
    \XeTeXinterchartoks\XPGKOcharclassAA\XPGKOcharclassFS{\XPGKOstopAA\XPGKOstartFS}%
    \XeTeXinterchartoks\XPGKOcharclassAA\XPGKOcharclassAA{\XPGKOstartAA}%
    %
    \XeTeXinterchartoks\XeTeXcharclassID\XeTeXcharclassID{\XPGKOstartID}%
    \XeTeXinterchartoks\XeTeXcharclassID\XeTeXcharclassOP{\XPGKOstopID\XPGKOhalfhalf\XPGKOstartOP}%
    \XeTeXinterchartoks\XeTeXcharclassID\XeTeXcharclassCL{\XPGKOstopID\XPGKOstartCL}%
    \XeTeXinterchartoks\XeTeXcharclassID\XPGKOcharclassMD{\XPGKOstopID\XPGKOnobreak\XPGKOquarterquarter\XPGKOstartMD}%
    \XeTeXinterchartoks\XeTeXcharclassID\XPGKOcharclassFS{\XPGKOstopID\XPGKOstartFS}%
    \XeTeXinterchartoks\XeTeXcharclassID\XPGKOcharclassAO{\XPGKOstopID\XPGKOlatincjk}%
    \XeTeXinterchartoks\XeTeXcharclassID\XPGKOcharclassAA{\XPGKOstopID\XPGKOlatincjk\XPGKOstartAA}%
    %
    \XeTeXinterchartoks\XeTeXcharclassOP\XeTeXcharclassID{\XPGKOstopOP\XPGKOstartID}%
    \XeTeXinterchartoks\XeTeXcharclassOP\XeTeXcharclassOP{\XPGKOstopOP\XPGKOstartOP}%
    \XeTeXinterchartoks\XeTeXcharclassOP\XeTeXcharclassCL{\XPGKOstopOP\XPGKOstartCL}%
    \XeTeXinterchartoks\XeTeXcharclassOP\XPGKOcharclassMD{\XPGKOstopOP\XPGKOnobreak\XPGKOquarterquarter\XPGKOstartMD}%
    \XeTeXinterchartoks\XeTeXcharclassOP\XPGKOcharclassFS{\XPGKOstopOP\XPGKOstartFS}%
    \XeTeXinterchartoks\XeTeXcharclassOP\XPGKOcharclassAA{\XPGKOstopOP\XPGKOstartAA}%
    %
    \XeTeXinterchartoks\XeTeXcharclassCL\XeTeXcharclassID{\XPGKOstopCL\XPGKOhalfhalf\XPGKOstartID}%
    \XeTeXinterchartoks\XeTeXcharclassCL\XeTeXcharclassOP{\XPGKOstopCL\XPGKOhalfhalf\XPGKOstartOP}%
    \XeTeXinterchartoks\XeTeXcharclassCL\XeTeXcharclassCL{\XPGKOstopCL\XPGKOstartCL}%
    \XeTeXinterchartoks\XeTeXcharclassCL\XPGKOcharclassMD{\XPGKOstopCL\XPGKOnobreak\XPGKOquarterquarter\XPGKOstartMD}%
    \XeTeXinterchartoks\XeTeXcharclassCL\XPGKOcharclassFS{\XPGKOstopCL\XPGKOstartFS}%
    \XeTeXinterchartoks\XeTeXcharclassCL\XPGKOcharclassLD{\XPGKOstopCL\XPGKOnobreak\XPGKOhalfhalf}%
    \XeTeXinterchartoks\XeTeXcharclassCL\XPGKOcharclassEX{\XPGKOstopCL\XPGKOnobreak\XPGKOhalfhalf}%
    \XeTeXinterchartoks\XeTeXcharclassCL\XPGKOcharclassAO{\XPGKOstopCL\XPGKOhalfhalf}%
    \XeTeXinterchartoks\XeTeXcharclassCL\XPGKOcharclassAC{\XPGKOstopCL\XPGKOnobreak\XPGKOhalfhalf}%
    \XeTeXinterchartoks\XeTeXcharclassCL\XPGKOcharclassAA{\XPGKOstopCL\XPGKOhalfhalf\XPGKOstartAA}%
    %
    \XeTeXinterchartoks\XPGKOcharclassMD\XeTeXcharclassID{\XPGKOstopMD\XPGKOquarterquarter\XPGKOstartID}%
    \XeTeXinterchartoks\XPGKOcharclassMD\XeTeXcharclassOP{\XPGKOstopMD\XPGKOquarterquarter\XPGKOstartOP}%
    \XeTeXinterchartoks\XPGKOcharclassMD\XeTeXcharclassCL{\XPGKOstopMD\XPGKOnobreak\XPGKOquarterquarter\XPGKOstartCL}%
    \XeTeXinterchartoks\XPGKOcharclassMD\XPGKOcharclassMD{\XPGKOstopMD\XPGKOnobreak\XPGKOhalfquarter\XPGKOstartMD}%
    \XeTeXinterchartoks\XPGKOcharclassMD\XPGKOcharclassFS{\XPGKOstopMD\XPGKOnobreak\XPGKOquarterquarter\XPGKOstartFS}%
    \XeTeXinterchartoks\XPGKOcharclassMD\XPGKOcharclassLD{\XPGKOstopMD\XPGKOnobreak\XPGKOquarterquarter}%
    \XeTeXinterchartoks\XPGKOcharclassMD\XPGKOcharclassEX{\XPGKOstopMD\XPGKOnobreak\XPGKOquarterquarter}%
    \XeTeXinterchartoks\XPGKOcharclassMD\XPGKOcharclassAO{\XPGKOstopMD\XPGKOquarterquarter}%
    \XeTeXinterchartoks\XPGKOcharclassMD\XPGKOcharclassAC{\XPGKOstopMD\XPGKOnobreak\XPGKOquarterquarter}%
    \XeTeXinterchartoks\XPGKOcharclassMD\XPGKOcharclassAA{\XPGKOstopMD\XPGKOquarterquarter\XPGKOstartAA}%
    %
    \XeTeXinterchartoks\XPGKOcharclassFS\XeTeXcharclassID{\XPGKOstopFS\XPGKOhalfzero\XPGKOstartID}%
    \XeTeXinterchartoks\XPGKOcharclassFS\XeTeXcharclassOP{\XPGKOstopFS\XPGKOhalfzero\XPGKOstartOP}%
    \XeTeXinterchartoks\XPGKOcharclassFS\XeTeXcharclassCL{\XPGKOstopFS\XPGKOstartCL}%
    \XeTeXinterchartoks\XPGKOcharclassFS\XPGKOcharclassMD{\XPGKOstopFS\XPGKOnobreak\XPGKOiiiquarterquarter\XPGKOstartMD}%
    \XeTeXinterchartoks\XPGKOcharclassFS\XPGKOcharclassFS{\XPGKOstopFS\XPGKOstartFS}%
    \XeTeXinterchartoks\XPGKOcharclassFS\XPGKOcharclassLD{\XPGKOstopFS\XPGKOnobreak\XPGKOhalfzero}%
    \XeTeXinterchartoks\XPGKOcharclassFS\XPGKOcharclassEX{\XPGKOstopFS\XPGKOnobreak\XPGKOhalfzero}%
    \XeTeXinterchartoks\XPGKOcharclassFS\XPGKOcharclassAO{\XPGKOstopFS\XPGKOhalfzero}%
    \XeTeXinterchartoks\XPGKOcharclassFS\XPGKOcharclassAC{\XPGKOstopFS\XPGKOnobreak\XPGKOhalfzero}%
    \XeTeXinterchartoks\XPGKOcharclassFS\XPGKOcharclassAA{\XPGKOstopFS\XPGKOhalfzero\XPGKOstartAA}%
    %
    \XeTeXinterchartoks\XPGKOcharclassLD\XeTeXcharclassOP{\XPGKOhalfhalf\XPGKOstartOP}%
    \XeTeXinterchartoks\XPGKOcharclassLD\XPGKOcharclassMD{\XPGKOnobreak\XPGKOquarterquarter\XPGKOstartMD}%
    %
    \XeTeXinterchartoks\XPGKOcharclassEX\XeTeXcharclassID{\XPGKOhalfhalf\XPGKOstartID}%
    \XeTeXinterchartoks\XPGKOcharclassEX\XeTeXcharclassOP{\XPGKOhalfhalf\XPGKOstartOP}%
    \XeTeXinterchartoks\XPGKOcharclassEX\XPGKOcharclassMD{\XPGKOnobreak\XPGKOquarterquarter\XPGKOstartMD}%
    \XeTeXinterchartoks\XPGKOcharclassEX\XPGKOcharclassAO{\XPGKOhalfhalf}%
    \XeTeXinterchartoks\XPGKOcharclassEX\XPGKOcharclassAC{\XPGKOnobreak\XPGKOhalfhalf}%
    \XeTeXinterchartoks\XPGKOcharclassEX\XPGKOcharclassAA{\XPGKOhalfhalf\XPGKOstartAA}%
    %
    \XeTeXinterchartoks\XPGKOcharclassAO\XeTeXcharclassOP{\XPGKOnobreak\XPGKOhalfhalf\XPGKOstartOP}%
    \XeTeXinterchartoks\XPGKOcharclassAO\XPGKOcharclassMD{\XPGKOnobreak\XPGKOquarterquarter\XPGKOstartMD}%
    %
    \XeTeXinterchartoks\XPGKOcharclassAC\XeTeXcharclassID{\XPGKOlatincjk\XPGKOstartID}%
    \XeTeXinterchartoks\XPGKOcharclassAC\XeTeXcharclassOP{\XPGKOhalfhalf\XPGKOstartOP}%
    \XeTeXinterchartoks\XPGKOcharclassAC\XPGKOcharclassMD{\XPGKOnobreak\XPGKOquarterquarter\XPGKOstartMD}%
}
% char classes for classic/modern variants
\def\setvariantkoreancharclasses{}
\def\unsetvariantkoreancharclasses{}
\def\@tmpa#1=#2{%
    \edef\setvariantkoreancharclasses{%
        \unexpanded\expandafter{\setvariantkoreancharclasses
            \XeTeXcharclass#1=#2}}%
    \edef\unsetvariantkoreancharclasses{%
        \noexpand\XeTeXcharclass#1=\the\XeTeXcharclass#1\relax
        \unexpanded\expandafter{\unsetvariantkoreancharclasses}}%
}
\count@"30 \loop % 0 .. 9
    \expandafter\@tmpa\the\count@=\XPGKOcharclassAA
    \ifnum\count@<"39
    \advance\count@\@ne
    \repeat
\count@"41 \loop % A .. Z
    \expandafter\@tmpa\the\count@=\XPGKOcharclassAA
    \ifnum\count@<"5A
    \advance\count@\@ne
    \repeat
\count@"61 \loop % a .. z
    \expandafter\@tmpa\the\count@=\XPGKOcharclassAA
    \ifnum\count@<"7A
    \advance\count@\@ne
    \repeat
% NS
\@tmpa "3005=\XeTeXcharclassID % 々 IDEOGRAPHIC ITERATION MARK
\@tmpa "301C=\XeTeXcharclassID % 〜 WAVE DASH
\@tmpa "303B=\XeTeXcharclassID % 〻 VERTICAL IDEOGRAPHIC ITERATION MARK
\@tmpa "303C=\XeTeXcharclassID % 〼 MASU MARK
\@tmpa "309B=\XeTeXcharclassID % ゛ KATAKANA-HIRAGANA VOICED SOUND MARK
\@tmpa "309C=\XeTeXcharclassID % ゜ KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
\@tmpa "309D=\XeTeXcharclassID % ゝ HIRAGANA ITERATION MARK
\@tmpa "309E=\XeTeXcharclassID % ゞ HIRAGANA VOICED ITERATION MARK
\@tmpa "30A0=\XeTeXcharclassID % ゠ KATAKANA-HIRAGANA DOUBLE HYPHEN
\@tmpa "30FD=\XeTeXcharclassID % ヽ KATAKANA ITERATION MARK
\@tmpa "30FE=\XeTeXcharclassID % ヾ KATAKANA VOICED ITERATION MARK
\@tmpa "A015=\XeTeXcharclassID % ꀕ YI SYLLABLE ITERATION MARK
\@tmpa "FF9E=\XeTeXcharclassID % ﾞ HALFWIDTH KATAKANA VOICED SOUND MARK
\@tmpa "FF9F=\XeTeXcharclassID % ﾟ HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK
% IS
\@tmpa "FE13=\XeTeXcharclassID % ︓ PRESENTATION FORM FOR VERTICAL COLON
\@tmpa "FE14=\XeTeXcharclassID % ︔ PRESENTATION FORM FOR VERTICAL SEMICOLON
% CJ
\ifnum\the\XeTeXcharclass"3041=\XeTeXcharclassID \else
    \@tmpa "3041=\XeTeXcharclassID % ぁ HIRAGANA LETTER SMALL A
    \@tmpa "3043=\XeTeXcharclassID % ぃ HIRAGANA LETTER SMALL I
    \@tmpa "3045=\XeTeXcharclassID % ぅ HIRAGANA LETTER SMALL U
    \@tmpa "3047=\XeTeXcharclassID % ぇ HIRAGANA LETTER SMALL E
    \@tmpa "3049=\XeTeXcharclassID % ぉ HIRAGANA LETTER SMALL O
    \@tmpa "3063=\XeTeXcharclassID % っ HIRAGANA LETTER SMALL TU
    \@tmpa "3083=\XeTeXcharclassID % ゃ HIRAGANA LETTER SMALL YA
    \@tmpa "3085=\XeTeXcharclassID % ゅ HIRAGANA LETTER SMALL YU
    \@tmpa "3087=\XeTeXcharclassID % ょ HIRAGANA LETTER SMALL YO
    \@tmpa "308E=\XeTeXcharclassID % ゎ HIRAGANA LETTER SMALL WA
    \@tmpa "3095=\XeTeXcharclassID % ゕ HIRAGANA LETTER SMALL KA
    \@tmpa "3096=\XeTeXcharclassID % ゖ HIRAGANA LETTER SMALL KE
    \@tmpa "30A1=\XeTeXcharclassID % ァ KATAKANA LETTER SMALL A
    \@tmpa "30A3=\XeTeXcharclassID % ィ KATAKANA LETTER SMALL I
    \@tmpa "30A5=\XeTeXcharclassID % ゥ KATAKANA LETTER SMALL U
    \@tmpa "30A7=\XeTeXcharclassID % ェ KATAKANA LETTER SMALL E
    \@tmpa "30A9=\XeTeXcharclassID % ォ KATAKANA LETTER SMALL O
    \@tmpa "30C3=\XeTeXcharclassID % ッ KATAKANA LETTER SMALL TU
    \@tmpa "30E3=\XeTeXcharclassID % ャ KATAKANA LETTER SMALL YA
    \@tmpa "30E5=\XeTeXcharclassID % ュ KATAKANA LETTER SMALL YU
    \@tmpa "30E7=\XeTeXcharclassID % ョ KATAKANA LETTER SMALL YO
    \@tmpa "30EE=\XeTeXcharclassID % ヮ KATAKANA LETTER SMALL WA
    \@tmpa "30F5=\XeTeXcharclassID % ヵ KATAKANA LETTER SMALL KA
    \@tmpa "30F6=\XeTeXcharclassID % ヶ KATAKANA LETTER SMALL KE
    \@tmpa "30FC=\XeTeXcharclassID % ー KATAKANA-HIRAGANA PROLONGED SOUND MARK
    \count@"31F0 \loop
        \expandafter\@tmpa\the\count@=\XeTeXcharclassID
        \ifnum\count@<"31FF
        \advance\count@\@ne
        \repeat
    \count@"FF67 \loop
        \expandafter\@tmpa\the\count@=\XeTeXcharclassID
        \ifnum\count@<"FF70
        \advance\count@\@ne
        \repeat
\fi
%
\@tmpa "28=\XPGKOcharclassAO % ( LEFT PARENTHESIS
\@tmpa "5B=\XPGKOcharclassAO % [ LEFT SQUARE BRACKET
\@tmpa "60=\XPGKOcharclassAO % ` GRAVE ACCENT
\@tmpa "7B=\XPGKOcharclassAO % { LEFT CURLY BRACKET
\@tmpa "AB=\XPGKOcharclassAO % « LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
%
\@tmpa "21=\XPGKOcharclassAC % ! EXCLAMATION MARK
\@tmpa "27=\XPGKOcharclassAC % ' APOSTROPHE
\@tmpa "29=\XPGKOcharclassAC % ) RIGHT PARENTHESIS
\@tmpa "2C=\XPGKOcharclassAC % , COMMA
\@tmpa "2E=\XPGKOcharclassAC % . FULL STOP
\@tmpa "3B=\XPGKOcharclassAC % ; SEMICOLON
\@tmpa "3F=\XPGKOcharclassAC % ? QUESTION MARK
\@tmpa "5D=\XPGKOcharclassAC % ] RIGHT SQUARE BRACKET
\@tmpa "7D=\XPGKOcharclassAC % } RIGHT CURLY BRACKET
\@tmpa "BB=\XPGKOcharclassAC % » RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
%
\@tmpa "2018=\XeTeXcharclassOP % ‘ LEFT SINGLE QUOTATION MARK
\@tmpa "201C=\XeTeXcharclassOP % “ LEFT DOUBLE QUOTATION MARK
%
\@tmpa "2019=\XeTeXcharclassCL % ’ RIGHT SINGLE QUOTATION MARK
\@tmpa "201D=\XeTeXcharclassCL % ” RIGHT DOUBLE QUOTATION MARK
% NS
\@tmpa "00B7=\XPGKOcharclassMD % · MIDDLE DOT
\@tmpa "30FB=\XPGKOcharclassMD % ・ KATAKANA MIDDLE DOT
\@tmpa "FE54=\XPGKOcharclassMD % ﹔ SMALL SEMICOLON
\@tmpa "FE55=\XPGKOcharclassMD % ﹕ SMALL COLON
\@tmpa "FF1A=\XPGKOcharclassMD % ： FULLWIDTH COLON
\@tmpa "FF1B=\XPGKOcharclassMD % ； FULLWIDTH SEMICOLON
\@tmpa "FF65=\XPGKOcharclassMD % ･ HALFWIDTH KATAKANA MIDDLE DOT
%
\@tmpa "3002=\XPGKOcharclassFS % 。 IDEOGRAPHIC FULL STOP
\@tmpa "FE12=\XPGKOcharclassFS % ︒ PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC FULL STOP
\@tmpa "FE52=\XPGKOcharclassFS % ﹒ SMALL FULL STOP
\@tmpa "FF0E=\XPGKOcharclassFS % ． FULLWIDTH FULL STOP
\@tmpa "FF61=\XPGKOcharclassFS % ｡ HALFWIDTH IDEOGRAPHIC FULL STOP
%
\@tmpa "2014=\XPGKOcharclassLD % — EM DASH
\@tmpa "2015=\XPGKOcharclassLD % ― HORIZONTAL BAR
\@tmpa "2025=\XPGKOcharclassLD % ‥ TWO DOT LEADER
\@tmpa "2026=\XPGKOcharclassLD % … HORIZONTAL ELLIPSIS
% EX
\@tmpa "FE15=\XPGKOcharclassEX % ︕ PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK
\@tmpa "FE16=\XPGKOcharclassEX % ︖ PRESENTATION FORM FOR VERTICAL QUESTION MARK
\@tmpa "FE56=\XPGKOcharclassEX % ﹖ SMALL QUESTION MARK
\@tmpa "FE57=\XPGKOcharclassEX % ﹗ SMALL EXCLAMATION MARK
\@tmpa "FF01=\XPGKOcharclassEX % ！ FULLWIDTH EXCLAMATION MARK
\@tmpa "FF1F=\XPGKOcharclassEX % ？ FULLWIDTH QUESTION MARK

%    \end{macrocode}
% \iffalse
%</gloss-korean.ldf>
%<*gloss-lao.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-lao.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-lao.ldf}[polyglossia: module for Lao]
\ifluatex
  \xpg@warning{Lao is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\PolyglossiaSetup{lao}{
  script=Lao,
  scripttag=lao,
  hyphennames={lao},
  hyphenmins={1,1},
  fontsetup=true,
  %TODO localalph={xxx@alph,xxx@Alph}
  %TODO localdigits=laonumber
}

\newif\if@lao@numerals
\def\tmp@lao{lao}
\define@key{lao}{numerals}[arabic]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@lao\@lao@numeralstrue\else
	  \@lao@numeralsfalse\fi
}

\setkeys{lao}{numerals}

% Translations provided by Brian Wilson <bountonw at gmail.com>
\def\captionslao{%
  \def\prefacename{ຄໍານໍາ}%
  \def\refname{ໜັງສືອ້າງອີງ}%
  \def\abstractname{ບົດຫຍໍ້ຄວາມ}%
  \def\bibname{ເອກະສານອ້າງອີງ}%
  \def\chaptername{ບົດທີ}%
  \def\appendixname{ພາກຄັດຕິດ}%
  \def\contentsname{ສາລະບານ}%
  \def\listfigurename{ສາລະບານຮູບ}%
  \def\listtablename{ສາລະບານຕາຕະລາງ}%
  \def\indexname{ດັດຊະນີ}%
  \def\figurename{ຮູບທີ}%
  \def\tablename{ຕາຕະລາງທີ}%
  \def\partname{ພາກ}%
  \def\pagename{ໜ້າ}%
  \def\seename{ອ່ານ}%
  \def\alsoname{ອ່ານເພີ່ມ}%
  \def\enclname{ເອກະສານປະກອບ}%
  \def\ccname{ສໍາເນົາເຖິງ}%
  \def\headtoname{ຮຽນ}%
  \def\proofname{ຂໍ້ພິສູດ}%
  \def\glossaryname{ປະມວນສັບ}% 
}
\def\datelao{%   
   \def\lao@month{%
     \ifcase\month\or
      ມັງກອນ\or
      ກຸມພາ\or
      ມີນາ\or
      ເມສາ\or
      ພຶດສະພາ\or
      ມິຖຸນາ\or
      ກໍລະກົດ\or
      ສິງຫາ\or
      ກັນຍາ\or
      ຕຸລາ\or
      ພະຈິກ\or
      ທັນວາ\fi}%
   \def\today{\laonumber\day \space \lao@month \space \laonumber\year}%
}

\def\laodigits#1{\expandafter\@lao@digits #1@}
\def\@lao@digits#1{%
  \ifx @#1% then terminate
  \else
    \ifx0#1໐\else\ifx1#1໑\else\ifx2#1໒\else\ifx3#1໓\else\ifx4#1໔\else\ifx5#1໕\else\ifx6#1໖\else\ifx7#1໗\else\ifx8#1໘\else\ifx9#1໙\else#1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
    \expandafter\@lao@digits
  \fi
}

\def\laonumber#1{%
  \if@lao@numerals
    \laodigits{\number#1}%
  \else
    \number#1%
  \fi}

\def\lao@globalnumbers{%
   \let\orig@arabic\@arabic%
   \let\@arabic\laonumber%
   \renewcommand{\thefootnote}{\protect\laonumber{\c@footnote}}%
}
\def\nolao@globalnumbers{%
   \let\@arabic\orig@arabic%
   \renewcommand\thefootnote{\protect\number{\c@footnote}}%
}

%    \end{macrocode}
% \iffalse
%</gloss-lao.ldf>
%<*gloss-latin.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-latin.ldf}
%    \begin{macrocode}
%%
%% This is file `gloss-latin.ldf',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gloss-latin.dtx  (with options: `lamodern')
%%   ------------------------------------------------------------------
%%   Latin module for polyglossia
%%   Copyright (C) Claudio Beccari 2013-2016
%%   Copyright (C) Élie Roux 2016
%%   This work is distributed under the MIT License.
%% 
%%   See the postamble.
%%   ------------------------------------------------------------------
\ProvidesFile{gloss-latin.ldf}
        [2016/09/10 v.1.03 Latin support from polyglossia]
%%


\PolyglossiaSetup{latin}{%
      hyphennames={latin},
      hyphenmins={2,2},
      frenchspacing=true,
      fontsetup=true,
}
\def\classicuclccodes{\lccode`\V=`\u \uccode`\u=`\V}
\def\noclassicuclccodes{\lccode`\V=`\v \uccode`\u=`\U}
\def\tmp@modern{modern}
\def\tmp@medieval{medieval}
\unless\ifluatex
  \def\tmp@classic{classic}
  \def\tmp@liturgical{liturgical}
\fi
\newif\ifmedieval\medievalfalse
\newif\ifclassic\classicfalse
\define@boolkey{latin}[latin@]{ecclesiastic}[true]{}

\let\latin@variant\l@latin
\ifluatex
  \ifcsname l@latin\endcsname\xpg@set@language@luatex@ii{latin}\fi
\fi
\def\captionslatin{\latincaptions}%
\def\datelatin{\latindate}%
\define@key{latin}{variant}[modern]{%
\def\@tempa{#1}%
\ifx\@tempa\tmp@medieval
  \ifluatex
    \ifcsname l@latin\endcsname\xpg@set@language@luatex@ii{latin}\fi
  \fi
  \let\latin@variant\l@latin
  \xpg@set@language@luatex@ii{latin}
  \medievaltrue \classictrue
  \classicuclccodes
  \xpg@info{Option: Medieval Latin}%
\else
  \ifx\@tempa\tmp@classic
    \unless\ifluatex
      \unless\ifcsname l@classiclatin\endcsname
         \xpg@nopatterns{Classic Latin}%
         \adddialect\l@classiclatin\l@latin
         \let\latin@variant\l@latin
      \else
         \let\latin@variant\l@classiclatin
      \fi
    \fi
    \medievalfalse\classictrue\classicuclccodes
    \xpg@info{Option: Classic Latin}%
  \else
   \ifx\@tempa\tmp@liturgical\unless\ifluatex
      \unless\ifcsname l@liturgicallatin\endcsname
         \xpg@nopatterns{Liturgical Latin}%
         \adddialect\l@liturgicallatin\l@latin
         \def\latin@variant{\l@latin}%
      \else
         \let\latin@variant\l@liturgicallatin
      \fi
        \medievaltrue\classicfalse
        \xpg@info{Option: Liturgical Latin}\fi
   \else
      \ifx\@tempa\tmp@modern
        \let\latin@variant\l@latin
        \ifluatex\xpg@set@language@luatex@ii{latin}\fi
        \xpg@info{Option: Modern Latin}%
      \else
        \def\latin@variant{\l@nohyphenation}%
        \PackageWarning{polyglossia}{%
          *******************\MessageBreak
          No hyphenation set for \@tempa
          *******************\MessageBreak
        }{}%
      \fi
    \fi
  \fi
\fi
}

\def\latin@language{\language=\latin@variant}%
\ifluatex
       \PackageWarning{polyglossia}{\MessageBreak\MessageBreak
       *****************\MessageBreak
       The ecclesiastic option is not active\MessageBreak
       when typesetting with LuaLaTeX\MessageBreak
       *****************\MessageBreak
       \MessageBreak}{}
  \else
   \def\ecclesiasticlatin@punctuation{%
      \def\xpg@unskip{\ifhmode\ifdim\lastskip>\z@\unskip\fi\fi}
      \lccode\string"2019=\string"2019
      \newXeTeXintercharclass\ecclesiasticlatin@punctthin
      \newXeTeXintercharclass\ecclesiasticlatin@punctguillstart
      \newXeTeXintercharclass\ecclesiasticlatin@punctguillend
      \XeTeXinterchartokenstate=1
      \XeTeXcharclass `\! \ecclesiasticlatin@punctthin
      \XeTeXcharclass `\? \ecclesiasticlatin@punctthin
      \XeTeXcharclass `\; \ecclesiasticlatin@punctthin
      \XeTeXcharclass `\: \ecclesiasticlatin@punctthin
      \XeTeXcharclass `\« \ecclesiasticlatin@punctguillstart
      \XeTeXcharclass `\» \ecclesiasticlatin@punctguillend
      \XeTeXinterchartoks \z@ \ecclesiasticlatin@punctthin = {\penalty\@M
      \hskip.2\fontdimen2\font \@plus\z@\@minus\z@}%
      \XeTeXinterchartoks 255 \ecclesiasticlatin@punctthin = {\xpg@unskip}
      \XeTeXinterchartoks \ecclesiasticlatin@punctguillstart \z@ = {\penalty\@M
      \hskip.2\fontdimen2\font \@plus\z@\@minus\z@\ignorespaces}
      \XeTeXinterchartoks \z@ \ecclesiasticlatin@punctguillend = {\xpg@unskip
      \penalty\@M\hskip.2\fontdimen2\font \@plus\z@\@minus\z@}
    }

   \def\noecclesiasticlatin@punctuation{%
      \lccode\string"2019=\z@
        \XeTeXcharclass `\! \z@
        \XeTeXcharclass `\? \z@
        \XeTeXcharclass `\; \z@
        \XeTeXcharclass `\: \z@
        \XeTeXcharclass `\« \z@
        \XeTeXcharclass `\» \z@
        \XeTeXinterchartokenstate=0
      }
    \let\latin@original@makefntext\@makefntext
    \newcommand\latin@ecclesiastic@makefntext[1]{%
        \parindent 1em \noindent
        \latin@Makefnmark{\enspace #1}}
    \newcommand\latin@Makefnmark{\hbox{\normalfont\@thefnmark.}}
\fi
\setkeys{latin}{variant,ecclesiastic=false}
\def\latincaptions{%
   \def\prefacename{\ifmedieval Præfatio\else Praefatio\fi}%
   \def\refname{Conspectus librorum}%
   \def\abstractname{Summarium}%
   \def\bibname{Conspectus librorum}%
   \def\chaptername{Caput}%
   \def\appendixname{Additamentum}%
   \def\contentsname{Index}%
   \def\listfigurename{Conspectus descriptionum}%
   \def\listtablename{Conspectus tabularum}%
   \def\indexname{Index rerum notabilium}%
   \def\figurename{Descriptio}%
   \def\tablename{Tabula}%
   \def\partname{Pars}%
   \def\enclname{Additur}%
   \def\ccname{Exemplar}%
   \def\headtoname{\ignorespaces}%
   \def\pagename{charta}%
   \def\seename{cfr.}%
   \def\alsoname{cfr.}%
   \def\proofname{Demonstratio}%
   \def\glossaryname{Glossarium}%
   }

\def\latindate{%
   \def\today{\uppercase\expandafter{\romannumeral\day}%
      \space \ifcase\month%
      \or Januarii\or Februarii\or Martii\or Aprilis\or Maji\or
      Junii\or Julii\or Augusti\or Septembris\or Octobris\or
        \ifclassic Nouembris\else Novembris\fi
      \or Decembris\fi%
      \space \uppercase\expandafter{\romannumeral\year}}}
%%%%%%%%% Latin shorthands

\define@boolkey{latin}[latin@]{babelshorthands}[true]{}

\ifsystem@babelshorthands
  \setkeys{latin}{babelshorthands=true}
\else
  \setkeys{latin}{babelshorthands=false}
\fi
\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
\initiate@active@char{'}%
}{}
\def\latin@shorthands{%
  \def\language@group{latin}%
  \bbl@activate{"}%
  \declare@shorthand{latin}{"}{\relax
    \ifmmode
      \def\xpgla@nextdq{''}%
    \else
      \def\xpgla@nextdq{\futurelet\xpgla@temp\xpgla@cwm}%
    \fi
  \xpgla@nextdq}%
  \bbl@activate{'}%
  \declare@shorthand{latin}{'}{\relax
    \ifmmode
      \def\xpgla@nextsq{'}%
    \else
      \def\xpgla@nextsq{\futurelet\xpgla@temp@A\xpgla@putacute}%
    \fi
  \xpgla@nextsq}%
}
\def\xpgla@allowhyphens{\bbl@allowhyphens
        \discretionary{-}{}{}\bbl@allowhyphens}
\newcommand*{\xpgla@cwm}{\let\xpgla@@nextdq\relax
  \ifcat\noexpand\xpgla@temp a%
    \let\xpgla@@nextdq\xpgla@allowhyphens
  \else
    \ifx\xpgla@temp\ae
        \let\xpgla@@nextdq\xpgla@allowhyphens
    \else
        \ifx\xpgla@temp\oe
           \let\xpgla@@nextdq\xpgla@allowhyphens
        \else
           \if\noexpand\xpgla@temp\string|%
              \def\xpgla@@nextdq{\xpgla@allowhyphens\@gobble}%
           \fi
        \fi
    \fi
  \fi
  \xpgla@@nextdq}%
\def\xpgla@putacute#1{\let\xpgla@nextsq\relax%
\if a\xpgla@temp@A
  æ\kern-0.175em^^^^0301\kern0.175em\xpgla@allowhyphens
\else
\if o\xpgla@temp@A
  œ\kern-0.175em^^^^0301\kern0.175em\xpgla@allowhyphens
\else
  \if æ\xpgla@temp@A
    æ^^^^0301%
  \else
    \if œ\xpgla@temp@A
      œ^^^^0301%
    \else
      \string'%
    \fi
  \fi
\fi
\fi}%

\def\nolatin@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{'}}%
}

\let\xpgla@savedvalues\empty
\AtEndPreamble{%
  \edef\xpgla@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}
}
\def\noextras@latin{%
   \lccode\string"2019=\z@
   \nolatin@shorthands
   \xpgla@savedvalues
   \noclassicuclccodes
  \iflatin@ecclesiastic
    \unless\ifluatex\noecclesiasticlatin@punctuation
    \let\@makefntext\latin@original@makefntext\fi
  \fi
}

\def\blockextras@latin{%
   \lccode\string"2019=\string"2019
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000
   \finalhyphendemerits=50000000
   \iflatin@babelshorthands\latin@shorthands\fi
   \iflatin@ecclesiastic\unless\ifluatex\ecclesiasticlatin@punctuation
   \let\@makefntext\latin@ecclesiastic@makefntext\fi
   \fi
}

\def\inlineextras@latin{%
   \lccode\string"2019=\string"2019
   \iflatin@babelshorthands\latin@shorthands\fi
   \iflatin@ecclesiastic
      \unless\ifluatex\ecclesiasticlatin@punctuation
      \let\@makefntext\latin@ecclesiastic@makefntext\fi
   \fi
}
%%   Copyright (C) Claudio Beccari 2013-2016
%%   Copyright (C) Élie Roux 2016
%% 
%%   Permission is hereby granted, free of charge, to any person obtaining
%%   a copy of this software and associated documentation files
%%   (the "Software"), to deal in the Software without restriction, including
%%   without limitation the rights to use, copy, modify, merge, publish,
%%   distribute, sublicense, and/or sell copies of the Software, and to permit
%%   persons to whom the Software is furnished to do so, subject to the following
%%   conditions:
%% 
%%   The above copyright notice and this permission notice shall be included in
%%   all copies or substantial portions of the Software.
%% 
%%   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%%   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%%   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
%%   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%%   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%%   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
%%   IN THE SOFTWARE.
%%
%% End of file `gloss-latin.ldf'.
%    \end{macrocode}
% \iffalse
%</gloss-latin.ldf>
%<*gloss-latvian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-latvian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-latvian.ldf}[polyglossia: module for latvian]
\PolyglossiaSetup{latvian}{
  hyphennames={latvian},
  hyphenmins={2,2},
  fontsetup=true,
}

\def\captionslatvian{%
   \def\prefacename{Priekšvārds}%
   \def\refname{Literatūras saraksts}%
   \def\abstractname{Anotācija}%
   \def\bibname{Literatūra}%
   \def\chaptername{Nodaļa}%
   \def\appendixname{Pielikums}%
   \def\contentsname{Saturs}%
   \def\listfigurename{Attēlu saraksts}%
   \def\listtablename{Tabulu saraksts}%
   \def\indexname{Index}%
   \def\figurename{Att.}%
   \def\tablename{Tabula}%
   \def\partname{Daļa}%
   \def\enclname{encl}%
   \def\ccname{cc}%
   \def\headtoname{To}%
   \def\pagename{lpp.}%
   \def\seename{sk.}%
   \def\alsoname{sk. arī}%
   \def\proofname{Pierādījums}%
   }
\def\datelatvian{%
   \def\today{%
      \number\year.\thinspace gada%
      \space\number\day.\thinspace%
      \ifcase\month\or%
      janvārī\or februārī\or martā\or%
      aprīlī\or maijā\or jūnijā\or%
      jūlijā\or augustā\or septembrī\or%
      oktobrī\or novembrī\or decembrī\fi}}

%    \end{macrocode}
% \iffalse
%</gloss-latvian.ldf>
%<*gloss-lithuanian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-lithuanian.ldf}
%    \begin{macrocode}
% Translated by Paulius Sladkevičius <komsas@gmail.com>

\ProvidesFile{gloss-lithuanian.ldf}[polyglossia: module for lithuanian]
\PolyglossiaSetup{lithuanian}{
  hyphennames={lithuanian},
  hyphenmins={2,2},
  fontsetup=true
}

\def\captionslithuanian{%
   \def\refname{Literatūra}%
   \def\abstractname{Santrauka}%
   \def\bibname{Literatūra}%
   \def\prefacename{Pratarmė}%
   \def\chaptername{Skyrius}%
   \def\appendixname{Priedas}%
   \def\contentsname{Turinys}%
   \def\listfigurename{Iliustracijų sąrašas}%
   \def\listtablename{Lentelių sąrašas}%
   \def\indexname{Rodyklė}%
   \def\figurename{pav.}%
   \def\tablename{lentelė}%
   \def\partname{Dalis}%
   \def\pagename{puslapis}%
   \def\seename{žiūrėk}%
   \def\alsoname{taip pat}%
   \def\enclname{Įdėta}%
   \def\ccname{Kopijos}%
   \def\headtoname{Kam}%
   \def\proofname{Įrodymas}%
   \def\glossaryname{Terminų žodynas}%
}

\def\datelithuanian{%
   \def\lithuanianmonth{\ifcase\month\or
      sausio\or
      vasario\or
      kovo\or
      balandžio\or
      gegužės\or
      birželio\or
      liepos\or
      rugpjūčio\or
      rugsėjo\or
      spalio\or
      lapkričio\or
      gruodžio\fi}%
   \def\today{\number\year~m.~\lithuanianmonth~\number\day~d.}%
}

\def\blockextras@lithuanian{%
  \let\fnum@figure@orig\fnum@figure
  \def\fnum@figure{\thefigure\nobreakspace\figurename}%
  \let\fnum@table@orig\fnum@table
  \def\fnum@table{\thetable\nobreakspace\tablename}%
}

\def\noextras@lithuanian{%
  \let\fnum@figure\fnum@figure@orig
  \let\fnum@table\fnum@table@orig
}

%    \end{macrocode}
% \iffalse
%</gloss-lithuanian.ldf>
%<*gloss-liturgicallatin.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-liturgicallatin.ldf}
%    \begin{macrocode}
%%
%% This is file `gloss-liturgicallatin.ldf',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gloss-latin.dtx  (with options: `laliturgic')
%%   ------------------------------------------------------------------
%%   Latin module for polyglossia
%%   Copyright (C) Claudio Beccari 2013-2016
%%   Copyright (C) Élie Roux 2016
%%   This work is distributed under the MIT License.
%% 
%%   See the postamble.
%%   ------------------------------------------------------------------
\ProvidesFile{gloss-liturgiclatin.ldf}
        [2016/09/10 v.1.03 Latin support from polyglossia]
%%


\PolyglossiaSetup{liturgicallatin}{%
      hyphennames={liturgicallatin},
      hyphenmins={2,2},
      frenchspacing=true,
      fontsetup=true,
}
\def\liturgicallatincaptions{%
   \def\prefacename{Præfatio}%
   \def\refname{Conspectus librorum}%
   \def\abstractname{Summarium}%
   \def\bibname{Conspectus librorum}%
   \def\chaptername{Caput}%
   \def\appendixname{Additamentum}%
   \def\contentsname{Index}%
   \def\listfigurename{Conspectus descriptionum}%
   \def\listtablename{Conspectus tabularum}%
   \def\indexname{Index rerum notabilium}%
   \def\figurename{Descriptio}%
   \def\tablename{Tabula}%
   \def\partname{Pars}%
   \def\enclname{Additur}%
   \def\ccname{Exemplar}%
   \def\headtoname{\ignorespaces}%
   \def\pagename{charta}%
   \def\seename{cfr.}%
   \def\alsoname{cfr.}%
   \def\proofname{Demonstratio}%
   \def\glossaryname{Glossarium}%
   }

\def\liturgicallatindate{%
   \def\today{\uppercase\expandafter{\romannumeral\day}%
      \space \ifcase\month%
      \or Januarii\or Februarii\or Martii\or Aprilis\or Maji\or Junii\or%
      Julii\or Augusti\or Septembris\or Octobris\or Novembris\or%
      Decembris\fi%
      \space \uppercase\expandafter{\romannumeral\year}}}

\define@boolkey{liturgicallatin}[liturgicallatin@]{babelshorthands}[true]{}

\ifsystem@babelshorthands
  \setkeys{liturgicallatin}{babelshorthands=true}
\else
  \setkeys{liturgicallatin}{babelshorthands=false}
\fi

\ifcsundef{initiate@active@char}{%
    \input{babelsh.def}%
    \initiate@active@char{"}%
    \initiate@active@char{'}%
}{}

\def\liturgicallatin@shorthands{%
  \def\language@group{liturgicallatin}%
  \bbl@activate{"}%
  \declare@shorthand{liturgicallatin}{"}{\relax
    \ifmmode
      \def\xpglla@next{''}%
    \else
      \def\xpglla@nextdq{\futurelet\xpglla@temp\xpglla@cwm}%
    \fi
  \xpglla@nextdq}%
  \bbl@activate{'}%
  \declare@shorthand{liturgicallatin}{'}{\relax
    \ifmmode
      \def\xpglla@nextsq{'}%
    \else
      \def\xpglla@nextsq{\futurelet\temp@A\xpglla@putacute}%
    \fi
  \xpgla@nextsq}%
}

\def\xpglla@allowhyphens{\bbl@allowhyphens
     \discretionary{-}{}{}\bbl@allowhyphens}

\newcommand*{\xpglla@cwm}{\let\xpglla@@nextdq\relax
  \ifcat\noexpand\xpglla@temp a%
    \let\xpglla@@nextdq\xpglla@allowhyphens
  \else
    \ifx\xpglla@temp\ae
        \let\xpglla@@nextdq\xpglla@allowhyphens
    \else
        \ifx\xpglla@temp\oe
           \let\xpglla@@nextdq\xpglla@allowhyphens
        \else
           \if\noexpand\xpglla@temp\string|%
              \def\xpglla@@nextdq{\xpglla@allowhyphens\@gobble}%
           \fi
        \fi
    \fi
  \fi
  \xpglla@@nextdq}%

\def\xpglla@putacute#1{\let\xpglla@nextsq\relax%
\if a\xpglla@temp@A
  æ\kern-0.175em^^^^0301\kern0.175em\xpglla@allowhyphens
\else
\if o\xpglla@temp@A
  œ\kern-0.175em^^^^0301\kern0.175em\xpglla@allowhyphens
\else
  \if æ\xpglla@temp@A
    æ^^^^0301%
  \else
    \if œ\xpglla@temp@A
      œ^^^^0301%
    \else
      \string'%
    \fi
  \fi
\fi
\fi}%
\def\noliturgicallatin@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{'}}%
}

\let\xpglla@savedvalues\empty
\AtEndPreamble{%
  \edef\xpglla@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}%
}

\def\noextras@liturgicallatin{%
   \lccode\string"2019=\z@
   \noliturgicallatin@shorthands
   \xpglla@savedvalues
}

\def\blockextras@liturgicallatin{%
   \lccode\string"2019=\string"2019
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000
   \finalhyphendemerits=50000000
   \ifliturgicallatin@babelshorthands\liturgicallatin@shorthands\fi
}

\def\inlineextras@liturgicallatin{%
   \lccode\string"2019=\string"2019
   \ifliturgicallatin@babelshorthands\liturgicallatin@shorthands\fi
}
%%   Copyright (C) Claudio Beccari 2013-2016
%%   Copyright (C) Élie Roux 2016
%% 
%%   Permission is hereby granted, free of charge, to any person obtaining
%%   a copy of this software and associated documentation files
%%   (the "Software"), to deal in the Software without restriction, including
%%   without limitation the rights to use, copy, modify, merge, publish,
%%   distribute, sublicense, and/or sell copies of the Software, and to permit
%%   persons to whom the Software is furnished to do so, subject to the following
%%   conditions:
%% 
%%   The above copyright notice and this permission notice shall be included in
%%   all copies or substantial portions of the Software.
%% 
%%   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%%   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%%   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
%%   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%%   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%%   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
%%   IN THE SOFTWARE.
%%
%% End of file `gloss-liturgicallatin.ldf'.
%    \end{macrocode}
% \iffalse
%</gloss-liturgicallatin.ldf>
%<*gloss-lsorbian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-lsorbian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-lsorbian.ldf}[polyglossia: module for lower sorbian]
\PolyglossiaSetup{lsorbian}{
  hyphennames={lsorbian,lowersorbian,Lsorbian},
  hyphenmins={2,2},
  fontsetup=true,
}

\def\captionslsorbian{%
   \def\refname{Referency}%
   \def\abstractname{Abstrakt}%
   \def\bibname{Literatura}%
   \def\prefacename{Zawod}%
   \def\chaptername{Kapitl}%
   \def\appendixname{Dodawki}%
   \def\contentsname{Wopśimjeśe}%
   \def\listfigurename{Zapis wobrazow}%
   \def\listtablename{Zapis tabulkow}%
   \def\indexname{Indeks}%
   \def\figurename{Wobraz}%
   \def\tablename{Tabulka}%
   %\def\thepart{}%
   \def\partname{Źěl}%
   \def\pagename{Strona}%
   \def\seename{gl.}%
   \def\alsoname{gl.~teke}%
   \def\enclname{Pśiłoga}%
   \def\ccname{CC}%
   \def\headtoname{Komu}%
   \def\proofname{Proof}%
   \def\glossaryname{Glossary}%
   }
\def\datelsorbian{%
    \def\today{\number\day.~\ifcase\month\or
    januara\or februara\or měrca\or apryla\or maja\or
    junija\or julija\or awgusta\or septembra\or oktobra\or
    nowembra\or decembra\fi
    \space \number\year}%
    \def\oldtoday{\textlsorbian{\number\day.~\ifcase\month\or
    wjelikego rožka\or małego rožka\or nalětnika\or
    jatšownika\or rožownika\or smažnika\or pražnika\or
    žnjeńca\or požnjeńca\or winowca\or nazymnika\or 
    godownika\fi\space \number\year}}%
    }

%    \end{macrocode}
% \iffalse
%</gloss-lsorbian.ldf>
%<*gloss-macedonian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-macedonian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-macedonian.ldf}[polyglossia: module for macedonian]
\PolyglossiaSetup{macedonian}{
  script=Cyrillic,
  scripttag=cyrl,
  langtag=MKD,
  hyphennames={macedonian},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup
}

\def\macedonian@Alph#1{%
   \ifcase#1\or
   А\or Б\or В\or Г\or Д\or Ѓ\or Е\or
   Ж\or З\or Ѕ\or И\or Ј\or К\or Л\or 
   Љ\or М\or Н\or Њ\or О\or П\or Р\or
   С\or Т\or Ќ\or У\or Ф\or Х\or Ц\or
   Ч\or Џ\or Ш\else
   \xpg@ill@value{#1}{macedonian@Alph}\fi}%

\def\macedonian@alph#1{%
   \ifcase#1\or
   а\or б\or в\or г\or д\or ѓ\or е\or
   ж\or з\or ѕ\or и\or ј\or к\or л\or
   љ\or м\or н\or њ\or о\or п\or р\or
   с\or т\or ќ\or у\or ф\or х\or ц\or
   ч\or џ\or ш\else
   \xpg@ill@value{#1}{macedonian@alph}\fi}%

\def\macedonian@numbers{%
   \let\latin@Alph\@Alph%
   \let\latin@alph\@alph%
   \let\@Alph\macedonian@Alph%
   \let\@alph\macedonian@alph%
 }

\def\nomacedonian@numbers{%
   \let\@Alph\latin@Alph%
   \let\@alph\latin@alph%
}

\def\captionsmacedonian{%
   \def\refname{Литература}%
   \def\abstractname{Апстракт}%
   \def\bibname{Библиографија}%
   \def\prefacename{Предговор}%
   \def\chaptername{Глава}%
   \def\appendixname{Прилог}%
   \def\contentsname{Содржина}%
   \def\listfigurename{Листа на слики}%
   \def\listtablename{Листа на табели}%
   \def\indexname{Индекс}%
   \def\figurename{Слика}%
   \def\tablename{Табела}%
   %\def\thepart{}%
   \def\partname{Поглавје}%
   \def\pagename{стр.}%
   \def\seename{види}%
   \def\alsoname{види исто така}%
   \def\enclname{Прилог}%
   %\def\ccname{cc}%
   %\def\headtoname{}%
   \def\proofname{Доказ}%
   \def\glossaryname{Терминолошки речник}%
   }
\def\datemacedonian{%
   \def\today{\number\day~\ifcase\month\or
       јануари\or
       февруари\or
       март\or
       април\or
       мај\or
       јуни\or
       јули\or
       август\or
       септември\or
       октомври\or
       ноември\or
       декември\fi%
       \ \number\year~г.}%
    \def\month@Roman{\expandafter\@Roman\month}%
    \def\todayRoman{\number\day.\,\month@Roman.\,\number\year~г.}%
    }

%    \end{macrocode}
% \iffalse
%</gloss-macedonian.ldf>
%<*gloss-magyar.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-magyar.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-magyar.ldf}[polyglossia: module for magyar]
\PolyglossiaSetup{magyar}{
  hyphennames={magyar,hungarian},
  hyphenmins={2,2},
  fontsetup=true,
}

\frenchspacing

% change 'táblázat x.x' to 'x.x. táblázat'
\newcommand{\@magyar@fnum@table}{\thetable.~\tablename}
\let\fnum@table\@magyar@fnum@table

% change 'ábra x.x' to 'x.x. ábra'
\newcommand{\@magyar@fnum@figure}{\thefigure.~\figurename}
\let\fnum@figure\@magyar@fnum@figure

\def\captionsmagyar{%
   \def\refname{Hivatkozások}%
   \def\abstractname{Kivonat}%
   \def\bibname{Irodalomjegyzék}%
   \def\prefacename{Előszó}%
   \def\chaptername{fejezet}%
   \def\appendixname{Függelék}%
   \def\contentsname{Tartalomjegyzék}%
   \def\listfigurename{Ábrák jegyzéke}%
   \def\listtablename{Táblázatok jegyzéke}%
   \def\indexname{Tárgymutató}%
   \def\figurename{ábra}%
   \def\tablename{táblázat}%
   %\def\thepart{}%
   \def\partname{rész}%
   \def\pagename{oldal}%
   \def\seename{lásd}%
   \def\alsoname{lásd még}%
   \def\enclname{Melléklet}%
   \def\ccname{Körlevél–címzettek}%
   \def\headtoname{Címzett}%
   \def\proofname{Bizonyítás}%
   \def\glossaryname{Szójegyzék}%
   }
\def\datemagyar{%   
   \def\today{%
    \number\year.\nobreakspace\ifcase\month\or
    január\or február\or március\or
    április\or május\or június\or
    július\or augusztus\or szeptember\or
    október\or november\or december\fi
    \space\number\day.}%
   \def\ondatemagyar{%
    \number\year.\nobreakspace\ifcase\month\or
    január\or február\or március\or
    április\or május\or június\or
    július\or augusztus\or szeptember\or
    október\or november\or december\fi
      \space\ifcase\day\or
      1-jén\or  2-án\or  3-án\or  4-én\or  5-én\or
      6-án\or  7-én\or  8-án\or  9-én\or 10-én\or
     11-én\or 12-én\or 13-án\or 14-én\or 15-én\or
     16-án\or 17-én\or 18-án\or 19-én\or 20-án\or
     21-én\or 22-én\or 23-án\or 24-én\or 25-én\or
     26-án\or 27-én\or 28-án\or 29-én\or 30-án\or
     31-én\fi}%
   \let\ontoday\ondatemagyar}

\def\noextras@magyar{%
   \let\ontoday\@undefined
}

%    \end{macrocode}
% \iffalse
%</gloss-magyar.ldf>
%<*gloss-malayalam.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-malayalam.ldf}
%    \begin{macrocode}
﻿\ProvidesFile{gloss-malayalam.ldf}[polyglossia: module for malayalam]
\ifluatex
  \xpg@warning{Malayalam is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
% Translations provided by Kevin & Siji, 01-11-2009

\PolyglossiaSetup{malayalam}{
  script=Malayalam,
  scripttag=mlym,
  langtag=MAL, %FIXME there is also MLR for "Malayalam Reformed"
  hyphennames={malayalam},
  hyphenmins={2,2}, %FIXME
  fontsetup=true,
}

\def\captionsmalayalam{%
     \def\abstractname{സാരാംശം}%
     \def\appendixname{ശിഷ്ടം}%
     \def\bibname{}% (?)
     \def\ccname{}%
     \def\chaptername{അദ്ധ്യായം}%
     \def\contentsname{ഉള്ളടക്കം}%
     \def\enclname{}%
     \def\figurename{ചിത്രം}% रेखाचित्र
     \def\headpagename{}%
     \def\headtoname{}%
     \def\indexname{സൂചിക}%
     \def\listfigurename{ചിത്രസൂചിക}%
     \def\listtablename{പട്ടികകളുടെ സൂചിക}%
     \def\pagename{}%
     \def\partname{ഭാഗം}%
     \def\prefacename{}% 
     \def\refname{}%
     \def\tablename{പട്ടിക}%
     \def\seename{കാണുക}%
     \def\alsoname{ഇതും കാണുക}%
     \def\alsoseename{ഇതും കാണുക}%
}
\def\datemalayalam{%
   \def\today{\number\year\space\ifcase\month\or
     ജനുവരി\or
     ഫിബ്രുവരി\or
     മാർച്ച്\or
     ഏപ്രിൽ\or
     മെയ്\or
     ജൂൺ\or
     ജൂലായ്\or
     ആഗസ്ത്\or
     സെപ്തംബർ\or
     ഒക്ടോബർ\or
     നവംബർ\or
     ഡിസംബർ\fi
     \space\number\day}%
}

%    \end{macrocode}
% \iffalse
%</gloss-malayalam.ldf>
%<*gloss-marathi.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-marathi.ldf}
%    \begin{macrocode}
% Translations provided by Abhijit Navale <abhi_navale@live.in>
% TODO implement Hindu calendar (not used in day-to-day practice)

\ProvidesFile{gloss-marathi.ldf}[polyglossia: module for marathi]
\ifluatex
  \xpg@warning{Marathi is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\RequirePackage{devanagaridigits}

\PolyglossiaSetup{marathi}{
  script=Devanagari,
  scripttag=deva,
  langtag=MAR,
  hyphennames={marathi},
  hyphenmins={2,2},%CHECK
  fontsetup=true,
  %TODO nouppercase=true,
  %TODO localnumber=marathinumber
}

\def\tmp@western{Western}
\newif\ifmarathi@devanagari@numerals
\marathi@devanagari@numeralstrue

\define@key{marathi}{numerals}[Devanagari]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@western
    \marathi@devanagari@numeralsfalse
  \fi}

\def\marathinumber#1{%
  \ifmarathi@devanagari@numerals
    \devanagaridigits{\number#1}%
  \else
    \number#1%
  \fi}

\def\captionsmarathi{%
   \def\refname{संदर्भ}%
   \def\abstractname{सारांश}%
   \def\bibname{संदर्भ ग्रंथांची यादी}%
   \def\prefacename{प्रस्तावना}%
   \def\chaptername{प्रकरण}%
   \def\appendixname{परिशिष्ट}%
   \def\contentsname{अनुक्रमणिका}%
   \def\listfigurename{आकृत्यांची यादी}%
   \def\listtablename{कॊष्टकांची यादी}%
   \def\indexname{सूची}%
   \def\figurename{आक्रुती}%
   \def\tablename{कोष्टक}%
   %\def\thepart{}% TODO
   \def\partname{भाग}%
   \def\pagename{पान}%
   \def\seename{पहा}%
   \def\alsoname{हे सुध्दा पहा}%
   \def\enclname{समाविष्ट}%
   \def\ccname{सि.सि.}%
   \def\headtoname{प्रति}%
   \def\proofname{सिद्धता}%
   \def\glossaryname{स्पष्टीकरणांची यादी}%
}
\def\datemarathi{%
   \def\marathimonth{%
     \ifcase\month\or
       जानेवारी\or
       फेब्रुवारी\or
       मार्च\or
       एप्रिल\or
       मे\or
       जून\or
       जुलै\or
       ऑगस्ट\or
       सप्टेंबर\or
       ऑक्टोबर\or
       नोव्हेंबर\or
       डिसेंबर\fi
   }%
   \def\today{\marathinumber\day\space\marathimonth\space\marathinumber\year}%
}

%    \end{macrocode}
% \iffalse
%</gloss-marathi.ldf>
%<*gloss-nko.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-nko.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-nko.ldf}[Polyglossia: module for N’Ko v0.1 2013/05/19]
\PolyglossiaSetup{nko}{%
  script=N'ko,
  scripttag=nko~,
  fontsetup=true,
  hyphennames={nohyphenation},
  direction=RL
}
\RequirePackage{nkonumbers}%

\def\captionsnko{%
  \def\prefacename{ߢߍߛߓߍ}%
  \def\refname{ߞߐߡߊߛߙߋ}%
  \def\abstractname{ߓߊߕߐߡߐ߲}%
  \def\bibname{ߟߍߙߊߥߙߍߟߐ߲߲}%
  \def\chaptername{ߛߌ߰ߘߊ}%
  \def\appendixname{ߘߋ߬ߙߋ}%
  \def\contentsname{ߞߣߐߘߐ}%
  \def\listfigurename{ߢߊ ߟߎ߬ ߛߙߍߘߍ}%
  \def\listtablename{ߦߌ߬ߘߊ߬ߥߟߊ ߟߎ߬ ߛߙߍߘߍ}%
  \def\indexname{ߛߙߍߘߍ}%
  \def\figurename{ߢߊ}%
  \def\tablename{ߦߌ߬ߘߊ߬ߥߟߊ}%
  \def\partname{ߛߌ߰ߘߊ߬ߙߋ߲}%
  \def\enclname{ߝߍ߬ߕߊ}%
  \def\ccname{ߓߊ ߘߏ߫ ߘߌ߫}%
  \def\headtoname{ߞߊߕߙߍ߬}%
  \def\pagename{ߞߐߜߍ}%
  \def\seename{ߡߊߝߟߍ߫}%
  \def\alsoname{ߝߟߍߡߊߛߊ߬ߦߌ߬}%
  \def\proofname{ߦߌ߬ߘߊ߬ߞߏ}%
  \def\glossaryname{ߞߘߐߝߐߟߊ߲}%
}%

% In n'ko, this is an example of date :
% ߂߀߁߃ ߞߏ߲ߞߏߜߍ ߕߟߋ߬ ߁߈ (RTL)
% ( 18 February 2013 )
% The word "ߕߟߋ߬" is mandatory between month name and day number.

\def\datenko{%
  \def\today{%
    \nkonumber{\year}\space
    \ifcase\month
    \orߓߌ߲ߠߊߥߎߟߋ߲%
    \orߞߏ߲ߞߏߜߍ%
    \orߕߙߊߓߊ
    \orߞߏ߲ߞߏߘߌ߬ߓߌ%
    \orߘߓߊ߬ߕߊ%
    \orߥߊ߬ߛߌߥߊ߬ߙߊ%
    \orߞߊ߬ߙߌߝߐ߭%
    \orߘߓߊ߬ߓߌߟߊ%
    \orߕߎߟߊߝߌ߲%
    \orߞߏ߲ߓߌߕߌ߮%
    \orߣߍߣߍߓߊ%
    \orߞߏ߬ߟߌ߲߬ߞߏߟߌ߲\fi
    \spaceߕߟߋ߬
    \space\nkonumber{\day}
  }%

  \def\today{%
    \nkonumber{\year}\space
    \ifcase\month
    \or ߓߌ߲ߠߊߥߎߟߋ߲%
    \or ߞߏ߲ߞߏߜߍ%
    \or ߕߙߊߓߊ%
    \or ߞߏ߲ߞߏߘߌ߬ߓߌ%
    \or ߘߓߊ߬ߕߊ%
    \or ߥߊ߬ߛߌߥߊ߬ߙߊ%
    \or ߞߊ߬ߙߌߝߐ߭%
    \or ߘߓߊ߬ߓߌߟߊ%
    \or ߕߎߟߊߝߌ߲%
    \or ߞߏ߲ߓߌߕߌ߮%
    \or ߣߍߣߍߓߊ%
    \or ߞߏ߬ߟߌ߲߬ߞߏߟߌ߲\fi
    \space ߕߟߋ߬
    \space\nkonumber{\day}
  }%
}%

%    \end{macrocode}
% \iffalse
%</gloss-nko.ldf>
%<*gloss-norsk.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-norsk.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-norsk.ldf}[polyglossia: module for norwegian]
\PolyglossiaSetup{norsk}{
  hyphennames={norsk},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true,
}

\def\captionsnorsk{%
   \def\refname{Referanser}%
   \def\abstractname{Sammendrag}%
   \def\bibname{Bibliografi}%
   \def\prefacename{Forord}%
   \def\chaptername{Kapittel}%
   \def\appendixname{Tillegg}%
   \def\contentsname{Innhold}%
   \def\listfigurename{Figurer}%
   \def\listtablename{Tabeller}%
   \def\indexname{Register}%
   \def\figurename{Figur}%
   \def\tablename{Tabell}%
   %\def\thepart{}% <<<
   \def\partname{Del}%
   \def\pagename{Side}%
   \def\seename{Se}%
   \def\alsoname{Se også}%
   \def\enclname{Vedlegg}%
   \def\ccname{Kopi sendt}%
   \def\headtoname{Til}%
   \def\proofname{Bevis}%
   \def\glossaryname{Ordliste}%
   }

\def\datenorsk{%   
   \def\today{\number\day.~\ifcase\month\or
    januar\or februar\or mars\or april\or mai\or juni\or
    juli\or august\or september\or oktober\or november\or desember
    \fi\space\number\year}%
    }

%    \end{macrocode}
% \iffalse
%</gloss-norsk.ldf>
%<*gloss-nynorsk.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-nynorsk.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-nynorsk.ldf}[polyglossia: module for norwegian (Nynorsk)]
\PolyglossiaSetup{nynorsk}{
  hyphennames={nynorsk},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true,
}

\def\captionsnynorsk{%
   \def\refname{Referansar}%
   \def\abstractname{Sammendrag}%
   \def\bibname{Litteratur}%
   \def\prefacename{Forord}%
   \def\chaptername{Kapittel}%
   \def\appendixname{Tillegg}%
   \def\contentsname{Innhald}%
   \def\listfigurename{Figurar}%
   \def\listtablename{Tabellar}%
   \def\indexname{Register}%
   \def\figurename{Figur}%
   \def\tablename{Tabell}%
   %\def\thepart{}% <<<
   \def\partname{Del}%
   \def\pagename{Side}%
   \def\seename{Sjå}%
   \def\alsoname{Sjå òg}%
   \def\enclname{Vedlegg}%
   \def\ccname{Kopi til}%
   \def\headtoname{Til}%
   \def\proofname{Bevis}%
   \def\glossaryname{Ordliste}%
   }

\def\datenynorsk{%   
   \def\today{\number\day.~\ifcase\month\or
    januar\or februar\or mars\or april\or mai\or juni\or
    juli\or august\or september\or oktober\or november\or desember
    \fi\space\number\year}%
    }

%    \end{macrocode}
% \iffalse
%</gloss-nynorsk.ldf>
%<*gloss-occitan.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-occitan.ldf}
%    \begin{macrocode}
%%
%% This is file `gloss-occitan.ldf',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gloss-occitan.dtx  (with options: `ldf')
%%   ------------------------------------------------------------------
%%   The gloss-occitan module for polyglossia
%%   Copyright (C) 2016 Cédric Valmary
%%   All rights reserved
%% 
%%   Licence information appended
%% 
%%   Created by Cédric Valmary: cvalmary at yahoo dot fr
%%   of Tot en òc <http://www.totenoc.eu/>
%% 
\ProvidesFile{gloss-occitan.ldf}[2016/02/04 v0.3 polyglossia:
     module for Occitan]
\PolyglossiaSetup{occitan}{
  hyphennames={occitan},
  hyphenmins={2,2},
  frenchspacing=true,
  indentfirst=true,
  fontsetup=true,
}
\define@boolkey{occitan}[occitan@]{babelshorthands}[true]{}

\ifsystem@babelshorthands
  \setkeys{occitan}{babelshorthands=true}
\else
  \setkeys{occitan}{babelshorthands=false}
\fi
\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
}{}
\def\occitan@shorthands{%
  \bbl@activate{"}%
  \def\language@group{occitan}%
  \declare@shorthand{occitan}{"}{%
    \relax\ifmmode
      \def\xpgoc@next{''}%
    \else
      \def\xpgoc@next{\futurelet\xpgoc@temp\xpgoc@cwm}%
    \fi
  \xpgoc@next}%
}
\def\xpgoc@@cwm{\nobreak\discretionary{-}{}{}\nobreak\hskip\z@skip}
\def\xpgoc@ponchinterior{%
      \nobreak\discretionary{-}{}{\mbox{$\cdot$}}\nobreak\hskip\z@skip}
\def\xpgoc@cwm{\let\xpgoc@@next\relax
  \ifcat\noexpand\xpgoc@temp a%
                         \def\xpgoc@@next{\xpgoc@@cwm}%
  \else
    \if\noexpand\xpgoc@temp \string|%
      \def\xpgoc@@next##1{\xpgoc@@cwm}%
    \else
      \if\noexpand\xpgoc@temp \string<%
        \def\xpgoc@@next##1{«\ignorespaces}%
      \else
        \if\noexpand\xpgoc@temp \string>%
          \def\xpgoc@@next##1{\unskip»}%
        \else
          \if\noexpand\xpgoc@temp\string/%
            \def\xpgoc@@next##1{\slash}%
          \else
            \if\noexpand\xpgoc@temp\string.%
              \def\xpgoc@@next##1{\xpgoc@ponchinterior}%
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi
  \xpgoc@@next}
\def\nooccitan@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
}
\def\captionsoccitan{%
   \def\refname{Referéncias}%
   \def\abstractname{Resumit}%
   \def\bibname{Bibliografia}%
   \def\prefacename{Prefaci}%
   \def\chaptername{Capítol}%
   \def\appendixname{Annèx}%
   \def\contentsname{Ensenhador}%
   \def\listfigurename{Taula de las figuras}%
   \def\listtablename{Taula dels tablèus}%
   \def\indexname{Indèx}%
   \def\figurename{Figura}%
   \def\tablename{Tablèu}%
   %\def\thepart{}%
   \def\partname{Partida}%
   \def\pagename{Pagina}%
   \def\seename{vejatz}%
   \def\alsoname{vejatz tanben}%
   \def\enclname{Pèça junta}%
   \def\ccname{còpia a}%
   \def\headtoname{A}%
   \def\proofname{Demostracion}%
   \def\glossaryname{Glossari}%
}
\def\dateoccitan{%
   \def\occitanmonth{\ifcase\month\or
      de~genièr\or
      de~febrièr\or
      de~març\or
      d'abril\or
      de~mai\or
      de~junh\or
      de~julhet\or
      d'agost\or
      de~setembre\or
      d'octobre\or
      de~novembre\or
      de~decembre\fi
   }%
   \def\occitanday{\ifcase\day\or
      1èr\else% primièr
      \number\day\fi% all other numbers
   }%
   \def\today{\occitanday\space \occitanmonth\space de~\number\year}%
}
\let\xpgoc@savedvalues\empty
\AtEndPreamble{% the user or the class might define different values
  \edef\xpgoc@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}
}
\def\noextras@occitan{%
   \lccode\string"2019=\z@
   \nooccitan@shorthands
   \xpgoc@savedvalues
}
\def\blockextras@occitan{%
   \lccode\string"2019=\string"2019
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000
   \finalhyphendemerits=50000000
   \ifoccitan@babelshorthands\occitan@shorthands\fi
}

\def\inlineextras@occitan{%
   \lccode\string"2019=\string"2019
   \ifoccitan@babelshorthands\occitan@shorthands\fi
}
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is "author-maintained"
%% The maintainer is Cédric Valmary
%% 
%%
%% End of file `gloss-occitan.ldf'.
%    \end{macrocode}
% \iffalse
%</gloss-occitan.ldf>
%<*gloss-piedmontese.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-piedmontese.ldf}
%    \begin{macrocode}
% !TEX encoding = UTF-8 Unicode
\ProvidesFile{gloss-piedmontese.ldf}[2013/02/12 v1.0 polyglossia: module for piedmontese]
\makeatletter
\PolyglossiaSetup{piedmontese}{
  hyphennames={piedmontese},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true,
}


\define@boolkey{piedmontese}[piedmontese@]{babelshorthands}[true]{}

\ifsystem@babelshorthands
  \setkeys{piedmontese}{babelshorthands=true}
\else
  \setkeys{piedmontese}{babelshorthands=false}
\fi

\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
}{}

\def\piedmontese@shorthands{%
  \bbl@activate{"}%
  \def\language@group{piedmontese}%
  \declare@shorthand{piedmontese}{"}{%
    \relax\ifmmode
      \def\xpgpms@next{''}%
    \else
      \def\xpgpms@next{\futurelet\xpgpms@temp\xpgpms@cwm}%
    \fi
  \xpgpms@next}%
}

\def\xpgpms@@cwm{\nobreak\discretionary{-}{}{}\nobreak\hskip\z@skip}
\def\xpgpms@cwm{\let\xpgpms@@next\relax
\ifcat\noexpand\xpgpms@temp a%
    \def\xpgpms@@next{\pms@@cwm}%
\else
    \ifx\xpgpms@temp/%
        \def\xpgpms@@next{\bbl@allowhyphens/\bbl@allowhyphens\@gobble}%
    \else
        \ifx\xpgpms@temp-%
           \def\xpgpms@@next{\bbl@allowhyphens-\bbl@allowhyphens\@gobble}%
        \else
            \ifx\xpgpms@temp"%
                \def\xpgpms@@next{``\expandafter\@gobble\string}%
            \fi
        \fi
    \fi
\xpgpms@@next}

\def\nopiedmontese@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
}
\@namedef{captions\CurrentOption}{%
    \def\prefacename{Prefassion}%
    \def\refname{Riferiment}%
    \def\abstractname{Somari}%
    \def\bibname{Bibliografìa}%
    \def\chaptername{Capìtol}%
    \def\appendixname{Gionta}%
    \def\contentsname{Tàula}%
    \def\listfigurename{Lista dle figure}%
    \def\listtablename{Lista dle tabele}%
    \def\indexname{Tàula analìtica}%
    \def\figurename{Figura}%
    \def\tablename{Tabela}%
    \def\partname{Part}%
    \def\enclname{Gionta/e}%
    \def\ccname{Con còpia a}%
    \def\headtoname{Për}%
    \def\pagename{Pàgina}%
    \def\seename{vëd}%
    \def\alsoname{vëd anche}%
    \def\proofname{Dimostrassion}%
    \def\glossaryname{Glossari}%
}
\@namedef{date\CurrentOption}{%
    \def\today{\number\day\space\ifcase\month\or
      ëd gené\or ëd fevré\or ëd mars\or d'avril\or ëd maj\or ëd giugn\or
      ëd luj\or d'agost\or dë stèmber\or d'otóber\or ëd novèmber\or dë dzèmber%
      \fi\space dal\space\number\year}}
      
\AtEndPreamble{% 
  \edef\xpgpms@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}
}


\def\noextras@piedmontese{%
   \lccode\string"2019=\z@
   \nopiedmontese@shorthands
   \xpgpms@savedvalues
}

\def\blockextras@piedmontese{%
   \lccode\string"2019=\string"2019
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000
   \finalhyphendemerits=50000000
   \ifpiedmontese@babelshorthands\piedmontese@shorthands\fi
}

\def\inlineextras@piedmontese{%
   \lccode\string"2019=\string"2019
   \ifpiedmontese@babelshorthands\piedmontese@shorthands\fi
}
%%% CHANGES END %%%
%    \end{macrocode}
% \iffalse
%</gloss-piedmontese.ldf>
%<*gloss-polish.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-polish.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-polish.ldf}[polyglossia: module for polish]
\PolyglossiaSetup{polish}{
  hyphennames={polish},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true,
}

\def\captionspolish{%
  \def\prefacename{Przedmowa}%
  \def\refname{Literatura}%
  \def\abstractname{Streszczenie}%
  \def\bibname{Bibliografia}%
  \def\chaptername{Rozdział}%
  \def\appendixname{Dodatek}%
  \def\contentsname{Spis treści}%
  \def\listfigurename{Spis rysunków}%
  \def\listtablename{Spis tabel}%
  \def\indexname{Indeks}%
  \def\figurename{Rysunek}%
  \def\tablename{Tabela}%
  \def\partname{Część}%
  \def\enclname{Załącznik}%
  \def\ccname{Kopie:}%
  \def\headtoname{Do}%
  \def\pagename{Strona}%
  \def\seename{Zobacz}%
  \def\alsoname{Zobacz też}%
  \def\proofname{Dowód}%
  \def\glossaryname{Glossary}% <-- Needs translation
  }

\def\datepolish{%
  \def\today{\number\day\space\ifcase\month\or
      stycznia\or lutego\or marca\or kwietnia\or maja\or czerwca\or
      lipca\or sierpnia\or września\or października\or
      listopada\or grudnia\fi\space
      \number\year}%
  }

%    \end{macrocode}
% \iffalse
%</gloss-polish.ldf>
%<*gloss-portuges.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-portuges.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-portuges.ldf}[polyglossia: module for portuguese]
\PolyglossiaSetup{portuges}{
  hyphennames={portuges,portuguese},
  hyphenmins={2,3},
  fontsetup=true,
}

\def\captionsportuges{%
  \def\refname{Referências}%
  \def\abstractname{Resumo}%
  \def\bibname{Bibliografia}%
  \def\prefacename{Prefácio}%
  \def\chaptername{Capítulo}%
  \def\appendixname{Apêndice}%
  \def\contentsname{Conteúdo}%
  \def\listfigurename{Lista de Figuras}%
  \def\listtablename{Lista de Tabelas}%
  \def\indexname{Índice}%
  \def\figurename{Figura}%
  \def\tablename{Tabela}%
  %\def\thepart{}%
  \def\partname{Parte}%
  \def\pagename{Página}%
  \def\seename{ver}%
  \def\alsoname{ver também}%
  \def\enclname{Anexo}%
  \def\ccname{Com cópia a}%
  \def\headtoname{Para}%
  \def\proofname{Demonstração}%
  \def\glossaryname{Glossário}%
  }

\def\dateportuges{%   
  \def\today{\number\day\space de\space\ifcase\month\or
    Janeiro\or Fevereiro\or Março\or Abril\or Maio\or Junho\or
    Julho\or Agosto\or Setembro\or Outubro\or Novembro\or Dezembro\fi
    \space de\space\number\year}%
  }
     
%    \end{macrocode}
% \iffalse
%</gloss-portuges.ldf>
%<*gloss-romanian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-romanian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-romanian.ldf}[polyglossia: module for romanian]

\PolyglossiaSetup{romanian}{
  hyphennames={romanian},
  hyphenmins={2,2},
  fontsetup=true,
}

\def\captionsromanian{%
   \def\refname{Bibliografie}%
   \def\abstractname{Rezumat}%
   \def\bibname{Bibliografie}%
   \def\prefacename{Prefață}%
   \def\chaptername{Capitolul}%
   \def\appendixname{Anexa}%
   \def\contentsname{Cuprins}%
   \def\listfigurename{Listă de figuri}%
   \def\listtablename{Listă de tabele}%
   \def\indexname{Glosar}%
   \def\figurename{Figura}%
   \def\tablename{Tabela}%
   %\def\thepart{}%
   \def\partname{Partea}%
   \def\pagename{Pagina}%
   \def\seename{Vezi}%
   \def\alsoname{Vezi de asemenea}%
   \def\enclname{Anexă}%
   \def\ccname{Copie}%
   \def\headtoname{Pentru}%
   \def\proofname{Demonstrație}%
   \def\glossaryname{Glosar}%
   }

\def\dateromanian{%
  \def\today{\number\day~\ifcase\month\or
    ianuarie\or februarie\or martie\or aprilie\or mai\or
    iunie\or iulie\or august\or septembrie\or octombrie\or
    noiembrie\or decembrie\fi
    \space \number\year}%
  }

%    \end{macrocode}
% \iffalse
%</gloss-romanian.ldf>
%<*gloss-romansh.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-romansh.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-romansh.ldf}[polyglossia: module for romansh]
\makeatletter
\PolyglossiaSetup{romansh}{%
  hyphennames={romansh},
  hyphenmins={2,2},
  indentfirst=true,
  fontsetup=true,
}


\def\captionsromansh{%
  \def\prefacename{Prefaziun}%
  \def\refname{Bibliografia}%
  \def\abstractname{Recapitulaziun}%
  \def\bibname{Index bibliografic}%
  \def\chaptername{Chapitel}%
  \def\appendixname{Appendix}%
  \def\contentsname{Tavla dal cuntegn}%
  \def\listfigurename{Tavla da las figuras}%
  \def\listtablename{Tavla da las tabellas}%
  \def\indexname{Register da materias}%       Index?
  \def\figurename{Figura}%
  \def\tablename{Tabella}%
  \def\partname{Part}%
  \def\enclname{Agiunta(s)}%
  \def\ccname{Copia a}%
  \def\headtoname{A}%
  \def\pagename{pagina}%  
  \def\seename{vesair }%
  \def\alsoname{vesair era}%
  \def\proofname{Demonstraziun}%
  \def\glossaryname{Glossari}%
  }
  
\def\dateromansh{%
  \def\today{\ifcase\day\or1.\else ils~\number\day\fi~da~%
    \ifcase\month\or
    schaner\or favrer\or mars\or avrigl\or matg\or zercladur\or
    fanadur\or avust\or settember\or october\or november\or
    december\fi\space \number\year}}
\makeatother
%    \end{macrocode}
% \iffalse
%</gloss-romansh.ldf>
%<*gloss-russian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-russian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-russian.ldf}[polyglossia: module for russian]
\PolyglossiaSetup{russian}{
  script=Cyrillic,
  scripttag=cyrl,
  langtag=RUS,
  hyphennames={russian},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup
  %TODO localalph={russian@alph,russian@Alph}
}

\define@key{russian}{spelling}[modern]{%
  \ifstrequal{#1}{old}%
    {\def\captionsrussian{\captionsrussian@old}%
     \def\daterussian{\daterussian@old}}%
    {\def\captionsrussian{\captionsrussian@modern}%
     \def\daterussian{\daterussian@modern}}%
}

\newif\ifcyrillic@numerals
\define@key{russian}{numerals}[latin]{%
   \ifstrequal{#1}{cyrillic}%
      {\cyrillic@numeralstrue}
      {\cyrillic@numeralsfalse}%
}

\define@boolkey{russian}[russian@]{babelshorthands}[false]{}

\setkeys{russian}{spelling,numerals}

\ifsystem@babelshorthands
  \setkeys{russian}{babelshorthands=true}
\else
  \setkeys{russian}{babelshorthands=false}
\fi

\ifcsundef{initiate@active@char}{%
  \input{babelsh.def}%
  \initiate@active@char{"}%
}{}

\def\russian@shorthands{%
  \bbl@activate{"}%
  \def\language@group{russian}%
%  \declare@shorthand{russian}{"`}{„}%
%  \declare@shorthand{russian}{"'}{“}%
%  \declare@shorthand{russian}{"<}{«}%
%  \declare@shorthand{russian}{">}{»}%
  \declare@shorthand{russian}{""}{\hskip\z@skip}%
  \declare@shorthand{russian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}%
  \declare@shorthand{russian}{"=}{\nobreak-\hskip\z@skip}%
  \declare@shorthand{russian}{"|}{\textormath{\nobreak\discretionary{-}{}{\kern.03em}\allowhyphens}{}}%
  \declare@shorthand{russian}{"-}{%
    \def\russian@sh@tmp{%
      \if\russian@sh@next-\expandafter\russian@sh@emdash
      \else\expandafter\russian@sh@hyphen\fi
    }%
    \futurelet\russian@sh@next\russian@sh@tmp}%
  \def\russian@sh@hyphen{%
    \nobreak\-\bbl@allowhyphens}%
  \def\russian@sh@emdash##1##2{\cdash-##1##2}%
  \def\cdash##1##2##3{\def\tempx@{##3}%
  \def\tempa@{-}\def\tempb@{~}\def\tempc@{*}%
   \ifx\tempx@\tempa@\@Acdash\else
    \ifx\tempx@\tempb@\@Bcdash\else
     \ifx\tempx@\tempc@\@Ccdash\else
      \errmessage{Wrong usage of cdash}\fi\fi\fi}%
  \def\@Acdash{\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi
    \cyrdash\hskip.2em\ignorespaces}%
  \def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi
   \nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z@skip\ignorespaces}%
  \def\@Ccdash{\leavevmode
   \nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}%
  \ifx\cyrdash\undefined
    \def\cyrdash{\hbox to.8em{--\hss--}}
  \fi
  \declare@shorthand{russian}{",}{\nobreak\hskip.2em\ignorespaces}%
}

\def\norussian@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
}


\def\captionsrussian@modern{%
   \def\prefacename{Предисловие}%
   \def\refname{Список литературы}%
   \def\abstractname{Аннотация}%
   \def\bibname{Литература}%
   \def\chaptername{Глава}%
   \def\appendixname{Приложение}%
   \ifcsundef{thechapter}%
     {\def\contentsname{Содержание}}%
     {\def\contentsname{Оглавление}}%
   \def\listfigurename{Список иллюстраций}%
   \def\listtablename{Список таблиц}%
   \def\indexname{Предметный указатель}%
   \def\authorname{Именной указатель}%
   \def\figurename{Рис.}%
   \def\tablename{Таблица}%
   \def\partname{Часть}%
   \def\enclname{вкл.}%
   \def\ccname{исх.}%
   \def\headtoname{вх.}%
   \def\pagename{с.}%
   \def\seename{см.}%
   \def\alsoname{см.~также}%
   \def\proofname{Доказательство}%
}
\def\daterussian@modern{%
      \def\today{\number\day%
      \space\ifcase\month\or%
      января\or
      февраля\or
      марта\or
      апреля\or
      мая\or
      июня\or
      июля\or
      августа\or
      сентября\or
      октября\or
      ноября\or
      декабря\fi%
      \space \number\year\space г.}}
     
\def\captionsrussian@old{%
   \def\prefacename{Предисловіе}%
   \def\refname{Примѣчанія}%
   \def\abstractname{Аннотація}%
   \def\bibname{Библіографія}%
   \def\chaptername{Глава}%
   \def\appendixname{Приложеніе}%
   \ifcsundef{thechapter}%
     {\def\contentsname{Содержаніе}}%
     {\def\contentsname{Оглавленіе}}%
   \def\listfigurename{Списокъ иллюстрацій}%
   \def\listtablename{Списокъ таблицъ}%
   \def\indexname{Предмѣтный указатель}%
   \def\authorname{Именной указатель}%
   \def\figurename{Рис.}%
   \def\tablename{Таблица}%
   \def\partname{Часть}%
   \def\enclname{вкл.}%
   \def\ccname{исх.}%
   \def\headtoname{вх.}%
   \def\pagename{с.}%
   \def\seename{см.}%
   \def\alsoname{см.~также}%
   \def\proofname{Доказательство}%
}  
\def\daterussian@old{%
      \def\today{\number\day%
      \space\ifcase\month\or%
      января\or
      февраля\or
      марта\or
      апреля\or
      мая\or
      іюня\or
      іюля\or
      августа\or
      сентября\or
      октября\or
      ноября\or
      декабря\fi%
      \space \number\year\space г.}}

% The following is based on some ideas from ruscor.sty
\def\russian@capsformat{%
   \ifdef{\KOMAScript}{%
      \ifdef{\chapterformat}{%
        \renewcommand{\chapterformat}{\prechapter\thechapter\postchapter}}{}%
      \renewcommand{\sectionformat}{\presection\thesection\postsection}%
      \renewcommand{\subsectionformat}{\presubsection\thesubsection\postsubsection}%
      \renewcommand{\subsubsectionformat}{\presubsubsection\thesubsubsection\postsubsubsection}%
      \renewcommand{\paragraphformat}{\preparagraph\theparagraph\postparagraph}%
      \renewcommand{\subparagraphformat}{\presubparagraph\thesubparagraph\postsubparagraph}%
   }{%
      \def\@seccntformat##1{\csname pre##1\endcsname%
         \csname the##1\endcsname%
         \csname post##1\endcsname}%
   }%
   \def\@aftersepkern{\hspace{0.5em}}%
   \def\postchapter{.\@aftersepkern}%
   \def\postsection{.\@aftersepkern}%
   \def\postsubsection{.\@aftersepkern}%
   \def\postsubsubsection{.\@aftersepkern}%
   \def\postparagraph{.\@aftersepkern}%
   \def\postsubparagraph{.\@aftersepkern}%
   \def\prechapter{}%
   \def\presection{}%
   \def\presubsection{}%
   \def\presubsubsection{}%
   \def\preparagraph{}%
   \def\presubparagraph{}}

\def\Asbuk#1{\expandafter\russian@Alph\csname c@#1\endcsname}
\def\russian@Alph#1{\ifcase#1\or
   А\or Б\or В\or Г\or Д\or Е\or Ж\or
   З\or И\or К\or Л\or М\or Н\or О\or
   П\or Р\or С\or Т\or У\or Ф\or Х\or
   Ц\or Ч\or Ш\or Щ\or Э\or Ю\or Я\else\xpg@ill@value{#1}{russian@Alph}\fi}
\def\asbuk#1{\expandafter\russian@alph\csname c@#1\endcsname}
\def\russian@alph#1{\ifcase#1\or
   а\or б\or в\or г\or д\or е\or ж\or
   з\or и\or к\or л\or м\or н\or о\or
   п\or р\or с\or т\or у\or ф\or х\or
   ц\or ч\or ш\or щ\or э\or ю\or я\else\xpg@ill@value{#1}{russian@alph}\fi}

\def\russian@numbers{%
   \let\latin@alph\@alph%
   \let\latin@Alph\@Alph%
   \ifcyrillic@numerals
     \let\@alph\russian@alph%
     \let\@Alph\russian@Alph%
   \fi
}

\def\norussian@numbers{%
   \let\@alph\latin@alph%
   \let\@Alph\latin@Alph%
}

\def\noextras@russian{%
   \ifdef{\KOMAScript}{%
      \ifdef{\chapterformat}{%
        \renewcommand{\chapterformat}{\thechapter\autodot\enskip}}{}%
      \renewcommand{\sectionformat}{\thesection\autodot\enskip}%
      \renewcommand{\subsectionformat}{\thesubsection\autodot\enskip}%
      \renewcommand{\subsubsectionformat}{\thesubsubsection\autodot\enskip}%
      \renewcommand{\paragraphformat}{\theparagraph\autodot\enskip}%
      \renewcommand{\subparagraphformat}{\thesubparagraph\autodot\enskip}%
   }{%
      \def\@seccntformat##1{\csname the##1\endcsname\quad}% = LaTeX kernel
   }%
   \ifcyrillic@numerals\norussian@numbers\fi
   \norussian@shorthands%
}

\def\blockextras@russian{%
   \russian@capsformat%
   \ifcyrillic@numerals\russian@numbers\fi
   \ifrussian@babelshorthands\russian@shorthands\fi
}

\def\inlineextras@russian{%
   \ifrussian@babelshorthands\russian@shorthands\fi%
}

%%% These lines taken from russianb.ldf, part of babel package.
% make it optional?
\def\sh    {\mathop{\operator@font sh}\nolimits}
\def\ch    {\mathop{\operator@font ch}\nolimits}
\def\tg    {\mathop{\operator@font tg}\nolimits}
\def\arctg {\mathop{\operator@font arctg}\nolimits}
\def\arcctg{\mathop{\operator@font arcctg}\nolimits}
\def\th    {\mathop{\operator@font th}\nolimits}
\def\ctg   {\mathop{\operator@font ctg}\nolimits}
\def\cth   {\mathop{\operator@font cth}\nolimits}
\def\cosec {\mathop{\operator@font cosec}\nolimits}
\def\Prob  {\mathop{\kern\z@\mathsf{P}}\nolimits}
\def\Variance{\mathop{\kern\z@\mathsf{D}}\nolimits}
\def\nod   {\mathop{\mathrm{н.о.д.}}\nolimits}
\def\nok   {\mathop{\mathrm{н.о.к.}}\nolimits}
\def\NOD   {\mathop{\mathrm{НОД}}\nolimits}
\def\NOK   {\mathop{\mathrm{НОК}}\nolimits}
\def\Proj  {\mathop{\mathrm{Пр}}\nolimits}
%\DeclareRobustCommand{\No}{№}

%    \end{macrocode}
% \iffalse
%</gloss-russian.ldf>
%<*gloss-samin.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-samin.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-samin.ldf}[polyglossia: module for samin]

\PolyglossiaSetup{samin}{
  hyphennames={samin},
  hyphenmins={2,2},
  fontsetup=true,
}

\def\captionssamin{%
   \def\refname{Čujuhusat}%
   \def\abstractname{Čoahkkáigeassu}%
   \def\bibname{Girjjálašvuohta}%
   \def\prefacename{Ovdasátni}%
   \def\chaptername{Kapihttal}%
   \def\appendixname{Čuovus}%
   \def\contentsname{Sisdoallu}%
   \def\listfigurename{Govvosat}%
   \def\listtablename{Tabeallat}%
   \def\indexname{Registtar}%
   \def\figurename{Govus}%
   \def\tablename{Tabealla}%
   \def\thepart{}%
   \def\partname{Oassi}%
   \def\pagename{Siidu}%
   \def\seename{geahča}%
   \def\alsoname{geahča maiddái}%
   \def\enclname{Mielddus}%
   \def\ccname{Kopia sáddejuvvon}%
   \def\headtoname{Vuostáiváldi}%
   \def\proofname{Duođaštus}%
   \def\glossaryname{Sátnelistu}%
   }
\def\datesamin{%
  \def\today{\ifcase\month\or
    ođđajagemánu\or
    guovvamánu\or
    njukčamánu\or
    cuoŋománu\or
    miessemánu\or
    geassemánu\or
    suoidnemánu\or
    borgemánu\or
    čakčamánu\or
    golggotmánu\or
    skábmamánu\or
    juovlamánu\fi
    \space\number\day.~b.\space\number\year}%
  }

%    \end{macrocode}
% \iffalse
%</gloss-samin.ldf>
%<*gloss-sanskrit.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-sanskrit.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-sanskrit.ldf}[polyglossia: module for sanskrit]
\RequirePackage{devanagaridigits}

\PolyglossiaSetup{sanskrit}{
  langtag=SAN,
  hyphennames={sanskrit,prakrit},
  hyphenmins={1,3},
  frenchspacing=true,
  fontsetup=false, % will be done below
  %TODO localnumber=sanskritnumber
}

\define@key{sanskrit}{Script}[Devanagari]{%
  \setkeys[xpg@setup]{sanskrit}{script=#1}%
  \ifcsdef{fontsetup@sanskrit@#1}%
    {\csname fontsetup@sanskrit@#1\endcsname}%
    {\xpg@error{`#1' is not a valid script for Sanskrit}%
  }%
}

\def\fontsetup@sanskrit@Devanagari{%
  \def\xpg@scripttag@sanskrit{deva}%
  \xpg@fontsetup@nonlatin{sanskrit}}
\def\fontsetup@sanskrit@Gujarati{%
  \def\xpg@scripttag@sanskrit{gujr}%
  \xpg@fontsetup@nonlatin{sanskrit}}
\def\fontsetup@sanskrit@Malayalam{%
  \def\xpg@scripttag@sanskrit{mlym}%
  \xpg@fontsetup@nonlatin{sanskrit}}
\def\fontsetup@sanskrit@Bengali{%
  \def\xpg@scripttag@sanskrit{beng}%
  \xpg@fontsetup@nonlatin{sanskrit}}
\def\fontsetup@sanskrit@Kannada{%
  \def\xpg@scripttag@sanskrit{knda}%
  \xpg@fontsetup@nonlatin{sanskrit}}
\def\fontsetup@sanskrit@Telugu{%
  \def\xpg@scripttag@sanskrit{telu}%
  \xpg@fontsetup@nonlatin{sanskrit}}
%% DW
\def\fontsetup@sanskrit@Latin{%
    \def\xpg@scripttag@sanskrit{latn}%
    \xpg@fontsetup@latin{sanskrit}}
%% DW

\setkeys{sanskrit}{Script} %sets the default for Devanagari

%% TODO option for numerals (Devanagari or Western)
%\def\tmp@western{Western}
%\newif\ifsanskrit@devanagari@numerals
%\sanskrit@devanagari@numeralstrue
%
%\define@key{sanskrit}{numerals}[Devanagari]{%
%  \def\@tmpa{#1}%
%  \ifx\@tmpa\tmp@western
%    \sanskrit@devanagari@numeralsfalse
%  \fi}

\newXeTeXintercharclass\sanskrit@punctthin % ! ? ; : danda double_danda

\def\sanskrit@punctthinspace{{\unskip\thinspace}}

\def\sanskrit@punctuation{%
  \XeTeXinterchartokenstate=1%
  \XeTeXcharclass `\! \sanskrit@punctthin
  \XeTeXcharclass `\? \sanskrit@punctthin
  \XeTeXcharclass `\; \sanskrit@punctthin
  \XeTeXcharclass `\: \sanskrit@punctthin
  \XeTeXcharclass `\। \sanskrit@punctthin
  \XeTeXcharclass `\॥ \sanskrit@punctthin
  \XeTeXinterchartoks \z@ \sanskrit@punctthin = \sanskrit@punctthinspace
}

\def\nosanskrit@punctuation{%
  \XeTeXcharclass `\! \z@
  \XeTeXcharclass `\? \z@
  \XeTeXcharclass `\; \z@
  \XeTeXcharclass `\: \z@
  \XeTeXcharclass `\। \z@
  \XeTeXcharclass `\॥ \z@
  \XeTeXinterchartokenstate=0%
}

\def\noextras@sanskrit{%
  \nosanskrit@punctuation%
}

\def\blockextras@sanskrit{%
  \sanskrit@punctuation%
}

%    \end{macrocode}
% \iffalse
%</gloss-sanskrit.ldf>
%<*gloss-scottish.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-scottish.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-scottish.ldf}[polyglossia: module for scottish]

\PolyglossiaSetup{scottish}{
  hyphennames={scottish},
  hyphenmins={2,2},
  fontsetup=true,
}

\def\captionsscottish{%
   \def\refname{Iomraidh}%
   \def\abstractname{Brìgh}%
   \def\bibname{Leabhraichean}%
   \def\prefacename{Preface}%    <-- needs translation
   \def\chaptername{Caibideil}%
   \def\appendixname{Ath-sgr`ıobhadh}%
   \def\contentsname{Clàr-obrach}%
   \def\listfigurename{Liosta Dhealbh}%
   \def\listtablename{Liosta Chlàr}%
   \def\indexname{Clàr-innse}%
   \def\figurename{Dealbh}%
   \def\tablename{Clàr}%
   %\def\thepart{}%
   \def\partname{Cuid}%
   \def\pagename{t.d.}%
   \def\seename{see}%    <-- needs translation
   \def\alsoname{see also}%    <-- needs translation
   \def\enclname{a-staigh}%
   \def\ccname{lethbhreac gu}%
   \def\headtoname{gu}%
   \def\proofname{Proof}%    <-- needs translation 
   \def\glossaryname{Glossary}%    <-- needs translation
   }

\def\datescottish{%
   \def\today{%
    \number\day\space \ifcase\month\or
    am Faoilteach\or an Gearran\or am Màrt\or an Giblean\or
    an Cèitean\or an t-Òg mhios\or an t-Iuchar\or
    Lùnasdal\or an Sultuine\or an Dàmhar\or
    an t-Samhainn\or an Dubhlachd\fi
    \space \number\year}%
    }

%    \end{macrocode}
% \iffalse
%</gloss-scottish.ldf>
%<*gloss-serbian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-serbian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-serbian.ldf}[polyglossia: module for serbian]
%TODO split into gloss-serbiancyr.ldf and gloss-serbianlat.ldf
%% load these automatically from polyglossia.sty according to the script option ??
%% same thing for all languages that have a "script" key !
%% BETTER APPROACH: see gloss-sanskrit!

\PolyglossiaSetup{serbian}{
  langtag=SRB,
  hyphennames={serbian},
  hyphenmins={2,2},
  indentfirst=true,
  fontsetup=false
  %TODO localalph
}

\newif\if@serbian@cyr

\define@key{serbian}{Script}[Cyrillic]{% TODO FIXDOC: keyname is CHANGED: script -> Script !!!
  \ifstrequal{#1}{Cyrillic}%
    {\@serbian@cyrtrue
     \setkeys[xpg@setup]{serbian}{script=Cyrillic}%
     \def\xpg@scripttag@serbian{cyrl}%
     \xpg@fontsetup@nonlatin{serbian}%
    }%
    {\ifstrequal{#1}{Latin}%
      {\@serbian@cyrfalse
      \xpg@fontsetup@latin{serbian}%
      %TODO \def\serbian@language{\language=\l@serbianlat}%
      % or should we use Croatian patterns as a fallback for the time being???
      }%
      {\xpg@error{Unknown script `#1' for Serbian language\MessageBreak
      Valid values are "Cyrillic" and "Latin"}}%
    }%
}
\define@key{serbian}{script}[Cyrillic]{\setkeys{serbian}{Script=#1}}

\setkeys{serbian}{Script}

\def\captionsserbian{%
   \if@serbian@cyr\captionsserbian@cyr\else\captionsserbian@lat\fi
   }

\def\dateserbian{%
   \if@serbian@cyr\dateserbian@cyr\else\dateserbian@lat\fi
   }

\def\captionsserbian@lat{%
   \def\refname{Bibliografija}%
   \def\abstractname{Sažetak}%
   \def\bibname{Literatura}%
   \def\prefacename{Predgovor}%
   \def\chaptername{Glava}%
   \def\appendixname{Dodatak}%
   \def\contentsname{Sadržaj}%
   \def\listfigurename{Spisak slika}%
   \def\listtablename{Spisak tabela}%
   \def\indexname{Registar}%
   \def\figurename{Slika}%
   \def\tablename{Tabela}%
   \def\partname{Deo}%
   \renewcommand\thepart{\ifcase\value{part}\or Prvi\or Drugi\or
      Treći\or Čevrti\or Peti\or Šesti\or Sedmi\or Osmi\or
      Deveti\or Deseti\or Jedanaesti\or Dvanaesti\or Trinaesti\or
      Četrnaesti\or Petnaesti\or Šesnaesti\or Sedamnaesti\or
      Osamnaesti\or Devetnaesti\or Dvadeseti\fi}%
   \def\pagename{Strana}%
   \def\seename{Vidi}%
   \def\alsoname{Vidi takođe}%
   \def\enclname{Prilozi}%
   \def\ccname{Kopije}%
   \def\headtoname{Prima}%
   \def\proofname{Dokaz}%
   \def\glossaryname{Rečnik nepoznatih reči}%
   }
\def\dateserbian@lat{%
   \def\today{\number\day .~\ifcase\month\or
    januar\or februar\or mart\or april\or maj\or
    jun\or jul\or avgust\or septembar\or oktobar\or novembar\or
    decembar\fi \space \number\year.}%
    }

\def\captionsserbian@cyr{%
   \def\refname{Библиографија}%
   \def\abstractname{Сажетак}%
   \def\bibname{Литература}%
   \def\prefacename{Предговор}%
   \def\chaptername{Глава}%
   \def\appendixname{Додатак}%
   \def\contentsname{Садржај}%
   \def\listfigurename{Списак слика}%
   \def\listtablename{Списак табела}%
   \def\indexname{Регистар}%
   \def\figurename{Слика}%
   \def\tablename{Табела}%
   \def\partname{Део}%
   \renewcommand\thepart{\ifcase\value{part}\or Први\or Други\or Трећи\or
   Четврти\or Пети\or Шести\or Седми\or Осми\or Девети\or Десети\or
   Једанаести\or Дванаести\or Тринаести\or Четрнаести\or Петнаести\or
   Шеснаести\or Седамнаести\or Осамнаести\or Деветнаести\or Двадесети\fi}%
   \def\pagename{Страна}%
   \def\seename{Види}%
   \def\alsoname{Види такође}%
   \def\enclname{Прилози}%
   \def\ccname{Копије}%
   \def\headtoname{Прима}%
   \def\proofname{Доказ}%
   \def\glossaryname{Речник непознатих речи}%
   }
\def\dateserbian@cyr{%
   \def\today{\number\day .~\ifcase\month\or
    јануар\or фебруар\or март\or април\or мај\or
    јун\or јул\or август\or септембар\or октобар\or новембар\or
    децембар\fi \space \number\year.}%
    }

%    \end{macrocode}
% \iffalse
%</gloss-serbian.ldf>
%<*gloss-slovak.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-slovak.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-slovak.ldf}[polyglossia: module for slovak]

\PolyglossiaSetup{slovak}{
  hyphennames={slovak},
  hyphenmins={2,2},
  fontsetup=true,
}

\def\captionsslovak{%
   \def\refname{Referencie}%
   \def\abstractname{Abstrakt}%
   \def\bibname{Literatúra}%
   \def\prefacename{Úvod}%
   \def\chaptername{Kapitola}%
   \def\appendixname{Dodatok}%
   \def\contentsname{Obsah}%
   \def\listfigurename{Zoznam obrázkov}%
   \def\listtablename{Zoznam tabuliek}%
   \def\indexname{Index}%
   \def\figurename{Obrázok}%
   \def\tablename{Tabuľka}%
   %\def\thepart{}%
   \def\partname{Časť}%
   \def\pagename{Strana}%
   \def\seename{viď}%
   \def\alsoname{viď tiež}%
   \def\enclname{Prílohy}%
   \def\ccname{cc.}%
   \def\headtoname{Pre}% was komu
   \def\proofname{Dôkaz}%
   \def\glossaryname{Slovník}%
   }

\def\dateslovak{%   
  \def\today{\number\day.~\ifcase\month\or
    januára\or februára\or marca\or apríla\or mája\or
    júna\or júla\or augusta\or septembra\or októbra\or
    novembra\or decembra\fi
    \space \number\year}%
  }

%    \end{macrocode}
% \iffalse
%</gloss-slovak.ldf>
%<*gloss-slovenian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-slovenian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-slovenian.ldf}[polyglossia: module for slovenian]

\PolyglossiaSetup{slovenian}{
  hyphennames={slovenian,slovene},
  hyphenmins={2,2},
  fontsetup=true,
}

\providebool{slovenian@localalph}
\define@boolkey{slovenian}[slovenian@]{localalph}[false]{%
  \def\@tmpa{#1}%
  \def\@tmptrue{true}%
  \ifx\@tmpa\@tmptrue
    \slovenian@localalphtrue
  \fi
  \setlocalalph
}


\def\captionsslovenian{%
   \def\refname{Literatura}%
   \def\abstractname{Povzetek}%
   \def\bibname{Literatura}%
   \def\prefacename{Predgovor}%
   \def\chaptername{Poglavje}%
   \def\appendixname{Dodatek}%
   \def\contentsname{Kazalo}%
   \def\listfigurename{Slike}%
   \def\listtablename{Tabele}%
   \def\indexname{Stvarno kazalo}%
   \def\figurename{Slika}%
   \def\tablename{Tabela}%
   %\def\thepart{}%
   \def\partname{Del}%
   \def\pagename{Stran}%
   \def\seename{glej}%
   \def\alsoname{glej tudi}%
   \def\enclname{Priloge}%
   \def\ccname{Kopije}%
   \def\headtoname{Prejme}%
   \def\proofname{Dokaz}%
   \def\glossaryname{Slovar}%
   }

\def\dateslovenian{%   
  \def\today{\number\day.~\ifcase\month\or
    januar\or februar\or marec\or april\or maj\or junij\or
    julij\or avgust\or september\or oktober\or november\or december\fi
    \space \number\year}%
  }

\def\slovenian@alph#1{%
  \ifcase#1\or a\or b\or c\or č\or d\or e\or f\or g\or h\or i\or j\or k\or l\or
  m\or n\or o\or p\or r\or s\or š\or t\or u\or v\or z\or ž\else#1\fi
}
\def\slovenian@Alph#1{%
  \ifcase#1\or A\or B\or C\or Č\or D\or E\or F\or G\or H\or I\or J\or K\or L\or
  M\or N\or O\or P\or R\or S\or Š\or T\or U\or V\or Z\or Ž\else#1\fi}
\def\abeceda#1{\expandafter\slovenian@alph\csname c@#1\endcsname}
\def\Abeceda#1{\expandafter\slovenian@Alph\csname c@#1\endcsname}

\def\setlocalalph{%
  \def\extras@slovenian{\let\savealph\alph\let\saveAlph\Alph\let\alph\abeceda\let\Alph\Abeceda}
  \def\blockextras@slovenian{\extras@slovenian}
  \def\inlineextras@slovenian{\extras@slovenian}
  \def\noextras@slovenian{\let\alph\savealph\let\Alph\saveAlph}
}

%    \end{macrocode}
% \iffalse
%</gloss-slovenian.ldf>
%<*gloss-spanish.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-spanish.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-spanish.ldf}[polyglossia: module for spanish]
\PolyglossiaSetup{spanish}{
  hyphennames={spanish},
  hyphenmins={2,2},
  frenchspacing=true,
  indentfirst=true,
  fontsetup=true,
}

\def\captionsspanish{%
  \def\prefacename{Prefacio}%
  \def\refname{Referencias}%
  \def\abstractname{Resumen}%
  \def\bibname{Bibliografía}%
  \def\chaptername{Capítulo}%
  \def\appendixname{Apéndice}%
  \def\contentsname{Índice general}%
  \def\listfigurename{Índice de figuras}%
  \def\listtablename{Índice de cuadros}%
  \def\indexname{Índice alfabético}%
  \def\figurename{Figura}%
  \def\tablename{Cuadro}%
  \def\partname{Parte}%
  \def\enclname{Adjunto(s)}%
  \def\ccname{Copia a}%
  \def\headtoname{A}%
  \def\pagename{Página}%
  \def\seename{véase}%
  \def\alsoname{véase también}%
  \def\proofname{Prueba}%
  \def\glossaryname{Glosario}%
  }

\def\datespanish{%
  \def\today{\number\day~de~\ifcase\month\or
    enero\or febrero\or marzo\or abril\or mayo\or junio\or
    julio\or agosto\or septiembre\or octubre\or noviembre\or
    diciembre\fi\space de~\number\year}%
  }

%    \end{macrocode}
% \iffalse
%</gloss-spanish.ldf>
%<*gloss-swedish.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-swedish.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-swedish.ldf}[polyglossia: module for swedish]

\PolyglossiaSetup{swedish}{
  hyphennames={swedish},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true,
}

\def\captionsswedish{%
  \def\refname{Referenser}%
  \def\abstractname{Sammanfattning}%
  \def\bibname{Litteraturförteckning}%
  \def\prefacename{Förord}%
  \def\chaptername{Kapitel}%
  \def\appendixname{Bilaga}%
  \def\contentsname{Innehåll}%
  \def\listfigurename{Figurer}%
  \def\listtablename{Tabeller}%
  \def\indexname{Sakregister}%
  \def\figurename{Figur}%
  \def\tablename{Tabell}%
  %\def\thepart{}%
  \def\partname{Del}%
  \def\pagename{Sida}%
  \def\seename{se}%
  \def\alsoname{se även}%
  \def\enclname{Bil.}%
  \def\ccname{Kopia för kännedom}%
  \def\headtoname{Till}%
  \def\proofname{Bevis}%
  \def\glossaryname{Ordlista}%
  }

\def\dateswedish{%   
  \def\today{%
    \number\day~\ifcase\month\or
    januari\or februari\or mars\or april\or maj\or juni\or
    juli\or augusti\or september\or oktober\or november\or
    december\fi
    \space\number\year}%
    \def\datesymd{%
      \def\today{\number\year-\two@digits\month-\two@digits\day}}%
    \def\datesdmy{%
     \def\today{\number\day/\number\month\space\number\year}}%
    }

%    \end{macrocode}
% \iffalse
%</gloss-swedish.ldf>
%<*gloss-syriac.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-syriac.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-syriac.ldf}[polyglossia: module for syriac]
\ifluatex
  \xpg@warning{Syriac is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\RequireBidi
\RequirePackage{arabicnumbers}

\PolyglossiaSetup{syriac}{
  script=Syriac,
  scripttag=syrc,
  direction=RL,
  hyphennames={syriac,nohyphenation},
  fontsetup=true,
  %TODO localalph
}

\def\syriacnumber#1{\@syriacnumber{#1}}%

\newif\if@eastern@numerals
\def\tmp@eastern{eastern}
\def\tmp@abjad{abjad}
\define@key{syriac}{numerals}[western]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@abjad
	  \let\syriacnumber\abjadsyriac
	\else
	  \ifx\@tmpa\tmp@eastern
      \@eastern@numeralstrue
	  \else
      \@eastern@numeralsfalse
 	  \fi
  \fi}

\setkeys{syriac}{numerals}
	
%\define@key{polyglossia}{syriaclocale}[default]{%
%	\def\@syriac@locale{#1}}
%
%\def\captionssyriac{%
%\def\prefacename{\@ensure@RTL{}}% 
%\def\refname{\@ensure@RTL{}}
%\def\abstractname{\@ensure@RTL{}}%
%\def\bibname{\@ensure@RTL{}}%
%\def\chaptername{\@ensure@RTL{}}%
%\def\appendixname{\@ensure@RTL{}}%
%\def\contentsname{\@ensure@RTL{}}
%\def\listfigurename{\@ensure@RTL{}}%
%\def\listtablename{\@ensure@RTL{}}%
%\def\indexname{\@ensure@RTL{}}%
%\def\figurename{\@ensure@RTL{}}%
%\def\tablename{\@ensure@RTL{}}%
%\def\partname{\@ensure@RTL{}}%
%\def\enclname{\@ensure@RTL{}}%
%\def\ccname{\@ensure@RTL{}}%
%\def\headtoname{\@ensure@RTL{}}%
%\def\pagename{\@ensure@RTL{}}%
%\def\seename{\@ensure@RTL{}}%
%\def\alsoname{\@ensure@RTL{}}%
%\def\proofname{\@ensure@RTL{}}%
%\def\glossaryname{\@ensure@RTL{}}%
%}

\def\datesyriac{%
  \def\syriac@month##1{\ifcase##1%
  \or ܟܢܘܢ ܐܚܪܝ\or ܫܒܛ\or ܐܕܪ\or ܢܝܣܢ\or ܐܝܪ\or ܚܙܝܪܢ\or ܬܡܘܙ\or ܐܒ\or ܐܝܠܘܠ% ܐܠܘܠ
   \or ܬܫܪܝܢ ܩܕܡ% ܬܫܪܝܢ ܩܕܝܡ
   \or ܬܫܪܝܢ ܐܚܪܝ\or ܟܢܘܢ ܩܕܡ% ܟܢܘܢ ܩܕܝܡ
   \fi}%
   \def\today{\@ensure@RTL{\syriacnumber\day{\space}%
    \syriac@month{\month}{\space}\syriacnumber\year}}%
}

\def\syriac@zero{}

\def\abjadsyriac#1{%
\ifnum#1>9999\xpg@ill@value{#1}{abjadsyriac}%
\else%
  \ifnum#1<\z@\space\xpg@ill@value{#1}{abjadsyriac}%
  \else%
    \ifnum#1<10\expandafter\abj@syr@num@i\number#1%
    \else%
      \ifnum#1<100\expandafter\abj@syr@num@ii\number#1%
      \else%
        \ifnum#1<1000\expandafter\abj@syr@num@iii\number#1%
	\else%
          \expandafter\abj@syr@num@iv\number#1%
	\fi%
      \fi%
    \fi%
  \fi%
\fi%
}
\def\abj@syr@num@i#1{%
  \ifcase#1\or\char"0710\or\char"0712\or\char"0713\or\char"0715%
 \or\char"0717\or\char"0718\or\char"0719\or\char"071A\or\char"071B\fi
  \ifnum#1=\z@\syriac@zero\fi}
\def\abj@syr@num@ii#1{%
  \ifcase#1\or\char"071D\or\char"071F\or\char"0720\or\char"0721\or\char"0722%
          \or\char"0723\or\char"0725\or\char"0726\or\char"0728\fi
  \ifnum#1=\z@\fi\abj@syr@num@i}
\def\abj@syr@num@iii#1{%
  \ifcase#1\or\char"0729\or\char"072A\or\char"072B\or\char"072C%
  \or\char"0722\char"0307\or\char"0723\char"0307\or\char"0725\char"0307%
  \or\char"0726\char"0307\or\char"0728\char"0307\fi
  \ifnum#1=\z@\fi\abj@syr@num@ii}
\def\abj@syr@num@iv#1{%
  \ifcase#1\or\char"0710\char"0748\or\char"0712\char"0748%
  \or\char"0713\char"0748\or\char"0715\char"0748%
  \or\char"0717\char"0748\or\char"0718\char"0748%
  \or\char"0719\char"0748\or\char"071A\char"0748\or\char"071B\char"0748\fi
  \ifnum#1=\z@\fi\abj@syr@num@iii}

\def\@syriacnumber#1{%
   \if@eastern@numerals
     \ifnum\XeTeXcharglyph"0661 > 0%
     %%% we test for the presence of one of ١٢٣٤٥٦٧٨٩٠ in the Syriac font, 
     %%% else we try \arabicfont if defined (and give a warning), 
     %%% else we fall back to the Western numerals.
       %%\protect\addfontfeature{Mapping=arabicdigits}\number#1}%
       \protect\arabicdigits{\number#1}%
     \else%
       \ifcsdef{arabicfont}%
         {\protect\arabicdigits{\number#1}%
          \xpg@warning{You have specified the option numerals=eastern for Syriac, but the Syriac font does not contain the appropriate glyphs: I am using \string\arabicfont instead}}%
         {\number#1%%% <---changed from \RL{\protect\reset@font\protect\number#1}%
          \xpg@warning{You have specified the option numerals=eastern for Syriac, but the Syriac font does not contain the appropriate glyphs: since \string\arabicfont is not defined, we'll use Western numerals instead}}%
     \fi
   \else
     %%\RL{\protect\reset@font\number#1}%
     \number#1%
   \fi}

\def\syriac@numbers{%
   \let\@latinalph\@alph%
   \let\@latinAlph\@Alph%
   \let\@alph\abjadsyriac%
   \let\@Alph\abjadsyriac%
}
\def\nosyriac@numbers{%
  \let\@alph\@latinalph%
  \let\@Alph\@latinAlph%
  }
\def\syriac@globalnumbers{%
  \let\orig@arabic\@arabic%
  \let\@arabic\syriacnumber%
  \renewcommand\thefootnote{\protect\syriacnumber{\c@footnote}}%
}
\def\nosyriac@globalnumbers{%
  \let\@arabic\orig@arabic%
  \renewcommand\thefootnote{\protect\number{\c@footnote}}%
  }

\def\blockextras@syriac{%
   \let\@@MakeUppercase\MakeUppercase%
   \def\MakeUppercase##1{##1}%
   }
\def\noextras@syriac{%
   \let\MakeUppercase\@@MakeUppercase%
   }

%    \end{macrocode}
% \iffalse
%</gloss-syriac.ldf>
%<*gloss-tamil.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-tamil.ldf}
%    \begin{macrocode}
﻿\ProvidesFile{gloss-tamil.ldf}[polyglossia: module for tamil]
\ifluatex
  \xpg@warning{Tamil is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
% Translations provided by Kevin & Siji, 01-11-2009

\PolyglossiaSetup{tamil}{
  script=Tamil,
  scripttag=taml,
  langtag=TAM,
  hyphennames={tamil},
  hyphenmins={2,2}, %FIXME?
  fontsetup=true,
}

\def\captionstamil{%
     \def\abstractname{சாராம்சம்}%
     \def\appendixname{பிற்சேர்க்கை}%பின்னிணைப்பு
     %\def\bibname{}%
     %\def\ccname{}%
     \def\chaptername{அத்தியாயம்}%
     \def\contentsname{உள்ளே}%
     %\def\enclname{}%
     \def\figurename{படம்}%
     %\def\headpagename{}%
     %\def\headtoname{}%
     \def\indexname{சுட்டி}%பொருளடக்க அட்டவணை
     \def\listfigurename{படங்களின் பட்டியல்}%
     \def\listtablename{அட்டவணை பட்டியல்}%
     %\def\pagename{}%
     \def\partname{பகுதி}%
     %\def\prefacename{}% 
     %\def\refname{}%
     \def\tablename{அட்டவணை}%
     \def\seename{பார்க்க}%
     %\def\alsoname{}%
     %\def\alsoseename{}%
}
\def\datetamil{%
   \def\today{\number\year\space\ifcase\month\or
     ஜனவரி\or
     பிப்ரவரி\or
     மார்ச்\or
    ஏப்ரல்\or
     மே\or
     ஜூன்\or
     ஜூலை\or
    ஆகஸ்ட்\or
     செப்டம்பர்\or
     அக்டோபர்\or
     நவம்பர்\or
     டிசம்பர்\fi
     \space\number\day}%
}

%    \end{macrocode}
% \iffalse
%</gloss-tamil.ldf>
%<*gloss-telugu.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-telugu.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-telugu.ldf}[polyglossia: module for telugu]
\ifluatex
  \xpg@warning{Telugu is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
% Translations provided by Anmol Sharma <unmole.in@gmail.com>

\PolyglossiaSetup{telugu}{
  script=Telugu,
  scripttag=telu,
  langtag=TEL,
  hyphennames={telugu},
  hyphenmins={2,2}, %FIXME
  fontsetup=true,
}

\def\captionstelugu{%
   \def\refname{ఆధారాలు}%
   \def\abstractname{సారాంశం}%
   \def\bibname{గ్రంథాల జాబితా}%
   \def\prefacename{ముందుమాట}%
   \def\chaptername{అధ్యాయము}%
   \def\appendixname{అదనంగా}%
   \def\contentsname{విషయాలు}%
   \def\listfigurename{ఆకృతుల జాబితా}%
   \def\listtablename{పట్టికల జాబితా}%
   \def\indexname{విషయ సూచిక}%
   \def\figurename{ఆకృతి}%
   \def\tablename{పట్టిక}%
   %\def\thepart{}%
   \def\partname{భాగం}%
   \def\pagename{పేజి}%
   \def\seename{చూడండి}%
   \def\alsoname{కూడా చూడండి}%
   \def\enclname{ఎంక్లోజర్*}%
   \def\ccname{సిసి}%
   \def\headtoname{కి}%
   \def\proofname{రుజువు}%
   \def\glossaryname{నిఘంటువు}%
}

\def\datetelugu{%
   \def\telugu@month{%
      \ifcase\month\or
         జనవరి\or
         ఫిబ్రవరి\or
         మార్చ్\or
         ఏప్రిల్\or
         మే\or
         జూన్\or
         జూలై\or
         ఆగస్ట్\or
         సెప్టెంబర్\or
         అక్తోబెర్\or
         నవంబర్\or
         డిసంబర్\fi}%
   \def\today{\telugu@month\space\number\day,\space\number\year}%
}

%    \end{macrocode}
% \iffalse
%</gloss-telugu.ldf>
%<*gloss-thai.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-thai.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-thai.ldf}[polyglossia: module for thai]
%% This is partly based on thai-latex for Babel:
%%%% Copyright (C) 1999 - 2006
%%%%           by Surapant Meknavin,
%%%%              Theppitak Karoonboonyanan (thep at linux.thai.net),
%%%%              Chanop Silpa-Anan (chanop at debian.org),
%%%%              Poonlap Veerathanabutr (poonlap at linux.thai.net)
%%%%              Thai Linux Working Group
%%%%              http://linux.thai.net/
%%%%
\ifluatex
  \xpg@warning{Thai is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\PolyglossiaSetup{thai}{
  script=Thai,
  scripttag=thai,
  hyphennames={nohyphenation},
  fontsetup=true
  %TODO localalph={xxx@alph,xxx@Alph}
  %TODO localdigits=thainumber
}

\newif\if@thai@numerals
\def\tmp@thai{thai}
\define@key{thai}{numerals}[arabic]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@thai\@thai@numeralstrue\else
	  \@thai@numeralsfalse\fi
}

\setkeys{thai}{numerals}

\def\captionsthai{%
   \def\refname{หนังสืออ้างอิง}%
   \def\abstractname{บทคัดย่อ}%
   \def\bibname{บรรณานุกรม}%
   \def\prefacename{คำนำ}%
   \def\chaptername{บทที่}%
   \def\appendixname{ภาคผนวก}%
   \def\contentsname{สารบัญ}%
   \def\listfigurename{สารบัญรูป}%
   \def\listtablename{สารบัญตาราง}%
   \def\indexname{ดรรชนี}%
   \def\figurename{รูปที่}%
   \def\tablename{ตารางที่}%
   %\def\thepart{}%
   \def\partname{ภาค}%
   \def\pagename{หน้า}%
   \def\seename{ดู}%
   \def\alsoname{ดูเพิ่มเติม}%
   \def\enclname{สิ่งที่แนบมาด้วย}%
   \def\ccname{สำเนาถึง}%
   \def\headtoname{เรียน}%
   \def\proofname{พิสูจน์}%
   %\def\glossaryname{}%
}
\def\datethai{%   
   \def\thai@month{%
     \ifcase\month\or
       มกราคม\or กุมภาพันธ์\or มีนาคม\or เมษายน%
      \or พฤษภาคม\or มิถุนายน\or กรกฎาคม\or สิงหาคม%
      \or กันยายน\or ตุลาคม\or พฤศจิกายน\or ธันวาคม\fi}%
   \newcount\thai@year%
   \thai@year=\year%
   \advance\thai@year by 543%
   \def\today{\thainumber\day \space \thai@month\space พ.ศ.~\thainumber\thai@year}%
}

%NB: thai-latex had "plus 0.6pt", but .4em appears to give better results
% FIXME to avoid name clashes, rename \wbr to \wordbreak or \thaiworkbreak ?
\def\wbr{\hskip0pt plus .4em\relax} %%OR \char"200B = ZWSP ? Does not work
%\catcode"200b=\active
%\def^^200b{\hskip 0pt plus .4em}

\def\thaidigits#1{\expandafter\@thai@digits #1@}
\def\@thai@digits#1{%
  \ifx @#1% then terminate
  \else
    \ifx0#1๐\else\ifx1#1๑\else\ifx2#1๒\else\ifx3#1๓\else\ifx4#1๔\else\ifx5#1๕\else\ifx6#1๖\else\ifx7#1๗\else\ifx8#1๘\else\ifx9#1๙\else#1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
    \expandafter\@thai@digits
  \fi
}

\def\thainumber#1{%
  \if@thai@numerals
    \thaidigits{\number#1}%
    %%{\protect\addfontfeature{Mapping=thaidigits}\protect\number#1}
  \else
    \number#1%
    %%{\protect\reset@font\number#1}
  \fi}

\def\@thaialph#1{%
  \ifcase#1\or ก\or ข\or ค\or ง\or จ\or ฉ\or ช\or ซ\or ฌ\or ญ\or ฎ\or
   ฏ\or ฐ\or ฑ\or ฒ\or ณ\or ด\or ต\or ถ\or ท\or ธ\or น\or บ\or ป\or ผ\or
   ฝ\or พ\or ฟ\or ภ\or ม\or ย\or ร\or ล\or ว\or ศ\or ษ\or ส\or ห\or ฬ\or อ\or
   ฮ\else\xpg@ill@value{#1}{@thaialph}\fi}
\def\thaiAlph#1{\expandafter\@thaiAlph\csname c@#1\endcsname}
\def\@thaiAlph#1{%
  \ifcase#1\or ก\or ข\or ฃ\or ค\or ฅ\or ฆ\or ง\or จ\or ฉ\or ช\or ซ\or
   ฌ\or ญ\or ฎ\or ฏ\or ฐ\or ฑ\or ฒ\or ณ\or ด\or ต\or ถ\or ท\or ธ\or น\or
    บ\or ป\or ผ\or ฝ\or พ\or ฟ\or ภ\or ม\or ย\or ร\or ฤ\or ล\or ฦ\or ว\or
     ศ\or ษ\or ส\or ห\or ฬ\or อ\or ฮ\else\xpg@ill@value{#1}{@thaialph}\fi}
     
\def\thai@numbers{%
   \let\@latinalph\@alph%
   \let\@latinAlph\@Alph%
   \if@thai@numerals
     \let\@alph\@thaialph%
     \let\@Alph\@thaiAlph%
   \fi
}
\def\nothai@numbers{%
  \let\@alph\@latinalph%
  \let\@Alph\@latinAlph%
}

\def\thai@globalnumbers{%
   \let\orig@arabic\@arabic%
   \let\@arabic\thainumber%
   \renewcommand{\thefootnote}{\protect\thainumber{\c@footnote}}%
}
\def\nothai@globalnumbers{%
   \let\@arabic\orig@arabic%
   \renewcommand\thefootnote{\protect\number{\c@footnote}}%
}

\def\blockextras@thai{%
%%TODO \XeTeXlinebreaklocales "th"% uses ICU to find line breaks on the basis of a dictionary lookup-- make this optional? (in case a user might prefer a preprocessor
   \let\orig@baselinestrech\baselinestretch%
   \renewcommand{\baselinestretch}{1.2}%
}
\def\noblockextras@thai{%
%%TODO \XeTeXlinebreaklocales "en"%
   \let\baselinestrech\orig@baselinestretch%
}

%    \end{macrocode}
% \iffalse
%</gloss-thai.ldf>
%<*gloss-tibetan.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-tibetan.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-tibetan.ldf}[polyglossia: module for tibetan]
%% Copyright 2013 Elie Roux
%% Under the CC0 license <http://creativecommons.org/publicdomain/zero/1.0/>
%%
%% A good font to make tests is \newfontfamily\tibetanfont{Tibetan Machine Uni}
%%

\PolyglossiaSetup{tibetan}{
  script=Tibetan,
  scripttag=tibt,
  hyphennames={nohyphenation},
  fontsetup=true
  %TODO localalph={xxx@alph,xxx@Alph}
  %TODO localdigits=tibetannumber
}

\newif\if@tibetan@numerals
\def\tmp@tibetan{tibetan}
\define@key{tibetan}{numerals}[tibetan]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@tibetan\@tibetan@numeralstrue\else
	  \@tibetan@numeralsfalse\fi
}

\ifluatex
  \newluatexattribute\xpg@tibteol %
  \directlua{polyglossia.load_tibt_eol()}%
\fi

\def\tibetan@eol{%
  \ifluatex %
    \xpg@tibteol=1\relax %
    \directlua{polyglossia.activate_tibt_eol()}%
  \else %
    \XeTeXlinebreaklocale "bo"%
    \XeTeXlinebreakskip=0pt plus 0.1em% doesn't do much, but doesn't harm I guess...
  \fi %
}

\def\notibetan@eol{%
  \ifluatex %
    \xpg@tibteol=0\relax %
    %\directlua{polyglossia.activate_tibt_eol()}%
  \else %
    \XeTeXlinebreaklocale "en"% en? really?
    \XeTeXlinebreakskip=0pt plus 0pt%
  \fi %
}

\setkeys{tibetan}{numerals}

% some are known, but very few
% a few come from "Standardizing Tibetan Terms of Information Technology"
% from the China Tibetology Research Center
\def\captionstibetan{%
   %\def\refname{}%
   \def\abstractname{གནད་བསྡུས།}%
   \def\bibname{དཔེ་ཆའི་ཐོ་གཞུང་།}% or dpe deb kyi re'u mig?
   \def\prefacename{དཔེ་དེབ་ཀྱི་གླེང་བརྗོད།}% or gleng brjod 'god pa or ngo sprod?
   \def\chaptername{ལེའུ་}%
   \def\appendixname{ཞར་བྱུང་།}%
   \def\contentsname{དཀར་ཆག།}%
   %\def\listfigurename{}%
   %\def\listtablename{}%
   \def\indexname{གསུལ་བྱང་།}%
   \def\figurename{པར་རིས་}% or dpe ris?
   \def\tablename{རེའུ་མིག་}%
   %\def\thepart{}%
   \def\partname{ཆ་ཤས་}%
   \def\pagename{ཤོག་}%
   %\def\seename{}%
   %\def\alsoname{}%
   %\def\enclname{}%
   \def\ccname{འདྲ་བཤུས་ལེན་མཁན་}%
   %\def\headtoname{}%
   \def\proofname{བདེན་དཔང་།}% not sure about this one...
   \def\glossaryname{མིང་ཚིག་རེའུ་མིག།}%
}
\def\datetibetan{%   
   \def\tibetan@month{%
     \ifcase\month\or
       ཟླ་དང་པོ\or ཟླ་གཉིས་པ\or ཟླ་གསུམ་པ%
      \or ཟླ་བཞི་པ\or ཟླ་ལྔ་པ\or ཟླ་དྲུག་པ\or ཟླ་བདུན་པ%
      \or ཟླ་བརྒྱད་པ\or ཟླ་དགུ་པ\or ཟླ་བཆུ་པ\or ཟླ་བཆུ་གཅིག་པ\or ཟླ་བཆུ་གཉིས་པ\fi}%      
   \def\tibetan@daynum{%
     \ifcase\day\or དང་པོ\or གཉིས་པ\or གསུམ་པ \or བཞི་པ\or ལྔ་པ\or དྲུག་པ\or བདུན་པ\or བརྒྱད་པ\or དགུ་པ\or བཆུ་པ%
 \or བཆུ་གཅིག་པ\or བཆུ་གཉིས་པ\or བཆུ་གསུམ་པ\or བཆུ་བཞི་པ\or བཆུ་ལྔ་པ\or བཆུ་དྲུག་པ\or བཆུ་བདུན་པ\or བཆུ་བརྒྱད་པ\or བཆུ་དགུ་པ\or ཉི་ཤུ་པ%
 
 \or ཉི་ཤུ་རྩ་གཅིག་པ\or ཉི་ཤུ་རྩ་གཉིས་པ\or ཉི་ཤུ་རྩ་གསུམ་པ\or ཉི་ཤུ་རྩ་བཞི་པ\or ཉི་ཤུ་རྩ་ལྔ་པ\or ཉི་ཤུ་རྩ་དྲུག་པ\or ཉི་ཤུ་རྩ་བདུན་པ\or ཉི་ཤུ་རྩ་བརྒྱད་པ\or ཉི་ཤུ་རྩ་དགུ་པ\or སུམ་ཆུ་པ%
 \or སུམ་ཆུ་སོ་གཅིག་པ\fi}%      
   % As we use gregorian calendar, it's better to stick with spyi lo
   %\newcount\tibetan@year%
   %\tibetan@year=\year%
   %\advance\tibetan@year by 127% this is bod rgyal lo, the most common, but there are others...
   % I'm not sure the / character is in most tibetan fonts
   %\def\today{\tibetannumber\day /\tibetannumber\day /\tibetannumber\year}%
   \def\today{\tibetannumber\day །\tibetannumber\month །\tibetannumber\year}%
   % this is more litterate, but longer
   %\def\today{སྤྱི་ལོ་\tibetannumber\year ་སྤྱི་\tibetan@month{}་ད་རེས་\tibetan@daynum{}།}%  
}

\def\tibetandigits#1{\expandafter\@tibetan@digits #1@}
\def\@tibetan@digits#1{%
  \ifx @#1% then terminate
  \else
    \ifx0#1༠\else\ifx1#1༡\else\ifx2#1༢\else\ifx3#1༣\else\ifx4#1༤\else\ifx5#1༥\else\ifx6#1༦\else\ifx7#1༧\else\ifx8#1༨\else\ifx9#1༩\else#1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
    \expandafter\@tibetan@digits
  \fi
}

\def\tibetannumber#1{%
  \if@tibetan@numerals
    \tibetandigits{\number#1}%
    %%{\protect\addfontfeature{Mapping=tibetandigits}\protect\number#1}
  \else
    \number#1%
    %%{\protect\reset@font\number#1}
  \fi}

\def\@tibetanalph#1{%
  \ifcase#1\or ཀ\or ཁ\or ག\or ང\or ཅ\or ཆ\or ཇ\or ཉ\or ཏ\or ཐ\or ད\or ན\or པ\or 
  ཕ\or བ\or མ\or ཙ\or ཚ\or ཛ\or ཝ\or ཞ\or ཟ\or འ\or ཡ\or ར\or ལ\or ཤ\or ས\or ཧ\or ཨ
 \else\xpg@ill@value{#1}{@tibetanalph}\fi}
\def\tibetanAlph#1{\expandafter\@tibetanAlph\csname c@#1\endcsname}
\def\@tibetanAlph#1{%
  \ifcase#1\or ཀ\or ཁ\or ག\or ང\or ཅ\or ཆ\or ཇ\or ཉ\or ཏ\or ཐ\or ད\or ན\or པ\or 
  ཕ\or བ\or མ\or ཙ\or ཚ\or ཛ\or ཝ\or ཞ\or ཟ\or འ\or ཡ\or ར\or ལ\or ཤ\or ས\or ཧ\or ཨ
 \else\xpg@ill@value{#1}{@tibetanalph}\fi}
     
\def\tibetan@numbers{%
   \let\@latinalph\@alph%
   \let\@latinAlph\@Alph%
   \if@tibetan@numerals
     \let\@alph\@tibetanalph%
     \let\@Alph\@tibetanAlph%
   \fi
}
\def\notibetan@numbers{%
  \let\@alph\@latinalph%
  \let\@Alph\@latinAlph%
}

\def\tibetan@globalnumbers{%
   \let\xpg@orig@arabic\@arabic%
   \let\@arabic\tibetannumber%
   \renewcommand{\thefootnote}{\protect\tibetannumber{\c@footnote}}%
}

\def\notibetan@globalnumbers{%
   \let\@arabic\xpg@orig@arabic%
   \renewcommand\thefootnote{\protect\number{\c@footnote}}%
}

\def\noextras@tibetan{%
   \notibetan@eol%
   \ifcsname xpg@orig@baselinestretch\endcsname\renewcommand{\baselinestretch}{\xpg@orig@baselinestretch}\fi %
   }

\def\inlineextras@tibetan{%
   \xdef\xpg@orig@baselinestretch{\ifcsname baselinestretch\endcsname \baselinestretch \else 1\fi}%
   \renewcommand{\baselinestretch}{1.2}%
   \tibetan@eol%
   }

\def\blockextras@tibetan{%
   \xdef\xpg@orig@baselinestretch{\ifcsname baselinestretch\endcsname \baselinestretch \else 1\fi}%
   \renewcommand{\baselinestretch}{1.2}%
   \tibetan@eol%
}

%    \end{macrocode}
% \iffalse
%</gloss-tibetan.ldf>
%<*gloss-turkish.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-turkish.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-turkish.ldf}[polyglossia: module for turkish]
\RequirePackage{hijrical}
\PolyglossiaSetup{turkish}{
  hyphennames={turkish},
  hyphenmins={2,2},
  langtag=TRK,
  frenchspacing=true,
  fontsetup=true
  }

% TODO Add \ifluatex branch everywhere
\ifxetex
\newXeTeXintercharclass\turkish@punctthin % ! :
\newXeTeXintercharclass\turkish@punctthick % =
\fi

\def\turkish@punctthinspace{{\ifdim\lastskip>\z@\unskip\penalty\@M\thinspace\fi}}
\def\turkish@punctthickspace{{\unskip\nobreakspace}}

\def\turkish@punctuation{%
   \ifxetex
   \XeTeXinterchartokenstate=1%
   \XeTeXcharclass `\! \turkish@punctthin
   \XeTeXcharclass `\: \turkish@punctthin
   \XeTeXcharclass `\= \turkish@punctthick
   \XeTeXinterchartoks \z@ \turkish@punctthin = \turkish@punctthinspace
   \XeTeXinterchartoks \z@ \turkish@punctthick = \turkish@punctthickspace
   \fi
}

\def\noturkish@punctuation{%
   \ifxetex
   \XeTeXcharclass `\! \z@
   \XeTeXcharclass `\: \z@
   \XeTeXcharclass `\= \z@
   \XeTeXinterchartokenstate=0%
   \fi
}

\def\turkish@casing{%
  \lccode`\I=`\ı
  \uccode`\i=`\İ
}

\def\noturkish@casing{%
  \lccode`\I=`\i
  \uccode`\i=`\I
}

\def\captionsturkish{%
  \def\prefacename{Önsöz}%
  \def\refname{Kaynaklar}%
  \def\abstractname{Özet}%
  \def\bibname{Kaynakça}%
  \def\chaptername{Bölüm}%
  \def\appendixname{Ek}%
  \def\contentsname{İçindekiler}%
  \def\listfigurename{Şekil Listesi}%
  \def\listtablename{Tablo Listesi}%
  \def\indexname{Dizin}%
  \def\figurename{Şekil}%
  \def\tablename{Tablo}%
  \def\partname{Kısım}%
  \def\enclname{İlişik}%
  \def\ccname{Diğer Alıcılar}%
  \def\headtoname{Alıcı}%
  \def\pagename{Sayfa}%
  \def\subjectname{İlgili}%
  \def\seename{bkz.}%
  \def\alsoname{ayrıca bkz.}%
  \def\proofname{Kanıt}%
  \def\glossaryname{Lügatçe}%
   }
\def\dateturkish{%
   \def\today{\number\day~\ifcase\month\or
    Ocak\or Şubat\or Mart\or Nisan\or Mayıs\or Haziran\or
    Temmuz\or Ağustos\or Eylül\or Ekim\or Kasım\or
    Aralık\fi
    \space\number\year}%
}
\def\hijrimonthturkish#1{\ifcase#1%
\or Muharrem\or Safer\or Rebiülevvel\or Rebiülahir\or Cemaziyelevvel\or Cemaziyelahir\or Recep\or Şaban\or Ramazan\or Şevval\or Zilkade\or Zilhicce\fi}
%%\Hijritoday is now locale-aware and will format the date with this macro:
\DefineFormatHijriDate{turkish}{%
\number\value{Hijriday}\space\hijrimonthturkish{\value{Hijrimonth}}\space\number\value{Hijriyear}}

\def\noextras@turkish{%
   \noturkish@punctuation%
   \noturkish@casing%
}

\def\blockextras@turkish{%
   \turkish@punctuation%
   \turkish@casing%
}

\def\inlineextras@turkish{%
   \turkish@punctuation%
   \turkish@casing%
}

%    \end{macrocode}
% \iffalse
%</gloss-turkish.ldf>
%<*gloss-turkmen.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-turkmen.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-turkmen.ldf}[polyglossia: module for turkmen]
%% Translations provided by Nazar Annagurban <nazartm at gmail dot com>
\PolyglossiaSetup{turkmen}{
  hyphennames={turkmen},
  hyphenmins={2,2},
  langtag=TKM,
  frenchspacing=false,
  fontsetup=true
}

\def\captionsturkmen{%
  \def\prefacename{Sözbaşy}%
  \def\refname{Çeşmeler}%
  \def\abstractname{Gysgaça manysy}%
  \def\bibname{Çeşmeler}%
  \def\chaptername{Bap}%
  \def\appendixname{Goşmaça}%
  \def\contentsname{Mazmuny}%
  \def\listfigurename{Suratlaryň sanawy}%
  \def\listtablename{Tablisalaryň sanawy}%
  \def\indexname{Indeks}%
  \def\figurename{Surat}%
  \def\tablename{Tablisa}%
  \def\partname{Bölüm}%
  \def\enclname{Goşmaça}%
  \def\ccname{Iberilenler}%
  \def\headtoname{Kime}%
  \def\pagename{Sahypa}%
  \def\subjectname{Tema}%
  \def\seename{ser.}%
  \def\alsoname{şuňa-da ser.}%
  \def\proofname{Delil}%
  \def\glossaryname{Sözlük}%
}
\def\dateturkmen{%
   \def\today{\number\day~\ifcase\month\or
    Ýanwar\or Fewral\or Mart\or Aprel\or Maý\or Iýun\or
    Iýul\or Awgust\or Sentýabr\or Oktýabr\or Noýabr\or
    Dekabr\fi
    \space\number\year}%
}
%    \end{macrocode}
% \iffalse
%</gloss-turkmen.ldf>
%<*gloss-ukrainian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-ukrainian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-ukrainian.ldf}[polyglossia: module for ukrainian]
% Strings taken from Babel
% and revised by Roman Kyrylych

\PolyglossiaSetup{ukrainian}{
  script=Cyrillic,
  scripttag=cyrl,
  langtag=UKR,
  hyphennames={ukrainian},
  hyphenmins={2,2},
  frenchspacing=true,
  fontsetup=true
  %TODO localalph
}

\newif\ifcyrillic@numerals
\define@key{ukrainian}{numerals}[latin]{%
\ifstrequal{#1}{cyrillic}%
{\cyrillic@numeralstrue}
{\cyrillic@numeralsfalse}%
}

\define@boolkey{ukrainian}[ukrainian@]{babelshorthands}[false]{}

\setkeys{ukrainian}{numerals}

\ifsystem@babelshorthands
\setkeys{ukrainian}{babelshorthands=true}
\else
\setkeys{ukrainian}{babelshorthands=false}
\fi

\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
}{}

\def\ukrainian@shorthands{%
\bbl@activate{"}%
\def\language@group{ukrainian}%
%  \declare@shorthand{ukrainian}{"`}{„}%
%  \declare@shorthand{ukrainian}{"'}{“}%
%  \declare@shorthand{ukrainian}{"<}{«}%
%  \declare@shorthand{ukrainian}{">}{»}%
\declare@shorthand{ukrainian}{""}{\hskip\z@skip}%
\declare@shorthand{ukrainian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}%
\declare@shorthand{ukrainian}{"=}{\nobreak-\hskip\z@skip}%
\declare@shorthand{ukrainian}{"|}{\textormath{\nobreak\discretionary{-}{}{\kern.03em}\allowhyphens}{}}%
\declare@shorthand{ukrainian}{"-}{%
\def\ukrainian@sh@tmp{%
\if\ukrainian@sh@next-\expandafter\ukrainian@sh@emdash
\else\expandafter\ukrainian@sh@hyphen\fi
}%
\futurelet\ukrainian@sh@next\ukrainian@sh@tmp}%
\def\ukrainian@sh@hyphen{%
\nobreak\-\bbl@allowhyphens}%
\def\ukrainian@sh@emdash##1##2{\cdash-##1##2}%
\def\cdash##1##2##3{\def\tempx@{##3}%
\def\tempa@{-}\def\tempb@{~}\def\tempc@{*}%
\ifx\tempx@\tempa@\@Acdash\else
\ifx\tempx@\tempb@\@Bcdash\else
\ifx\tempx@\tempc@\@Ccdash\else
\errmessage{Wrong usage of cdash}\fi\fi\fi}%
\def\@Acdash{\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi
\cyrdash\hskip.2em\ignorespaces}%
\def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi
\nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z@skip\ignorespaces}%
\def\@Ccdash{\leavevmode
\nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}%
\ifx\cyrdash\undefined
\def\cyrdash{\hbox to.8em{--\hss--}}
\fi
\declare@shorthand{ukrainian}{",}{\nobreak\hskip.2em\ignorespaces}%
}

\def\noukrainian@shorthands{%
\@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
}

\def\captionsukrainian{%
   \def\refname{Література}%
   \def\abstractname{Анотація}%
   \def\bibname{Бібліоґрафія}%
   \def\prefacename{Вступ}%
   \def\chaptername{Розділ}%
   \def\appendixname{Додаток}%
   \def\contentsname{Зміст}%
   \def\listfigurename{Перелік ілюстрацій}%
   \def\listtablename{Перелік таблиць}%
   \def\indexname{Покажчик}%
   \def\authorname{Іменний покажчик}% babel has "Їменний покажчик"
   \def\figurename{Рис.}%
   \def\tablename{Табл.}%
   %\def\thepart{}%
   \def\partname{Частина}%
   \def\pagename{с.}%
   \def\seename{див.}%
   \def\alsoname{див.\ також}%
   \def\enclname{вкладка}%
   \def\ccname{копія}%
   \def\headtoname{До}%
   \def\proofname{Доведення}%
   \def\glossaryname{Словник термінів}%
   }
\def\dateukrainian{%
   \def\today{\number\day~\ifcase\month\or
    січня\or
    лютого\or
    березня\or
    квітня\or
    травня\or
    червня\or
    липня\or
    серпня\or
    вересня\or
    жовтня\or
    листопада\or
    грудня\fi%
    \space\number\year~р.}}

% The following is based on some ideas from ruscor.sty
\def\ukrainian@capsformat{%
\def\@seccntformat##1{\csname pre##1\endcsname%
\csname the##1\endcsname%
\csname post##1\endcsname}%
\def\@aftersepkern{\hspace{0.5em}}%
\def\postchapter{.\@aftersepkern}%
\def\postsection{.\@aftersepkern}%
\def\postsubsection{.\@aftersepkern}%
\def\postsubsubsection{.\@aftersepkern}%
\def\postparagraph{.\@aftersepkern}%
\def\postsubparagraph{.\@aftersepkern}%
\def\prechapter{}%
\def\presection{}%
\def\presubsection{}%
\def\presubsubsection{}%
\def\preparagraph{}%
\def\presubparagraph{}}

\def\Asbuk#1{\expandafter\ukrainian@Alph\csname c@#1\endcsname}
\def\ukrainian@Alph#1{\ifcase#1\or
   А\or Б\or В\or Г\or Д\or Е\or Є\or Ж\or
   З\or И\or І\or Ї\or Й\or К\or Л\or М\or Н\or О\or
   П\or Р\or С\or Т\or У\or Ф\or Х\or
   Ц\or Ч\or Ш\or Щ\or Ю\or Я\else\xpg@ill@value{#1}{ukrainian@Alph}\fi}
\def\asbuk#1{\expandafter\ukrainian@alph\csname c@#1\endcsname}
\def\ukrainian@alph#1{\ifcase#1\or
   а\or б\or в\or г\or д\or е\or є\or ж\or
   з\or и\or і\or ї\or й\or к\or л\or м\or н\or о\or
   п\or р\or с\or т\or у\or ф\or х\or
   ц\or ч\or ш\or щ\or ю\or я\else\xpg@ill@value{#1}{ukrainian@alph}\fi}

\def\ukrainian@numbers{%
   \let\latin@Alph\@Alph%
   \let\latin@alph\@alph%
   \let\@Alph\ukrainian@Alph%
   \let\@alph\ukrainian@alph%
}

\def\noukrainian@numbers{%
   \let\@Alph\latin@Alph%
   \let\@alph\latin@alph%
}

\def\noextras@ukrainian{%
\def\@seccntformat##1{\csname the##1\endcsname\quad}% = LaTeX kernel
\ifcyrillic@numerals\noukrainian@numbers\fi
\noukrainian@shorthands%
}

\def\blockextras@ukrainian{%
\ukrainian@capsformat%
\ifcyrillic@numerals\ukrainian@numbers\fi
\ifukrainian@babelshorthands\ukrainian@shorthands\fi
}

\def\inlineextras@ukrainian{%
\ifukrainian@babelshorthands\ukrainian@shorthands\fi%
}

%%% stuff from Babel
% make it optional?
\def\sh{\mathop{\operator@font sh}\nolimits}
\def\ch{\mathop{\operator@font ch}\nolimits}
\def\tg{\mathop{\operator@font tg}\nolimits}
\def\arctg{\mathop{\operator@font arctg}\nolimits}
\def\arcctg{\mathop{\operator@font arcctg}\nolimits}
\def\ctg{\mathop{\operator@font ctg}\nolimits}
\def\cth{\mathop{\operator@font cth}\nolimits}
\def\cosec{\mathop{\operator@font cosec}\nolimits}
\def\Prob{\mathop{\kern\z@\mathsf{P}}\nolimits}
\def\Variance{\mathop{\kern\z@\mathsf{D}}\nolimits}
\def\nsd{\mathop{\mathrm{н.с.д.}}\nolimits}
\def\nsk{\mathop{\mathrm{н.с.к.}}\nolimits}
\def\NSD{\mathop{\mathrm{НСД}}\nolimits}
\def\NSK{\mathop{\mathrm{НСК}}\nolimits}
\def\nod{\mathop{\mathrm{н.о.д.}}\nolimits}
\def\nok{\mathop{\mathrm{н.о.к.}}\nolimits}
\def\NOD{\mathop{\mathrm{НОД}}\nolimits}
\def\NOK{\mathop{\mathrm{НОК}}\nolimits}
\def\Proj{\mathop{\mathrm{пр}}\nolimits}

%    \end{macrocode}
% \iffalse
%</gloss-ukrainian.ldf>
%<*gloss-urdu.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-urdu.ldf}
%    \begin{macrocode}
%%% Adapted from a file contributed by Kamal Abdali
\ProvidesFile{gloss-urdu.ldf}[polyglossia: module for Urdu]
\ifluatex
  \xpg@warning{Urdu is not supported with LuaTeX.\MessageBreak
I will proceed with the compilation, but\MessageBreak
the output is not guaranteed to be correct\MessageBreak
and may look very wrong.}
\fi
\RequireBidi
\RequirePackage{arabicnumbers}
\RequirePackage{hijrical}

\PolyglossiaSetup{urdu}{
  script=Arabic,
  direction=RL,
  scripttag=arab,
  langtag=URD,
  hyphennames={urdu,nohyphenation},
  fontsetup=true
  %TODO localalph={abjad,abjad}
  %TODO localnumber=urdunumber
}

\newif\if@western@numerals
\def\tmp@western{western}
\define@key{urdu}{numerals}[eastern]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@western\@western@numeralstrue%
	  \else\@western@numeralsfalse%
	\fi}

%% TODO USE boolkey instead !!!
%this is needed for \abjad in arabicnumbers.sty
\def\tmp@true{true}
\define@key{urdu}{abjadjimnotail}[true]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@true\abjad@jim@notailtrue%
  \else
    \abjad@jim@notailfalse
  \fi}

\newif\if@hijrical
\def\tmp@hijri{hijri}
\define@key{urdu}{calendar}[gregorian]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@hijri\@hijricaltrue%
    \else\@hijricalfalse%
  \fi}

\define@key{urdu}{hijricorrection}[0]{%
  \gdef\@hijri@correction{#1}}%

% This should set the defaults
\setkeys{urdu}{calendar,numerals,hijricorrection}

\def\urdugregmonth#1{\ifcase#1%
  \or جنوری\or فروری\or مارچ\or اپریل\or مئی\or جون\or جولائی\or اگست\or  ستمبر\or اکتوبر\or نومبر\or دسمبر\fi}

\def\urduhijrimonth#1{\ifcase#1%
 \or محرّم\or صفر\or ربیع الاوّل\or ربیع الثّانی\or جمادی الاوّل\or جمادی الثّانی\or رجب\or شعبان\or  رمضان\or شوّال\or ذیقعدہ\or ذی الحجّہ\fi}

%\Hijritoday is now locale-aware and will format the date with this macro:
\DefineFormatHijriDate{urdu}{\@ensure@RTL{%
  \urdunumber{\value{Hijriday}}؍\space\urduhijrimonth{\value{Hijrimonth}}\space\urdunumber{\value{Hijriyear}}}}

\def\captionsurdu{%
  \def\refname{\@ensure@RTL{حوالہ جات}}%
  \def\abstractname{\@ensure@RTL{ملخّص}}%
  \def\bibname{\@ensure@RTL{کتابیات}}%
  \def\prefacename{\@ensure@RTL{دیباچہ}}%
  \def\chaptername{\@ensure@RTL{باب}}%
  \def\appendixname{\@ensure@RTL{ضمیمہ}}%
  \def\contentsname{\@ensure@RTL{فہرست عنوانات}}%
  \def\listfigurename{\@ensure@RTL{فہرست اشکال}}%
  \def\listtablename{\@ensure@RTL{فہرست جداول}}%
  \def\indexname{\@ensure@RTL{اشاریہ}}%
  \def\figurename{\@ensure@RTL{شكل}}%
  \def\tablename{\@ensure@RTL{جدول}}%
  %\def\thepart{}%
  \def\partname{\@ensure@RTL{حصّہ}}%
  \def\pagename{\@ensure@RTL{صفحہ}}%
  \def\seename{\@ensure@RTL{ملاحظہ ہو}}%
  \def\alsoname{\@ensure@RTL{ایضاً}}%
  \def\enclname{\@ensure@RTL{منسلک}}%
  \def\ccname{\@ensure@RTL{نقل}}%
  \def\headtoname{\@ensure@RTL{بملاحظہ}}%
  \def\proofname{\@ensure@RTL{ثبوت}}%
  \def\glossaryname{\@ensure@RTL{لغت}}%
  \def\sectionname{\@ensure@RTL{فصل}}%
}

\def\dateurdu{%
  \def\today{%
    \if@hijrical
     \Hijritoday[\@hijri@correction]%
    \else
      \@ensure@RTL{\urdunumber\day؍\space\urdugregmonth{\month}%
         \space\urdunumber\year}%
    \fi}%
}

\def\urdunumber#1{%
  \if@western@numerals
    \number#1%
  \else
    %%FIXME use farsidigits instead???
    \protect\arabicdigits{\number#1}%
  \fi}

\def\urdu@numbers{%
  \let\@latinalph\@alph%
  \let\@latinAlph\@Alph%
  \let\@alph\abjad%
  \let\@Alph\abjad%
  }

\def\nourdu@numbers{%
  \let\@alph\@latinalph%
  \let\@Alph\@latinAlph%
  }

\def\urdu@globalnumbers{%
  \let\orig@arabic\@arabic%
  \let\@arabic\urdunumber%
  % For some reason \thefootnote needs to be set separately:
  \renewcommand\thefootnote{\protect\urdunumber{\c@footnote}}%
  }

\def\nourdu@globalnumbers{
  \let\@arabic\orig@arabic%
  \renewcommand\thefootnote{\protect\number{\c@footnote}}%
  }

\def\blockextras@urdu{%
  \let\@@MakeUppercase\MakeUppercase%
  \def\MakeUppercase##1{##1}%
  }

\def\noextras@urdu{%
  \let\MakeUppercase\@@MakeUppercase%
  }

%    \end{macrocode}
% \iffalse
%</gloss-urdu.ldf>
%<*gloss-usorbian.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-usorbian.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-usorbian.ldf}[polyglossia: module for upper sorbian]

\PolyglossiaSetup{usorbian}{
  hyphennames={usorbian,uppersorbian},
  hyphenmins={2,2},
  fontsetup=true,
}

\def\captionsusorbian{%
   \def\refname{Referency}%
   \def\abstractname{Abstrakt}%
   \def\bibname{Literatura}%
   \def\prefacename{Zawod}%
   \def\chaptername{Kapitl}%
   \def\appendixname{Dodawki}%
   \def\contentsname{Wobsah}%
   \def\listfigurename{Zapis wobrazow}%
   \def\listtablename{Zapis tabulkow}%
   \def\indexname{Indeks}%
   \def\figurename{Wobraz}%
   \def\tablename{Tabulka}%
   %\def\thepart{}%
   \def\partname{Dźěl}%
   \def\pagename{Strona}%
   \def\seename{hl.}%
   \def\alsoname{hl.~tež}%
   \def\enclname{Přłoha}%
   \def\ccname{CC}%
   \def\headtoname{Komu}%
   \def\proofname{Proof}% <-- needs translation
   \def\glossaryname{Glossary}% <-- needs translation
   }%

\def\dateusorbian{%   
  \def\today{\number\day.~\ifcase\month\or
    januara\or februara\or měrca\or apryla\or meje\or junija\or
    julija\or awgusta\or septembra\or oktobra\or
    nowembra\or decembra\fi
    \space \number\year}%
  %TODO implement option olddate:
    \def\oldtoday{\number\day.~\ifcase\month\or
    wulkeho róžka\or małeho róžka\or nalětnika\or
    jutrownika\or róžownika\or  smažnika\or pražnika\or
    žnjenca\or požnjenca\or winowca\or nazymnika\or
    hodownika\fi \space \number\year}%
  }

%    \end{macrocode}
% \iffalse
%</gloss-usorbian.ldf>
%<*gloss-vietnamese.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-vietnamese.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-vietnamese.ldf}[polyglossia: module for vietnamese]
%% Strings contributed by Daniel Owens < dhowens . pmbx . net >

\PolyglossiaSetup{vietnamese}{
  hyphennames={nohyphenation},
  hyphenmins={2,2},
  langtag=VIT,
  frenchspacing=true,
  fontsetup=true,
}

\def\captionsvietnamese{%
  \def\refname{Tài liệu}%
  \def\abstractname{Tóm tắt nội dung}%
  \def\bibname{Tài liệu tham khảo}%
  \def\prefacename{Lời nói đầu}%
  \def\chaptername{Chương}%
  \def\appendixname{Phụ lục}%
  \def\contentsname{Mục lục}%
  \def\listfigurename{Danh sách hình vẽ}%
  \def\listtablename{Danh sách bảng}%
  \def\indexname{Chỉ mục}%
  \def\figurename{Hình}%
  \def\tablename{Bảng}%
  \def\partname{Phần}%
  \def\pagename{Trang}%
  \def\seename{Xem}%
  \def\alsoname{Xem thêm}%
  \def\enclname{Kèm theo}%
  \def\ccname{Cùng gửi}%
  \def\headtoname{Gửi}%
  \def\proofname{Chứng minh}%
  \def\glossaryname{Từ điển chú giải}%
  }

\def\datevietnamese{%
  \def\today{%
    Ngày \number\day\space
    tháng \number\month\space
    năm \number\year}%
  }

%    \end{macrocode}
% \iffalse
%</gloss-vietnamese.ldf>
%<*gloss-welsh.ldf>
% \fi
% \clearpage
% 
% \subsection{gloss-welsh.ldf}
%    \begin{macrocode}
\ProvidesFile{gloss-welsh.ldf}[polyglossia: module for welsh]

\PolyglossiaSetup{welsh}{
  hyphennames={welsh},
  hyphenmins={2,3},
  fontsetup=true,
}

\providebool{welsh@formaldate}

% TODO (maybe) Interface to change that mid-document
\define@key{welsh}{date}{%
  \ifstrequal{#1}{long}{%
    \welsh@formaldatetrue
  }% Anything else gives \welsh@formaldatefalse
}

\def\captionswelsh{%
  \def\refname{Cyfeiriadau}%
  \def\abstractname{Crynodeb}%
  \def\bibname{Llyfryddiaeth}%
  \def\prefacename{Rhagair}%
  \def\chaptername{Pennod}%
  \def\appendixname{Atodiad}%
  \def\contentsname{Cynnwys}%
  \def\listfigurename{Rhestr Ddarluniau}%
  \def\listtablename{Rhestr Dablau}%
  \def\indexname{Mynegai}%
  \def\figurename{Darlun}%
  \def\tablename{Taflen}%
  %\def\thepart{}%
  \def\partname{Rhan}%
  \def\pagename{tudalen}%
  \def\seename{gweler}%
  \def\alsoname{gweler hefyd}%
  \def\enclname{amgaeëdig}%
  \def\ccname{copïau}%
  \def\headtoname{At}% ‘at’ on letters meaning ‘to (a person)’;
                     % ‘to (a place)’ is ‘i’ in Welsh
  \def\proofname{Prawf}%
  \def\glossaryname{Rhestr termau}%
  }

\newif\ifwelsh@first
\def\welsh@article#1{\welsh@firsttrue y\expandafter\welsh@article@do#1}
\def\welsh@article@do#1{\ifwelsh@first\welsh@isvowel#1\ifwelsh@vowel r\space\welsh@vowelfalse\else\space\fi#1\welsh@firstfalse\fi}
\newif\ifwelsh@vowel
\def\welsh@isvowel#1{\show#1\ifx#1a\welsh@voweltrue\else\ifx#1u\welsh@voweltrue\else\ifx#1w\welsh@voweltrue\fi\fi\fi}% FIXME Add the other vowels, just for good measure

\def\welsh@ordinal@long#1{%
  \ifcase#1\or cyntaf\or ail\or trydydd\or pedwerydd\or
  pumed\or chweched\or seithfed\or wythfed\or nawfed\or degfed\or unfed ar ddeg\or deuddegfed\or trydydd ar ddeg\or pedwerydd ar ddeg\or pymthegfed\or unfed ar bymtheg\or ail ar bymtheg\or deunawfed\or pedwerydd ar bymtheg\or ugeinfed\else\expandafter\welsh@ordinalplusxx@long#1\fi}

\def\welsh@ordinalplusxx@long#1{%
  \let\dday=#1\advance\dday by -20\relax\welsh@ordinal@long\dday\space ar hugain%
}

\def\datewelsh{%   
  \def\today{\ifwelsh@formaldate\formaltoday\else\standardtoday\fi}
  \def\standardtoday{%
    \ifcase\day\or 1af\or 2ail\or 3ydd\or 4ydd\or 5ed\or 6ed%
    \or 7fed\or 8fed\or 9fed\or 10fed\or 11eg\or 12fed\or 13eg\or
    14eg\or 15fed\or 16eg\or 17eg\or 18fed\or 19eg\or
    20fed\else\number\day ain\fi\space\ifcase\month\or
    Ionawr\or Chwefror\or Mawrth\or Ebrill\or
    Mai\or Mehefin\or Gorffennaf\or Awst\or
    Medi\or Hydref\or Tachwedd\or Rhagfyr\fi%
    \space\number\year}%

  \def\formaltoday{%
    \expandafter\welsh@article\welsh@ordinal@long\day\space o\space\ifcase\month\or Ionawr\or Chwefror\or Fawrth\or Ebrill\or Fai\or Fehefin\or Orffenaf\or Awst\or Fedi\or Hydref\or Dachwedd\or Ragfyr\fi
    \space\number\year}%
  }

%    \end{macrocode}
% \iffalse
%</gloss-welsh.ldf>
%<*arabicdigits.map>
% \fi
% \clearpage
% 
% \subsection{arabicdigits.map}
%    \begin{macrocode}
; FC ... 
LHSName	"Digits"
RHSName	"ArabicDigits"

pass(Unicode)
U+0030 <> U+0660 ;
U+0031 <> U+0661 ;
U+0032 <> U+0662 ;
U+0033 <> U+0663 ;
U+0034 <> U+0664 ;
U+0035 <> U+0665 ;
U+0036 <> U+0666 ;
U+0037 <> U+0667 ;
U+0038 <> U+0668 ;
U+0039 <> U+0669 ;

%    \end{macrocode}
% \iffalse
%</arabicdigits.map>
%<*bengalidigits.map>
% \fi
% \clearpage
% 
% \subsection{bengalidigits.map}
%    \begin{macrocode}
; FC ... 
LHSName	"Digits"
RHSName	"BengaliDigits"

pass(Unicode)
U+0030 <> U+09E6 ;
U+0031 <> U+09E7 ;
U+0032 <> U+09E8 ;
U+0033 <> U+09E9 ;
U+0034 <> U+09EA ;
U+0035 <> U+09EB ;
U+0036 <> U+09EC ;
U+0037 <> U+09ED ;
U+0038 <> U+09EE ;
U+0039 <> U+09EF ;

%    \end{macrocode}
% \iffalse
%</bengalidigits.map>
%<*devanagaridigits.map>
% \fi
% \clearpage
% 
% \subsection{devanagaridigits.map}
%    \begin{macrocode}
; FC ... 
LHSName	"Digits"
RHSName	"DevanagariDigits"

pass(Unicode)
U+0030 <> U+0966 ;
U+0031 <> U+0967 ;
U+0032 <> U+0968 ;
U+0033 <> U+0969 ;
U+0034 <> U+096A ;
U+0035 <> U+096B ;
U+0036 <> U+096C ;
U+0037 <> U+096D ;
U+0038 <> U+096E ;
U+0039 <> U+096F ;

%    \end{macrocode}
% \iffalse
%</devanagaridigits.map>
%<*farsidigits.map>
% \fi
% \clearpage
% 
% \subsection{farsidigits.map}
%    \begin{macrocode}
; FC ... 
LHSName	"Digits"
RHSName	"FarsiDigits"

pass(Unicode)
U+0030 <> U+06F0 ;
U+0031 <> U+06F1 ;
U+0032 <> U+06F2 ;
U+0033 <> U+06F3 ;
U+0034 <> U+06F4 ;
U+0035 <> U+06F5 ;
U+0036 <> U+06F6 ;
U+0037 <> U+06F7 ;
U+0038 <> U+06F8 ;
U+0039 <> U+06F9 ;

%    \end{macrocode}
% \iffalse
%</farsidigits.map>
%<*thaidigits.map>
% \fi
% \clearpage
% 
% \subsection{thaidigits.map}
%    \begin{macrocode}
; FC ... 
LHSName	"Digits"
RHSName	"ThaiDigits"

pass(Unicode)
U+0030 <> U+0E50 ;
U+0031 <> U+0E51 ;
U+0032 <> U+0E52 ;
U+0033 <> U+0E53 ;
U+0034 <> U+0E54 ;
U+0035 <> U+0E55 ;
U+0036 <> U+0E56 ;
U+0037 <> U+0E57 ;
U+0038 <> U+0E58 ;
U+0039 <> U+0E59 ;

%    \end{macrocode}
% \iffalse
%</thaidigits.map>
%<*polyglossia-frpt.lua>
% \fi
% \clearpage
% 
% \subsection{polyglossia-frpt.lua}
%    \begin{macrocode}
require('polyglossia') -- just in case...

local add_to_callback = luatexbase.add_to_callback
local remove_from_callback = luatexbase.remove_from_callback
local priority_in_callback = luatexbase.priority_in_callback

local get_quad = luaotfload.aux.get_quad -- needs luaotfload > 20130516

local next, type = next, type

local nodes, fonts, node = nodes, fonts, node

local nodecodes          = nodes.nodecodes

local insert_node_before = node.insert_before
local insert_node_after  = node.insert_after
local remove_node        = nodes.remove
local has_attribute      = node.has_attribute
local node_copy          = node.copy
local new_node           = node.new

local end_of_math        = node.end_of_math
if not end_of_math then -- luatex < .76
  local traverse_nodes = node.traverse_id
  local math_code      = nodecodes.math
  local end_of_math = function (n)
    for n in traverse_nodes(math_code, n.next) do
      return n
    end
  end
end

-- node types according to node.types()
local glue_code         = nodecodes.glue
local glue_spec_code    = nodecodes.glue_spec
local glyph_code        = nodecodes.glyph
local penalty_code      = nodecodes.penalty
local kern_code         = nodecodes.kern

-- we make a new node, so that we can copy it later on
local penalty_node   = new_node(penalty_code)
penalty_node.penalty = 10000

local function get_penalty_node()
  return node_copy(penalty_node)
end

-- same for glue node
local kern_node       = new_node(kern_code)

local function get_kern_node(dim)
  local n = node_copy(kern_node)
  n.kern = dim
  return n
end

-- we have here all possible space characters, referenced by their
-- unicode slot number, taken from char-def.lua
local space_chars = {[32]=1, [160]=1, [5760]=1, [6158]=1, [8192]=1, [8193]=1, [8194]=1, [8195]=1, 
  [8196]=1, [8197]=1, [8198]=1, [8199]=1, [8200]=1, [8201]=1, [8202]=1, [8239]=1, [8287]=1, [12288]=1}

-- from nodes-tst.lua, adapted
local function somespace(n,all)
    if n then
        local id = n.id
        if id == glue_code then
            return (all or (n.spec.width ~= 0)) and glue_code
        elseif id == kern_code then
            return (all or (n.kern ~= 0)) and kern_code
        elseif id == glyph_code then
            if space_chars[n.char] then
                return true
            else
                return false
            end
        end
    end
    return false
end

-- idem
local function somepenalty(n,value)
    if n then
        local id = n.id
        if id == penalty_code then
            if value then
                return n.penalty == value
            else
                return true
            end
        end
    end
    return false
end

local xpgfrptattr = luatexbase.attributes['xpg@frpt']

local left=1
local right=2
local byte = unicode.utf8.byte

-- Now there is a good question: how do we now, in lua, what a \thinspace is?
-- In the LaTeX source (ltspace.dtx) it is defined as:
-- \def\thinspace{\kern .16667em }. I see no way of seeing if it has been
-- overriden or not... So we stick to this value.
local thinspace  = 0.16667 
-- thickspace is defined in amsmath.sty as:
-- \renewcommand{\;}{\mspace+\thickmuskip{.2777em}}. Same problem as above, we
-- stick to this fixed value.
local thickspace = 0.2777 -- 5/18

local mappings =  {
 [byte(':')] = {left,  thickspace}, --really?
 [byte('!')] = {left,  thinspace},
 [byte('?')] = {left,  thinspace},
 [byte(';')] = {left,  thinspace},
 [byte('‼')] = {left,  thinspace},
 [byte('⁇')] = {left,  thinspace},
 [byte('⁈')] = {left,  thinspace},
 [byte('⁉')] = {left,  thinspace},
 [byte('»')] = {left,  thinspace},
 [byte('›')] = {left,  thinspace},
 [byte('«')] = {right, thinspace}, 
 [byte('‹')] = {right, thinspace}, 
 }

local function set_spacings(thinsp, thicksp)
  for _, m in pairs(mappings) do
    if m[2] == thinspace then
      m[2] = thinsp
    elseif m[2] == thickspace then
      m[2] = thicksp
    end
  end
  thickspace = thicksp
  thinspace = thinsp
end

-- from typo-spa.lua
local function process(head)
    local done = false
    local start = head
    -- head is always begin of par (whatsit), so we have at least two prev nodes
    -- penalty followed by glue
    while start do
        local id = start.id
        if id == glyph_code then
            local attr = has_attribute(start, xpgfrptattr)
            if attr and attr > 0 then
                local char = start.char
                local map = mappings[char]
                --node.unset_attribute(start, xpgfrptattr) -- needed?
                if map then
                    local quad = get_quad(start.font) -- might be optimized
                    local prev = start.prev
                    if map[1] == left and prev then
                        local prevprev = prev.prev
                        local somespace = somespace(prev,true)
                        -- TODO: there is a question here: do we override a preceding space or not?...
                        if somespace then
                            local somepenalty = somepenalty(prevprev,10000)
                            if somepenalty then
                                head = remove_node(head,prev,true)
                                head = remove_node(head,prevprev,true)
                            else
                                head = remove_node(head,prev,true)
                            end
                        end
                        insert_node_before(head,start,get_penalty_node())
                        insert_node_before(head,start,get_kern_node(map[2]*quad))
                        done = true
                    end
                    local next = start.next
                    if map[1] == right and next then
                        local nextnext = next.next
                        local somepenalty = somepenalty(next,10000)
                        if somepenalty then
                            local somespace = somespace(nextnext,true)
                            if somespace then
                                head = remove_node(head,next,true)
                                head = remove_node(head,nextnext,true)
                            end
                        else
                            local somespace = somespace(next,true)
                            if somespace then
                                head = remove_node(head,next,true)
                            end
                        end
                        insert_node_after(head,start,get_kern_node(map[2]*quad))
                        insert_node_after(head,start,get_penalty_node())
                        done = true
                    end
                end
            end
        elseif id == math_code then
            -- warning: this is a feature of luatex > 0.76
            start = end_of_math(start) -- weird, can return nil .. no math end?
        end
        if start then
            start = start.next
        end
    end
    return head, done
end

local callback_name = "pre_linebreak_filter"

local function activate()
  if not priority_in_callback (callback_name, "polyglossia-frpt.process") then
    add_to_callback(callback_name, process, "polyglossia-frpt.process", 1)
  end
end

local function desactivate()
  if priority_in_callback (callback_name, "polyglossia-frpt.process") then
    remove_from_callback(callback_name, "polyglossia-frpt.process")
  end
end

polyglossia.activate_frpt    = activate
polyglossia.desactivate_frpt = desactivate
polyglossia.set_spacings     = set_spacings
polyglossia.thinspace        = thinspace
polyglossia.thickspace       = thickpace
%    \end{macrocode}
% \iffalse
%</polyglossia-frpt.lua>
%<*polyglossia-tibt.lua>
% \fi
% \clearpage
% 
% \subsection{polyglossia-tibt.lua}
%    \begin{macrocode}
require('polyglossia') -- just in case...

local add_to_callback = luatexbase.add_to_callback
local remove_from_callback = luatexbase.remove_from_callback
local priority_in_callback = luatexbase.priority_in_callback

local next, type = next, type

local nodes, fonts, node = nodes, fonts, node

local nodecodes          = nodes.nodecodes --- <= preloaded node.types()

local insert_node_before = node.insert_before
local insert_node_after  = node.insert_after
local remove_node        = nodes.remove
local copy_node          = node.copy
local has_attribute      = node.has_attribute

local end_of_math        = node.end_of_math
if not end_of_math then -- luatex < .76
  local traverse_nodes = node.traverse_id
  local math_code      = nodecodes.math
  local end_of_math = function (n)
    for n in traverse_nodes(math_code, n.next) do
      return n
    end
  end
end

-- node types as of April 2013
local glyph_code         = nodecodes.glyph
local penalty_code       = nodecodes.penalty
local kern_code          = nodecodes.kern

-- we make a new node, so that we can copy it later on
local penalty_node  = node.new(penalty_code)
penalty_node.penalty = 50 -- corresponds to the penalty LaTeX sets at explicit hyphens

local function get_penalty_node()
  return copy_node(penalty_node)
end

local xpgtibtattr = luatexbase.attributes['xpg@tibteol']

local tsheg = unicode.utf8.byte('་')

-- from typo-spa.lua
local function process(head)
    local start = head
    -- head is always begin of par (whatsit), so we have at least two prev nodes
    -- penalty followed by glue
    while start do
        local id = start.id
        if id == glyph_code then 
            local attr = has_attribute(start, xpgtibtattr)
            if attr and attr > 0 then
                if start.char == tsheg then
                    if start.next then
                        insert_node_after(head,start,get_penalty_node())
                    end
                end
            end
        elseif id == math_code then
            -- warning: this is a feature of luatex > 0.76
            start = end_of_math(start) -- weird, can return nil .. no math end?
        end
        if start then
            start = start.next
        end
    end
    return head
end

local callback_name = "pre_linebreak_filter"

local function activate()
  if not priority_in_callback (callback_name, "polyglossia-tibt.process") then
    add_to_callback(callback_name, process, "polyglossia-tibt.process", 1)
  end
end

local function desactivate()
  if priority_in_callback (callback_name, "polyglossia-tibt.process") then
    remove_from_callback(callback_name, "polyglossia-tibt.process")
  end
end

polyglossia.activate_tibt_eol    = activate
polyglossia.desactivate_tibt_eol = desactivate
%    \end{macrocode}
% \iffalse
%</polyglossia-tibt.lua>
%<*polyglossia.lua>
% \fi
% \clearpage
% 
% \subsection{polyglossia.lua}
%    \begin{macrocode}
require('luatex-hyphen')

local luatexhyphen = luatexhyphen
local byte = unicode.utf8.byte

local module_name = "polyglossia"
local polyglossia_module = {
    name          = module_name,
    version       = 1.3,
    date          = "2013/05/11",
    description   = "Polyglossia",
    author        = "Elie Roux",
    copyright     = "Elie Roux",
    license       = "CC0"
}

luatexbase.provides_module(polyglossia_module)

local log_info = function(message)
	luatexbase.module_info(module_name, message)
end
local log_warning = function(message)
	luatexbase.module_warning(module_name, message)
end

polyglossia = polyglossia or {}
local polyglossia = polyglossia

local current_language
local last_language
local default_language

polyglossia.newloader_loaded_languages = { }
polyglossia.newloader_max_langid = 0
local newloader_available_languages = dofile(kpse.find_file('language.dat.lua'))
-- Suggestion by Dohyun Kim on #129
local t = { }
for k, v in pairs(newloader_available_languages) do
    t[k] = v
    for _, vv in pairs(v.synonyms) do
        t[vv] = v
    end
end
newloader_available_languages = t

local function loadlang(lang, id)
  if luatexhyphen.lookupname(lang) then
    luatexhyphen.loadlanguage(lang, id) 
  end
end

local function select_language(lang, id)
  loadlang(lang, id)
  current_language = lang
  last_language = lang
end

local function set_default_language(lang, id)
  polyglossia.default_language = lang
end

local function falsefun()
  return false
end

local function disable_hyphenation()
  luatexbase.add_to_callback("hyphenate", falsefun, "polyglossia.disable_hyphenation")
end

local function enable_hyphenation()
  luatexbase.remove_from_callback("hyphenate", "polyglossia.disable_hyphenation")
end

local check_char

if luaotfload and luaotfload.aux and luaotfload.aux.font_has_glyph then
  local font_has_glyph = luaotfload.aux.font_has_glyph
  function check_char(chr)
    local codepoint = tonumber(chr)
    if not codepoint then codepoint = byte(chr) end
    if font_has_glyph(font.current(), codepoint) then
      tex.sprint('1')
    else
      tex.sprint('0')
    end
  end
else
  local ids = fonts.identifiers or fonts.ids or fonts.hashes.identifiers
  function check_char(chr) -- always in current font
      local otfdata = ids[font.current()].characters
      local codepoint = tonumber(chr)
      if not codepoint then codepoint = byte(chr) end
      if otfdata and otfdata[codepoint] then
          tex.print('1')
      else
          tex.print('0')
      end
  end
end

local function load_frpt()
    require('polyglossia-frpt')
end

local function load_tibt_eol()
    require('polyglossia-tibt')
end

-- New hyphenation pattern loader: use language.dat.lua directly and the language identifiers
local function newloader(langentry)
    loaded_language = polyglossia.newloader_loaded_languages[langentry]
    if loaded_language then
        log_info('Language ' .. langentry .. ' already loaded; id is ' .. lang.id(loaded_language))
        -- texio.write_nl('term and log', 'Language ' .. langentry .. ' already loaded with patterns ' .. tostring(loaded_language) .. '; id is ' .. lang.id(loaded_language))
        -- texio.write_nl('term and log', 'Language ' .. langentry .. ' already loaded with patterns ' .. loaded_language['patterns'] .. '; id is ' .. lang.id(loaded_language))
        return lang.id(loaded_language)
    else
        langdata = newloader_available_languages[langentry]
        if langdata and langdata['special'] == 'language0' then return 0 end

        if langdata then
            local s = "Language data for " .. langentry
            for k, v in pairs(langdata) do
				s = s .. "\n" .. k .. "\t" .. tostring(v)
            end
            polyglossia.newloader_max_langid = polyglossia.newloader_max_langid + 1
            -- langobject = lang.new(newloader_max_langid)
            lang.new(); lang.new(); lang.new()
            langobject = lang.new()
			s = s .. "\npatterns: " .. langdata.patterns
			log_info(s)
            if langdata.patterns and langdata.patterns ~= '' then
                pattfilepath = kpse.find_file(langdata.patterns)
                if pattfilepath then
                    pattfile = io.open(pattfilepath)
                    lang.patterns(langobject, pattfile:read('*all'))
                    pattfile:close()
                end
            end
            if langdata.hyphenation and langdata.hyphenation ~= '' then
                hyphfilepath = kpse.find_file(langdata.hyphenation)
                if hyphfilepath then
                    hyphfile = io.open(hyphfilepath)
                    lang.hyphenation(langobject, hyphfile:read('*all'))
                    hyphfile:close()
                end
            end
            polyglossia.newloader_loaded_languages[langentry] = langobject

            log_info('Language ' .. langentry .. ' was not yet loaded; created with id ' .. lang.id(langobject))
            return lang.id(langobject)
        else
            log_warning('Language ' .. langentry .. ' not found in language.dat.lua')
            return 255
        end
    end
end

polyglossia.loadlang = loadlang
polyglossia.select_language = select_language
polyglossia.set_default_language = set_default_language
polyglossia.current_language = current_language -- doesn't seem to be working well :-(
polyglossia.default_language = default_language
polyglossia.check_char = check_char
polyglossia.load_frpt = load_frpt
polyglossia.load_tibt_eol = load_tibt_eol
polyglossia.disable_hyphenation = disable_hyphenation
polyglossia.enable_hyphenation = enable_hyphenation
polyglossia.newloader = newloader
%    \end{macrocode}
% \iffalse
%</polyglossia.lua>
% \fi
% \clearpage
% \PrintChanges
% \Finale
% 
% \iffalse
%<*../README>

   ¦----------------------------------------------¦
   ¦                                              ¦
   ¦       THE POLYGLOSSIA PACKAGE v1.44          ¦
   ¦                                              ¦
   ¦     Modern multilingual typesetting          ¦
   ¦        with XeLaTeX and LuaLaTeX             ¦
   ¦                                              ¦
   ¦----------------------------------------------¦

This package provides an alternative to Babel for users of XeLaTeX and LuaLaTeX
(with a few languages incompletely supported for the latter). This version
includes support for 78 different languages.

Polyglossia makes it possible to automate the following tasks:

* Loading the appropriate hyphenation patterns.
* Setting the script and language tags of the current font (if possible and
  available), using the package fontspec.
* Switching to a font assigned by the user to a particular script or language.
* Adjusting some typographical conventions in function of the current language
  (such as afterindent, frenchindent, spaces before or after punctuation marks,
  etc.).
* Redefining the document strings (like “chapter”, “figure”, “bibliography”).
* Adapting the formatting of dates (for non-gregorian calendars via external
  packages bundled with polyglossia: currently the Hebrew, Islamic and Farsi
  calendars are supported).
* For languages that have their own numeration system, modifying the formatting
  of numbers appropriately.
* Ensuring the proper directionality if the document contains languages
  written from right to left (via the package bidi, available separately).

LICENSE

Copyright (c) 2008-2010 François Charette, 2013 Élie Roux, 2011-2019 Arthur Reutenauer

Polyglossia is placed under the terms of the LaTeX Project Public Licence
(LPPL), either version 1.3, or, at your option, any later version.  See
LICENCE.txt for the text of the LPPL v1.3c, or
http://www.latex-project.org/lppl.txt for the latest version.

This work has the LPPL maintenance status ‘maintained’.  The current maintainer is Arthur Reutenauer.

BUGS

Polyglossia is full of bugs.  If you run into one, or suspect you do, or you
have a request or comment, please use the GitHub issue tracker:
http://github.com/reutenauer/polyglossia/issues

This is more efficient than contacting me by email as it allows me to track the
issues and follow progress.
%</../README>
%<*Changelog>
1.44 (04-04-2019)
  * Correction to Russian language file, by Maksim Zholudev (commit d2f383e)
  * Added Macedonian language file, by Stefan Zlatinov (commit cd379e1)

05-03-2019
  * Correction to Hindi language file, by Zdenĕk Wagner

1.42.5 (13-04-2017)
  * Many changes to the French language file, by Maïeul Rouquette

1.42.4 (February, March 2016)
  * Remedial actions for the Babel changes

09-02-2016
  * Fixed side effect of pull request #122 (see commit d2a34ff)
  * Added automatic Josa selection, variant, and captions options to Korean, by Dohyun Kim (pull request #128)

08-02-2016
  * Updated gloss-occitan from CTAN

18-01-2016
  * Fixed issue #124 (minor typo in polyglossia-frpt.lua)

03-12-2015
  * Merged pull request #117 for more French guillemet spacing
  * Merged pull request #121 to add \bbl@loaded; fixes issue #120
  * Merged pull request #122 that build on #121

08-11-2015
  * Merged pull request #116 for French (spacing around guillemets)

22-10-2015
  * Fixed issue #115 (spurious spaces in Arabic)

19-08-2015
  * Fixed issue #107 for Marathi (labels and month names)

1.42.0 (06-08-2015)
  * Add Bengali digits package, and option to reset all numbering functions

05-08-2015
  * Add “long” option for Welsh date
  * Add local alphabet in Slovenian, for enumerations and such

04-08-2015
  * Fix long-standing bug with Welsh: date should use ordinals

03-08-2015
  * Fix for Latin with LuaTeX: all variants had same problems as Classic

02-08-2015
  * Fixed error with British variant of English and LuaTeX (issue #86)

1.41.0 (16-07-2015)
  * Added support for Khmer, by Say Ol (private email)

1.40.1 (14-07-2015)
  * Bugfix for Korean, by Kim Dohyun (pull request #103)

1.40.0 (07-07-2015)
  * gloss-korean.ldf contributed by Kim Dohyun (pull request #102)

1.33.7 (04-07-2015)
  * Release to CTAN, no code change

03-07-2015
  * Fixed extraneous space in code for Swiss German (pull request #101)
  * Fixed a typo in Ukrainian alphabet, for \Asbuk (pull request #99)

24-06-2015
  * Fix for Classic Latin: load patterns for LuaTeX

23-05-2015
  * Made \rmfamily, \sffamily and \ttfamily robust again

11-05-2015
  * Merged fix for Hebrew date format, by Guy Rutenberg (pull request #94)
  * Merged fix for spurious space, by Caleb McKennan (pull request #91)
  * Merged pull request #84 by Élie Roux for Tibetan

10-05-2015
  * Added support for Swiss German (pull request #75)
  * Added commands \Asbuk and \asbuk for Ukrainian (pull request #76), similar to Russian
  * Documented changes to Latin from last year.

09-05-2015
  * Be friendlier to right-to-left languages with LuaTeX

04-06-2014
  * Enhanced Latin support by Claudio Beccari

1.33.5 (21-05-2014)
  * Option to disable hyphenation entirely, by Élie Roux
  * Fix spurious spaces in gloss-russian.ldf, by Oleg Domanov
  * Support for the Austrian variant of German, by Jürgen Spitzmüller
  * Changes to the Croatian translations, by Ivan Kokan
  * Correction to the Lithuanian translations, by Ignas Anikevičius

1.33.4 (27-06-2013)
  * Emergency release for a bug introduced in babelsh.def

1.33.3 (28-05-2013)
  * Changed formatting of some error messages (emergency fixes for TeX Live 2013)

1.33.2 (26-05-2013)
  * Added \disablehyphenation and \enablehyphenation, contributed by
    Élie Roux.
  * Fixed bug related to package inclusion.  Polyglossia would break if
    we loaded breqn.sty, and then called \setmainlanguage{english}, this
    is no longer the case.
  * Removed spurious space introduced by \captionswedish.

1.33.1 (23-05-2013)
  * Editorial changes to the documentation
  * Hunted and documented bugs

1.33.0 (20-05-2013)
  * Added support for N’Ko.
  * Bugfixes for LuaTeX
  * More work in progress on Bidi in LuaTeX.

1.32.0 (15-05-2013)
  Transitional version to support right-to-left languages with LuaTeX.

1.31 (10-05-2013) / 1.3 (11-05-2013)
  * Several bugfixes.
  * Sync with Babel 3.9.
  * Consolidated support for LuaTeX for all languages but the ones using
    South and South-East Asian scripts, and languages written from right
    to left.  Many thanks to Élie Roux for his help.
  * Added support for Tibetan, contributed by Élie Roux (end of lines are experimental).

1.30MM (06-08-2012)
  * Added support for LuaTeX.  Many languages don’t work yet.  Please be
    patient.

1.2.0e (28-04-2012)
  * Fixed a number of outstanding and not very interesting bugs.
  * Added gloss files for Romansh and Friulan, contributed by Claudio
    Beccari.

1.2.0d (12-01-2012)
  * Removed \makeatletter and \makeother from gloss files entirely.

1.2.0cc (12-10-2011) [First update by Arthur Reutenauer]
  * Update to gloss-italian.ldf by Claudio Beccari, incorporating changes
    by Enrico Gregorio.
  * Conclude every gloss file with \makeatother to match the initial
    \makeatletter.  (Not necessary from a technical point of vue, because of one of the changes by Enrico reported below, but I like it better that way :-)
  * Conclude polyglossia.sty with \ExplSyntaxOff to match the initial
    \ExplSyntaxOn.
  * Added gloss file for Kannada, contributed by Aravinda VK and others.
  * Corrections to the gloss-dutch.ldf thanks to Wouter Bolsterlee.
  * Several patches by Enrico Gregorio, fixing long-standing bugs.
    From the git log:
    - Deleted setup for right-to-left writing direction, see http://tug.org/pipermail/xetex/2011-April/020319.html
    - Changed three appearances of \newcommand to \newrobustcmd, as the commands needs to be protected. Bug reported by "kamensky".
    - Corrected \datepolish as suggested by Piotr Kempa
    - Changed \lccode" into \lccode\string", because it might come into action at wrong times when " is active
    - Changed definition of key xpg@setup, as \@tmpfirst and \@tmpsecond were not expanded, causing dependence of \lefthyphenmin and \righthyphenmin to the last loaded language.  Raised by Vadim Rodionov on the XeTeX mailing list.
    - Deleted \bgroup and \egroup tokens from the definition of otherlanguage*; they serve no purpose (we are already inside an environment) and conflict with csquotes. Noticed by P. Lehman.
    - Changed the calls of \input to \xpg@input, which inputs the required file and resets the catcode of @ to the same value as it had before the input. Since each .ldf file starts with \makeatletter, the old behaviour would leave a category 11 @, which is wrong.
    - Added "\csuse{date#2}" to the definition of "otherlanguage*"


1.2.0b (03-10-2011) [Update by Philipp Stephani]
  * Load xkeyval package explicitly since newer versions
    of fontspec don't load it any more

1.2.0a (27-07-2010) [Last update by François Charette]
  * Initialize \fontfamily acc to value of \familydefault
    (Fixes a bug when using polyglossia with beamer)
  * Remove spurious space in def of \dateenglish
  * Add missing English variant "american"
  * Serbian: fix date format and captions (Latin+Cyrillic)
  * Fix \atticnumeral in gloss-greek
  * Small improvements and fixes in documentation


1.2.0 (15-07-2010)
  * Adapted for fontspec 2.0 (will not work with earlier versions!)
  * New implementation of a \PolyglossiaSetup interface
    that simplifies writing gloss-*.ldf files
  * Many internal enhancements and refactoring
    (including a patch by Dirk Ulrich)
  * Improved automatic font setup when \<lang>font is not defined
  * New environment otherlanguage* (env. equivalent of \foreignlanguage
    (Enrico Gregorio)
  * Bugfix to prevent bogus expansion of \{rm,sf,tt}family even in aux files
    (Enrico Gregorio)
  * New gloss files for Armenian, Bengali, Occitan, Bengali, Lao,
    Malayalam, Marathi, Tamil, Telugu, and Turkmen.
  * New auxiliary packages 'devanagaridigits' and 'bengalidigits'
  * hijrical no longer loads bidi and checks for incompatible l3calc
  * Add Babel shorthands for Russian (based on a patch by Vladimir Lomov)
  * Fix \fnum@{table,figure} for Lithuanian
  * Various improvements in gloss-russian (provided by Vladimir Lomov and
    others)
  * Corrected captions for Bahasai, Lithuanian, Russian, Croatian
  * Add option indentfirst=true for Spanish, Croation and other languages
    (NB: indentfirst was previously named frenchindent)
  * New option 'script' for German: Setting script=fraktur modifies the
    captions for typesetting in Fraktur.
  * New command \aemph for Arabic, Farsi, Urdu, etc. to mark emphasis through
    overlining.
  * Package option 'nolocalmarks' is now true by default: to activate it the
    option 'localmarks' must be passed instead.
  * Loading languages à la Babel as package options is no longer possible (this
    feature was deprecated since v1.1.0).

1.1.1 (23-03-2010)
  * Bugfix for French: explicit spaces before/after double punctuation
    signs ("Par exemple : les grands « espaces » du Canada ! ") are
    now replaced by the appropriate non-breaking spaces, as in Babel.
  * Bugfix for font switching mechanism within Latin script
    (pending a complete re-implementation in v1.2):
    the font shape and series are no longer reset when switching language.
  * New macros for non-Western decimal digits
    (instead of fontmappings)
  * New gloss files for Asturian, Lithuanian and Urdu
  * hijrical.sty is now locale-aware: \hijritoday is
    formatted differently in Arabic, Farsi, Urdu, Turkish
    and Bahasa Indonesia.
---NB: the above five items were not part of v1.1.1-rc1 which was made available on github---
  * Enable babelshorthands for Dutch
  * Add missing macro \allowhyphens
  * Add global option babelshorthands
  * Support Catalan geminated l
  * Bugfix when declaring more than one pkg option
  * Protect \reset@font
  * Add missing requirement makecmds
  * Bugfix for smallcaps in captions
  * Typo for ccname in Hebrew
  * Add option numerals to gloss-russian
  * Provide newXeTeXintercharclass when undefined
  * Bugfix for Russian alph
  * Remove superfluous level of {} in def of markright
  * Bugfix for \datecatalan
  * Change hyphenmins for Sanskrit

1.1.0b
   * Modify hyphenmins for Sanskrit (Yves Codet)
   * Bugfixes for Serbian and Bulgarian (Enrico Gregorio)
1.1.0a
   * Bugfix for interchar tokens
1.1.0
   * Use \newXeTeXintercharclass (thanks to Enrico Gregorio)
   * Fixed implementation of shorthands for German (Babel code in file babelsh.def)
   * Arabic (Khaled Hosny):
     - Fix abjad form for 3 and 5 and add option abjadjimnotail
     - bugfix for \arabicnumber
     - make Gregorian calender the default
     - fixed typos in the sample text
   * Turkish (S. Ö. Yıldız):
     - fix white-space before : and !
     - also check if the font specified TRK for language
     - added missing Turkish translation of "Glossary"
   * Suppress nopattern warning for non-hyphenated scripts
   * Changed U+0163 to U+021B for Romanian (Elie Roux)
   * Stylistic fixes and use macro \xpg@option for package options (E. Gregorio)
   * Fix monthnames in Dutch (A. Ledda)
   * Add Brazilian translation for "glossary"
   * Remove spurious space generated by gloss-spanish
   * Fix ldf file for brazilian
   * Various improvements in the code communicated by E. Gregorio:
     - remove superfluous \protect\language
     - change default language from 0 to \l@nohyphenation=255
     - localize lccode handling of apostrophe in French; add it to Italian
   * Fix frenchspacing for vietnamese
   * Other minor bugfixes

1.0.2
   This is mostly a bug fixes release.
   * Captions corrected in Hebrew, Russian and Spanish
   * Removed all \text<lang> wrappers within caption definitions
   * Improved compatibility with Babel
   * New option "babelshorthands" for German
   * New option "Script" for Sanskrit

1.0.1
   * Improved documentation (added sections on font setup and numeration mappings)
   * Improvements and bugfixes for English and German
   * Bugfix in gloss-syriac.ldf (spurious space after \textsyriac{...})
   * Extended the scope of \syriacabjad
   * Added gloss-amharic.ldf (ported from ethiop.ldf in the package ethiop)

1.0
   * Initial release on CTAN
%</Changelog>
%<*examples.tex>
\documentclass[a4paper]{article}
\usepackage[no-math]{fontspec}
\usepackage{xltxtra,url}
\let\XeTeX\undefined
\let\XeLaTeX\undefined
\usepackage{polyglossia}
\usepackage{trace}
\setdefaultlanguage{french}
\setotherlanguage[variant=british,ordinalmonthday=false]{english}
\setotherlanguage[variant=poly]{greek}
\setotherlanguage[numerals=thai]{thai}
\setotherlanguage[locale=mashriq]{arabic}
\setotherlanguage[spelling=new,latesthyphen=true,babelshorthands=true]{german}
\setotherlanguages{latin,russian,turkish,polish,latvian,sanskrit,ukrainian,farsi,syriac,divehi,hebrew,amharic,nko}
\setotherlanguage[calendar=gregorian,numerals=western]{urdu}
\setmainfont{Linux Libertine O}
\defaultfontfeatures{Scale=MatchLowercase}
\setmonofont{Inconsolata}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\newfontfamily\syriacfont[Script=Syriac]{Serto Jerusalem}
\newfontfamily\hebrewfont[Script=Hebrew]{Ezra SIL}
\newfontfamily\sanskritfont[Script=Devanagari]{Sanskrit 2003}
\newfontfamily\thaifont[Script=Thai]{Norasi}
\newfontfamily\thaanafont[Script=Thaana,WordSpace=2]{FreeSerif}
\newfontfamily\ethiopicfont[Script=Ethiopic]{Abyssinica SIL}
\newfontfamily\nkofont[Renderer=Graphite]{Conakry}
\parskip 1.33\baselineskip
%\newcommand\showhyphmin{\fbox{\the\lefthyphenmin\ \the\righthyphenmin}}
\begin{document}
\hyphenation{Bru-xel-les}
\noindent
\textbf{Le français}\footnote{ From \url{http://fr.wikipedia.org/wiki/Français}} est une langue romane parlée en France, dont elle est originaire (la «langue d'oïl»), ainsi qu'en Afrique francophone, au Canada (principalement au Québec, au Nouveau-Brunswick et en Ontario), en Belgique (en Région wallonne et à Bruxelles), en Suisse, au Liban, en Haïti et dans d'autres régions du monde, soit au total dans 51 pays du monde ayant pour la plupart fait partie des anciens empires coloniaux français et belge. \\
(\today)

\begin{english}
\textbf{English}\footnote{From \url{http://en.wikipedia.org/wiki/English_language}} is a West Germanic language originating in England, and the first language for most people in Australia, Canada, the Commonwealth Caribbean, Ireland, New Zealand, the United Kingdom and the United States of America (also commonly known as the Anglosphere). It is used extensively as a second language and as an official language throughout the world, especially in Commonwealth countries and in many international organisations. \\
(\today)
\end{english}

\begin{german}
\textbf{Die deutsche Sprache}\footnote{ From \url{http://de.wikipedia.org/wiki/Deutsche_Sprache}} (auch das Deutsche) gehört zum westlichen Zweig der germanischen Sprachen und ist eine der meistgesprochenen europäischen Sprachen weltweit, und gilt so als Weltsprache.\\
(\today)
\end{german}

\begin{russian}
\textbf{Русский язык} — один из восточнославянских языков, один из крупнейших языков мира, в том числе самый распространённый из славянских языков и самый распространённый язык Европы, как географически, так и по числу носителей языка как родного (хотя значительная, и географически бо́льшая, часть русского языкового ареала находится в Азии).	\\
(\today)
\end{russian}

\begin{latin}
\textbf{Lingua Latina} est lingua Indoeuropaea. Nomen ductum est de terra in paeninsula Italica quam Latine loquentes incolebant, Vetus Latium appellata sitaque inter flumen Tiberis, Volscam terram, mare Tyrrhenicum, montes Apenninos. 
Quamquam sermone nativo fungi desinit, cumque nostris diebus perpauci Latine loqui possint, lingua mortua appellari solet, multas tamen peperit linguas quae linguae romanicae vocantur, sicut Hispanicam, Francogallicam, Italicam, Lusitanam, Dacoromanicam, Gallaicam, ne omnes afferam. \\
(\today) 
\end{latin}

\begin{greek}
\textbf{Η ελληνική γλώσσα} είναι μία από τις ινδοευρωπαϊκές γλώσσες, για την
οποία έχουμε γραπτά κείμενα από τον 15ο αιώνα π.Χ. μέχρι σήμερα. Αποτελεί το
μοναδικό μέλος ενός κλάδου της ινδοευρωπαϊκής οικογένειας γλωσσών. Ανήκει
επίσης στον βαλκανικό γλωσσικό δεσμό.\\	
(\today) 
\end{greek}


\begin{hebrew}[numerals=hebrew]
\textbf{עברית} היא שפה ממשפחת השפות השמיות, הידועה כשפתו של העם היהודי, ואשר ניב מודרני שלה משמש כשפה הרשמית והעיקרית של מדינת ישראל. \\
(\today\ = \hebrewtoday)
\end{hebrew}

\begin{syriac}[numerals=abjad]
ܠܫܢܐ ܐܪܡܝܐ ܐܘ ܐܪܡܝܬ ܗܘ ܠܫܢ̈ܐ ܥܡ ܬܫܥܝܬܐ ܕ\textrm{3000} ܫܢ̈ܝܐ܂ ܗܘܐ ܠܫܢܐ ܕܡܠܟܘ̈ܬܐ ܘܬܘܕ̈ܝܬܐ܂ ܥܡ ܠܫܢܐ ܥܒܪܝܐ܄ ܗܘܐ ܠܫܢܐ ܕܣܦܪ̈ܐ ܕܕܢܝܐܝܠ ܘܥܙܪܐ ܘܗܘ ܠܫܢܐ ܚܕܢܝܐ ܕܬܠܡܘܕ܂ ܐܪܡܝܐ ܗܘܐ ܠܫܢܐ ܕܝܫܘܥ܂ ܐܕܝܘܡ܄ ܐܪܡܝܐ ܗܘ ܠܫܢܐ ܕܟܠܕ̈ܝܐ܄ ܐܬܘܪ̈ܝܐ܄ ܡܪ̈ܘܢܝܐ܄ ܘܣܘܪ̈ܝܝܐ܀ \\
(\today)
\end{syriac}

\begin{turkish}
\textbf{Türkiye Türkçesi}, Ural-Altay Dilleri içerisinde Türk dil ailesinin Oğuz Grubu'na mensup lehçedir. Anadolu, Kıbrıs, Balkanlar ve Orta Avrupa'da geniş yayılım alanı bulmuş olup, Türkiye Cumhuriyeti, Kuzey Kıbrıs Türk Cumhuriyeti, Güney Kıbrıs Rum Kesimi, Makedonya ve Kosova'nın resmî dilidir. \\
(\today = \Hijritoday)
\end{turkish}

\begin{polish}
\textbf{Język polski (polszczyzna)} należy wraz z językiem czeskim, słowackim, pomorskim (kaszubskim), dolnołużyckim, górnołużyckim oraz wymarłym połabskim do grupy języków zachodniosłowiańskich, stanowiących część rodziny języków indoeuropejskich. Ocenia się, że język polski jest językiem ojczystym około 44 milionów ludzi na świecie (w literaturze naukowej można spotkać szacunki od 40 do 48 milionów), mieszkańców Polski oraz Polaków zamieszkałych za granicą (Polonia).\\
(\today)
\end{polish}

\begin{latvian} 
\textbf{Latviešu valoda} ir dzimtā valoda apmēram 1,5 miljoniem cilvēku, galvenokārt Latvijā, kurā tā ir vienīgā valsts valoda. Lielākās latviešu valodas pratēju kopienas ārzemēs ir Austrālijā, ASV, Zviedrijā, Lielbritānijā, Vācijā, Brazīlijā, Krievijā. Latviešu valoda pieder indoeiropiešu valodu saimes baltu valodu grupai.\\
(\today)
\end{latvian}

\begin{ukrainian}
\textbf{Українська мова} — східнослов'янська мова, входить до однієї підгрупи з білоруською та російською. Подібно до цих мов українську записують кирилицею. Історично білоруська та українська мови походять з давньоруської (давньоукраїнської) — розмовної мови Київської Русі.\\
(\today)
\end{ukrainian}

\begin{sanskrit}
{\Large ससकत} पृथिव्यां प्राचीना समृद्घा वैज्ञानिकी च भाषा मन्यते । विश्ववाङ्‌मयेषु संस्कृतं श्रेष्ठरत्नम् इति न केवलं भारते अपि तु समग्रविश्वे एतद्विषये निर्णयाधिकारिभि: जनै: स्वीकृतम् । महर्षि पाणिनिना विरचिता अष्टाध्यायी इति संस्कृतव्याकरणम्‌ अधुनापि भारते विदेशेषु च भाषाविज्ञानिनां प्रेरणास्‍थानं वर्तते . संस्कृतशब्दा: एव उत्तरं दक्षिणं च भारतं संयोजयन्ति ।
\end{sanskrit}

\begin{Arabic}[]
«اعلم أنّ فنّ التاريخ فنّ عزيز المذهب، جمّ الفوائد، شريف الغاية؛ إذ هو يوقفنا على أحوال الماضين من الأمم في أخلاقهم، و الأنبياء في سيرهم، و الملوك في دولهم و سياستهم؛ حتّى تتمّ فائدة الإقتداء في ذلك لمن يرومه في أحوال الدين و الدنيا.» (ابن خلدون، المقدّمة)\\
(\today\ = \Hijritoday[0])
\end{Arabic}

\begin{farsi}
فارسی یا پارسی، (که دری، فارسی دری، و پارسی دری نیز نامیده می‌شود) زبانی است که
در کشورهای ایران، افغانستان، تاجیکستان و ازبکستان به آن سخن می‌رانند. \\
(\Jalalitoday = \Hijritoday)
\end{farsi}

\pagebreak
\begin{urdu}
اُردو ایک ہندآریائی زبان ہے جس کا تعلّق ہند یوروپی لسانی خاندان کی ہندایرانی شاخ سے ہے۔ بارہویں صدی میں ہندوستان کی مقامی زبانوں اور فارسی، عربی، اور تُرکی زبانوں کے اختلاط سے اردو وجود میں آئی۔ اردو پاکستان کی قومی زبان ہے، اور ہندوستان کی 23 سرکاری زبانوں میں سے ایک ہے۔ جنوبی ایشیا کے باہر خلیجِ فارس کے ممالک، سعودی عرب، برطانیہ، امریکہ، کنیڈا، جرمنی، ناروے، اور آسٹریلیا میں بھی جنوبی ایشیائی مہاجرین کی بڑی تعداد اردو بولتی ہے۔ \\

(\today\ مطابق \Hijritoday[0])
\end{urdu}

\begin{thai}
เป็น\wbr แผนงานเพื่อ\wbr สนับสนุน\wbr การ\wbr ร่วมกัน\wbr สร้าง, การ\wbr ร่วมกันใช้, และ\wbr การ%
ร่วมกัน\wbr พัฒนา\wbr ทรัพยากร\wbr ทาง\wbr ภาษา\wbr ของ\wbr ภาษา\wbr ไทย, บน\wbr เครือข่าย World Wide Web. แผนงานนี้\wbr มี%
จุด\wbr ประสงค์หลั\wbr กอยู่\wbr สอง\wbr ประการคือ เพื่อแก้ปัญหา\wbr กำ\wbr แพง\wbr ทาง\wbr ภาษา, และรักษา%
ไว้เพื่อ\wbr ความค\wbr งอยู่\wbr ของ\wbr ภาษา\wbr และ\wbr วัฒนธรรม\wbr ไทย. \\
(\today)
\end{thai}

\begin{divehi}\small\sloppy
ދިވެހިބަހަކީ ދިވެހިރާއްޖޭގެ ރަސްމީ ބަހެވެ. މި ބަހުން ވާހަކަ ދައްކައި އުޅެނީ ދިވެހިރާއްޖޭގެ އަހުލުވެރިންގެ އިތުރުން ހިންދުސްތާނުގެ މަލިކު ގެ
އަހުލުވެރިންނެވެ. އެބައިމީހުން މި ބަހަށް ކިޔަނީ މަހަލް ބަހެވެ. ބަހާބެހޭ މާހިރުން ދިވެހިބަސް ހިމަނުއްވައިފައިވަނީ އިންޑޯ އާރިޔަން ބަސްތަކުގެ
ތެރޭގަ އެވެ. 
\end{divehi}

%\fontspec[Script=Georgian]{DejaVu Serif}
%ქართული ენა არის საქართველოს სახელმწიფო ენა (აფხაზეთის ავტონომიურ რესპ\-უბლიკაში მის პარალელურად სახელმწიფო ენად აღიარებულია აგრეთვე აფხაზური ენა). ქართულ ენაზე 7 მილიონზე მეტი ადამიანი ლაპარაკობს.
%

\begin{amharic}
\textbf{አማርኛ} የኢትዮጵያ መደበኛ ቋንቋ ነው። ከሴማዊ ቋንቋዎች እንደ ዕብራይስጥ ወይም ዓረብኛ አንዱ ነው። እንዲያውም 27 ሚሊዮን ያህል ተናጋሪዎች እያሉት፣ አማርኛ ከአረብኛ ቀጥሎ ትልቁ ሴማዊ ቋንቋ ነው። የሚጻፈውም በግዕዝ ፊደል ነው። አማርኛ ክዓረብኛና ከዕብራይስጥ ያለው መሰረታዊ ልዩነት አንደላቲን ከግራ ወደ ቀኝ መጻፉ ነው። \\
(\today)
\end{amharic}

\begin{nko}
ߒߞߏ ߦߋ߫ ߛߓߍߟߌߞߊ߲ߞߋ ߟߋ߬ ߘߌ߫ ߝߘߊ߬ߝߌ߲߬ߠߊ߫ ߕߟߋ߬ߓߋ ߘߐ߫ ߡߊ߲߬ߘߋ߲߬ ߡߌߙߌ߲ߘߌ ߞߊ߲ ߞߊߡߊ߬߸ ߊ߬ ߣߴߊ߬ ߡߟߋߞߎߦߊߞߊ߲ ߕߐ߮ ߟߋ߬. ߞߊ߬ߕߎ߲߯ ߸ ߊ߬ ߞߘߐ ߟߋ߬ ߡߊ߲߬ߘߋ߲߫ ߝߘߏ߬ߓߊ߬ߞߊ߲ ߓߏߟߏ߲ ߓߍ߯ ߘߐ߫ ߞߏ߫: ߒ ߞߊ߲߫ ߠߋ߬ ߞߏ߫. ߝߣߊ߫߸ ߊ߬ ߦߋ߫ ߟߊߓߊ߯ߙߟߊ߫ ߟߊ߫ ߖߡߊ߬ߣߊ ߢߌ߲߬ ߠߎ߫ ߟߋ߬ ߘߐ߫ ߓߊߞߍ߭: ߖߌ߬ߣߍ߫، ߜߋ߲ߞߐ߰ߖߌ߬ߘߊ، ߊ߬ ߣߌ߫ ߡߊߟߌ߫.
\\
(\today)
\end{nko}

\end{document}
%</examples.tex>
%<*example-arabic.tex>
\documentclass[a4paper]{book}%
\usepackage[no-math]{fontspec}
\usepackage{xltxtra,url,amsmath}
\setmainfont{Linux Libertine O}
\defaultfontfeatures{Scale=MatchLowercase}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}%
\newfontfamily\arabicfonttt[Script=Arabic,Scale=.75]{DejaVu Sans Mono}
\newfontfamily\farsifont[Script=Arabic,Scale=1.1,WordSpace=2]{IranNastaliq}
\let\XeTeX\undefined
\let\XeLaTeX\undefined
\usepackage[quiet,nolocalmarks]{polyglossia}
\setdefaultlanguage[calendar=gregorian,hijricorrection=1,locale=mashriq]{arabic}
\setotherlanguage[variant=british]{english}
\setotherlanguage{farsi}
\parindent 0pt
\title{اختبار دعم اللغة العربية}
\author{فرانسوا شاريت}
\begin{document}
\pagenumbering{alph}
\maketitle
\tableofcontents
\chapter{تجربة}
\pagenumbering{arabic}
\section{لغات مختلفة}

\textbf{العربية}\footnote{%
من «\LR{\textenglish{\url{http://ar.wikipedia.org/wiki/}}\RL{\ttfamily لغة عربية}}»} 
أكبر لغات المجموعة السامية من حيث عدد المتحدثين، وإحدى أكثر اللغات انتشارا في
العالم، يتحدثها أكثر من ٤٢٢ مليون نسمة، ويتوزع متحدثوها في المنطقة المعروفة
باسم الوطن العربي، بالإضافة إلى العديد من المناطق الأخرى المجاورة كالأحواز وتركيا
وتشاد ومالي والسنغال. وللغة العربية أهمية قصوى لدى أتباع الديانة الإسلامية، فهي
لغة مصدري التشريع الأساسيين في الإسلام: القرآن، والأحاديث النبوية المروية عن النبي
محمد، ولا تتم الصلاة في الإسلام (وعبادات أخرى) إلا بإتقان بعض من كلمات هذه اللغة.
والعربية هي أيضًا لغة طقسية رئيسية لدى عدد من الكنائس المسيحية في العالم العربي،
كما كتبت بها الكثير من أهم الأعمال الدينية والفكرية اليهودية في العصور الوسطى.
وإثر انتشار الإسلام، وتأسيسه دولا، ارتفعت مكانة اللغة العربية، وأصبحت لغة السياسة
والعلم والأدب لقرون طويلة في الأراضي التي حكمها المسلمون، وأثرت العربية، تأثيرا
مباشرا أو غير مباشر على كثير من اللغات الأخرى في العالم الإسلامي، كالتركية
والفارسية والأردية مثلا.

\textfarsi{\bfseries فارسی}\footnote{%
از «\LR{\textenglish{\url{http://fa.wikipedia.org/wiki/}}\RL{\ttfamily فارسي}}»}
\begin{farsi}
یا پارسی، (که دری، فارسی دری، و پارسی دری نیز نامیده می‌شود) زبانی است که
در کشورهای ایران، افغانستان، تاجیکستان و ازبکستان به آن سخن می‌رانند.
(برخی زبان فارسی در تاجیکستان و ازبکستان و چین را فارسی تاجیکی نام
می‌گذارند).  
\end{farsi}

\newpage
\begin{english}
\textbf{English}\footnote{%
	From \url{http://en.wikipedia.org/wiki/English_language}} 
is a West Germanic language originating in England, and the first language for
most people in Australia, Canada, the Commonwealth Caribbean, Ireland, New
Zealand, the United Kingdom and the United States of America (also commonly
known as the Anglosphere). It is used extensively as a second language and as
an official language throughout the world, especially in Commonwealth countries
and in many international organisations.

\textarabic{١ ٢ ٣}

\end{english}
\clearpage

\section{أعمال تأريخية \textenglish{(Calendar operations)}}

%\textenglish{\today} = \LTR{\today} = 
\setfootnoteLR
\today\ = \Hijritoday%\footnote{ 
%	محسوب بـ \textenglish{\textsf{hijrical.sty}}}
\LTRfootnote{ What is this?}
\setfootnoteRL

%\newpage
\subsection{فلان}
\textenglish{This is English: a b c}\marginpar{انكليزي} %FIXME! cf farsitex?

\subsubsection{فلان فلان}
\begin{enumerate}
	\item مثال
	\item مثال
		\begin{enumerate}
			\item مثال
			\item مثال
		\end{enumerate}

	\item مثال	
\end{enumerate}

\begin{table}[h]
	\centering
	\begin{tabular}{cc}
		ا & ب  \\
		ج & د  
	\end{tabular}
	\caption{هذا المثال}
\end{table}

\[
x^\text{مال مال}
\]

\begin{equation}
	x^2 + y^2 = z^2
	\label{test}
\end{equation}
\end{document}
%</example-arabic.tex>
%<*example-thai.tex>
\documentclass[a4paper]{article}
\usepackage[no-math]{fontspec}
\usepackage{xltxtra,url}
\usepackage{polyglossia}
\setdefaultlanguage[numerals=thai]{thai}
\setotherlanguage{english}
\setmainfont{Norasi}
\begin{document}
\begin{center}
	\abstractname
\end{center}
\begin{english}
Some English to begin with.\footnote{ %
	Blabla}
\end{english}
%%% NOTE: The wordbreak (\wbr) commands were inserted by the preprocessor cttex 
%%% (available from http://linux.thai.net/pub/thailinux/cvs/software/cttex/ 
%%% or from http://packages.debian.org/cttex) 
%%% using the command :
%%% $ cttex-utf8 <infile.tex> <outfile.tex>
%%% where cttex-utf8 is the following simple shell script:
%%% #!/bin/bash 
%%% cat $1 | iconv -f UTF-8 -t TIS-620 | cttex -w | sed 's/<WBR>/\\wbr /g' | iconv -f TIS-620 -t UTF8 > $2
%%% (this should also work on MacOSX; windows users need to tweak it into a batch file I guess)

เป็น\wbr แผนงานเพื่อ\wbr สนับสนุน\wbr การ\wbr ร่วมกัน\wbr สร้าง, การ\wbr ร่วมกันใช้, และ\wbr การ%
ร่วมกัน\wbr พัฒนา\wbr ทรัพยากร\wbr ทาง\wbr ภาษา\wbr ของ\wbr ภาษา\wbr ไทย, บน\wbr เครือข่าย World Wide Web. แผนงานนี้\wbr มี%
จุด\wbr ประสงค์หลั\wbr กอยู่\wbr สอง\wbr ประการคือ เพื่อแก้ปัญหา\wbr กำ\wbr แพง\wbr ทาง\wbr ภาษา, และรักษา%
ไว้เพื่อ\wbr ความค\wbr งอยู่\wbr ของ\wbr ภาษา\wbr และ\wbr วัฒนธรรม\wbr ไทย.

เรา\wbr ตระหนัก\wbr ดีถึง\wbr ความ\wbr สำคัญ\wbr ของ\wbr ภาษา ซึ่ง\wbr นอกจาก\wbr จะ\wbr เป็นสื่อ\wbr ระหว่าง\wbr คนกับ\wbr คน\wbr แล้ว ยัง\wbr เป็น%
รูปแทน\wbr ความคิด และ\wbr เป็น\wbr เครื่องมือ\wbr ใน\wbr การใช้\wbr ความคิด\wbr ด้วย. เครือข่าย\wbr คอมพิวเตอร์%
ใน\wbr ปัจจุบัน\wbr ทำให้ข้อมูล\wbr ข่าวสาร\wbr แพร่หลาย\wbr ไป\wbr อย่าง\wbr รวดเร็ว. เครื่องมือที่ใช้\wbr ใน\wbr การแส\wbr ดง\wbr ผล%
และ\wbr การเต\wbr รี\wbr ยมข้อมูล\wbr ข่าวสาร\wbr นั้น จึง\wbr เป็นสิ่ง\wbr จำ\wbr เป็น. ด้วย\wbr เทคโนโลยีที่\wbr ก้าวหน้า\wbr ไป%
อย่าง\wbr รวดเร็ว, การที่\wbr เพียง\wbr จะ\wbr สามารถแส\wbr ดง\wbr ผลได้หรือ\wbr ป้อนข้อมูลได้\wbr เท่านั้น ไม่\wbr เป็นที่%
เพียงพออีก\wbr แล้ว. การแส\wbr ดง\wbr ผลที่\wbr สวย\wbr งาม\wbr ถูก\wbr ต้อง\wbr ตาม\wbr แบบแผน หรือ\wbr การเต\wbr รี\wbr ยมข้อมูลได้\wbr อย่าง%
ถูก\wbr ต้อง และ\wbr รวดเร็วจึง\wbr เป็นสิ่งที่\wbr จำ\wbr เป็นที่\wbr จะ\wbr ต้อง\wbr พัฒนาให้\wbr ทันตาม\wbr การ\wbr เปลี่ยนแปลง\wbr ของ%
เทคโนโลยี.\footnote{ %
	Second footnote}

\today

\begin{english}
This is today: \today
\end{english}

\begin{enumerate}
	\item A
	\item B	
	\begin{enumerate}
		\item a
		\item b	
		\item c	
	\end{enumerate}
	\item C	
\end{enumerate}
\end{document}
%</example-thai.tex>
% \fi
% 
% \typeout{*************************************************************}
% \typeout{*}
% \typeout{* To finish the installation you have to move the following}
% \typeout{* file into a directory searched by TeX:}
% \typeout{*}
% \typeout{* \space\space\space all *.sty, *.lua, *.def and *.ldf files}
% \typeout{*}
% \typeout{* You also need to compile the *.map files with teckit_compile}
% \typeout{* and place the resulting *.tec files under}
% \typeout{* .../fonts/misc/xetex/fontmapping}
% \typeout{*}
% \typeout{*************************************************************}
\endinput
