diff options
author | Karl Berry <karl@freefriends.org> | 2016-10-08 23:34:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-10-08 23:34:41 +0000 |
commit | 0e25a365d04f0f281f06e0b65397b61142501b12 (patch) | |
tree | fb35ddaf228cb6449f36fd8f07c2beb5f3362e64 /Master/texmf-dist/source/latex/tracklang | |
parent | afce9e93f3a413b814c2b7f5a79dec2290624335 (diff) |
tracklang (8oct16)
git-svn-id: svn://tug.org/texlive/trunk@42235 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/tracklang')
-rw-r--r-- | Master/texmf-dist/source/latex/tracklang/tracklang.dtx | 10093 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/tracklang/tracklang.ins | 12 |
2 files changed, 7822 insertions, 2283 deletions
diff --git a/Master/texmf-dist/source/latex/tracklang/tracklang.dtx b/Master/texmf-dist/source/latex/tracklang/tracklang.dtx index 8a382e1bf6e..af62e33d90d 100644 --- a/Master/texmf-dist/source/latex/tracklang/tracklang.dtx +++ b/Master/texmf-dist/source/latex/tracklang/tracklang.dtx @@ -1,12 +1,16 @@ %\iffalse % tracklang.dtx generated using makedtx version 1.1 (c) Nicola Talbot % Command line args: +% -section "chapter" +% -author "Nicola Talbot" % -src "tracklang.sty\Z=>tracklang.sty" % -src "tracklang.tex\Z=>tracklang.tex" +% -src "tracklang-region-codes.tex\Z=>tracklang-region-codes.tex" +% -src "tracklang-scripts.sty\Z=>tracklang-scripts.sty" +% -src "tracklang-scripts.tex\Z=>tracklang-scripts.tex" % -doc "tracklang-manual.tex" -% -author "Nicola Talbot" % tracklang -% Created on 2015/3/23 13:50 +% Created on 2016/10/8 12:58 %\fi %\iffalse %<*package> @@ -29,29 +33,242 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2015 Nicola Talbot, all rights reserved. +% Copyright (C) 2016 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> -\documentclass[widecs]{nlctdoc} +\documentclass[report,inlinetitle]{nlctdoc} -\usepackage{alltt} +\DeleteShortVerb{|} + +\usepackage[a4paper,marginpar=2in,marginparsep=10pt, + left=2in,right=.5in]{geometry} \usepackage{graphicx} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} +\usepackage{tracklang} +\usepackage{etoolbox} +\usepackage{longtable} +\usepackage{datatool-base}[2016/07/20] +\let\orgtheindex\theindex +\let\orgendtheindex\endtheindex +\usepackage{imakeidx} \usepackage[colorlinks, bookmarks, hyperindex=false, pdfauthor={Nicola L.C. Talbot}, pdftitle={tracklang: tracking language options}]{hyperref} +\CheckSum{3861} -\CheckSum{2003} - -\renewcommand*{\usage}[1]{\hyperpage{#1}} -\renewcommand*{\main}[1]{\hyperpage{#1}} -\IndexPrologue{\section*{\indexname}\markboth{\indexname}{\indexname}} +\appto\MacroFont{\scriptsize} +\renewcommand*{\usage}[1]{\textit{\hyperpage{#1}}} +\renewcommand*{\main}[1]{\underline{\hyperpage{#1}}} +\PageIndex \setcounter{IndexColumns}{2} +\newcommand*{\PrintCodeIndex}{% + \bgroup + \let\theindex\orgtheindex + \let\endtheindex\orgendtheindex + \PrintIndex + \egroup +} +\IndexPrologue{% +\clearpage\phantomsection +\addcontentsline{toc}{chapter}{Code Index}% +\chapter*{Code Index}\markboth{Code Index}{Code Index}% +} + +\makeindex[name=user,title=Main Index,intoc] +\renewcommand{\iapp}[1]{\index[user]{#1@\appfmt{#1}|hyperpage}} +\renewcommand{\iterm}[1]{\index[user]{#1|hyperpage}} +\renewcommand{\ics}[1]{\cs{#1}\index[user]{#1@\protect\cs{#1}|hyperpage}} +\renewcommand*{\ipkgopt}[2][]{% + \ifstrempty{#1}% + {\index[user]{package options:!#2@\pkgoptfmt{#2}|hyperpage}}% + {\index[user]{package options:!#2@\pkgoptfmt{#2}!#1@\pkgoptfmt{#1}|hyperpage}}% +} +\renewcommand*{\pkgopt}[2][]{% + \pkgoptfmt{#2}\ifstrempty{#1}% + {\index[user]{package options:!#2@\pkgoptfmt{#2}|hyperpage}}% + {\index[user]{package options:!#2@\pkgoptfmt{#2}!#1@\pkgoptfmt{#1}|hyperpage}}% +} +\renewcommand*{\isty}[1]{% + \index[user]{#1 package@\styfmt{#1} package|hyperpage}} + +\newcommand*{\envvar}[1]{% + \texttt{#1}% + \index[user]{#1@\texttt{#1}}} + +\newcommand*{\isopkgopts}{} +\newcommand*{\nonisopkgopts}{} +\newcommand*{\rootlangopts}{} + +\makeatletter +\renewcommand*{\changes@}[3]{% + \protected@edef\@tempa{\noexpand\glossary{#1 (#2)\levelchar + \ifx\saved@macroname\@empty + \space + \actualchar + \generalname + \else + \expandafter\@gobble + \saved@macroname + \actualchar + \string\verb\quotechar*% + \verbatimchar\saved@macroname + \verbatimchar + \fi + :\levelchar #3\encapchar hyperpage}}% + \@tempa\endgroup\@esphack} + + +\ifdim\overfullrule=0pt\relax % final mode + \typeout{Sorting available options. This may take a while.}% + \newcommand{\addopt}[3]{% + \expandafter\dtlinsertinto\expandafter{#1}{#2}{#3}% + }% +\else + \newcommand{\addopt}[3]{% + \ifdefempty{#2}{\edef#2{#1}}{\eappto{#2}{,#1}} + } +\fi + + +\@for\thisdialect:=\@tracklang@declaredoptions\do{% + \ifdefempty\thisdialect + {}% + {% + \typeout{\thisdialect}% + \ifnum\pdfmatch {[a-z]{2,3}-[A-Z]{2}}{\thisdialect}=1\relax + \addopt{\thisdialect}{\isopkgopts}{\dtlcompare}% + \else + \TrackLangIfKnownLang{\thisdialect} + {% + \addopt{\thisdialect}{\rootlangopts}{\dtlcompare}% + }% + {% + \addopt{\thisdialect}{\nonisopkgopts}{\dtlicompare}% + }% + \fi + }% +} + +\newcommand*{\isopkgoptstab}{\begin{table}[p] +\caption[Predefined ISO Language-Region Dialects]% +{Predefined ISO Language-Region Dialects. (May be used as a package +option or with \cs{TrackPredefinedDialect}.)}\label{tab:isoopts} +\medskip +\centering +\begin{tabular}{llll}% +} + +\newcommand*{\fnregion}{\textsuperscript{\textdagger}} + +\newcommand*{\rootlangoptstab}{\begin{longtable}{lll} +\caption[Predefined Root Languages]{Predefined Root Languages. +(\fnregion Has an associated territory.) +The corresponding +language tag obtained with \cs{GetTrackedLanguageTag}\marg{dialect} +is shown in parentheses.}\label{tab:rootlangopts}\\\endfirsthead +\caption[]{Predefined Root Languages Continued.}\\\endhead +} + +\newcommand*{\nonisopkgoptstab}{\begin{longtable}{ll} +\caption[Predefined Non-ISO Dialects]{Predefined Non-ISO Dialects. +(\fnregion Has an associated territory.) +The corresponding +language tag obtained with \cs{GetTrackedLanguageTag}\marg{dialect} +is shown in parentheses. If the dialect has a corresponding mapping +for the closest matching non-root language \cs{caption\ldots} or +\cs{date\ldots}, this is also include after the tag following a +slash.}% +\label{tab:nonisoopts}\\\endfirsthead +\caption[]{Predefined Non-ISO Dialects Continued}\\\endhead +} + +\newcount\tmpctr + +\@for\thisdialect:=\isopkgopts\do{% + \advance\tmpctr by 1\relax + \eappto\isopkgoptstab{\noexpand\pkgoptfmt{\thisdialect}&}% + {%locally track this dialect to pick up information + \TrackPredefinedDialect\thisdialect + \xappto\isopkgoptstab{\space + {\noexpand\small(\noexpand\texttt{% + \csname @tracklang@dialect\endcsname})}}% + }% + \ifnum\tmpctr>1 + \tmpctr = 0\relax + \appto\isopkgoptstab{\\}% + \else + \appto\isopkgoptstab{&}% + \fi +} + +\appto\isopkgoptstab{\end{tabular}\par +\medskip +Other combinations need to be set with \cs{TrackLocale} or +\cs{TrackLanguageTag}. +\end{table}} + +\tmpctr=0\relax + +\@for\thisdialect:=\nonisopkgopts\do{% + \advance\tmpctr by 1\relax + \eappto\nonisopkgoptstab{\noexpand\pkgoptfmt{\thisdialect}}% + {%locally track this dialect to pick up information + \TrackPredefinedDialect\thisdialect + \IfTrackedLanguageHasIsoCode{3166-1}{\thisdialect}% + {\gappto\nonisopkgoptstab{\fnregion}}% + {}% + \IfTrackedDialectHasMapping\thisdialect + {\def\nonisopkgmap{ / + \noexpand\texttt{\GetTrackedDialectToMapping\thisdialect}}}% + {\def\nonisopkgmap{}}% + \xappto\nonisopkgoptstab{\space + {\noexpand\small(\noexpand\texttt{\GetTrackedLanguageTag\thisdialect}% + \nonisopkgmap)}}% + }% + \ifnum\tmpctr>1 + \tmpctr = 0\relax + \appto\nonisopkgoptstab{\\}% + \else + \appto\nonisopkgoptstab{&}% + \fi +} + +\appto\nonisopkgoptstab{\end{longtable}} + +\tmpctr=0\relax + +\@for\thisdialect:=\rootlangopts\do{% + \advance\tmpctr by 1\relax + \eappto\rootlangoptstab{\noexpand\pkgoptfmt{\thisdialect}}% + \TrackLangIfHasKnownCountry{\thisdialect}% + {% + \appto\rootlangoptstab{\fnregion}% + }% + {}% + {%locally track this language to pick up information + \TrackPredefinedDialect\thisdialect + \xappto\rootlangoptstab{\space + {\noexpand\small(\noexpand\texttt{\GetTrackedLanguageTag\thisdialect})}}% + }% + \ifnum\tmpctr>2 + \tmpctr = 0\relax + \appto\rootlangoptstab{\\}% + \else + \appto\rootlangoptstab{&}% + \fi +} + +\appto\rootlangoptstab{\end{longtable}} + +\makeatother + +\newcommand*{\refoptstables}{tables~\ref{tab:isoopts}, \ref{tab:rootlangopts} +and~\ref{tab:nonisoopts}} \begin{document} \DocInput{tracklang.dtx} @@ -61,11 +278,11 @@ % %\MakeShortVerb{"} % -%\title{tracklang v1.2: +%\title{tracklang v1.3.1: %tracking language options} %\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}} % -%\date{2015-03-23} +%\date{2016-10-08} %\maketitle % %\begin{abstract} @@ -76,12 +293,39 @@ %translations.} %Its purpose is simply to track which languages have been requested by the %user. Generic \TeX\ code is in \texttt{tracklang.tex} for -%non-\LaTeX\ users (category code of \texttt{@} must be 11 on input). +%non-\LaTeX\ users. +% +%If the shell escape is enabled or \ics{directlua} is available, +%this package may also be used to query the \envvar{LC\_ALL} +%or \envvar{LANG} environment variable (see +%\sectionref{sec:langsty}). Windows users, who don't have the locale +%stored in environment variables, can use \app{texosquery} +%in combination with \styfmt{tracklang}. %\end{abstract} % +%The fundamental aim of this generic package is to be able to +%effectively say: +%\begin{quote} +%The user (that is, the \emph{document} author) wants to use +%dialects \texttt{xx-XX}, \texttt{yy-YY-Scrp}, etc in this +%document. Any packages used by this document that provide +%multilingual or region-dependent support should do whatever is +%required to activate the settings for those languages and regions +%(or warn the user that there's no support). +%\end{quote} +%Naturally, this is only of use if the locale-sensitive packages use +%\styfmt{tracklang} to pick up this information, which is entirely up +%to the package authors, but at the moment there's no standard method +%for packages to detect the required language and region. The aim of +%\styfmt{tracklang} is to provide that method. +% +%\clearpage %\tableofcontents +%\clearpage\phantomsection +%\pdfbookmark{Tables}{lot}% +%\listoftables % -%\section{Introduction} +%\chapter{Introduction} %\label{sec:intro} % %When I'm developing a package that provides multilingual support @@ -118,28 +362,36 @@ %\usepackage[english,british]{tracklang} %\end{verbatim} %This means that \ics{ForEachTrackedDialect} will iterate -%through the list ``english,british'' instead of just -%``british'', which can result in some redundancy. +%through the list \qt{english,british} instead of just +%\qt{british}, which can result in some redundancy. % %Unfortunately I can't work out how to pick up the language variant +%or script %from \sty{polyglossia}, so only the root languages are detected, %which is suboptimal but at least provides some information. % %If the \sty{ngerman} package has been loaded, \styfmt{tracklang} -%sets the root language to ``german'' and the dialect to ``ngerman'', -%but it doesn't set the country code. +%effectively does +%\begin{verbatim} +%\TrackPredefinedDialect{ngerman} +%\end{verbatim} +%Similarly, if the \sty{german} package has been loaded, +%\styfmt{tracklang} effectively does +%\begin{verbatim} +%\TrackPredefinedDialect{german} +%\end{verbatim} % %If any document class or package options are passed to %\styfmt{tracklang}, then \styfmt{tracklang} won't bother checking -%for \sty{babel}, \sty{translator}, \sty{ngerman} or +%for \sty{babel}, \sty{translator}, \sty{ngerman}, \sty{german} or %\sty{polyglossia}. So, if the above example is changed to: %\begin{verbatim} %\documentclass[british]{article} %\usepackage{translator} %\usepackage{tracklang} %\end{verbatim} -%then the dialect list will just consist of ``british'' rather than -%``english,british''. This does, however, mean that if the user mixes +%then the dialect list will just consist of \qt{british} rather than +%\qt{english,british}. This does, however, mean that if the user mixes %class and package options, only the class options will be detected. %For example: %\begin{verbatim} @@ -147,7 +399,7 @@ %\usepackage[french]{babel} %\usepackage{tracklang} %\end{verbatim} -%In this case, only the ``british'' option will be detected. The user +%In this case, only the \qt{british} option will be detected. The user %can therefore use the document class option (or \styfmt{tracklang} %package option) to override the dialect and set the country code %(where provided). For example: @@ -156,19 +408,860 @@ %\usepackage[spanish]{babel} %\usepackage{tracklang} %\end{verbatim} -%This sets the dialect to ``mexicanspanish'' and the root language to -%``spanish''. See \texttt{tracklang.tex} (\sectionref{sec:predefined}) -%for all predefined options. -% -%Section~\ref{sec:user} is for package writers who want to +%This sets the dialect to \qt{mexicanspanish} and the root language to +%\qt{spanish}. +% +%Predefined dialects are listed in \refoptstables. These may be +%passed in the document class options or +%used in \ics{TrackPredefinedDialect}, as illustrated above. +% +%\sectionref{sec:summary} provides brief examples of use for those +%who want a general overview before reading the more detailed +%sections. +%\sectionref{sec:generic} describes generic commands for +%identifying the document languages. +%\sectionref{sec:user} is for package writers who want to %add multilingual support to their package and need to know which %settings the user has requested through language packages like -%\sty{babel}. Section~\ref{sec:langsty} is for +%\sty{babel}. \sectionref{sec:langsty} is for %developers of language definition packages who want to help other %package writers to detect what languages have been requested. -%Section~\ref{sec:plain} provides a plain \TeX\ example. % -%\section{Detecting the User's Requested Languages} +%\isopkgoptstab +% +%\clearpage +% +%\rootlangoptstab +% +%\clearpage +% +%\nonisopkgoptstab +% +%\chapter{Summary of Use} +%\label{sec:summary} +% +%There are three levels of use: +%\begin{enumerate} +%\item document level (code used by document authors); +%\item locale-sensitive package level +%(code for package authors who need to +%know what languages or locale the document is +%using, such as \styfmt{glossaries} to translate commands like +%\cs{descriptionname} or \styfmt{datetime2} to provide localised +%formats or time zone information); +%\item language set-up level (code for packages that set up +%the document languages, such as \sty{babel} or \sty{polyglossia}). +%\end{enumerate} +% +%\section{Document Level} +%\label{sec:summary-doc} +% +%\subsection{Generic \texorpdfstring{\TeX}{TeX}} +%Unix user wants the locale information picked up from the +%locale environment variable: +%\begin{verbatim} +%\input tracklang % v1.3 +%\TrackLangFromEnv +%% load packages that use tracklang for localisation +%\end{verbatim} +% +%Windows user wants the locale information picked up from the +%operating system: +%\begin{verbatim} +%\input texosquery +%\input tracklang %v1.3 +%\TrackLangFromEnv +%% load packages that use tracklang for localisation +%\end{verbatim} +%Or (\sty{texosquery} v1.2 currently pending) +%\begin{verbatim} +%\input texosquery % v1.2 +%\input tracklang % v1.3 +% +%\TeXOSQueryLangTag{\langtag} +%\TrackLanguageTag{\langtag} +%% load packages that use tracklang for localisation +%\end{verbatim} +%Anticipate the release of \styfmt{texosquery} v1.2: +%\begin{verbatim} +%\input texosquery +%\input tracklang % v1.3 +% +%\ifx\TeXOSQueryLangTag\undefined +% \TrackLangFromEnv +%\else +% \TeXOSQueryLangTag{\langtag} +% \TrackLanguageTag{\langtag} +%\fi +%% load packages that use tracklang for localisation +%\end{verbatim} +% +%User is writing in Italy in Armenian with a Latin +%script and the arevela variant: +%\begin{verbatim} +%\input tracklang % v1.3 +%\TrackLanguageTag{hy-Latn-IT-arevela} +%% load packages that use tracklang for localisation +%\end{verbatim} +% +%User is writing in English in the UK: +%\begin{verbatim} +%\input tracklang +%\TrackPredefinedDialect{british} +%% load packages that use tracklang for localisation +%\end{verbatim} +% +%Find out information about the current language (supplied +%in \cs{languagename}): +%\begin{verbatim} +%\SetCurrentTrackedDialect{\languagename} +%Dialect: \CurrentTrackedDialect. +%Language: \CurrentTrackedLanguage. +%ISO Code: \CurrentTrackedIsoCode. +%Region: \CurrentTrackedRegion. +%Modifier: \CurrentTrackedDialectModifier. +%Variant: \CurrentTrackedDialectVariant. +%Script: \CurrentTrackedDialectScript. +%Sub-Lang: \CurrentTrackedDialectSubLang. +%Additional: \CurrentTrackedDialectAdditional. +%Language Tag: \CurrentTrackedLanguageTag. +%\end{verbatim} +%Additional information about the script can be obtained by +%also loading \sty{tracklang-scripts}: +%\begin{verbatim} +%\input tracklang-scripts +%\end{verbatim} +%The name, numeric code and direction can now be obtained: +%\begin{verbatim} +%Name: \TrackLangScriptAlphaToName{\CurrentTrackedDialectScript}. +%Numeric: \TrackLangScriptAlphaToNumeric{\CurrentTrackedDialectScript}. +%Dir: \TrackLangScriptAlphaToDir{\CurrentTrackedDialectScript}. +%\end{verbatim} +%Test for a specific script: +%\begin{verbatim} +%Latin? +%\ifx\CurrentTrackedDialectScript\TrackLangScriptLatn +% Yes +%\else +% No +%\fi +%\end{verbatim} +% +%\subsection{\texorpdfstring{\LaTeX}{LaTeX}} +% +%For \sty{babel} users where the supplied \sty{babel} dialect +%label is sufficient, there's no need to do anything special: +%\begin{verbatim} +%\documentclass[british,canadien]{article} +%\usepackage[T1]{fontenc} +%\usepackage{babel} +%% load packages that use tracklang for localisation +%\end{verbatim} +%If the region is important but there's no \sty{babel} dialect +%that represents it, there are several options. +% +%Use the class options recognised by \styfmt{tracklang} +%and the root language labels when loading \sty{babel}: +%\begin{verbatim} +%\documentclass[en-IE,ga-IE]{article} +%\usepackage[english,irish]{babel} +%% load packages that use tracklang for localisation +%\end{verbatim} +% +%This method is needed for \sty{polyglossia} where the regional +%information is required. For example +%\begin{verbatim} +%\documentclass[en-GB]{article} +%\usepackage{polyglossia} +%\setmainlanguage[variant=uk]{english} +%% load packages that use tracklang for localisation +%\end{verbatim} +% +%Another method with \sty{babel} is to +%use \cs{TrackLanguageTag} and map the new dialect label to +%\sty{babel}'s nearest matching label: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{tracklang}% v1.3 +%\TrackLanguageTag{en-MT} +%\SetTrackedDialectLabelMap{\TrackLangLastTrackedDialect}{UKenglish} +% +%\usepackage[UKenglish]{babel} +%% load packages that use tracklang for localisation +%\end{verbatim} +%This ensures that the \cs{captionsUKenglish} hook is detected +%by the localisation packages. This mapping isn't needed +%for \sty{polyglossia} as the caption hooks use the root language +%label. This mapping also isn't needed if \texttt{british} is used +%instead of \texttt{UKenglish} since the \pkgopt{en-MT} +%(\pkgopt{maltaenglish}) +%predefined dialect automatically sets up a mapping to +%\texttt{british}. (The default mappings are shown in +%\tableref{tab:nonisoopts}.) +% +%\section{Locale-Sensitive Packages} +%\label{sec:summary-localepkg} +% +%Let's suppose you are developing a package called +%\texttt{mypackage.sty} or \texttt{mypackage.tex} and you want +%to find out what languages the document author has requested. +% +%Generic use: +%\begin{verbatim} +%\input tracklang +%\end{verbatim} +%(Most of the commands used in this section require at least +%\styfmt{tracklang} version 1.3.) +%Note that \texttt{tracklang.tex} has a check to determine if +%it's already been loaded, so you don't need to worry about that. +% +%\LaTeX\ use: +%\begin{verbatim} +%\RequirePackage{tracklang}[2016/10/07]% at least v1.3 +%\end{verbatim} +%This will picked up any language options supplied in the document +%class options and will also detect if \sty{babel} or +%\sty{polyglossia} have been loaded. +% +%(\LaTeX) If you want to allow the user to set the locale in the +%package options: +%\begin{verbatim} +%\DeclareOption*{\TrackLanguageTag{\CurrentOption}} +%\end{verbatim} +%This means the user can do, say, +%\begin{verbatim} +%\usepackage[hy-Latn-IT-arevela]{mypackage} +%\end{verbatim} +%The rest of the example package in this section uses generic code. +% +%If you want to fetch the locale information from the operating +%system when the user hasn't requested a language: +%\begin{verbatim} +%\AnyTrackedLanguages +%{} +%{% fetch locale information from the operating system +% \ifx\TeXOSQueryLangTag\undefined +% % texosquery v1.2 not available +% \TrackLangFromEnv +% \else +% % texosquery v1.2 available +% \TeXOSQueryLangTag{\langtag} +% \TrackLanguageTag{\langtag} +% \fi +%} +%\end{verbatim} +% +%Set up the defaults if necessary: +%\begin{verbatim} +%\def\fooname{Foo} +%\def\barname{Bar} +%\end{verbatim} +% +%Now load the resource files: +%\begin{verbatim} +%\AnyTrackedLanguages +%{% +% \ForEachTrackedDialect{\thisdialect}{% +% \TrackLangRequireDialect{mypackage}{\thisdialect}% +% }% +%} +%{}% no tracked languages, default already set up +%\end{verbatim} +% +%Each resource file has the naming scheme \meta{prefix}\texttt{-} +%\meta{tag}\texttt{.ldf}. In this example, the \meta{prefix} is +%\texttt{mypackage}. The \meta{tag} may be the language or dialect label +%(for example, \texttt{english} or \texttt{british}) or a combination of the ISO +%language and region codes (for example, \texttt{en-GB} or +%\texttt{en} or \texttt{GB}). +% +%The simplest scheme is to use the root language label (not the +%dialect label) for the base language settings and use the ISO +%codes for regional support. +% +%For example, the file \texttt{mypackage-english.ldf}: +%\begin{verbatim} +%\TrackLangProvidesResource{english}[2016/10/06 v1.0]% identify this file +% +%\TrackLangAddToCaptions{% +% \def\fooname{Foo}% +% \def\barname{Bar}% +%} +%\end{verbatim} +%This sets up appropriate the \cs{captions\ldots} hook (if it's +%found). For other hooks, such as \cs{date\ldots}, use +%\ics{TrackLangAddToHook}\marg{code}\marg{hook type} instead. +% +%Here's an example for a language with different writing systems. +%The resource file for Serbian \texttt{mypackage-serbian.ldf}: +%\begin{verbatim} +%\TrackLangProvidesResource{serbian}[2016/10/06 v1.0]% identify file +% +%\TrackLangRequestResource{serbian-\CurrentTrackedScript} +%{}% file not found, do something sensible here +%\end{verbatim} +%The file \texttt{mypackage-serbian-Latn.ldf} sets up +%the Latin script: +%\begin{verbatim} +%\TrackLangProvidesResource{serbian-Latn}[2016/10/06 v1.0] +% +%\TrackLangAddToCaptions{% +% \def\fooname{...}% provide appropriate Latin translations +% \def\barname{...}% +%} +%\end{verbatim} +%The file \texttt{mypackage-serbian-Cyrl.ldf} sets up +%the Cyrllic script: +%\begin{verbatim} +%\TrackLangProvidesResource{serbian-Cyrl}[2016/10/06 v1.0] +% +%\TrackLangAddToCaptions{% +% \def\fooname{...}% provide appropriate Cyrllic translations +% \def\barname{...}% +%} +%\end{verbatim} +% +%\section{Language Packages} +%\label{sec:summary-langpkg} +% +%Let's suppose now you're the developer of a package that +%sets up the language, hyphenation patterns and so on. +%It would be really helpful to the locale-sensitive packages +%in \sectionref{sec:summary-localepkg} to know what languages +%the document author has requested. You can use the +%\styfmt{tracklang} package to identify this information +%by tracking the requested localisation, so that other packages +%can have a consistent way of querying it. +% +%Generic use: +%\begin{verbatim} +%\input tracklang +%\end{verbatim} +%Alternative \LaTeX\ use: +%\begin{verbatim} +%\RequirePackage{tracklang}[2016/10/07] % v1.3 +%\end{verbatim} +%Unlike \cs{input}, \cs{RequirePackage} will allow \styfmt{tracklang} +%to pick up the document class options, but using \cs{RequirePackage} +%will also trigger the tests for known language packages. +%(If you want to find out if \styfmt{tracklang} has already been +%loaded and locales have already been tracked, you can use the +%same code as in the previous section.) +% +%When a user requests a particular language through your package, +%the simplest way of letting \styfmt{tracklang} know about it +%is to use \cs{TrackPredefinedDialect} or \cs{TrackLanguageTag}. +%For example, if the user requests \texttt{british}, that's a +%predefined dialect so you can just do: +%\begin{verbatim} +%\TrackPredefinedDialect{british} +%\end{verbatim} +%Alternatively +%\begin{verbatim} +%\TrackLanguageTag{en-GB} +%\end{verbatim} +%If your package uses caption hooks, then you can set up +%a mapping between \styfmt{tracklang}'s internal dialect label +%and your caption label. For example, let's suppose the +%closest match to English used in Malta (\texttt{en-MT}) is the +%dialect \texttt{UKenglish} (for example, the date format is +%similar between GB and MT): +%\begin{verbatim} +%\TrackLanguageTag{en-MT} +%\SetTrackedDialectLabelMap{\TrackLangLastTrackedDialect}{UKenglish} +%\def\captionsUKenglish{% +% \def\contentsname{Contents}% +% %... +%} +%\end{verbatim} +%(The predefined \pkgopt{maltaenglish} option provided by +%\styfmt{tracklang} automatically sets the mapping to +%\texttt{british}, but the above method will change that mapping +%to \texttt{UKenglish}.) +% +%This now means that \cs{TrackLangAddToCaptions} command used +%at the end of \sectionref{sec:summary-localepkg} above can +%find your caption hook. You don't need the map if your dialect +%label is the same as \styfmt{tracklang}'s root language label +%for that locale. For example: +%\begin{verbatim} +%\TrackLanguageTag{en-MT} +%\def\captionsenglish{% +% \def\contentsname{Contents}% +% %... +%} +%\end{verbatim} +% +%When the user switches language through commands like +%\ics{selectlanguage} it would be useful to also use +%\ics{SetCurrentTrackedDialect}\marg{dialect} to make it easier +%for the document author or locale-sensitive packages to pick +%up the current locale. The \meta{dialect} argument may be +%\styfmt{tracklang}'s internal dialect label or the dialect +%label you assigned with \cs{SetTrackedDialectLabelMap}. It +%may also be the root language label, in which case +%\styfmt{tracklang} will search for the last dialect to be +%tracked with that language. For example: +%\begin{verbatim} +%\def\selectlanguage#1{% +% % set up hyphenation patterns etc +% \SetCurrentTrackedDialect{#1}% +%} +%\end{verbatim} +%See the example in \sectionref{sec:summary-doc}. +% +%\chapter{Generic Use} +%\label{sec:generic} +% +%For plain \TeX\ you can input \texttt{tracklang.tex}: +%\begin{verbatim} +%\input tracklang +%\end{verbatim} +%or for \TeX\ formats that have an argument form for \ics{input}: +%\begin{verbatim} +%\input{tracklang} +%\end{verbatim} +%As from version 1.3, you don't need to change the category +%code of \texttt{@} before loading \texttt{tracklang.tex} +%as it will automatically be changed to 11 and switched +%back at the end (if required). +% +%The \LaTeX\ package \texttt{tracklang.sty} +%inputs the generic \TeX\ code in \texttt{tracklang.tex}, but before +%it does so it defines +%\begin{definition} +%\cs{@tracklang@declareoption}\marg{name} +%\end{definition} +%to +%\begin{definition} +%\cs{DeclareOption}\marg{name}\{\cs{TrackPredefinedDialect}\marg{name}\} +%\end{definition} +% +%This means that all the predefined languages and dialects +%(\refoptstables) automatically become package options, so +%the \styfmt{tracklang} package can pick up document class +%options and add them to \styfmt{tracklang}'s internal list of tracked +%document languages. +% +%If you're not using \LaTeX, this option isn't available +%(although you could redefine the internal command +%\cs{@tracklang@declareoption} +%to use something analogous to \cs{DeclareOption}). +%Instead, the document languages need +%to be explicitly identified (using any of the following commands) +%so that \styfmt{tracklang} knows about them. +% +%\begin{definition}[\DescribeMacro\TrackPredefinedDialect] +%\ics{TrackPredefinedDialect}\marg{dialect label} +%\end{definition} +%This will add the predefined dialect and its associated ISO codes to the list +%of tracked document languages. The \meta{dialect label} may be any +%of those listed in \refoptstables. +%(See also \sectionref{sec:predefinedlang} and \sectionref{sec:predefined}.) +% +%For example: +%\begin{verbatim} +%\input tracklang +%\TrackPredefinedDialect{british} +%\end{verbatim} +%is the Plain \TeX\ alternative to +%\begin{verbatim} +%\documentclass[british]{article} +%\usepackage{tracklang} +%\end{verbatim} +% +%Note that it's impractical to define every possible language +%and region combination as it would significantly slow the +%time taken to load \styfmt{tracklang} so, after version~1.3, +%I don't intend adding any new predefined dialects. As from version +%1.3, if you want to track a dialect that's not predefined by +%\styfmt{tracklang}, then you can use: +%\begin{definition}[\DescribeMacro\TrackLocale] +%\cs{TrackLocale}\marg{locale} +%\end{definition} +%If \meta{locale} is a recognised dialect, this is equivalent to +%using \cs{TrackPredefinedDialect}, otherwise \meta{locale} +%needs to be in one the following formats: +%\begin{itemize} +%\item \meta{ISO lang} +%\item \meta{ISO lang}\texttt{@}\meta{modifier} +%\item \meta{ISO lang}\texttt{-}\meta{ISO country} +%\item \meta{ISO lang}\texttt{-}\meta{ISO country}\texttt{@}\meta{modifier} +%\end{itemize} +%where \meta{ISO lang} is the ISO~639-1 or 639-2 code identifying +%the language (lower case), \meta{ISO country} is the 3166-1 +%ISO code identifying the territory (upper case) and +%\meta{modifier} is the modifier or variant. The hyphen may be +%replaced by an underscore character. Code set information in the +%form \texttt{.}\meta{codeset} may optionally appear before the +%modifier. For example, \texttt{de-DE.utf8@new} (modifier is +%\texttt{new}) or \texttt{en-GB.utf8} (modifier is missing). +%The codeset will be ignored if present, but it won't interfere +%with the parsing. +% +%For example: +%\begin{verbatim} +%\TrackLocale{de-NA@new} +%\end{verbatim} +%indicates German in Namibia using the new spelling. +% +%\begin{important} +%If a language has different \qt{T} and \qt{B} ISO~639-2 codes, then +%the \qt{T} form should be used. (So for the above example, +%\texttt{deu} may be used instead of \texttt{de}, but \texttt{ger} +%won't be recognised.) +%\end{important} +% +%Alternatively, you can use +%\begin{definition}[\DescribeMacro\TrackLanguageTag] +%\cs{TrackLanguageTag}\marg{tag} +%\end{definition} +%where \meta{tag} is a regular, well-formed language tag or a recognised dialect +%label. (Irregular grandfather tags aren't recognised.) +%This command will fully expand \meta{tag}. +%A warning is issued if the tag is empty. +%For example: +%\begin{verbatim} +%\TrackLanguageTag{hy-Latn-IT-arevela} +%\end{verbatim} +% +%If \meta{tag} contains a sub-language tag, this will be set +%as the 639-3 code for the \emph{dialect} label. Note that this is +%different to the root language codes which are set using the +%language label. For example +%\begin{verbatim} +%\TrackLanguageTag{zh-cmn-Hans-CN} +%\end{verbatim} +%creates a new dialect with the label \texttt{zhcmnHansCN}. +%The root language \texttt{chinese} has the ISO 639-1 code +%\texttt{zh} and the dialect \texttt{zhcmnHansCN} has the +%ISO 639-3 code \texttt{cmn}. +%\begin{verbatim} +%ISO 639-1: \TrackedIsoCodeFromLanguage{639-1}{chinese}. +%ISO 639-3: \TrackedIsoCodeFromLanguage{639-3}{zhcmnHansCN}. +%\end{verbatim} +% +%Version 1.2 (currently pending) of +%\sty{texosquery} will have a new command \ics{TeXOSQueryLangTag}, +%which may be used to fetch the operating system's regional +%information as a language tag. These commands can be used as +%follows: +%\begin{verbatim} +%\input tracklang % v1.3 +%\input texosquery % v1.2 +% +%\TeXOSQueryLangTag{\langtag} +%\TrackLanguageTag{\langtag} +%\end{verbatim} +%(If the shell escape is disabled, \cs{langtag} will be empty, which +%will trigger a~warning but no errors.) +% +%Some of the predefined root language options listed +%in \tableref{tab:rootlangopts} have an associated region +%(denoted by \fnregion). +%If \cs{TrackLocale} is used with just the language ISO code, +%no region is tracked for that language. For example +%\begin{verbatim} +%\TrackLocale{manx} +%\end{verbatim} +%will track the \qt{IM} ISO~3166-1 code but +%\begin{verbatim} +%\TrackLocale{gv} +%\end{verbatim} +%won't track the region. +%Similarly for \cs{TrackLanguageTag}. +% +%(New to version 1.3.) +%There's a similar command to \cs{TrackLocale} that doesn't take an argument: +%\begin{definition}[\DescribeMacro\TrackLangFromEnv] +%\cs{TrackLangFromEnv} +%\end{definition} +%If the shell escape has been enabled or +%\ics{directlua} is available, this will try to get the language +%information from the system environment variables +%\envvar{LC\_ALL} or \envvar{LANG} +%and, if successful, track that. +% +%Since \styfmt{tracklang} is neither able to look up the POSIX locale +%tables nor interpret file locales, if the result is \texttt{C} or +%\texttt{POSIX} or starts with a forward slash \texttt{/} then +%the locale value is treated as empty. +% +%\begin{important} +%Not all operating systems use environment variables for +%the system locale information. For example, Windows stores the +%locale information in the registry. In which case, consider +%using \styfmt{texosquery}. +%\end{important} +% +%If the operating system locale can't be obtained from environment variables, then +%\styfmt{tracklang} will use \ics{TeXOSQueryLocale} as a fallback if +%\styfmt{texosquery} has been loaded. Since \sty{texosquery} requires +%both the shell escape and the Java runtime environment, +%\styfmt{tracklang} doesn't automatically load it. +% +%Plain \TeX\ example: +%\begin{verbatim} +%\input texosquery +%\input tracklang +%\TrackLangFromEnv +%\end{verbatim} +%with \texttt{etex -{}-shell-escape }\meta{filename} +% +%\LaTeX\ example: +%\begin{verbatim} +%\usepackage{texosquery} +%\usepackage{tracklang} +%\TrackLangFromEnv +%\end{verbatim} +%with \texttt{latex -{}-shell-escape }\meta{filename} +% +%If the locale can't be determined, there will be warning messages. +%These can be suppressed using +%\begin{definition}[\DescribeMacro\TrackLangShowWarningsfalse] +%\cs{TrackLangShowWarningsfalse} +%\end{definition} +%or switched back on again using +%\begin{definition}[\DescribeMacro\TrackLangShowWarningstrue] +%\cs{TrackLangShowWarningstrue} +%\end{definition} +% +%For example, I have the environment variable \envvar{LANG} set to +%\texttt{en\_GB.utf8} on my Linux system so instead of +%\begin{verbatim} +%\TrackPredefinedDialect{british} +%\end{verbatim} +%I can use +%\begin{verbatim} +%\TrackLangFromEnv +%\end{verbatim} +% +%With \LaTeX\ documents I can do +%\begin{verbatim} +%\documentclass{article} +%\usepackage{tracklang} +%\TrackLangFromEnv +%\end{verbatim} +%However, this only helps subsequently loaded packages that +%use \styfmt{tracklang} to determine the required regional +%settings. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage{tracklang} +%\TrackLangFromEnv +%\usepackage[useregional]{datetime2} +%\end{verbatim} +%In my case, with \envvar{LANG} set to \texttt{en\_GB.utf8} and +%shell escape enabled, this automatically switches on the +%\texttt{en-GB} date style. +%Naturally this doesn't help locale-sensitive packages that don't use +%\styfmt{tracklang}. +% +%The \cs{TrackLangFromEnv} command also incidentally sets +%\begin{definition}[\DescribeMacro\TrackLangEnv] +%\cs{TrackLangEnv} +%\end{definition} +%to the value of the environment variable or empty if the +%query was unsuccessful (for example, the shell escape is +%unavailable). +% +%If \cs{TrackLangEnv} is already defined before +%\cs{TrackLangFromEnv} is used, then the environment variable +%won't be queried and the value of \cs{TrackLangEnv} will be +%parsed instead. +% +%\begin{important} +%The parser which splits the locale string into +%its component parts first tries splitting on the underscore +%\texttt{\_} with its usual category code~8, then tries splitting +%on a hyphen \texttt{-} with category code~12, and then tries +%splitting on the underscore \texttt{\_} with category code~12. +%\end{important} +% +%For example: +%\begin{verbatim} +%\def\TrackLangEnv{en-GB} +%\TrackLangFromEnv +%\end{verbatim} +%This doesn't perform a shell escape since \cs{TrackLangEnv} +%is already defined. In this case, you may just as well use +%\begin{verbatim} +%\TrackLocale{en-GB} +%\end{verbatim} +%(unless you happen to additionally require the component +%commands that are set by \cs{TrackLangFromEnv}, see below.) +% +%If the shell escape is unavailable +%(for example, your \TeX\ installation prohibits it), you +%can set this value when you invoke \TeX. For example, +%if the document file is called \texttt{myDoc.tex} (and it's +%in Plain \TeX): +%\begin{verbatim} +%tex "\\def\TrackLangEnv{$LANG}\\input myDoc" +%\end{verbatim} +% +%The \cs{TrackLangFromEnv} command also happens to store the +%component parts of the environment variable value in the +%following commands. (These aren't provided by +%\cs{TrackLocale}.) +% +%The language code is stored in: +%\begin{definition}[\DescribeMacro\TrackLangEnvLang] +%\cs{TrackLangEnvLang} +%\end{definition} +% +%The territory (if present) is stored in: +%\begin{definition}[\DescribeMacro\TrackLangEnvTerritory] +%\cs{TrackLangEnvTerritory} +%\end{definition} +%(Defined to empty if not present.) +% +%The codeset (if present) is stored in: +%\begin{definition}[\DescribeMacro\TrackLangEnvCodeSet] +%\cs{TrackLangEnvCodeSet} +%\end{definition} +%(Defined to empty if not present.) +% +%The modifier (if present) is stored in: +%\begin{definition}[\DescribeMacro\TrackLangEnvModifier] +%\cs{TrackLangEnvModifier} +%\end{definition} +%(Defined to empty if not present.) +% +%If you want to query the language environment, but don't +%want to track the result, you can just use: +%\begin{definition}[\DescribeMacro\TrackLangQueryEnv] +%\cs{TrackLangQueryEnv} +%\end{definition} +%This only tries to fetch the value of the +%language environment variable (and use \sty{texosquery} as +%a fallback, if it has been loaded). It doesn't try to parse the +%result. The result is stored in \cs{TrackLangEnv} (empty if +%unsuccessful). Unlike \cs{TrackLangFromEnv}, this doesn't check if +%\cs{TrackLangEnv} already exists. A warning will occur if the shell +%escape is unavailable. For systems that store the locale information in +%environment variables, this is more efficient than using +%\sty{texosquery}'s \cs{TeXOSQueryLocale} command (which is what's +%used as the fallback). +% +%The above queries \envvar{LC\_ALL} and, if that is unsuccessful, +%then queries \envvar{LANG} (before optionally falling back on +%\sty{texosquery}). If you want another environment +%variable tried after \envvar{LC\_ALL} and before \envvar{LANG}, +%you can instead use: +%\begin{definition}[\DescribeMacro\TrackLangQueryOtherEnv] +%\cs{TrackLangQueryOtherEnv}\marg{name} +%\end{definition} +%For example, to also query \envvar{LC\_MONETARY}: +%\begin{verbatim} +%\TrackLangQueryOtherEnv{LC_MONETARY} +%\end{verbatim} +% +%Since this sets \cs{TrackLangEnv}, you can use it before +%\cs{TrackLangFromEnv}. For example: +%\begin{verbatim} +%\TrackLangQueryOtherEnv{LC_MONETARY} +%\TrackLangFromEnv +%\end{verbatim} +%Remember that if you only want to do the shell escape if +%\cs{TrackLangEnv} hasn't already been defined, you can test for this +%first: +%\begin{verbatim} +%\ifx\TrackLangEnv\undefined +% \TrackLangQueryOtherEnv{LC_MONETARY} +%\fi +%\TrackLangFromEnv +%\end{verbatim} +% +%It's also possible to just parse the value of \cs{TrackLangEnv} +%without tracking the result using: +%\begin{definition}[\DescribeMacro\TrackLangParseFromEnv] +%\cs{TrackLangParseFromEnv} +%\end{definition} +%This is like \cs{TrackLangFromEnv} but assumes that +%\cs{TrackLangEnv} has already been set and doesn't track the +%result. The component parts are stored as for \cs{TrackLangFromEnv}. +% +%Example (Plain \TeX): +%\begin{verbatim} +%\input tracklang +% +%\def\TrackLangEnv{fr-BE.utf8@euro} +% +%\TrackLangParseFromEnv +% +%Language: \TrackLangEnvLang. +%Territory: \TrackLangEnvTerritory. +%Codeset: \TrackLangEnvCodeSet. +%Modifier: \TrackLangEnvModifier. +%Any tracked languages? \AnyTrackedLanguages{Yes}{No}. +% +%\end{verbatim} +%This produces: +% +%\medskip +% +%Language: fr. Territory: BE. Codeset: utf8. Modifier: euro. +%Any tracked languages? No. +% +%\medskip +% +%Compare this with: +%\begin{verbatim} +%\input tracklang +% +%\def\TrackLangEnv{fr-BE.utf8@euro} +% +%\TrackLangFromEnv +% +%Language: \TrackLangEnvLang. +%Territory: \TrackLangEnvTerritory. +%Codeset: \TrackLangEnvCodeSet. +%Modifier: \TrackLangEnvModifier. +%Any tracked languages? \AnyTrackedLanguages{Yes}{No}. +%Tracked dialect(s):% +%\ForEachTrackedDialect{\thisdialect}{\space\thisdialect}. +%\end{verbatim} +%This produces: +% +%\medskip +% +%Language: fr. Territory: BE. Codeset: utf8. Modifier: euro. +%Any tracked languages? Yes. +%Tracked dialect(s): belgique. +% +%\medskip +% +%If \cs{TrackLangFromEnv} doesn't recognise the given language and +%territory combination, it will define a new dialect and add that. +% +%For example, \styfmt{tracklang} doesn't recognise \texttt{en-BE}, so +%the sample document below defines a new dialect labelled +%\texttt{enBEeuro}: +%\begin{verbatim} +%\input tracklang +% +%\def\TrackLangEnv{en-BE.utf8@euro} +% +%\TrackLangFromEnv +% +%Language: \TrackLangEnvLang. +%Territory: \TrackLangEnvTerritory. +%Codeset: \TrackLangEnvCodeSet. +%Modifier: \TrackLangEnvModifier. +%Any tracked languages? \AnyTrackedLanguages{Yes}{No}. +%Tracked dialect(s):% +%\ForEachTrackedDialect{\thisdialect}{\space\thisdialect}. +%\end{verbatim} +%This now produces: +%\medskip +% +%Language: en. Territory: BE. Codeset: utf8. Modifier: euro. +%Any tracked languages? Yes. +%Tracked dialect(s): enBEeuro. +% +%\chapter{Detecting the User's Requested Languages} %\label{sec:user} % %The \styfmt{tracklang} package tries to track the loaded languages and @@ -176,21 +1269,50 @@ %term, the language option names are referred to as dialects even if %they're only a synonym for the language rather than an actual %dialect. For example, if the user -%has requested \texttt{british}, the root language label is +%has requested \texttt{british}, the \emph{root language} label is %\texttt{english} and the dialect is \texttt{british}, whereas if the %user requested \texttt{UKenglish}, the root language label is %\texttt{english} and the dialect is \texttt{UKenglish}. The %exceptions to this are the \styfmt{tracklang} package options that have been -%specified in the form \meta{iso lang}-\meta{iso country}. For +%specified in the form \meta{iso lang}-\meta{iso country} (listed +%in \tableref{tab:rootlangopts}). For %example, the package option \texttt{en-GB} behaves as though the %user requested the package option \texttt{british}. % +%If \cs{TrackLocale} or \cs{TrackLangFromEnv} are used and the locale +%isn't recognised a new dialect is created with the label formed from +%the ISO codes (and modifier, if present). +%Similarly for \cs{TrackLanguageTag} a new +%dialect is created with a label that's essentially the language tag +%without the hyphen separators. For example, +%\begin{verbatim} +%\TrackLocale{xx-YY} +%\end{verbatim} +%will add a new dialect with the label \texttt{xxYY}, +%\begin{verbatim} +%\TrackLocale{xx-YY@mod} +%\end{verbatim} +%will add a new dialect with the label \texttt{xxYYmod} and +%\begin{verbatim} +%\TrackLanguageTag{xx-YY-Latn} +%\end{verbatim} +%will add a new dialect with the label \texttt{xxYYLatn}. +% +%\begin{important} +%If \cs{TrackLocale} or \cs{TrackLangFromEnv} find a modifier, the +%value will be sanitized to allow it to be used as a label. If the +%modifier is set explicitly using \cs{SetTrackedDialectModifier}, +%no sanitization is performed. +%\end{important} +% %In addition to the root language label and the dialect identifier, %many of the language options also have corresponding ISO codes. In %most cases there is an ISO~639-1 or an ISO~639-2 code (or both), and in some %cases there is an ISO~3166-1 code identifying the dialect region. +%Where a language has both a \qt{T} and a \qt{B} ISO~639-2 +%code, the \qt{T} version is assumed. % -%When \styfmt{tracklang} is loaded, it first attempts to find the +%When the \styfmt{tracklang} \LaTeX\ package is loaded, it first attempts to find the %language options through the package options supplied to %\styfmt{tracklang}. This means that any languages that have been %supplied in the document class options should get identified @@ -208,39 +1330,70 @@ %label will appear in both lists. % %You can check whether or not any languages have been detected using: -%\begin{definition} -%\ics{AnyTrackedLanguages}\marg{true part}\marg{false part} +%\begin{definition}[\DescribeMacro\AnyTrackedLanguages] +%\cs{AnyTrackedLanguages}\marg{true part}\marg{false part} %\end{definition} %This will do \meta{true part} if one or more languages have been %detected otherwise it will do \meta{false part}. (Each detected %dialect will automatically have the root language label added %to the tracked language list, if it's not already present.) % +%If you want to find out if any of the tracked dialects +%match a particular language tag, you can use: +%\begin{definition}[\DescribeMacro\GetTrackedDialectFromLanguageTag] +%\cs{GetTrackedDialectFromLanguageTag}\marg{tag}\marg{cs} +%\end{definition} +%If successful, the supplied control sequence \meta{cs} is set to the +%dialect label, otherwise \meta{cs} is set to empty. Note that the +%extension (that is, the option part that may occur at the end of +%the tag) isn't used in the comparison. +% +%For example (Plain \TeX): +%\begin{verbatim} +%\input tracklang +%\TrackLanguageTag{en-826} +%Has en-GB-Latn been tracked? +%\GetTrackedDialectFromLanguageTag{en-GB-Latn}{\thisdialect}% +%\ifx\thisdialect\empty +% No! +%\else +% Yes! Dialect label: \thisdialect. +%\fi +%\bye +%\end{verbatim} +%This matches because the territory code 826 is recognised as +%equivalent to the code GB, and the default script for +%\texttt{english} is \texttt{Latn}. In this case, the dialect +%label is \texttt{british}. Note that this doesn't require +%the use of \cs{TrackLanguageTag} to track the dialect. +%It also works if the dialect has been tracked using other commands, +%such as \cs{TrackLocale}. +% %You can iterate through each tracked dialect using: -%\begin{definition} -%\ics{ForEachTrackedDialect}\marg{cs}\marg{code} +%\begin{definition}[\DescribeMacro\ForEachTrackedDialect] +%\cs{ForEachTrackedDialect}\marg{cs}\marg{code} %\end{definition} %At the start of each iteration, this sets \meta{cs} to the %tracked dialect and does \meta{code}. % %You can iterate through each tracked language using: -%\begin{definition} -%\ics{ForEachTrackedLanguage}\marg{cs}\marg{code} +%\begin{definition}[\DescribeMacro\ForEachTrackedLanguage] +%\cs{ForEachTrackedLanguage}\marg{cs}\marg{code} %\end{definition} %At the start of each iteration, this sets \meta{cs} to the %tracked language and does \meta{code}. % %You can test if a root language has been detected using: -%\begin{definition} -%\ics{IfTrackedLanguage}\marg{label}\marg{true part}\marg{false part} +%\begin{definition}[\DescribeMacro\IfTrackedLanguage] +%\cs{IfTrackedLanguage}\marg{label}\marg{true part}\marg{false part} %\end{definition} %where \meta{label} is the language label. If %true, this does \meta{true part} otherwise it does \meta{false %part}. % %You can test if a particular dialect has been detected using: -%\begin{definition} -%\ics{IfTrackedDialect}\marg{label}\marg{true part}\marg{false part} +%\begin{definition}[\DescribeMacro\IfTrackedDialect] +%\cs{IfTrackedDialect}\marg{label}\marg{true part}\marg{false part} %\end{definition} %where \meta{label} is the dialect label. If the root language was explicitly specified, then it will %also be detected as a dialect. @@ -280,35 +1433,38 @@ % %You can find the root language label for a given tracked dialect %using: -%\begin{definition} -%\ics{TrackedLanguageFromDialect}\marg{dialect} +%\begin{definition}[\DescribeMacro\TrackedLanguageFromDialect] +%\cs{TrackedLanguageFromDialect}\marg{dialect} %\end{definition} %If \meta{dialect} hasn't been defined this does nothing otherwise it %expands to the root language label. % %You can find the tracked dialects from a given root language %using: -%\begin{definition} -%\ics{TrackedDialectsFromLanguage}\marg{root language label} +%\begin{definition}[\DescribeMacro\TrackedDialectsFromLanguage] +%\cs{TrackedDialectsFromLanguage}\marg{root language label} %\end{definition} %This will expand to a~comma-separated list of dialect labels %if the root language label has been defined, otherwise it %does nothing. % % -%You can test if a language (or dialect) has a corresponding ISO code using: -%\begin{definition} -%\ics{IfTrackedLanguageHasIsoCode}\marg{code +%You can test if a language or dialect has a corresponding ISO code using: +%\begin{definition}[\DescribeMacro\IfTrackedLanguageHasIsoCode] +%\cs{IfTrackedLanguageHasIsoCode}\marg{code %type}\marg{label}\marg{true part}\marg{false part} %\end{definition} %where \meta{code type} is the type of ISO code (for example, %\texttt{639-1} for root languages or \texttt{3166-1} for regional %dialects), and \meta{label} is the language or dialect label. +%Note that the \texttt{639-3} may be set for the dialect +%rather than root language for sub-languages parsed using +%\ics{TrackLanguageTag}. % %Alternatively, you can test if a particular ISO code has been %defined using: -%\begin{definition} -%\ics{IfTrackedIsoCode}\marg{code type}\marg{code}\marg{true +%\begin{definition}[\DescribeMacro\IfTrackedIsoCode] +%\cs{IfTrackedIsoCode}\marg{code type}\marg{code}\marg{true %part}\marg{false part} %\end{definition} %where \meta{code type} is again the type of ISO code (for example, @@ -318,16 +1474,16 @@ % %You can fetch the language (or dialect) label associated with a %given ISO code using: -%\begin{definition} -%\ics{TrackedLanguageFromIsoCode}\marg{code type}\marg{code} +%\begin{definition}[\DescribeMacro\TrackedLanguageFromIsoCode] +%\cs{TrackedLanguageFromIsoCode}\marg{code type}\marg{code} %\end{definition} %This does nothing if the given \meta{code} for the given ISO %\meta{code type} has not been defined, otherwise it expands %a~comma-separated list of language or dialect labels. % %You can fetch the ISO code for a given code type using: -%\begin{definition} -%\ics{TrackedIsoCodeFromLanguage}\marg{code type}\marg{label} +%\begin{definition}[\DescribeMacro\TrackedIsoCodeFromLanguage] +%\cs{TrackedIsoCodeFromLanguage}\marg{code type}\marg{label} %\end{definition} %where \meta{label} is the language or dialect label and \meta{code %type} is the ISO code type (for example, \texttt{639-1} or @@ -339,22 +1495,61 @@ %code type, %so if you accidentally get the wrong code type, you won't get an error. %If you're unsure of the code type, you can use the following commands: -%\begin{definition} -%\ics{TwoLetterIsoCountryCode} +%\begin{definition}[\DescribeMacro\TwoLetterIsoCountryCode] +%\cs{TwoLetterIsoCountryCode} %\end{definition} %This expands to 3166-1 and is used for the two-letter country codes. % -%\begin{definition} -%\ics{TwoLetterIsoLanguageCode} +%\begin{definition}[\DescribeMacro\TwoLetterIsoLanguageCode] +%\cs{TwoLetterIsoLanguageCode} %\end{definition} %This expands to 639-1 and is used for the two-letter root language codes. % -%\begin{definition} -%\ics{ThreeLetterIsoLanguageCode} +%\begin{definition}[\DescribeMacro\ThreeLetterIsoLanguageCode] +%\cs{ThreeLetterIsoLanguageCode} %\end{definition} %This expands to 639-2 and is used for the three-letter root language %codes. % +%\begin{definition}[\DescribeMacro\ThreeLetterExtIsoLanguageCode] +%\cs{ThreeLetterExtIsoLanguageCode} +%\end{definition} +%(New to v1.3.) This expands to 639-3. This code is only used for a root language if +%there's no 639-1 or 639-2 code. It may also be used for a +%dialect if a sub-language part has been set in the language +%tag parsed by \cs{TrackLanguageTag}. +% +%The \cs{Get\ldots} commands below are designed to be expandable. +%If the supplied \meta{dialect} is unrecognised they expand to empty. +%Remember that the dialect must first be identified as a tracked +%language for it to be recognised. +% +%As from v1.3, the language tag for a given dialect can be obtained +%using: +%\begin{definition}[\DescribeMacro\GetTrackedLanguageTag] +%\cs{GetTrackedLanguageTag}\marg{dialect} +%\end{definition} +%where \meta{dialect} is the label identifying the dialect. +%Uses the \texttt{und} (undetermined) code for unknown languages. +% +%As from v1.3, each tracked dialect may also have an associated +%modifier, which can be fetched using: +%\begin{definition}[\DescribeMacro\GetTrackedDialectModifier] +%\cs{GetTrackedDialectModifier}\marg{dialect} +%\end{definition} +%where \meta{dialect} is the label identifying the dialect. +%This value is typically obtained by parsing a POSIX locale identifier +%with \cs{TrackLocale} or \cs{TrackLangFromEnv} but may be set explicitly. +%(See \sectionref{sec:langsty} for setting this value. Likewise for +%the following commands.) +% +%You can test if a dialect has an associated modifier using: +%\begin{definition}[\DescribeMacro\IfHasTrackedDialectModifier] +%\cs{IfHasTrackedDialectModifier}\marg{dialect}\marg{true}\marg{false} +%\end{definition} +%If the dialect has an associated modifier this does \meta{true} +%otherwise it does \meta{false}. +% %For example: %\begin{verbatim} %\documentclass[british,francais,american,canadian,canadien,dutch]{article} @@ -405,6 +1600,125 @@ % %\end{quote} % +%As from v1.3, each tracked dialect may also have an associated +%variant, which can be fetched using: +%\begin{definition}[\DescribeMacro\GetTrackedDialectVariant] +%\cs{GetTrackedDialectVariant}\marg{dialect} +%\end{definition} +%where \meta{dialect} is the label identifying the dialect. +%This value is typically obtained by parsing a language tag +%with \cs{TrackLanguageTag} but may be set explicitly. +% +%You can test if a dialect has an associated variant using: +%\begin{definition}[\DescribeMacro\IfHasTrackedDialectVariant] +%\cs{IfHasTrackedDialectVariant}\marg{dialect}\marg{true}\marg{false} +%\end{definition} +% +%As from v1.3, each tracked dialect may also have an associated +%script, which can be fetched using: +%\begin{definition}[\DescribeMacro\GetTrackedDialectScript] +%\cs{GetTrackedDialectScript}\marg{dialect} +%\end{definition} +%where \meta{dialect} is the label identifying the dialect. +% +%You can test if a dialect has an associated script using: +%\begin{definition}[\DescribeMacro\IfHasTrackedDialectScript] +%\cs{IfHasTrackedDialectScript}\marg{dialect}\marg{true}\marg{false} +%\end{definition} +%If the dialect has an associated script this does \meta{true} +%otherwise it does \meta{false}. This information is provided +%for language packages that need to know what script is required, +%but there's no guarantee that the script will actually be set +%in the document. Similarly for all the other attributes described +%here. +% +%Note that the script should be a recognised four-letter ISO 15924 +%code, such as \texttt{Latn} or \texttt{Cyrl}. If a~dialect +%doesn't have an associated script then the default for the root +%language should be assumed. For example, \qt{Latn} for English dialects or +%\qt{Cyrl} for Russian dialects. (The default script for +%known languages can be obtained using +%\cs{TrackLangGetDefaultScript}, see +%\sectionref{sec:code:knownlangs} for further details. +%Most root languages have a default script, but there +%are a few without one as it may depend on region, politics +%or ideology.) +% +%There's a convenient expandable command for testing the script: +%\begin{definition} +%\cs{IfTrackedDialectIsScriptCs}\marg{dialect}\marg{cs}\marg{true}\marg{false} +%\end{definition} +%This tests if the given tracked dialect has an associated script and +%compares the value with the replacement text of \meta{cs}. +%If the dialect hasn't been explicitly assigned a script, +%then test is performed against the default script for the root +%language. +% +%The supplementary package \sty{tracklang-scripts} provides some +%additional commands relating to writing systems, including commands +%in the form \ics{TrackLangScript\meta{code}} where +%\meta{code} is the ISO 15924 four-letter code. If the dialect +%doesn't have an associated script, \meta{false} is done. +%This package isn't +%loaded automatically, so you'll need to explicitly load it. The +%generic code is in \texttt{tracklang-scripts.tex}: +%\begin{verbatim} +%\input tracklang-scripts +%\end{verbatim} +%There's a convenient \LaTeX\ wrapper \texttt{tracklang-scripts.sty}: +%\begin{verbatim} +%\usepackage{tracklang-scripts} +%\end{verbatim} +%See \sectionref{sec:tracklang-scripts.tex} for further details of +%that package. +% +%For example, the following defines a command to check if +%the given dialect should use a Latin script: +%\begin{verbatim} +%\input tracklang-scripts +%\def\islatin#1#2#3{% +% \IfTrackedDialectIsScriptCs{#1}{\TrackLangScriptLatn}{#2}{#3}% +%} +%\end{verbatim} +% +%\begin{important} +%Note that the script value doesn't mean that the document is +%actually using that script. It means that this is the user's +%\emph{desired} script, but whether that script is actually set relies +%on the appropriate settings in the relevant language package (such +%as \sty{polyglossia}'s \texttt{script} key). +%\end{important} +% +%As from v1.3, each tracked dialect may also have a sub-language +%identifier (for example, \texttt{arevela}), which can be fetched +%using: +%\begin{definition}[\DescribeMacro\GetTrackedDialectSubLang] +%\cs{GetTrackedDialectSubLang}\marg{dialect} +%\end{definition} +%where \meta{dialect} is the label identifying the dialect. +% +%You can test if a dialect has an associated sub-tag using: +%\begin{definition}[\DescribeMacro\IfHasTrackedDialectSubLang] +%\cs{IfHasTrackedDialectSubLang}\marg{dialect}\marg{true}\marg{false} +%\end{definition} +%If the dialect has an associated sub-tag this does \meta{true} +%otherwise it does \meta{false}. +% +%As from v1.3, each tracked dialect may also have additional +%information, which can be fetched using: +%\begin{definition}[\DescribeMacro\GetTrackedDialectAdditional] +%\cs{GetTrackedDialectAdditional}\marg{dialect} +%\end{definition} +%where \meta{dialect} is the label identifying the dialect. +% +%You can test if a dialect has additional information using: +%\begin{definition}[\DescribeMacro\IfHasTrackedDialectAdditional] +%\cs{IfHasTrackedDialectAdditional}\marg{dialect}\marg{true}\marg{false} +%\end{definition} +%If the dialect has additional information this does \meta{true} +%otherwise it does \meta{false}. +% +% %Most packages that implement multilingual support have a~set of %language definition files for each supported language or dialect. %It may be that only the root language is needed, if there are no @@ -425,53 +1739,137 @@ % %To help with this, \styfmt{tracklang} provides: %\begin{definition} -%\ics{IfTrackedLanguageFileExists}\marg{label}\meta{prefix}\marg{suffix}\marg{true part}\marg{false part} +%\ics{IfTrackedLanguageFileExists}\marg{dialect}\marg{prefix}\marg{suffix}\marg{true part}\marg{false part} %\end{definition} %This attempts to find the file called %\meta{prefix}\meta{tag}\meta{suffix} where \meta{tag} is determined -%from \meta{label}. If the file is found +%from \meta{dialect}. If the file is found %\begin{definition} %\ics{CurrentTrackedTag} %\end{definition} %is set to \meta{tag} and \meta{true part} is done, otherwise -%\meta{false part} is done. +%\meta{false part} is done. If this command +%is empty, then the dialect hasn't been detected. If the dialect +%has been detected, but no file can be found, then +%\ics{CurrentTrackedTag} is set to the final attempt at determining +%\meta{tag}. % -%The \meta{tag} is determined as follows: -%\begin{enumerate} -% \item If no dialect with the given label has been -% detected, the condition evaluates to \emph{false} and -% \ics{CurrentTrackedTag} is empty. +%There's a convenient shortcut command new to version 1.3: +%\begin{definition}[\DescribeMacro\TrackLangRequireDialect] +%\cs{TrackLangRequireDialect}\oarg{load code}\marg{pkgname}\marg{dialect} +%\end{definition} +%which uses \cs{IfTrackedLanguageFileExists} to input the resource +%file if found. The prefix is given by \meta{pkgname}\texttt{-} and +%the suffix is \texttt{.ldf}. A warning is issued if no resource file +%is found. Note that while it makes sense for \meta{pkgname} +%to be the same as the base name of the package that uses these +%resource files, they don't have to be the same. This command +%additionally defines +%\begin{definition}[\DescribeMacro\TrackLangRequireDialectPrefix] +%\cs{TrackLangRequireDialectPrefix} +%\end{definition} +%to \meta{pkgname}, which allows the prefix to be picked up by +%resource file commands, such as \cs{TrackLangProvidesResource} +%and \cs{TrackLangRequireResource}. (See below.) % -% \item If \meta{label} has an ISO~3166-1 code, then +%The optional argument \meta{load code} is the code that actually +%inputs the required file. This defaults to +%\begin{verbatim} +%\TrackLangRequireResource{\CurrentTrackedTag} +%\end{verbatim} +% +% +%The \ics{IfTrackedLanguageFileExists} command sets up the current +%tracked dialect with +%\ics{SetCurrentTrackedDialect}\marg{dialect}, which enables the following +%commands that may be used within \meta{true part} or \meta{false +%part}: %\begin{definition} -%\ics{CurrentTrackedRegion} +%\ics{CurrentTrackedDialect} %\end{definition} -% is set to that code otherwise it's empty. +%The dialect label. % -% \item If the file \meta{prefix}\meta{label}\meta{suffix} exists, -% \meta{tag} (\ics{CurrentTrackedTag}) is just \meta{label} and the -% condition evaluates to \emph{true}. -% -% \item The root language label is obtained and stored in %\begin{definition} %\ics{CurrentTrackedLanguage} %\end{definition} -% (This may or may not be the same as the original dialect -% \meta{label}.) +%If the dialect hasn't been detected, this command will be empty, +%otherwise it will expand to the root language label (which may +%be the same as the dialect label). +% +%\begin{definition} +%\ics{CurrentTrackedRegion} +%\end{definition} +%If the dialect hasn't been detected, this command will be empty. +%If the dialect has been assigned an ISO~3166-1 code, +%\ics{CurrentTrackedRegion} will expand to that code, otherwise it +%will be empty. % -% \item If the root language has an ISO~639-1 code, this code is -% fetched and stored in %\begin{definition} %\ics{CurrentTrackedIsoCode} %\end{definition} -% If the root language doesn't have an ISO~639-1 code, but does -% have an ISO~639-2 code, then this code is fetched and stored -% in \ics{CurrentTrackedIsoCode}. +%If the dialect hasn't been detected, this command will be empty. +%Otherwise it may be empty or it may expand to the +%ISO~639-1 or ISO~639-2 or ISO~639-3 code. % -% \item If there is no ISO~639-1 and no ISO~636-2 code: +%As from version 1.3, the following are also available, but +%don't contribute to the tag. +%\begin{definition} +%\ics{CurrentTrackedDialectModifier} +%\end{definition} +%The dialect's modifier or empty if not set. +% +%\begin{definition} +%\ics{CurrentTrackedDialectVariant} +%\end{definition} +%The dialect's variant or empty if not set. +% +%\begin{definition} +%\ics{CurrentTrackedDialectSubTag} +%\end{definition} +%The dialect's sub-language code or empty if not set. +% +%\begin{definition} +%\ics{CurrentTrackedDialectAdditional} +%\end{definition} +%The dialect's additional information or empty if not set. +% +%\begin{definition} +%\ics{CurrentTrackedLanguageTag} +%\end{definition} +%The dialect's language tag. Take care not to confuse this +%with \cs{CurrentTrackedTag}. +% +%\begin{definition} +%\ics{CurrentTrackedDialectScript} +%\end{definition} +%The dialect's script. If the +%dialect doesn't have the script set, the default script +%is used instead. For example, the file \texttt{foo-serbian.ldf} +%could test for the existence of the file +%\begin{verbatim} +%foo-serbian-\CurrentTrackedDialectScript.ldf +%\end{verbatim} +%and load it if it exists. The most convenient way is to +%use \cs{TrackLangRequestResource} (described below): +%\begin{verbatim} +%\TrackLangRequestResource +% {serbian-\CurrentTrackedDialectScript} +% {}% not found, set default code here +%\end{verbatim} +%The Cyrillic settings could then be placed in +%\texttt{foo-serbian-Cyrl.ldf} and the Latin settings in +%\texttt{foo-serbian-Latn.ldf}. +% +%The \meta{tag} is determined as follows: +%\begin{enumerate} +% \item If no dialect with the given label has been +% detected, the condition evaluates to \emph{false} and +% \ics{CurrentTrackedTag} is empty. +% +% \item If there is no language code (ISO~639-1 or 639-2 or 639-3): % % \begin{enumerate} -% \item If there is also no ISO~3166-1 code (\ics{CurrentTrackedRegion} +% \item If there's also no ISO~3166-1 code (\ics{CurrentTrackedRegion} % is empty), then \meta{tag} (\ics{CurrentTrackedTag}) is set to the % root language (\ics{CurrentTrackedLanguage}). If the file % \meta{prefix}\meta{tag}\meta{suffix} exists, the condition will evaluate to @@ -484,14 +1882,16 @@ % to \emph{false}. % \end{enumerate} % -% \item If \ics{CurrentTrackedRegion} is empty (no ISO~3166-1 code) -% then \meta{tag} (\ics{CurrentTrackedTag}) is set to just -% \ics{CurrentTrackedIsoCode} and if the file -% \meta{prefix}\meta{tag}\meta{suffix} exists, the condition will +% \item If \ics{CurrentTrackedRegion} is empty (no ISO~3166-1 +% territory code) +% then the \meta{tag} (\ics{CurrentTrackedTag}) is set to just +% \ics{CurrentTrackedIsoCode}. +% +% If the file \meta{prefix}\meta{tag}\meta{suffix} exists, the condition will % evaluate to \emph{true}. If the file doesn't exist and -% \ics{CurrentTrackedIsoCode} was set to the ISO~639-1 code, then -% the test will be repeated with the ISO~639-2 code. If that test -% also fails, then the condition evaluates to \emph{false}. +% there are additional ISO language codes available (639-2 or 639-3) +% then the test will be repeated for the next code. +% If the test still fails, then the condition evaluates to \emph{false}. % % \item\label{itm:lang-country} The \meta{tag} (\ics{CurrentTrackedTag}) is then set to %\begin{verbatim} @@ -504,12 +1904,11 @@ % just \ics{CurrentTrackedIsoCode}, and if the file % \meta{prefix}\meta{tag}\meta{suffix} exists, % the condition evaluates to \emph{true}. If the file doesn't exist -% and \ics{CurrentTrackedIsoCode} is set to the ISO~636-1 code and -% the language also has an ISO~636-2 code, then set -% \ics{CurrentTrackedIsoCode} to the ISO~636-2 code and go back to -% step~\ref{itm:lang-country}. +% and there are other ISO codes (639-2 or 639-3), +% then \ics{CurrentTrackedIsoCode} is set to the next available +% language code and step~\ref{itm:lang-country} is retried. % -% \item If there is an ISO~3166-1 code, the +% \item If there is an ISO~3166-1 region code, the % \meta{tag} (\ics{CurrentTrackedTag}) is then set to % \ics{CurrentTrackedRegion}, % and if the file \meta{prefix}\meta{tag}\meta{suffix} exists, @@ -522,48 +1921,7 @@ % %\end{enumerate} % -%The \ics{IfTrackedLanguageFileExists} command sets the following -%commands which may be used within \meta{true part} or \meta{false -%part}: -%\begin{definition} -%\ics{CurrentTrackedDialect} -%\end{definition} -%This command will always be set to the first argument of -%\ics{IfTrackedLanguageFileExists}. -% -%\begin{definition} -%\ics{CurrentTrackedTag} -%\end{definition} -%This command will be set to \meta{tag} if the file -%\meta{prefix}\meta{tag}\meta{suffix} is found. If this command -%is empty, then the dialect hasn't been detected. If the dialect -%has been detected, but no file can be found, then -%\ics{CurrentTrackedTag} is set to the final attempt at determining -%\meta{tag}. -% -%\begin{definition} -%\ics{CurrentTrackedLanguage} -%\end{definition} -%If the dialect hasn't been detected, this command will be empty, -%otherwise it will expand to the root language label (which may -%be the same as the dialect label). -% -%\begin{definition} -%\ics{CurrentTrackedRegion} -%\end{definition} -%If the dialect hasn't been detected, this command will be empty. -%If the dialect has been assigned an ISO~3166-1 code, -%\ics{CurrentTrackedRegion} will expand to that code, otherwise it -%will be empty. -% -%\begin{definition} -%\ics{CurrentTrackedIsoCode} -%\end{definition} -%If the dialect hasn't been detected, this command will be empty. -%Otherwise it may be empty or it may expand to either the -%ISO~639-1 or ISO~639-2 code (see above). -% -%For example: +%For example (pre v1.3): %\begin{verbatim} %\AnyTrackedLanguages %{% @@ -572,8 +1930,8 @@ % \IfTrackedLanguageFileExists{\ThisDialect}% % {mypackage-}% file prefix % {.ldf}% file suffix -% {\input{mypackage-\CurrentTrackedTag.ldf}}% file found -% {% not found +% {\input mypackage-\CurrentTrackedTag.ldf}% file found +% {% file not found % \PackageWarning{mypackage}{No support for language % `\ThisDialect'}% % }% @@ -582,6 +1940,20 @@ %{% no languages detected so use defaults %} %\end{verbatim} +%With version 1.3 onwards, this can be written more concisely as: +%\begin{verbatim} +%\AnyTrackedLanguages +%{% +% \ForEachTrackedDialect{\ThisDialect}% +% {% try to load the language file for this dialect +% \TrackLangRequireDialect{mypackage}{\ThisDialect}% +% }% +%} +%{% no languages detected so use defaults +%} +%\end{verbatim} +%which additionally enables the \styfmt{tracklang} version 1.3 commands described below, +%such as \cs{TrackLangRequireResource}. % %If, for example, \ics{ThisDialect} is \texttt{british}, then the file search will %be in the order: @@ -603,10 +1975,20 @@ %\item \texttt{mypackage-fra.ldf} %\item \texttt{mypackage-french.ldf} %\end{enumerate} -%This is because the predefined \texttt{francais} option has no region assigned to it. +%This is because the predefined \texttt{francais} option has no +%region assigned to it. Be careful if the dialect label is the actual +%root language. For example, if \cs{ThisDialect} is \texttt{french}, +%then the file search will be in the order: +%\begin{enumerate} +%\item \texttt{mypackage-french.ldf} +%\item \texttt{mypackage-fr.ldf} +%\item \texttt{mypackage-fra.ldf} +%\item \texttt{mypackage-french.ldf} +%\end{enumerate} +%Note that the last try will always fail in this case since if the +%file exists, it will be found on the first try. % -%Alternatively, if you're only providing support for the root -%languages: +%If you're only providing support for the root languages (pre v1.3): %\begin{verbatim} %\AnyTrackedLanguages %{% @@ -615,8 +1997,8 @@ % \IfTrackedLanguageFileExists{\ThisLanguage}% % {mypackage-}% file prefix % {.ldf}% file suffix -% {\input{mypackage-\CurrentTrackedTag.ldf}}% file found -% {% not found +% {\input mypackage-\CurrentTrackedTag.ldf}% file found +% {% file not found % \PackageWarning{mypackage}{No support for language % `\ThisLanguage'}% % }% @@ -625,454 +2007,314 @@ %{% no languages detected so use defaults %} %\end{verbatim} -% -%\subsection{Examples} -%\label{sec:examples} -% -%The examples in this section illustrate the above commands. -% -%\subsubsection{animals.sty} -%\label{sec:animals} -% -%This example is for a trivial package called \sty{animals.sty} -%that defines three textual commands: \cs{catname}, \cs{dogname} -%and \cs{ladybirdname}. The default values are: ``cat'', ``dog'' and -%``bishy-barney-bee''.\footnote{Thass Broad Norfolk, my bewties -%\texttt{:-P}} -% -%The supported languages are defined in files -%with the prefix \texttt{animals-} and the suffix \texttt{.ldf}. -% -%Here's the code for \texttt{animals.sty}: +%With version 1.3 onwards, this can be written more concisely as: %\begin{verbatim} -%\NeedsTeXFormat{LaTeX2e} -%\ProvidesPackage{animals} -% -%\RequirePackage{tracklang} -% -%\newcommand\catname{cat} -%\newcommand\dogname{dog} -%\newcommand\ladybirdname{bishy-barney-bee} -% %\AnyTrackedLanguages %{% -% \ForEachTrackedDialect{\this@dialect}{% -% \IfTrackedLanguageFileExists{\this@dialect}% -% {animals-}% prefix -% {.ldf}% -% {% -% \PackageInfo{animals}{Loading `animals-\CurrentTrackedTag.ldf' -% for language `\this@dialect'}% -% \input{animals-\CurrentTrackedTag.ldf}% -% }% -% {% -% \PackageWarning{animals}% -% {No support for language `\this@dialect'}% -% }% +% \ForEachTrackedLanguage{\ThisLanguage}% +% {% try to load the language file for this root language +% \TrackLangRequireDialect{mypackage}{\ThisLanguage}% % }% %} -%{% no tracked languages, default already set up +%{% no languages detected so use defaults %} -% -%\endinput %\end{verbatim} -%The \texttt{animals-english.ldf} file contains: -%\begin{verbatim} -%\providecommand*{\englishanimals}{% -% \renewcommand*{\catname}{cat}% -% \renewcommand*{\dogname}{dog}% -% \renewcommand*{\ladybirdname}{bishy-barney-bee}% -%} -%\englishanimals -%\end{verbatim} -%The \texttt{animals-en-GB.ldf} file contains: -%\begin{verbatim} -%\input{animals-english.ldf} +%which additionally enables the commands described below. +%Note that in this case, if more than one dialect for the same +%language has been tracked, only the hooks for the last dialect for +%that language will be adjusted, so it's usually best to iterate over +%the dialects. +% +%The following \cs{TrackLang\ldots Resource\ldots} commands may +%only be used in resource files that are loaded using +%\ics{TrackLangRequireDialect}. An error will occur if the file is +%input through some other method. +% +%Within the resource file +%\meta{pkgname}\texttt{-}\meta{tag}\texttt{.ldf}, +%you can identify the file using (new to version 1.3): +%\begin{definition}[\DescribeMacro\TrackLangProvidesResource] +%\cs{TrackLangProvidesResource}\marg{tag}\oarg{version info} +%\end{definition} % -%\providecommand*{\englishGBanimals}{% -% \englishanimals -% \renewcommand*{\ladybirdname}{ladybird}% -%} -%\englishGBanimals -%\end{verbatim} -%The \texttt{animals-en-US.ldf} file contains: -%\begin{verbatim} -%\input{animals-english.ldf} +%If \cs{ProvidesFile} is defined (through the \LaTeX\ kernel) this is +%used, otherwise a simplified generic alternative is used that's +%suitable for other \TeX\ formats. % -%\providecommand*{\englishUSanimals}{% -% \englishanimals -% \renewcommand*{\ladybirdname}{ladybug}% -%} -%\englishUSanimals +%The resource file can load another resource file +%\meta{pkgname}\texttt{-}\meta{tag2}\texttt{.ldf}, +%using (new to version 1.3): +%\begin{definition}[\DescribeMacro\TrackLangRequireResource] +%\cs{TrackLangRequireResource}\marg{tag2} +%\end{definition} +%For example, the dialect file \texttt{foo-en-GB.ldf} might need to +%load the root language resource file \texttt{foo-english.ldf}: +%\begin{verbatim} +%\TrackLangProvidesResource{en-GB} +%\TrackLangRequireResource{english} %\end{verbatim} +%If \texttt{foo-english.ldf} is also identified with +%\cs{TrackLangProvidesResource}, this will ensure that it's only +%loaded once. +% +%If you require the resource file and want to perform +%\meta{code1} if it's loaded at this point or \meta{code2} if it's +%already been loaded then you can use (new to version 1.3): +%\begin{definition}[\DescribeMacro\TrackLangRequireResourceOrDo] +%\cs{TrackLangRequireResourceOrDo}\marg{tag2}\marg{code1}\marg{code2} +%\end{definition} % -%This simple example doesn't try to use \sty{babel} or \sty{polyglossia}'s -%\cs{captions}\meta{language} mechanism, which means that if any -%users need to switch language part way through the document they -%will have to use \cs{englishanimals}, \cs{englishGBanimals} or -%\cs{englishUSanimals} to redefine the fixed names provided by this -%package. -% -%The other drawback to this package is that if the user -%requests both \texttt{british} (or \texttt{UKenglish}) and -%\texttt{american} (or \texttt{USenglish}), then the -%\texttt{animals-english.ldf} file is loaded twice, once by -%\texttt{animals-en-GB.ldf} and once by \texttt{animals-en-US.ldf}. -%This redundant input can be avoided by implementing a mechanism -%similar to \cs{RequirePackage}. The example package below, -%\texttt{animals2.sty} adds the following definitions: -%\begin{verbatim} -%\newcommand*{\RequireAnimalsLang}[1]{% -% \@ifundefined{ver@animals2-#1.ldf}{\input{animals2-#1.ldf}}{}% -%} -% -%\newcommand*{\ProvidesAnimalsLang}[1]{% -% \ProvidesFile{animals2-#1.ldf}% -%} -%\end{verbatim} -%Each \texttt{.ldf} file should now identify itself with -%\cs{ProvidesAnimalsLang} so it can then be loaded with -%\cs{RequireAnimalsLang}. The complete code for \texttt{animals2.sty} -%is now: +%If you want to load a resource file if it exists (without an +%error if it doesn't exist), then you can use +%\begin{definition}[\DescribeMacro\TrackLangRequestResource] +%\cs{TrackLangRequestResource}\marg{tag2}\marg{not found code} +%\end{definition} +%If the file doesn't exist, \meta{not found code} is done. +% +%\begin{important} +%Note that these \cs{\ldots}\texttt{Resource} commands are only +%permitted within the resource files. They are internally enabled +%through \cs{TrackLangRequireDialect}. +%\end{important} +% +%The above restriction on the resource files loaded through +%\cs{TrackLangRequireDialect}, and the fact that it internally uses +%\cs{IfTrackedLanguageFileExists}, means that commands like +%\cs{CurrentTrackedLanguage} or \cs{CurrentTrackedDialect} may be +%used in those files. This means that the name of the captions hook +%can be obtained through them. (Remember that the file +%\texttt{foo-en-GB.ldf} might have been loaded with, say, the +%\texttt{british} dialect or with the synonymous \texttt{UKenglish} +%dialect or with a dialect label that doesn't have a corresponding +%caption hook, such as \texttt{enGBLatn}.) +% +%The \sty{polyglossia} package has caption hooks in the form +%\cs{captions\meta{language}} whereas \sty{babel} has captions hooks +%in the form \cs{captions\meta{dialect}}. This leads to a rather +%cumbersome set of conditionals: %\begin{verbatim} -%\NeedsTeXFormat{LaTeX2e} -%\ProvidesPackage{animals2} -% -%\RequirePackage{tracklang} -% -%\newcommand\catname{cat} -%\newcommand\dogname{dog} -%\newcommand\ladybirdname{bishy-barney-bee} -% -%\newcommand*{\RequireAnimalsLang}[1]{% -% \@ifundefined{ver@animals2-#1.ldf}{\input{animals2-#1.ldf}}{}% -%} -% -%\newcommand*{\ProvidesAnimalsLang}[1]{% -% \ProvidesFile{animals2-#1.ldf}% -%} -% -%\AnyTrackedLanguages +%\ifcsundef{captions\CurrentTrackedLanguage} %{% -% \ForEachTrackedDialect{\this@dialect}{% -% \IfTrackedLanguageFileExists{\this@dialect}% -% {animals2-}% prefix -% {.ldf}% -% {% -% \RequireAnimalsLang{\CurrentTrackedTag}% -% }% -% {% -% \PackageWarning{animals2}% -% {No support for language `\this@dialect'}% +% \ifcsundef{captions\CurrentTrackedDialect}% +% {}% +% {% +% \csgappto{captions\CurrentTrackedDialect}{% +% % code to append to hook % }% % }% +%}% +%{% +% \csgappto{captions\CurrentTrackedLanguage}{% +% % code to append to hook +% }% %} -%{% no tracked languages, default already set up -%} -% -%\endinput -%\end{verbatim} -%The \texttt{animals2-english.ldf} file is now: -%\begin{verbatim} -%\ProvidesAnimalsLang{english} -% -%\providecommand*{\englishanimals}{% -% \renewcommand*{\catname}{cat}% -% \renewcommand*{\dogname}{dog}% -% \renewcommand*{\ladybirdname}{bishy-barney-bee}% -%} -%\englishanimals -%\end{verbatim} -%The \texttt{animals2-en-GB.ldf} file is now: -%\begin{verbatim} -%\ProvidesAnimalsLang{en-GB} -% -%\RequireAnimalsLang{english}% -% -%\providecommand*{\englishGBanimals}{% -% \englishanimals -% \renewcommand*{\ladybirdname}{ladybird}% -%} -%\englishGBanimals -%\end{verbatim} -%The \texttt{animals2-en-US.ldf} file is now: -%\begin{verbatim} -%\ProvidesAnimalsLang{en-US} -% -%\RequireAnimalsLang{english}% -% -%\providecommand*{\englishUSanimals}{% -% \englishanimals -% \renewcommand*{\ladybirdname}{ladybug}% -%} -% -%\englishUSanimals +%% do code now to initialise %\end{verbatim} -%Here's a sample document: -%\begin{verbatim} -%\documentclass[british,american,a4paper]{article} -% -%\usepackage{animals2} -% -%\begin{document} +%Note that the above has been simplified through the use of +%\sty{etoolbox} commands, which isn't suitable for generic use. +%It also doesn't query the mapping from \styfmt{tracklang}'s dialect +%label to the closest matching \sty{babel} dialect label. +% +%Instead (new to version 1.3), \styfmt{tracklang} provides a command +%to perform this set of conditionals using generic code: +%\begin{definition}[\DescribeMacro\TrackLangAddToHook] +%\cs{TrackLangAddToHook}\marg{code}\marg{type} +%\end{definition} +%where \meta{code} is the code to append to the \meta{type} hook. +%This always performs \meta{code} after testing for the hook in case +%the hook is undefined or has already been called (for example, \sty{ngerman} uses +%\cs{captionsngerman} when the package is loaded, not at the start of +%the document). +% +%Note that this command is enabled through +%\cs{TrackLangRequireDialect} so should only be used inside resource +%files. +% +%Since \texttt{captions} is a commonly used hook type, there's +%a~shortcut command provided: +%\begin{definition}[\DescribeMacro\TrackLangAddToCaptions] +%\cs{TrackLangAddToCaptions}\marg{code} +%\end{definition} +%This is equivalent to +%\cs{TrackLangAddToHook}\marg{code}\verb|{captions}|. % -%\englishGBanimals % -%\catname. -%\dogname. -%\ladybirdname. +%\section{Examples} +%\label{sec:examples} % -%\englishUSanimals +%The examples in this section illustrate the above commands. % -%\catname. -%\dogname. -%\ladybirdname. +%\subsection{animals.sty} +%\label{sec:animals} % -%\end{document} -%\end{verbatim} -%The transcript includes: -%\begin{verbatim} -%(./animals2.sty -%(./tracklang.sty) (./animals2-en-US.ldf (./animals2-english.ldf)) -%(./animals2-en-GB.ldf)) -%\end{verbatim} -%which shows that \texttt{animals2-english.ldf} is only input once. +%This example is for a trivial package called \sty{animals.sty} +%that defines three textual commands: \cs{catname}, \cs{dogname} +%and \cs{ladybirdname}. The default values are: \qt{cat}, \qt{dog} and +%\qt{bishy-barney-bee}.\footnote{Thass Broad Norfolk, my bewties +%\texttt{:-P}} % -%The next step is to integrate with \sty{babel} or -%\sty{polyglossia}. Both these packages use -%\cs{captions}\meta{language} to update fixed names whenever the -%given \meta{language} is selected. With \sty{babel} the -%\meta{language} setting is the dialect label (which may also be the -%root language label). With \sty{polyglossia} \meta{language} is the -%root language label, regardless of the selected variant. +%The supported languages are defined in files +%with the prefix \texttt{animals-} and the suffix \texttt{.ldf}. % -%For example, if you load \sty{babel} using: -%\begin{verbatim} -%\usepackage[UKenglish]{babel} -%\end{verbatim} -%then \cs{captionsUKenglish} is defined but if you use: +%Here's the code for \texttt{animals.sty}: %\begin{verbatim} -%\usepackage[british]{babel} +% \NeedsTeXFormat{LaTeX2e} +% \ProvidesPackage{animals} +% +% \RequirePackage{tracklang}[2016/10/07] %v1.3 +% +% % Any undeclared options are language settings: +% \DeclareOption*{\TrackLanguageTag{\CurrentOption}} +% \ProcessOptions +% +% % Default definitions +% \newcommand\catname{cat} +% \newcommand\dogname{dog} +% \newcommand\ladybirdname{bishy-barney-bee} +% +% \AnyTrackedLanguages +% {% +% \ForEachTrackedDialect{\this@dialect}{% +% \TrackLangRequireDialect{animals}{\this@dialect}% +% }% +% } +% {% no tracked languages, default already set up +% } +% +% \endinput %\end{verbatim} -%then \cs{captionsbritish} is defined instead. If, however, you load -%\sty{polyglossia} using: +%Here's a Plain \TeX\ version that picks up the language from the +%locale environment variable: %\begin{verbatim} -%\usepackage{polyglossia} -%\setmainlanguage[variant=british]{english} +% \input tracklang +% +% \TrackLangFromEnv +% +% % Default definitions +% \def\catname{cat} +% \def\dogname{dog} +% \def\ladybirdname{bishy-barney-bee} +% +% \AnyTrackedLanguages +% {% +% \ForEachTrackedDialect{\thisdialect}{% +% \TrackLangRequireDialect{animals}{\thisdialect}% +% }% +% } +% {% no tracked languages, default already set up +% } %\end{verbatim} -%then \cs{captionsenglish} is defined. -% -%This just requires a few minor modifications to the above example -%package. Remember that the \texttt{.ldf} files are loaded within -%\ics{IfTrackedLanguageFileExists}, which means that the dialect label -%can be obtained from \ics{CurrentTrackedDialect}. To allow for the -%possibility of loading a language file at some later date, -%\ics{IfTrackedLanguageFile} can be moved to a new user command: +%In the event that a user or supplementary package for some +%reason wants to load a resource +%file for a language that hasn't been tracked, it might be worth +%providing a command for this purpose: %\begin{verbatim} %\newcommand*{\RequireAnimalsDialect}[1]{% -% \IfTrackedLanguageFileExists{#1}% -% {animals3-}% prefix -% {.ldf}% -% {% -% \RequireAnimalsLang{\CurrentTrackedTag}% -% }% -% {% -% \PackageWarning{animals3}% -% {No support for language `#1'}% -% }% +% \TrackLangRequireDialect{animals}{#1}% %} %\end{verbatim} -%Now \texttt{animals3-en-GB.ldf} and \texttt{animals3-en-US.ldf} can -%use \ics{CurrentTrackedDialect} to add to the language captions mechanism. -%The file \texttt{animals3-en-GB.ldf} contains: +%The loop can then be changed to: %\begin{verbatim} -%\ProvidesAnimalsLang{en-GB} +% \ForEachTrackedDialect{\this@dialect}{% +% \RequireAnimalsDialect\this@dialect +% }% +%\end{verbatim} % -%\RequireAnimalsLang{english}% +%The \texttt{animals-english.ldf} file valid for both the Plain \TeX\ +%and \LaTeX\ formats contains: +%\begin{verbatim} +%\TrackLangProvidesResource{english} % -%\providecommand*{\englishGBanimals}{% -% \englishanimals -% \renewcommand*{\ladybirdname}{ladybird}% +%\def\englishanimals{% +% \def\catname{cat}% +% \def\dogname{dog}% +% \def\ladybirdname{bishy-barney-bee}% %} % -%\englishGBanimals -% -%\@ifundefined{captions\CurrentTrackedDialect} -%{% -% \@ifundefined{captions\CurrentTrackedLanguage}{}% -% {% -% \expandafter\g@addto@macro -% \csname captions\CurrentTrackedLanguage\endcsname{\englishGBanimals}% -% } -%}% -%{% -% \expandafter\g@addto@macro -% \csname captions\CurrentTrackedDialect\endcsname{\englishGBanimals}% -%} +%\TrackLangAddToCaptions{\englishanimals} %\end{verbatim} -%The file \texttt{animals3-en-GB.ldf} contains: +%The \texttt{animals-en-GB.ldf} file contains: %\begin{verbatim} -%\ProvidesAnimalsLang{en-US} -% -%\RequireAnimalsLang{english}% +%\TrackLangProvidesResource{en-GB} +%\TrackLangRequireResource{english} % -%\providecommand*{\englishUSanimals}{% +%\def\enGBanimals{% % \englishanimals -% \renewcommand*{\ladybirdname}{ladybug}% -%} -% -%\englishUSanimals -% -%\@ifundefined{captions\CurrentTrackedDialect}% -%{% -% \@ifundefined{captions\CurrentTrackedLanguage}{}% -% {% -% \expandafter\g@addto@macro -% \csname captions\CurrentTrackedLanguage\endcsname{\englishUSanimals}% -% } -%}% -%{% -% \expandafter\g@addto@macro -% \csname captions\CurrentTrackedDialect\endcsname{\englishUSanimals}% +% \def\ladybirdname{ladybird}% %} +%\TrackLangAddToCaptions{\enGBanimals} %\end{verbatim} -%The inner \cs{@ifundefined} check is required in case -%\sty{polyglossia} has been loaded, although this causes some -%redundancy as \cs{captionsenglish} now contains both -%\cs{englishanimals} and \cs{englishGBanimals} (or -%\cs{englishUSanimals}). -% -%The root language file \texttt{animals3-english.ldf} contains: +%The \texttt{animals-en-US.ldf} file contains: %\begin{verbatim} -%\ProvidesAnimalsLang{english} +%\TrackLangProvidesResource{en-US} +%\TrackLangRequireResource{english} % -%\providecommand*{\englishanimals}{% -% \renewcommand*{\catname}{cat}% -% \renewcommand*{\dogname}{dog}% -% \renewcommand*{\ladybirdname}{bishy-barney-bee}% -%} -% -%\englishanimals -% -%\@ifundefined{captionsenglish}% -%{% -% \@ifundefined{captions\CurrentTrackedDialect}{}% -% {% -% \expandafter\g@addto@macro -% \csname captions\CurrentTrackedDialect\endcsname{\englishanimals}% -% } -%}% -%{% -% \g@addto@macro\captionsenglish{\englishanimals}% +%\def\enUSanimals{% +% \englishanimals +% \def\ladybirdname{ladybug}% %} +%\TrackLangAddToCaptions{\enUSanimals} %\end{verbatim} -%The additional \cs{@ifundefined} check ensures that the package -%will work with other English dialects (although it may not produce -%the correct translations for the given region). You'll have to -%decide on the most appropriate default translations for the -%root language given no regional information. -% -%The complete code for the \texttt{animals3.sty} package is as -%follows: +%Here's a German version in the file \texttt{animals-german.ldf}: %\begin{verbatim} -%\NeedsTeXFormat{LaTeX2e} -%\ProvidesPackage{animals3} -% -%\RequirePackage{tracklang} -% -%\newcommand\catname{cat} -%\newcommand\dogname{dog} -%\newcommand\ladybirdname{bishy-barney-bee} +%\TrackLangProvidesResource{german} % -%\newcommand*{\RequireAnimalsDialect}[1]{% -% \IfTrackedLanguageFileExists{#1}% -% {animals3-}% prefix -% {.ldf}% -% {% -% \RequireAnimalsLang{\CurrentTrackedTag}% -% }% -% {% -% \PackageWarning{animals3}% -% {No support for language `#1'}% -% }% -%} -% -%\newcommand*{\RequireAnimalsLang}[1]{% -% \@ifundefined{ver@animals3-#1.ldf}{\input{animals3-#1.ldf}}{}% -%} -% -%\newcommand*{\ProvidesAnimalsLang}[1]{% -% \ProvidesFile{animals3-#1.ldf}% +%\def\germananimals{% +% \def\catname{Katze}% +% \def\dogname{Hund}% +% \def\ladybirdname{Marienk\"afer}% %} % -%\AnyTrackedLanguages -%{% -% \ForEachTrackedDialect{\this@dialect}{% -% \RequireAnimalsDialect\this@dialect -% }% -%} -%{% no tracked languages, default already set up -%} -% -%\endinput +%\TrackLangAddToCaptions{\germananimals} %\end{verbatim} % -%Here's sample document that uses this package with \sty{babel}: -%\begin{verbatim} -%\documentclass[a4paper]{article} +%This means that if \sty{babel} or \sty{polyglossia} are loaded, the +%redefinitions are automatically performed whenever the language is +%changed, but if there's no caption mechanism the user can switch +%the fixed names using the \cs{\ldots animals} commands. % -%\usepackage[british,american]{babel} +%Here's an example \LaTeX\ document that doesn't have any caption +%hooks: +%\begin{verbatim} +%\documentclass[english,german,a4paper]{article} % -%\usepackage{animals3} +%\usepackage{animals} % %\begin{document} -% -%\selectlanguage{british} +%\englishanimals % %\catname. %\dogname. %\ladybirdname. % -%\selectlanguage{american} +%\germananimals % %\catname. %\dogname. %\ladybirdname. -% %\end{document} %\end{verbatim} -% -%Unfortunately when used with \sty{polyglossia}, \styfmt{tracklang} can't -%detect the requested dialect. Consider the following example -%document: +%Here's a \sty{babel} example document: %\begin{verbatim} -%\documentclass[a4paper]{article} -% -%\usepackage{polyglossia} -%\setmainlanguage[variant=british]{english} +%\documentclass[american,german,british,a4paper]{article} % -%\usepackage{animals3} +%\usepackage{babel} +%\usepackage{animals} % %\begin{document} +%\selectlanguage{american} % %\catname. %\dogname. %\ladybirdname. % -%\end{document} -%\end{verbatim} -%This loads \texttt{animals3-english.ldf} but doesn't load -%\texttt{animals3-en-GB.ldf}. The dialect has to be added to the -%document class options: -%\begin{verbatim} -%\documentclass[british,a4paper]{article} +%\selectlanguage{german} % -%\usepackage{polyglossia} -%\setmainlanguage[variant=british]{english} -% -%\usepackage{animals3} +%\catname. +%\dogname. +%\ladybirdname. % -%\begin{document} +%\selectlanguage{british} % %\catname. %\dogname. @@ -1081,102 +2323,78 @@ %\end{document} %\end{verbatim} % -%Other languages can be added by simply providing additional -%\texttt{.ldf} files. For example, \texttt{animals3-german.ldf}: +%There is some redundancy with the above resource files. Consider the +%\sty{babel} example above. The \texttt{american} dialect is the +%first option, so in that case \texttt{animals-en-US.ldf} is loaded +%followed by \texttt{animals-english.ldf}. This means that the +%\cs{captionsamerican} hook now includes %\begin{verbatim} -%\ProvidesAnimalsLang{german} -% -%\providecommand*{\germananimals}{% -% \renewcommand*{\catname}{Katze}% -% \renewcommand*{\dogname}{Hund}% -% \renewcommand*{\ladybirdname}{Marienk\"afer}% -%} -% -%\germananimals -% -%\@ifundefined{captionsgerman}% -%{% -% \@ifundefined{captions\CurrentTrackedDialect}{}% -% {% -% \expandafter\g@addto@macro -% \csname captions\CurrentTrackedDialect\endcsname{\germananimals}% -% } -%}% -%{% -% \g@addto@macro\captionsgerman{\germananimals}% -%} +%\englishanimals +%\enUSanimals %\end{verbatim} -% -%This works fine with \sty{babel}: +%Since \cs{enUSanimals} includes \cs{englishanimals}, there is +%redundant code. However, when the \texttt{british} dialect is +%processed, this loads the file \texttt{animals-en-GB.ldf} but not +%the file \texttt{animals-english.ldf} (since it's already been loaded). This +%means that \cs{captionsbritish} contains \cs{enGBanimals} but not +%\cs{englishanimals}. +% +%If this redundancy is an issue (for example, there are so many +%redefinitions needed that it significantly slows the document build +%process), then it can be addressed with the following modifications. +%The \texttt{animals-en-GB.ldf} file is now: %\begin{verbatim} -%\documentclass[a4paper]{article} -% -%\usepackage[ngerman]{babel} -% -%\usepackage{animals3} -% -%\begin{document} +%\TrackLangProvidesResource{en-GB} % -%\catname. -%\dogname. -%\ladybirdname. +%\def\enGBanimals{% +% \englishanimals +% \def\ladybirdname{ladybird}% +%} % -%\end{document} +%\TrackLangRequireResourceOrDo{english}% +%{ +% \TrackLangAddToCaptions{% +% \def\ladybirdname{ladybird}% +% }% +%} +%{ +% \TrackLangAddToCaptions{\enGBanimals} +%} %\end{verbatim} -%It also works with \sty{ngerman}: +%The \texttt{animals-en-US.ldf} file is now: %\begin{verbatim} -%\documentclass[a4paper]{article} -% -%\usepackage{ngerman} -% -%\usepackage{animals3} +%\TrackLangProvidesResource{en-US} % -%\begin{document} -% -%\catname. -%\dogname. -%\ladybirdname. +%\providecommand*{\enUSanimals}{% +% \englishanimals +% \renewcommand*{\ladybirdname}{ladybug}% +%} % -%\end{document} +%\TrackLangRequireResourceOrDo{english} +%{ +% \TrackLangAddToCaptions{% +% \renewcommand*{\ladybirdname}{ladybird}% +% }% +%} +%{ +% \TrackLangAddToCaptions{\enUSanimals}{captions} +%} %\end{verbatim} -%and with \sty{translator}: +%This means that the document that has the dialects listed in the +%order \texttt{american}, \texttt{british} now has %\begin{verbatim} -%\documentclass[a4paper]{article} -% -%\usepackage[ngerman]{translator} -% -%\usepackage{animals3} -% -%\begin{document} -% -%\catname. -%\dogname. -%\ladybirdname. -% -%\end{document} +%\englishanimals +%\def\ladybirdname{ladybird} %\end{verbatim} +%in the \cs{captionsbritish} hook and just \cs{enUSanimals} in the +%\cs{captionsamerican} hook, which has removed most of the redundancy. % -%Since no regional variants have been provided to accompany -%\texttt{animals3-german.ldf} this also works fine with -%\sty{polyglossia}: -%\begin{verbatim} -%\documentclass[a4paper]{article} +%Note that \sty{polyglossia} has a \cs{captionsenglish} hook but not +%\cs{captionsamerican} or \cs{captionsbritish}, so this code doesn't +%allow for switching between variants of the same language with +%\sty{polyglossia}. % -%\usepackage{polyglossia} -%\setmainlanguage{german} -% -%\usepackage{animals3} -% -%\begin{document} -% -%\catname. -%\dogname. -%\ladybirdname. -% -%\end{document} -%\end{verbatim} -% -%\subsubsection{regions.sty} +%\subsection{regions.sty} %\label{sec:regions} % %Earlier, I~mentioned the search order for @@ -1207,12 +2425,40 @@ %language and region combination, but this would result in a lot %redundancy. % +%\cs{TrackLangRequireDialect} has an optional argument for adjusting +%the way the resource files are loaded. Suppose I have +%\texttt{regions-}\meta{tag}\texttt{.ldf} resource files, then +%\begin{verbatim} +%\TrackLangRequireDialect{regions}{\this@dialect} +%\end{verbatim} +%loads the resource file for the dialect given by \cs{this@dialect} +%using +%\begin{verbatim} +%\TrackLangRequireResource{\CurrentTrackedTag} +%\end{verbatim} +%I can use the optional argument to also load the resource file for the +%root language as well: +%\begin{verbatim} +%\newcommand*{\RequireRegionsDialect}[1]{% +% \TrackLangRequireDialect +% [\TrackLangRequireResource{\CurrentTrackedTag}% +% \TrackLangRequireResource{\CurrentTrackedLanguage}% +% ]% +% {regions}{#1}% +%} +%\end{verbatim} +%Now the dialect \texttt{british} can load both +%\texttt{regions-GB.ldf} and \texttt{regions-english.ldf}. +% %The example package (\texttt{regions.sty}) below illustrates this. %\begin{verbatim} %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{regions} % -%\RequirePackage{tracklang} +%\RequirePackage{tracklang}[2016/10/07] +% +%\DeclareOption*{\TrackLanguageTag{\CurrentOption}} +%\ProcessOptions % %\newcommand*{\weightunit}{kg} %\newcommand*{\lengthunit}{mm} @@ -1220,27 +2466,18 @@ % %\newcommand*{\unitname}{units} % +%\newcommand*{\RequireRegionsDialect}[1]{% +% \TrackLangRequireDialect +% [\TrackLangRequireResource{\CurrentTrackedTag}% +% \TrackLangRequireResource{\CurrentTrackedLanguage}% +% ]% +% {regions}{#1}% +%} +% %\AnyTrackedLanguages %{% % \ForEachTrackedDialect{\this@dialect}{% -% \IfTrackedLanguageFileExists{\this@dialect}% -% {regions-}% prefix -% {.ldf}% -% {% -% \PackageInfo{regions}{Loading `regions-\CurrentTrackedTag.ldf' -% for language `\this@dialect'}% -% \input{regions-\CurrentTrackedTag.ldf}% -% \InputIfFileExists{regions-\CurrentTrackedLanguage.ldf}% -% {}% -% {% -% \PackageWarning{regions}{No support for language -% `\CurrentTrackedLanguage'}% -% }% -% }% -% {% -% \PackageWarning{regions}% -% {No support for language `\this@dialect'}% -% }% +% \RequireRegionsDialect\this@dialect % }% %} %{% no tracked languages, default already set up @@ -1254,85 +2491,101 @@ %\begin{itemize} %\item \texttt{regions-BE.ldf} (Belgium): %\begin{verbatim} +%\TrackLangProvidesResource{BE} +% %\providecommand*{\BEunits}{% % \renewcommand*{\weightunit}{kg}% % \renewcommand*{\lengthunit}{mm}% % \renewcommand*{\currencyunit}{EUR}% %} % -%\BEunits +%\TrackLangAddToCaptions{\BEunits} %\end{verbatim} % %\item \texttt{regions-CA.ldf} (Canada): %\begin{verbatim} +%\TrackLangProvidesResource{CA} +% %\providecommand*{\CAunits}{% % \renewcommand*{\weightunit}{kg}% % \renewcommand*{\lengthunit}{mm}% % \renewcommand*{\currencyunit}{CAD}% %} % -%\CAunits +%\TrackLangAddToCaptions{\CAunits} %\end{verbatim} % %\item \texttt{regions-GB.ldf} (Great Britain): %\begin{verbatim} +%\TrackLangProvidesResource{GB} +% %\providecommand*{\GBunits}{% % \renewcommand*{\weightunit}{kg}% % \renewcommand*{\lengthunit}{mm}% % \renewcommand*{\currencyunit}{GBP}% %} % -%\GBunits +%\TrackLangAddToCaptions{\GBunits} %\end{verbatim} % %\item \texttt{regions-US.ldf} (USA): %\begin{verbatim} +%\TrackLangProvidesResource{US} +% %\providecommand*{\USunits}{% % \renewcommand*{\weightunit}{lb}% % \renewcommand*{\lengthunit}{in}% % \renewcommand*{\currencyunit}{USD}% %} % -%\USunits +%\TrackLangAddToCaptions{\USunits} %\end{verbatim} %\end{itemize} -%Now follow the language files. +%Now the language files: % %\begin{itemize} %\item \texttt{regions-dutch.ldf}: %\begin{verbatim} +%\TrackLangProvidesResource{dutch} +% %\providecommand*{\dutchnames}{% % \renewcommand*{\unitname}{meeteenheden}% %} % -%\dutchnames +%\TrackLangAddToCaptions{\dutchnames} %\end{verbatim} % %\item \texttt{regions-english.ldf}: %\begin{verbatim} +%\TrackLangProvidesResource{english} +% %\providecommand*{\englishnames}{% % \renewcommand*{\unitname}{units}% %} % -%\englishnames +%\TrackLangAddToCaptions{\englishnames} %\end{verbatim} % %\item \texttt{regions-french.ldf}: %\begin{verbatim} +%\TrackLangProvidesResource{french} +% %\providecommand*{\frenchnames}{% % \renewcommand*{\unitname}{unit\'es}% %} % -%\frenchnames +%\TrackLangAddToCaptions{\frenchnames} %\end{verbatim} % %\item \texttt{regions-german.ldf}: %\begin{verbatim} +%\TrackLangProvidesResource{french} +% %\providecommand*{\germannames}{% % \renewcommand*{\unitname}{Ma\ss einheiten}% %} % -%\germannames +%\TrackLangAddToCaptions{\germannames} %\end{verbatim} %\end{itemize} % @@ -1349,21 +2602,22 @@ %\end{document} %\end{verbatim} % -%This works because \cs{IfTrackedLanguageFileExists} searches for the -%country code before the root language label. In this case, +%This works because the \meta{tag} search looks for the +%country code before the root language label. However, this will fail if +%the dialect label is the same as a root language label that has an +%associated territory, marked with \fnregion\ in +%\tableref{tab:rootlangopts}, as then it will be picked up before the +%country code. +% +%In the above example, %\texttt{regions-CA.ldf} is matched rather than %\texttt{regions-french.ldf}, so \texttt{regions-CA.ldf} is loaded by %\begin{verbatim} -% \input{regions-\CurrentTrackedTag.ldf}% +%\TrackLangRequireResource{\CurrentTrackedTag} %\end{verbatim} %After this, the language file \texttt{regions-french.ldf} is then loaded: %\begin{verbatim} -% \InputIfFileExists{regions-\CurrentTrackedLanguage.ldf}% -% {}% -% {% -% \PackageWarning{regions}{No support for language -% `\CurrentTrackedLanguage'}% -% }% +%\TrackLangRequireResource{\CurrentTrackedLanguage} %\end{verbatim} % %This assumes that there's a country code \texttt{.ldf} file @@ -1373,6 +2627,10 @@ %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{regions} % +%% Pass all options to tracklang: +%\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{tracklang}} +%\ProcessOptions +% %\RequirePackage{tracklang} % %\newcommand*{\weightunit}{kg} @@ -1387,31 +2645,22 @@ % \renewcommand*{\currencyunit}{EUR}% %} % -%\AnyTrackedLanguages -%{% -% \ForEachTrackedDialect{\this@dialect}{% -% \IfTrackedLanguageFileExists{\this@dialect}% -% {regions-}% prefix -% {.ldf}% -% {% -% \PackageInfo{regions}{Loading `regions-\CurrentTrackedTag.ldf' -% for language `\this@dialect'}% -% \input{regions-\CurrentTrackedTag.ldf}% +%\newcommand*{\RequireRegionsDialect}[1]{% +% \TrackLangRequireDialect +% [\TrackLangRequireResource{\CurrentTrackedTag}% % \ifx\CurrentTrackedTag\CurrentTrackedLanguage -% \defaultunits +% \TrackLangAddToCaptions{\defaultunits}% % \else -% \InputIfFileExists{regions-\CurrentTrackedLanguage.ldf}% -% {}% -% {% -% \PackageWarning{regions}{No support for language -% `\CurrentTrackedLanguage'}% -% }% +% \TrackLangRequireResource{\CurrentTrackedLanguage}% % \fi -% }% -% {% -% \PackageWarning{regions}% -% {No support for language `\this@dialect'}% -% }% +% ]% +% {regions}{#1}% +%} +% +%\AnyTrackedLanguages +%{% +% \ForEachTrackedDialect{\this@dialect}{% +% \RequireRegionsDialect\this@dialect % }% %} %{% no tracked languages, default already set up @@ -1419,198 +2668,530 @@ % %\endinput %\end{verbatim} +%Note that we still have a problem for dialect labels that are +%identical to root language labels with an associated territory (such +%as \pkgopt{manx}). This case can be checked with the following +%adjustment: +%\begin{verbatim} +%\newcommand*{\RequireRegionsDialect}[1]{% +% \TrackLangRequireDialect +% [\TrackLangRequireResource{\CurrentTrackedTag}% +% \ifx\CurrentTrackedTag\CurrentTrackedLanguage +% \ifx\CurrentTrackedRegion\empty +% \TrackLangAddToCaptions{\defaultunits}% +% \else +% \TrackLangRequireResource{\CurrentTrackedRegion}% +% \fi +% \else +% \TrackLangRequireResource{\CurrentTrackedLanguage}% +% \fi +% ]% +% {regions}{#1}% +%} +%\end{verbatim} +%In the case where both the dialect and root language label are +%\texttt{manx} with the resource files \texttt{regions-manx.ldf} +%and \texttt{regions-IM.ldf}, then \cs{CurrentTrackedTag} will be +%\texttt{manx} (the dialect label) so \texttt{regions-manx.ldf} will +%be loaded with: +%\begin{verbatim} +%\TrackLangRequireResource{\CurrentTrackedTag} +%\end{verbatim} +%In this case \cs{CurrentTrackedRegion} is \texttt{IM} (that is, it's +%not empty) so then \texttt{regions-IM.ldf} will be loaded with: +%\begin{verbatim} +%\TrackLangRequireResource{\CurrentTrackedRegion} +%\end{verbatim} % -%As with the trivial example in the previous section, this package -%hasn't hooked into \sty{babel}'s caption mechanism, but this can be -%implemented for this example in a similar manner to the final -%example package in the previous section. +%Here's another document that sets up dialects with +%\styfmt{tracklang} labels that aren't recognised by \sty{babel}. +%This means that there's no corresponding \cs{captions\ldots} hook +%for either the dialect label or the root language label, +%so mappings need to be defined from the \styfmt{tracklang} dialect +%label to the matching \sty{babel} dialect label. % -%\section{Adding Support for Language Tracking} -%\label{sec:langsty} +%\begin{verbatim} +%\documentclass{article} % -%If you are writing a package that \emph{defines} languages (rather -%than a package that provides multilingual support if the user has -%already loaded a language package) then you can load \styfmt{tracklang} -%and use the commands below to help other packages track your -%defined languages. +%\usepackage{tracklang} % -%You can notify \styfmt{tracklang} that a user has requested a -%particular dialect using: -%\begin{definition} -%\ics{AddTrackedDialect}\marg{dialect}\marg{root language label} -%\end{definition} -%where \meta{dialect} is the dialect label and \meta{root language -%label} is the label for the dialect's root language. This command -%may also be used for synonyms. If the dialect is already in the -%tracked dialect list, it won't be added again. If the root language -%is already in the tracked language list, it won't be added again. +%\TrackLanguageTag{de-US-1996} +%\SetTrackedDialectLabelMap{\TrackLangLastTrackedDialect}{ngerman} % -%\begin{definition} -%\ics{AddTrackedLanguage}\marg{root language label} -%\end{definition} -%This is equivalent to \ics{AddTrackedDialect}\marg{root language -%label}\marg{root language label} and is provided for the cases -%where the language doesn't have any variants or the user -%wants the default variant for that language. +%\TrackLanguageTag{en-MT} +%\SetTrackedDialectLabelMap{\TrackLangLastTrackedDialect}{UKenglish} % -%The ISO codes are specified using: -%\begin{definition} -%\ics{AddTrackedIsoLanguage}\marg{code type}\marg{code}\marg{label} -%\end{definition} -%where \meta{code type} is the ISO code type (for example, 639-1), -%\meta{code} is the code (for example, ``en'') and \meta{label} is -%the language or dialect label. (The root language label for -%ISO~639-1 or ISO~639-2, and the dialect label for the country -%code ISO~3166-1.) +%\usepackage[main=ngerman,UKenglish]{babel} +%\usepackage{regions} % -%For example: +%\begin{document} +%\selectlanguage{ngerman} +% +%\unitname: \weightunit, \lengthunit, \currencyunit. +% +%\selectlanguage{UKenglish} +% +%\unitname: \weightunit, \lengthunit, \currencyunit. +% +%\end{document} +%\end{verbatim} +%This produces: +%\begin{quote} +%Ma\ss einheiten: lb, in, USD. +% +%units: kg, mm, EUR. +%\end{quote} +%Compare this with: %\begin{verbatim} -%\ProvidesPackage{alien} +%\documentclass{article} % -%\RequirePackage{tracklang} +%\usepackage[main=ngerman,UKenglish]{babel} +%\usepackage{regions} % -%\DeclareOption{martian}{% -% \AddTrackedLanguage{martian}% -% \AddTrackedIsoLanguage{639-1}{xx}{martian}% -% % code to set Martian language -%} +%\begin{document} +%\selectlanguage{ngerman} % -%\DeclareOption{uppermartian}{% -% \AddTrackedDialect{uppermartian}{martian}% -% \AddTrackedIsoLanguage{639-1}{xx}{martian}% -% \AddTrackedIsoLanguage{3166-1}{XX}{uppermartian}% -% % code to set Upper Martian dialect -%} +%\unitname: \weightunit, \lengthunit, \currencyunit. % -%\DeclareOption{lowermartian}{% -% \AddTrackedDialect{lowermartian}{martian}% -% \AddTrackedIsoLanguage{639-1}{xx}{martian}% -% \AddTrackedIsoLanguage{3166-1}{YY}{lowermartian}% -% % code to set Lower Martian dialect -%} +%\selectlanguage{UKenglish} +% +%\unitname: \weightunit, \lengthunit, \currencyunit. +% +%\end{document} %\end{verbatim} +%which produces: +%\begin{quote} +%Ma\ss einheiten: kg, mm, EUR. % -%Now other package writers who want to provide support -%for the Martian dialects can easily detect which language options -%the user requested through your package, and it means the user -%doesn't have to specify all their language options through the -%document class or through each package that has multilingual -%support. +%units: kg, mm, GBP. +%\end{quote} % -%If you want to track one of the dialects known to -%\styfmt{tracklang} (for example, ``british'') you can do so -%using: -%\begin{definition} -%\ics{TrackPredefinedDialect}\marg{dialect label} -%\end{definition} -%This will add the dialect and the ISO codes. -%(See \texttt{tracklang.tex}, \sectionref{sec:predefined}, -%for all predefined options. These are all the control sequences in the form -%\cs{@tracklang@add@}\meta{dialect label}.) +%Note that these mappings aren't needed if \sty{babel} +%is loaded with the root language labels instead. For example: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{tracklang} +% +%\TrackLanguageTag{de-US-1996} +%\SetTrackedDialectLabelMap{\TrackLangLastTrackedDialect}{ngerman} +% +%\TrackLanguageTag{en-MT} +% +%\usepackage[main=ngerman,english]{babel} +%\usepackage{regions2} +% +%\begin{document} +%\selectlanguage{ngerman} +% +%\unitname: \weightunit, \lengthunit, \currencyunit. +% +%\selectlanguage{english} +% +%\unitname: \weightunit, \lengthunit, \currencyunit. +% +%\end{document} +%\end{verbatim} +%No mapping is required for the \texttt{en-MT} locale as +%it can pick up \cs{captionsenglish} when \cs{TrackLangAddToHook} +%(used by \cs{TrackLangAddToCaptions}) +%queries the root language label after failing to find the +%language hook from the dialect label. +% +%Some of the predefined \styfmt{tracklang} dialects come with +%a mapping to the closest matching \sty{babel} dialect label. +%For example, the option \pkgopt{ngermanDE} listed in +%\tableref{tab:nonisoopts} automatically provides a mapping +%to \texttt{ngerman}. Since a \styfmt{tracklang} dialect label +%can only map to one \styfmt{babel} label, this can be problematic +%for synonymous labels such as +%\texttt{british}\slash\texttt{UKenglish} or +%\texttt{american}\slash\texttt{USenglish}. The default mappings used +%by \styfmt{tracklang} are shown in \tableref{tab:nonisoopts}. +% +%\chapter{Adding Support for Language Tracking} +%\label{sec:langsty} +% +%If you are writing a package that \emph{sets up} the document languages (rather +%than a package that provides multilingual support if the user has +%already loaded a language package) then you can load \styfmt{tracklang} +%and use the commands below to help other packages track your +%provided languages. % -%For non-LaTeX packages, you can input \texttt{tracklang.tex} provided -%the category code for \texttt{@} has been set to 11: +%The \styfmt{tracklang} package can be loaded using %\begin{verbatim} -%\catcode `\@11\relax %\input tracklang %\end{verbatim} -%(Remember to revert it back afterwards if necessary.) +%or (\LaTeX\ only) +%\begin{verbatim} +%\RequirePackage{tracklang} +%\end{verbatim} % -%If you want some means of tracking each predefined option, you can -%define +%When using \LaTeX, there's a difference between the two. +%The first case prevents \styfmt{tracklang} from picking up +%the document class options but skips the check for known +%language packages. This check is redundant since this is +%the language package, so the thing to decide is whether or +%not to allow the user to set up the localisation information +%through the document class options. +% +%(If you just use \cs{input}, there's a test at the start of +%\texttt{tracklang.tex} to determine if it's already been loaded, so +%you don't need to worry if the user has already loaded it.) +% +%When the language is set (using commands like \cs{selectlanguage} +%) +%it would be convenient to users and other packages if the +%following command is also used: +%\begin{definition}[\DescribeMacro\SetCurrentTrackedDialect] +%\cs{SetCurrentTrackedDialect}\marg{dialect} +%\end{definition} +%where \meta{dialect} may the \styfmt{tracklang} dialect label, +%or the mapped label previously set through \cs{SetTrackedDialectLabelMap}, +%described below, or the language label (in which case the +%last dialect to be tracked with that root language will +%be assumed). +% +%This will make the following commands available which may be +%of use to other packages: +%\begin{itemize} +%\item\ics{CurrentTrackedDialect} The dialect label recognised +%by \styfmt{tracklang} (which may not be the same as \meta{dialect}). +% +%\item\ics{CurrentTrackedLanguage} +%The root language label used +%by \styfmt{tracklang}. (This should usually be the same as +%\ics{languagename}.) +%\item\ics{CurrentTrackedDialectModifier} The dialect modifier. +%\item\ics{CurrentTrackedDialectVariant} The dialect variant. +%\item\ics{CurrentTrackedDialectScript} The dialect script. +%Note that if \sty{tracklang-scripts} is also loaded, this allows the +%script direction to be accessed using +%\begin{verbatim} +%\TrackLangScriptAlphaToDir{\CurrentTrackedDialectScript} +%\end{verbatim} +%See \sectionref{sec:tracklang-scripts.tex} for further details. +%\item\ics{CurrentTrackedDialectSubLang} The dialect sub-language +%code. +%\item\ics{GetTrackedDialectAdditional} The dialect's additional +%information. +%\item\ics{CurrentTrackedIsoCode} The dialect's root language +%ISO code. (The first found in the sequence 639-1, 639-2, 639-3.) +%\item\ics{CurrentTrackedRegion} The dialect's ISO 3166-1 region +%code. +%\item\ics{CurrentTrackedLanguageTag} The dialect's language tag. +%\end{itemize} +%(Without this automated use of \cs{SetCurrentTrackedDialect}, +%the same information can be picked up using commands +%like \cs{GetTrackedDialectScript}, but that's less convenient, +%especially if \cs{languagename} needs to be converted +%to \meta{dialect}. See the accompanying sample file +%\texttt{sample-setlang.tex} for an example.) +% +%When the user requests a particular dialect through your language +%package, you can notify \styfmt{tracklang} of this choice using %\begin{definition} -%\cs{@tracklang@declareoption}\marg{dialect label} +%\cs{TrackPredefinedDialect}\marg{dialect} +%\end{definition} +%if the dialect label is recognised by \styfmt{tracklang} (all those +%listed in \refoptstables). +% +%If there's no matching dialect predefined by \styfmt{tracklang}, you +%can just use \cs{TrackLocale} or \cs{TrackLanguageTag} +%(described in \sectionref{sec:generic}) +%with the appropriate ISO codes \emph{if you're not providing caption +%hooks}. +% +%If you are providing a captions hook mechanism +%in the form \ics{captions\meta{dialect}}, then if \meta{dialect} +%doesn't match the corresponding \styfmt{tracklang} dialect label, +%you can provide a mapping using +%\cs{SetTrackedDialectLabelMap}, described below. +% +%For compatibility with pre version 1.3, +%if the dialect isn't predefined by +%\styfmt{tracklang}, then you can use: +%\begin{definition}[\DescribeMacro\AddTrackedDialect] +%\cs{AddTrackedDialect}\marg{dialect}\marg{root language label} %\end{definition} -%before loading \texttt{tracklang.tex}. For example, -%\texttt{tracklang.sty} has the following code: +%where \meta{root language label} is the label for the dialect's root +%language (\tableref{tab:rootlangopts}) and \meta{dialect} matches +%the captions hook. If the dialect is already in the tracked dialect +%list, it won't be added again. If the root language is already in +%the tracked language list, it won't be added again. As from version +%1.3 this additionally defines: +%\begin{definition}[\DescribeMacro\TrackLangLastTrackedDialect] +%\cs{TrackLangLastTrackedDialect} +%\end{definition} +%to \meta{dialect} for convenient reference if required. +%Note that \cs{AddTrackedDialect} is internally used by commands like +%\cs{TrackPredefinedDialect}, \cs{TrackLocale} and +%\cs{TrackLanguageTag}. +% +%(New to version 1.3.) Many of the \styfmt{tracklang} dialect +%labels don't have a corresponding match in various language packages. For +%example, \styfmt{tracklang} provides \texttt{ngermanDE} but the +%closest match in \sty{babel} is \texttt{ngerman}. This means that +%the caption hook \cs{captionsngerman} can't be accessed +%through %\begin{verbatim} -%\newcommand*{\@tracklang@declareoption}[1]{% -% \DeclareOption{#1}{\TrackPredefinedDialect{#1}}% -%} -%\input{tracklang} +%\csname captions\CurrentTrackedDialect\endcsname %\end{verbatim} -%which ensures that each predefined dialect is also declared -%as a package option. -% -%\section{Plain \TeX\ Example} -%\label{sec:plain} +%in the resource files. In this case, a mapping may be defined +%between the \styfmt{tracklang} dialect label and the closest +%matching label used by the language hooks. This is done through +%\begin{definition}[\DescribeMacro\SetTrackedDialectLabelMap] +%\cs{SetTrackedDialectLabelMap}\marg{from}\marg{to} +%\end{definition} +%where \meta{from} is the \styfmt{tracklang} label and \meta{to} +%is the language hook label. For example: +%\begin{verbatim} +%\TrackLanguageTag{de-AR-1996} +%\SetTrackedDialectLabelMap{\TrackLangLastTrackedDialect}{ngerman} +%\end{verbatim} +%Since \cs{TrackLanguageTag} internally uses \cs{AddTrackedDialect} +%the dialect label created by \styfmt{tracklang} can be accessed +%using \cs{TrackLangLastTrackedDialect}. This means that +%\ics{TrackLangAddToCaptions} can now find the \cs{captionsngerman} +%hook even though the \styfmt{tracklang} dialect label isn't \texttt{ngerman}. +% +%(New to version 1.3.) +%If the root language label is recognised by \styfmt{tracklang}, you +%can add the ISO codes using: +%\begin{definition}[\DescribeMacro\AddTrackedLanguageIsoCodes] +%\cs{AddTrackedLanguageIsoCodes}\marg{root language} +%\end{definition} % -%Since plain \TeX\ doesn't have document class or package options, -%the dialects and ISO codes need to be added using the commands -%described in the previous section. For example: +%As from v1.3, you can also provide a modifier for a given +%dialect using: +%\begin{definition}[\DescribeMacro\SetTrackedDialectModifier] +%\cs{SetTrackedDialectModifier}\marg{dialect}\marg{value} +%\end{definition} +%where \meta{dialect} is the dialect label and \meta{value} +%is the modifier value. For example: %\begin{verbatim} -%\catcode `\@11\relax -%\input tracklang -%\catcode `\@12\relax +%\AddTrackedDialect{oldgerman}{german} +%\AddTrackedLanguageIsoCodes{german} +%\SetTrackedDialectModifier{oldgerman}{old} +%\end{verbatim} % -%\TrackPredefinedDialect{british} -%\TrackPredefinedDialect{american} -%\TrackPredefinedDialect{canadian} -%\TrackPredefinedDialect{canadien} -%\TrackPredefinedDialect{belgique} +%Note that no sanitization is performed on \meta{value} when the +%modifier is set explicitly through \cs{SetTrackedDialectModifier}, +%since it's assumed that any package that specifically sets the +%modifier in this way is using a sensible labelling system. If the +%modifier is obtained through commands like \cs{TrackLocale}, then +%the modifier is sanitized as the value may have been obtained from +%the operating system and there's no guarantee that it won't contain +%problematic characters. +% +%The modifier is typically obtained by parsing locale information in +%POSIX format. +%\begin{display} +%\meta{language}[\_\meta{territory}][.\meta{codeset}][@\meta{modifier}] +%\end{display} +%whereas the variant is typically obtained by parsing the language +%tag. +% +%The information provided in the commands below (such as the script) +%are typically obtained by parsing the language tag. For example, +%with Serbian in the Latin alphabet the modifier would be \texttt{latin} +%whereas the script would be \texttt{Latn}: +%\begin{verbatim} +%\AddTrackedDialect{serbianlatin}{serbian} +%\AddTrackedLanguageIsoCodes{serbian} +%\SetTrackedDialectModifier{serbianlatin}{latin} +%\SetTrackedDialectScript{serbianlatin}{Latn} +%\end{verbatim} % -%Dialect Regions: +%As from v1.3, you can provide a script (for example, +%\qt{Latn} or \qt{Cyrl}) using: +%\begin{definition}[\DescribeMacro\SetTrackedDialectScript] +%\cs{SetTrackedDialectScript}\marg{dialect}\marg{value} +%\end{definition} +%where \meta{dialect} is the dialect label and \meta{value} is the +%four letter script identifier. For example: +%\begin{verbatim} +%\AddTrackedDialect{serbiancyrl}{serbian} +%\AddTrackedLanguageIsoCodes{serbian} +%\SetTrackedDialectScript{serbiancyrl}{Cyrl} +%\end{verbatim} % -%\ForEachTrackedDialect{\ThisDialect}{\ThisDialect: -% \TrackedIsoCodeFromLanguage{\TwoLetterIsoCountryCode}{\ThisDialect}. } +%As from v1.3, you can provide a variant for a given +%dialect using: +%\begin{definition}[\DescribeMacro\SetTrackedDialectVariant] +%\cs{SetTrackedDialectVariant}\marg{dialect}\marg{value} +%\end{definition} +%For example: +%\begin{verbatim} +%\AddTrackedDialect{german1901}{german} +%\SetTrackedDialectVariant{german1901}{1901} +%\end{verbatim} % -%Language Codes: +%As from v1.3, you can also provide a sub-language using: +%\begin{definition}[\DescribeMacro\SetTrackedDialectSubLang] +%\cs{SetTrackedDialectSubLang}\marg{dialect}\marg{value} +%\end{definition} +%where \meta{dialect} is the dialect label and \meta{value} is the +%code. For example: +%\begin{verbatim} +%\AddTrackedDialect{mandarin}{chinese} +%\AddTrackedLanguageIsoCodes{chinese} +%\SetTrackedDialectSubLang{mandarin}{cmn} +%\AddTrackedIsoLanguage{639-3}{cmn}{mandarin} +%\end{verbatim} % -%\ForEachTrackedLanguage{\ThisLanguage}{\ThisLanguage: -% \TrackedIsoCodeFromLanguage{\TwoLetterIsoLanguageCode}{\ThisLanguage}. } +%As from v1.3, you can also provide additional information using: +%\begin{definition}[\DescribeMacro\SetTrackedDialectAdditional] +%\cs{SetTrackedDialectAdditional}\marg{dialect}\marg{value} +%\end{definition} +%where \meta{dialect} is the dialect label and \meta{value} is the +%additional information. +% +%(New to version 1.3.) +%If the root language isn't recognised by \styfmt{tracklang} +%(not listed in \tableref{tab:rootlangopts}), then +%it can be defined (but not tracked at this point) using: +%\begin{definition}[\DescribeMacro\TrackLangNewLanguage] +%\cs{TrackLangNewLanguage}\marg{language name}\marg{639-1 +%code}\marg{639-2 (T)}\marg{639-2 (B)}\marg{639-3}\marg{3166-1}\marg{default +%script} +%\end{definition} +%where \meta{language name} is the root language name, +%\meta{639-1 code} is the ISO 639-1 code for that language (may be +%empty if there isn't one), \meta{639-2 (T)} is the ISO 639-2 (T) +%code for that language (may be empty if there isn't one), +%\meta{639-2 (B)} is the ISO 639-2 (B) code for that language (may be +%empty if it's the same as \meta{639-2 (T)}), \meta{639-3} is the ISO +%639-3 code for that language (empty if the same as the 639-2 +%code), \meta{3166-1} is the territory ISO code for languages that are only spoken in one +%territory (should be empty if the language is spoken in multiple +%territories), and \meta{default script} is the default script (empty +%if disputed or varies according to region). +% +%You can then track this language using \cs{AddTrackedDialect} for +%dialects or, if no regional variant is needed, you can instead use: +%\begin{definition}[\DescribeMacro\AddTrackedLanguage] +%\cs{AddTrackedLanguage}\marg{root language label} +%\end{definition} +%This is equivalent to \ics{AddTrackedDialect}\marg{root language +%label}\marg{root language label}. % -%\bye +%Suppose I want to create a language package \texttt{alien.sty} that defines the +%\texttt{martian} language with regional dialects +%\texttt{lowermartian} and \texttt{uppermartian}. First, let's +%suppose that \styfmt{tracklang} recognises the root language +%\texttt{martian}: +%\begin{verbatim} +% \ProvidesPackage{alien} +% +% \input{tracklang}% v1.3 +% +% \DeclareOption{martian}{% +% \TrackPredefinedDialect{martian} +% } +% \DeclareOption{lowermartian}{% +% \AddTrackedDialect{lowermartian}{martian} +% \AddTrackedIsoCodes{martian} +% \AddTrackedIsoLanguage{3166-1}{YY}{lowermartian} +% % other attributes such as +% % \SetTrackedDialectVariant{lowermartian}{...} +% } +% \DeclareOption{uppermartian}{% +% \AddTrackedDialect{uppermartian}{martian} +% \AddTrackedIsoCodes{martian} +% \AddTrackedIsoLanguage{3166-1}{XX}{uppermartian} +% % other attributes such as +% % \SetTrackedDialectVariant{uppermartian}{...} +% } +% +% \ProcessOptions +% +% \newcommand*{\selectlanguage}[1]{% +% \def\languagename{#1}% +% % other stuff +% \SetCurrentTrackedDialect{#1}% +% } +% +% \AnyTrackedLanguages +% { +% \ForEachTrackedDialect{\thisdialect} +% {% +% \TrackLangRequireDialect{alien}{\thisdialect} +% } +% } %\end{verbatim} +%The caption commands and language set up are in the files +%\texttt{alien-}\meta{tag}\texttt{.ldf} as in the examples from +%\sectionref{sec:examples}. This allows for the user having already +%loaded \styfmt{tracklang} before \styfmt{alien} and used \cs{TrackLangFromEnv} to pick up +%the locale from the operating system's environment variables. +%(For example, they may have \envvar{LANG} set to \texttt{xx\_YY}.) +% +%The resource files may need to set the mapping between the +%\styfmt{tracklang} dialect label and the \styfmt{alien} dialect +%label. For example, in \texttt{alien-xx-YY.ldf}: +%\begin{verbatim} +%\TrackLangProvidesResource{xx-YY} % -%This produces: -%\begin{quotation} -%Dialect Regions: +%\TrackLangRequireResource{martian}% load common elements +% +%\newcommand{\captionslowermartian}{% +% \captionsmartian +% \def\contentsname{X'flurp}% regional variation +%} % -%british: GB. american: US. canadian: CA. canadien: CA. belgique: BE. +%\SetTrackedDialectLabelMap{\CurrentTrackedDialect}{lowermartian} +%\end{verbatim} % -%Language Codes: +%Now let's consider the case where \styfmt{tracklang} doesn't know +%about the \texttt{martian} language. In this case the user can't +%track the dialect until the root language has been defined, so the +%user can't use \cs{TrackLangFromEnv} before using the \styfmt{alien} +%package. % -%english: en. french: fr. +%With \styfmt{tracklang} v1.3. The new root language can be defined +%with a minor adjustment to the above code: +%\begin{verbatim} +% \ProvidesPackage{alien} % -%Found ``animals-en-GB.ldf'' +% \input{tracklang}% needs v1.3 % -%Found ``animals-en-US.ldf'' +% \TrackLangIfKnownLang{martian} +% {}% tracklang already knows about the martian language +% { +% % tracklang doesn't known about the martian language, so define it +% % with ISO 639-1 (xx) and ISO 639-2 (xxx) codes: +% \TrackLangNewLanguage{martian}{xx}{xxx}{}{}{}{Latn} +% } +%\end{verbatim} +%The rest is as before. % -%Found ``animals-english.ldf'' +%Now other package writers who want to provide support +%for the Martian dialects can easily detect which language options +%the user requested through my package, \emph{without needing to know +%anything about my \styfmt{alien} package}. % -%No file found for dialect ``canadien'' +%\StopEventually{% +% \printindex[user] +% \PrintCodeIndex +% \PrintChanges +%} % -%No file found for dialect ``belgique'' -%\end{quotation} % -%\clearpage -%\addtolength{\marginparwidth}{40pt} -%\addtolength{\oddsidemargin}{40pt} -%\addtolength{\evensidemargin}{40pt} -%\StopEventually{\clearpage -%\addtolength{\marginparwidth}{-60pt} -%\addtolength{\oddsidemargin}{-60pt} -%\addtolength{\evensidemargin}{-60pt} -%\addtolength{\textwidth}{80pt} -%\addtolength{\linewidth}{80pt} -%\addtolength{\hsize}{80pt} -%\PrintIndex} -% -% -%\section{The Code} +%\chapter{The Code} %\iffalse % \begin{macrocode} %<*tracklang.sty> % \end{macrocode} %\fi %\changes{1.0}{2014-09-29}{Initial release} -%\subsection{\LaTeX\ Code (\texttt{tracklang.sty})} +%\section{\LaTeX\ Code (\texttt{tracklang.sty})} % To ensure maximum portability this file only uses \LaTeX\ kernel % commands, rather than using more convenient commands provided by % packages such as \styfmt{etoolbox}. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tracklang}[2015/03/23 v1.2 (NLCT) Track Languages] +\ProvidesPackage{tracklang}[2016/10/08 v1.3.1 (NLCT) Track Languages] % \end{macrocode} %\begin{macro}{\@tracklang@declareoption} % Set up package options. @@ -1624,6 +3205,13 @@ % \begin{macrocode} \input{tracklang} % \end{macrocode} +% There are no other options as this package will typically +% be loaded using \cs{RequirePackage} by a package. Explicitly +% adding an option at that point might create a package option +% clash. The declared package options are all the possible +% language names that might be passed as a document class option. +% (Also, adding any non-language options here will interfere +% with \cs{@tracklang@declaredoptions}.) % \begin{macrocode} \let\@tracklang@declaredoptions\@declaredoptions \ProcessOptions @@ -1637,7 +3225,7 @@ % package options (or through the class options, which the package % options should process provided the document class has used the % standard option declarations) we need to check if any of the known -% language packages have been loaded. This is a bit dangerous as it +% language packages have been loaded. This is a bit risky as it % relies on the packages not changing their internal language % macros. It would be easier if all the language packages could % provide a reliable user interface to determine which languages @@ -1667,42 +3255,38 @@ }% {% % \end{macrocode} -% Has \sty{polyglossia} been loaded? +% Has \sty{german} been loaded? +%\changes{1.3}{2016-10-07}{added test for german.sty} % \begin{macrocode} - \@ifpackageloaded{polyglossia} + \@ifpackageloaded{german}% + {% + \@tracklang@add@german + }% {% % \end{macrocode} +% Has \sty{polyglossia} been loaded? +% \begin{macrocode} + \@ifpackageloaded{polyglossia} + {% +% \end{macrocode} % \sty{polyglossia} sets \cs{\meta{lang}@loaded} for each loaded % language, so check this for all known languages. I don't know how -% to check for variants. -% \begin{macrocode} - \@for\this@language:=albanian,amharic,arabic,armenian,asturian,% - bahasai,bahasam,basque,bengali,brazil,breton,bulgarian,% - catalan,coptic,croatian,czech,danish,divehi,dutch,english,% - esperanto,estonian,farsi,finnish,french,friulan,galician,% - german,greek,hebrew,hindi,icelandic,interlingua,irish,% - italian,kannada,lao,latin,latvian,lithuanian,lsorbian,% - magyar,malayalam,marathi,nko,norsk,nynorsk,occitan,% - piedmontese,polish,portuges,romanian,romansh,russian,% - samin,sanskrit,scottish,serbian,slovak,slovenian,spanish,% - swedish,syriac,tamil,telugu,thai,tibetan,turkish,turkmen,% - ukrainian,urdu,usorbian,vietnamese,welsh\do{% - \@ifundefined{\this@language @loaded}% - {}% - {% - \@ifundefined{@tracklang@add@\this@language}% - {% - \PackageWarning{tracklang}% - {Adding unknown language `\this@language'}% - \AddTrackedLanguage\this@language - }% - {% - \@nameuse{@tracklang@add@\this@language}% - }% +% to consistently check for variants. (Conditionals such as +% \cs{if@british@locale} are set immediately with +% \cs{setotherlanguage} but are deferred to the start of the +% document with \cs{setmainlanguage}, which is too late for +% \styfmt{tracklang}.) Script names seem to be stored in +% \cs{xpg:scripttag@\meta{language}} but again this doesn't seem to be set +% for the main language until the start of the document. +%\changes{1.3}{2016-10-07}{removed hard-coded polyglossia language list} +% \begin{macrocode} + \@for\this@language:=\@tracklang@declaredoptions\do{% + \@ifundefined{\this@language @loaded}% + {}% + {\@nameuse{@tracklang@add@\this@language}}% }% }% - }% - {% + {% % \end{macrocode} % None of the known packages have been loaded, so do nothing in case % another package wants to load this one before setting up the @@ -1710,18 +3294,19 @@ % loaded, then it's an older version that hasn't defined % \cs{bbl@loaded} so check for this. % \begin{macrocode} - \@ifpackageloaded{babel} - {% - \PackageInfo{tracklang}{babel loaded but - \string\bb@loaded\space not defined. Will attempt - to track known languages.}% - \@for\this@language:=\@tracklang@declaredoptions\do{% - \@ifundefined{captions\this@language}% - {}% - {\@nameuse{@tracklang@add@\this@language}}% + \@ifpackageloaded{babel} + {% + \PackageInfo{tracklang}{babel loaded but + \string\bbl@loaded\space not defined. Will attempt + to track known languages.}% + \@for\this@language:=\@tracklang@declaredoptions\do{% + \@ifundefined{captions\this@language}% + {}% + {\@nameuse{@tracklang@add@\this@language}}% + }% }% + {}% }% - {}% }% }% }% @@ -1803,11 +3388,21 @@ \@for\this@language:=\bbl@loaded\do{% \@ifundefined{@tracklang@add@\this@language}% {% - \PackageWarning{tracklang}{Adding unknown language `\this@language'}% + \PackageWarning{tracklang}% + {Adding unknown babel language `\this@language'}% \AddTrackedLangage{\this@language}% }% {\@nameuse{@tracklang@add@\this@language}}% }% +% \end{macrocode} +% If \sty{babel} has been loaded with \pkgoptfmt{serbian}, then +% the script needs to be set to \texttt{Latn}. (The Cyrillic +% script is provided with \pkgoptfmt{serbianc}.) +% \begin{macrocode} + \ifx\captionsserbian\undefined + \else + \SetTrackedDialectScript{serbian}{Latn}% + \fi } % \end{macrocode} % End of check for language packages @@ -1824,26 +3419,87 @@ %<*tracklang.tex> % \end{macrocode} %\fi -%\subsection{Generic Code (\texttt{tracklang.tex})} +%\section{Generic Code (\texttt{tracklang.tex})} +% Does the category code of \verb|@| need changing? +%\changes{1.3}{2016-10-07}{added check for @ category code} +%\begin{macro}{\@tracklang@restore@at} +% \begin{macrocode} +\ifnum\catcode`\@=11\relax + \def\@tracklang@restore@at{}% +\else + \expandafter\edef\csname @tracklang@restore@at\endcsname{% + \noexpand\catcode`\noexpand\@=\number\catcode`\@\relax + }% + \catcode`\@=11\relax +\fi +% \end{macrocode} +%\end{macro} % First check if this file has already been loaded: % \begin{macrocode} -\ifx \@tracklang@languages\undefined +\ifx\@tracklang@languages\undefined \else + \@tracklang@restore@at \expandafter\endinput \fi % \end{macrocode} +% Version info. +% \begin{macrocode} +\expandafter\def\csname ver@tracklang.tex\endcsname{2016/10/08 v1.3.1 +(NLCT) Track Languages Generic Code} +% \end{macrocode} % Define a long command for determining the existence of a control -% sequence by its name. +% sequence by its name. (\cs{relax} is considered undefined.) %\begin{macro}{\@tracklang@ifundef} % \begin{macrocode} \long\def\@tracklang@ifundef#1#2#3{% - \expandafter\ifx\csname #1\endcsname\relax - #2% - \else - #3% + \ifcsname#1\endcsname + \expandafter\ifx\csname #1\endcsname\relax + #2% + \else + #3% + \fi + \else + \expandafter\ifx\csname #1\endcsname\relax + #2% + \else + #3% + \fi \fi } % \end{macrocode} +%\changes{1.3}{2016-10-07}{added check for \cs{ifcsname}} +%\cs{ifcsname} is an e\TeX\ primitive. Need to check if it's +%defined. +% \begin{macrocode} +\ifx\ifcsname\undefined +% \end{macrocode} +%Not using e\TeX. +% \begin{macrocode} + \long\def\@tracklang@ifundef#1#2#3{% + \expandafter\ifx\csname #1\endcsname\relax + #2% + \else + #3% + \fi + } +% \end{macrocode} +%Can't have an else part here as \TeX\ won't recognise +%\cs{ifcsname} and we'll have an unmatched end brace. +% \begin{macrocode} +\fi +% \end{macrocode} +%\end{macro} +% +% The shell escape stuff needs the Plain \TeX\ version of +% \cs{input}. This is \cs{@@input} if we're using \LaTeX. +%\begin{macro}{\@tracklang@input} +% \begin{macrocode} +\ifx\@@input\undefined + \let\@tracklang@input\input +\else + \let\@tracklang@input\@@input +\fi +% \end{macrocode} %\end{macro} % % Provide some commands in case the \LaTeX\ kernel hasn't been loaded. @@ -1909,16 +3565,50 @@ % \end{macrocode} %\end{macro} % +%\begin{macro}{\@tracklang@enamedef} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\@tracklang@enamedef#1{\expandafter\edef\csname#1\endcsname} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@tracklang@nameuse} +%\changes{1.3}{2016-10-07}{added check for undef} % \begin{macrocode} -\ifx\@nameuse\undefined - \def\@tracklang@nameuse#1{\csname#1\endcsname} +\def\@tracklang@nameuse#1{% + \@tracklang@ifundef{#1}{}{\csname#1\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@sanitize} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\ifx\@onelevel@sanitize\undefined + \def\@tracklang@sanitize#1{% + \edef#1{\expandafter\@tracklang@strip@prefix\meaning#1}% + } + \def\@tracklang@strip@prefix#1>{} \else - \let\@tracklang@nameuse\@nameuse + \let\@tracklang@sanitize\@onelevel@sanitize \fi % \end{macrocode} %\end{macro} % +%\begin{macro}{\@tracklang@firstoftwo} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\@tracklang@firstoftwo#1#2{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@secondoftwo} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\@tracklang@secondoftwo#1#2{#2} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@tracklang@err} % \begin{macrocode} \ifx\PackageError\undefined @@ -1931,19 +3621,83 @@ % \end{macrocode} %\end{macro} % +%\begin{macro}{\ifTrackLangShowWarnings} +%\changes{1.3}{2016-10-07}{new} +%Allow user to switch warnings on or off. +% \begin{macrocode} +\newif\ifTrackLangShowWarnings +\TrackLangShowWarningstrue +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@warn} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\ifx\PackageWarning\undefined + \def\@tracklang@warn#1{% + \ifTrackLangShowWarnings + {% + \newlinechar=`\^^J + \def\MessageBreak{^^J}% + \message{^^Jtracklang Warning: #1 on line \the\inputlineno.^^J}% + }% + \fi + } +\else + \def\@tracklang@warn#1{% + \ifTrackLangShowWarnings + \PackageWarning{tracklang}{#1}% + \fi + } +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifTrackLangShowInfo} +%\changes{1.3}{2016-10-07}{new} +%Allow user to switch information messages on or off. +% \begin{macrocode} +\newif\ifTrackLangShowInfo +\TrackLangShowInfotrue +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@info} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\ifx\PackageInfo\undefined + \def\@tracklang@info#1{% + \ifTrackLangShowInfo + {% + \newlinechar=`\^^J + \def\MessageBreak{^^J}% + \message{^^Jtracklang Info: #1 on line \the\inputlineno.^^J}% + }% + \fi + }% +\else + \def\@tracklang@info#1{% + \ifTrackLangShowInfo + \PackageInfo{tracklang}{#1}% + \fi + }% +\fi +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@tracklang@IfFileExists} % \begin{macrocode} \ifx\IfFileExists\undefined \long\def\@tracklang@IfFileExists#1#2#3{% \openin0=#1 % \ifeof0\relax - \def\reserved@a{#3}% + \def\@tracklang@tmp{#3}% \else \closein0\relax \edef\@filef@und{#1 }% - \def\reserved@a{#2}% + \def\@tracklang@tmp{#2}% \fi - \reserved@a + \@tracklang@tmp } \else @@ -1952,7 +3706,546 @@ % \end{macrocode} %\end{macro} % -%\subsubsection{Internal Lists} +%Provide a way to query the environment variables \envvar{LC\_ALL} +%or \envvar{LANG} to determine the region and language. The result +% is stored in \cs{TrackLangEnv} if it can be obtained. If +% it can't be obtained, \cs{TrackLangEnv} is set to empty. +% Also define \cs{TrackLangQueryOtherEnv}\marg{name} to query +% \texttt{LC\_ALL}, \meta{name}, \texttt{LANG}. +% For example +%\begin{verbatim} +%\TrackLangQueryOtherEnv{LC\_MONETARY} +%\end{verbatim} +%Note that there's not much that can be done from within \TeX\ +%for the C or POSIX locale or a locale starting with a slash, so +%provide a check for them. +%\begin{macro}{\@tracklang@checklocale} +% \begin{macrocode} +\def\@tracklang@checklocale{% + \ifx\TrackLangEnv\empty + \else + \ifx\TrackLangEnv\@tracklang@locale@posix + \def\TrackLangEnv{}% + \else + \ifx\TrackLangEnv\@tracklang@locale@c + \def\TrackLangEnv{}% + \else + \expandafter\@@tracklang@checklocale + \TrackLangEnv\empty\relax + \fi + \fi + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@@tracklang@checklocale} +%\changes{1.3}{2016-10-07}{new} +%Check for leading slash. +% \begin{macrocode} +\def\@@tracklang@checklocale#1#2\relax{% + \ifx#1/\relax + \def\TrackLangEnv{}% + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@locale@posix} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\@tracklang@locale@posix{POSIX} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@locale@c} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\@tracklang@locale@c{C} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +\ifx\directlua\undefined +% \end{macrocode} +%We can't use Lua, so we'll have to use the shell escape if it's +%enabled. First determine if the shell escape is available. +% \begin{macrocode} + \ifx\shellescape\undefined + \ifx\pdfshellescape\undefined +% \end{macrocode} +% Can't determine if the shell escape has been enabled. +% \begin{macrocode} + \def\@tracklang@tryshellescape#1{% + \def\TrackLangQueryEnv{% + \@tracklang@warn{\string\TrackLangQueryEnv\space + non-operational as can't determine if the + shell escape has been enabled. (Consider using + eTeX or pdfTeX.)}% + \def\TrackLangEnv{}% + }% + \def\TrackLangQueryOtherEnv##1{% + \@tracklang@warn{\string\TrackLangQueryOtherEnv{##1}\space + non-operational as can't determine if the + shell escape has been enabled. (Consider using + eTeX or pdfTeX.)}% + \def\TrackLangEnv{}% + }% + }% + \else +% \end{macrocode} +%\cs{pdfshellescape} is defined +% \begin{macrocode} + \ifnum\pdfshellescape=0\relax + \def\@tracklang@tryshellescape#1{% + \def\TrackLangQueryEnv{% + \@tracklang@warn{\string\TrackLangQueryEnv\space + non-operational as shell escape has been disabled}% + \def\TrackLangEnv{}% + }% + \def\TrackLangQueryOtherEnv##1{% + \@tracklang@warn{\string\TrackLangQueryOtherEnv{##1}\space + non-operational as shell escape has been disabled}% + \def\TrackLangEnv{}% + }% + }% + \else + \def\@tracklang@tryshellescape#1{#1}% + \fi + \fi + \else +% \end{macrocode} +% \cs{shellescape} is defined +% \begin{macrocode} + \ifnum\shellescape=0\relax + \def\@tracklang@tryshellescape#1{% + \def\TrackLangQueryEnv{% + \@tracklang@warn{\string\TrackLangQueryEnv\space + non-operational as shell escape has been disabled}% + \def\TrackLangEnv{}% + }% + \def\TrackLangQueryOtherEnv##1{% + \@tracklang@warn{\string\TrackLangQueryOtherEnv{##1}\space + non-operational as shell escape has been disabled}% + \def\TrackLangEnv{}% + }% + }% + \else + \def\@tracklang@tryshellescape#1{#1}% + \fi + \fi +% \end{macrocode} +% Try the shell escape: +% \begin{macrocode} + \@tracklang@tryshellescape + {% +% \end{macrocode} +%\begin{macro}{\TrackLangQueryEnv} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} + \def\TrackLangQueryEnv{% + \begingroup\endlinechar=-1\relax + \everyeof{\noexpand}% + \edef\x{\endgroup\def\noexpand\TrackLangEnv{% + \@tracklang@input|"kpsewhich --var-value LC_ALL" }}\x + \@tracklang@checklocale + \ifx\TrackLangEnv\empty + \begingroup\endlinechar=-1\relax + \everyeof{\noexpand}% + \edef\x{\endgroup\def\noexpand\TrackLangEnv{% + \@tracklang@input|"kpsewhich --var-value LANG" }}\x +% \end{macrocode} +%Not sure if a path is likely to occur with \app{kpsewhich} +%but check for it just in case. +% \begin{macrocode} + \@tracklang@checklocale + \ifx\TrackLangEnv\empty +% \end{macrocode} +% Try texosquery if available. +% \begin{macrocode} + \ifx\TeXOSQueryLocale\undefined + \@tracklang@warn{Locale environment variables + unavailable (tried LC\string_ALL and LANG)}% + \else + \@tracklang@info{Using texosquery to find locale}% + \TeXOSQueryLocale\TrackLangEnv + \ifx\TrackLangEnv\empty + \@tracklang@warn{Locale can't be found + (tried querying LC\string_ALL and LANG variables and + tried using texosquery)}% + \fi + \fi + \fi + \fi + }% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\TrackLangQueryOtherEnv} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} + \def\TrackLangQueryOtherEnv#1{% + \begingroup\endlinechar=-1\relax + \everyeof{\noexpand}% + \edef\x{\endgroup\def\noexpand\TrackLangEnv{% + \@tracklang@input|"kpsewhich --var-value LC_ALL" }}\x + \@tracklang@checklocale + \ifx\TrackLangEnv\empty + \begingroup\endlinechar=-1\relax + \everyeof{\noexpand}% + \edef\x{\endgroup\def\noexpand\TrackLangEnv{% + \@tracklang@input|"kpsewhich --var-value #1" }}\x + \@tracklang@checklocale + \ifx\TrackLangEnv\empty + \begingroup\endlinechar=-1\relax + \everyeof{\noexpand}% + \edef\x{\endgroup\def\noexpand\TrackLangEnv{% + \@tracklang@input|"kpsewhich --var-value LANG"}}\x + \@tracklang@checklocale + \ifx\TrackLangEnv\empty +% \end{macrocode} +% Try texosquery if available. +% \begin{macrocode} + \ifx\TeXOSQueryLocale\undefined + \@tracklang@warn{Locale environment variables unavailable + (tried LC\string_ALL, #1 and LANG)}% + \else + \@tracklang@info{Using texosquery to find locale}% + \TeXOSQueryLocale\TrackLangEnv + \ifx\TrackLangEnv\empty + \@tracklang@warn{Locale can't be found + (tried querying LC\string_ALL, #1 and LANG variables and + tried using texosquery)}% + \fi + \fi + \fi + \fi + \fi + }% +% \end{macrocode} +%\end{macro} +% \begin{macrocode} + }% +\else +% \end{macrocode} +%\cs{directlua} is defined, so we can query it through Lua: +%\begin{macro}{\TrackLangQueryEnv} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} + \def\TrackLangQueryEnv{% + \edef\TrackLangEnv{\directlua{ + l = os.getenv("LC_ALL") + if l == nil or l == "" or l == "C" or l == "POSIX" + or string.find(l, "^/") then + l = os.getenv("LANG") + if l == nil or l == "" or l == "C" or l == "POSIX" + or string.find(l, "^/") then + l=os.setlocale(nil) + if l == nil or l == "C" or l == "POSIX" + or string.find(l, "^/") then + l = "" + end + end + end + tex.print(l)}}% + \ifx\TrackLangEnv\empty +% \end{macrocode} +% Try texosquery if available. +% \begin{macrocode} + \ifx\TeXOSQueryLocale\undefined + \@tracklang@warn{Locale can't be found through Lua + (tried querying LC\string_ALL and LANG variables and + os.setlocale(nil))}% + \else + \TeXOSQueryLocale\TrackLangEnv + \ifx\TrackLangEnv\empty + \@tracklang@warn{Locale can't be found through Lua + (tried querying LC\string_ALL and LANG variables and + os.setlocale(nil) and tried using texosquery)}% + \fi + \fi + \fi + } +% \end{macrocode} +%\end{macro} +%\begin{macro}{\TrackLangQueryOtherEnv} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} + \def\TrackLangQueryOtherEnv#1{% + \edef\TrackLangEnv{\directlua{ + l = os.getenv("LC_ALL") + if l == nil or l == "" or l == "C" or l == "POSIX" + or string.find(l, "^/") then + l = os.getenv("#1") + if l == nil or l == "" or l == "C" or l == "POSIX" + or string.find(l, "^/") then + l = os.getenv("LANG") + if l == nil or l == "" or l == "C" or l == "POSIX" + or string.find(l, "^/") then + l=os.setlocale(nil) + if l == nil or l == "C" or l == "POSIX" + or string.find(l, "^/") then + l = "" + end + end + end + end + tex.print(l}}% + \ifx\TrackLangEnv\empty +% \end{macrocode} +% Try texosquery if available. +% \begin{macrocode} + \ifx\TeXOSQueryLocale\undefined + \@tracklang@warn{Locale can't be found through Lua + (tried querying LC\string_ALL, #1 and LANG variables and + os.setlocale(nil))}% + \else + \TeXOSQueryLocale\TrackLangEnv + \ifx\TrackLangEnv\empty + \@tracklang@warn{Locale can't be found through Lua + (tried querying LC\string_ALL, #1 and LANG variables and + os.setlocale(nil) and tried using texosquery)}% + \fi + \fi + \fi + } +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +\fi +% \end{macrocode} +% +% Allowed formats for the localisation environment variables are +%\begin{definition} +%\meta{iso-lang}[\_\meta{iso-territory}][\texttt{.}\meta{encoding}][@\meta{modifier}] +%\end{definition} +%(where the square brackets above indicate an optional component not that +%there are literal square brackets.) This is a bit fiddly, so it +%needs to be broken up into manageable chunks. +% +%\begin{macro}{\TrackLangParseFromEnv} +%\changes{1.3}{2016-10-07}{new} +%Parse \cs{TrackLangEnv}, if it has been +%set, and set \cs{TrackLangEnvLang}, \cs{TrackLangEnvTerritory} +% and \cs{TrackLangEnvCodeSet}. If the information is unavailable, +% the relevant commands will be set to empty. Use +% \cs{TrackLangFromEnv} to query, parse and set. +% \begin{macrocode} +\def\TrackLangParseFromEnv{% + \ifx\TrackLangEnv\undefined + \@tracklang@warn{\string\TrackLangParseFromEnv\space + non-operational as \string\TrackLangEnv\space hasn't been + defined}% + \def\TrackLangEnvLang{}% + \def\TrackLangEnvTerritory{}% + \def\TrackLangEnvCodeSet{}% + \def\TrackLangEnvModifier{}% + \else + \ifx\TrackLangEnv\empty + \@tracklang@warn{\string\TrackLangParseFromEnv\space + non-operational as \string\TrackLangEnv\space is empty}% + \def\TrackLangEnvLang{}% + \def\TrackLangEnvTerritory{}% + \def\TrackLangEnvCodeSet{}% + \def\TrackLangEnvModifier{}% + \else + \@tracklang@parse@locale{\TrackLangEnv}% + \let\TrackLangEnvLang\@TrackLangEnvLang + \let\TrackLangEnvTerritory\@TrackLangEnvTerritory + \let\TrackLangEnvCodeSet\@TrackLangEnvCodeSet + \let\TrackLangEnvModifier\@TrackLangEnvModifier + \fi + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@parse@locale} +%\changes{1.3}{2016-10-07}{new} +%Parse localisation format. +% \begin{macrocode} +\def\@tracklang@parse@locale#1{% +% \end{macrocode} +%Initialise. +% \begin{macrocode} + \def\@TrackLangEnvLang{}% + \def\@TrackLangEnvSubLang{}% + \def\@TrackLangEnvFirstSubLang{}% + \def\@TrackLangEnvTerritory{}% + \def\@TrackLangEnvCodeSet{}% + \def\@TrackLangEnvVariant{}% + \def\@TrackLangEnvModifier{}% + \def\@TrackLangEnvScript{}% + \def\@TrackLangEnvAdditional{}% +% \end{macrocode} +%Just in case argument is empty or \cs{relax}. +% \begin{macrocode} + \expandafter\ifx\expandafter\relax#1\relax + \else +% \end{macrocode} +% Parse codeset and modifier first. +% \begin{macrocode} + \expandafter\@tracklang@parseenv + #1..\relax\@tracklang@end@parseenv\@tracklang@result +% \end{macrocode} +% Parse language and territory. +% \begin{macrocode} + \ifx\@tracklang@result\empty + \else + \expandafter\@tracklang@split@underscoreorhyp\expandafter + {\@tracklang@result}% + \let\@TrackLangEnvLang\@tracklang@split@pre + \let\@TrackLangEnvTerritory\@tracklang@split@post + \fi + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@split@underscoreorhyp} +%\changes{1.3}{2016-10-07}{new} +%Split on either an underscore or a hyphen and store the results in +%\cs{@tracklang@split@pre} and \cs{@tracklang@split@post} +% \begin{macrocode} +\def\@tracklang@split@underscoreorhyp#1{% +% \end{macrocode} +%First try to split on an underscore. +% \begin{macrocode} + \@tracklang@split@underscore{#1}% +% \end{macrocode} +%If the post part was empty, try to split on hyphen instead. +% \begin{macrocode} + \ifx\@tracklang@split@post\empty + \@tracklang@split@hyphen{#1}% +% \end{macrocode} +%If the post part was empty, maybe the underscore has had its +%category code changed to 12. +% \begin{macrocode} + \ifx\@tracklang@split@post\empty + \@tracklang@split@otherunderscore{#1}% + \fi + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@split@underscore} +%\changes{1.3}{2016-10-07}{new} +%Split on an underscore and store the results in +%\cs{@tracklang@split@pre} and \cs{@tracklang@split@post}. First +%make sure that the underscore has its normal subscript category code. +% \begin{macrocode} +{ + \catcode`\_8\relax + \gdef\@tracklang@split@underscore#1{% + \@@tracklang@split@underscore#1__\relax\@tracklang@end@split@underscore + } + \gdef\@@tracklang@split@underscore#1_#2_#3\@tracklang@end@split@underscore{% + \def\@tracklang@split@pre{#1}% + \ifx\relax#3\relax + \def\@tracklang@split@post{#2}% + \else + \@tracklang@split@underscore@remainder#2_#3% + \fi + } + \gdef\@tracklang@split@underscore@remainder#1__\relax{% + \def\@tracklang@split@post{#1}% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@split@otherunderscore} +%\changes{1.3}{2016-10-07}{new} +%As above but where underscore has catcode 12. +% \begin{macrocode} +{ + \catcode`\_12\relax + \gdef\@tracklang@split@otherunderscore#1{% + \@@tracklang@split@otherunderscore#1__\relax\@tracklang@end@split@underscore + } + \gdef\@@tracklang@split@otherunderscore#1_#2_#3\@tracklang@end@split@underscore{% + \def\@tracklang@split@pre{#1}% + \ifx\relax#3\relax + \def\@tracklang@split@post{#2}% + \else + \@tracklang@split@otherunderscore@remainder#2_#3% + \fi + } + \gdef\@tracklang@split@otherunderscore@remainder#1__\relax{% + \def\@tracklang@split@post{#1}% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@split@hyphen} +%\changes{1.3}{2016-10-07}{new} +%Split on a hyphen and store the results in +%\cs{@tracklang@split@pre} and \cs{@tracklang@split@post} +% \begin{macrocode} +{ + \catcode`\-12\relax + \gdef\@tracklang@split@hyphen#1{% + \@@tracklang@split@hyphen#1--\relax\@tracklang@end@split@hyphen + } + \gdef\@@tracklang@split@hyphen#1-#2-#3\@tracklang@end@split@hyphen{% + \def\@tracklang@split@pre{#1}% + \ifx\relax#3\relax + \def\@tracklang@split@post{#2}% + \else + \@tracklang@split@hyphen@remainder#2-#3% + \fi + } + \gdef\@tracklang@split@hyphen@remainder#1--\relax{% + \def\@tracklang@split@post{#1}% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@parseenv} +%\changes{1.3}{2016-10-07}{new} +%Parse for the codeset. The first argument will be the +%language and (optionally) the territory. So the final argument is the control +%sequence to use to store the first argument, which can then be +%split. +% \begin{macrocode} +\gdef\@tracklang@parseenv#1.#2.#3\@tracklang@end@parseenv#4{% + \def\@TrackLangEnvCodeSet{#2}% + \def#4{#1}% + \ifx\@TrackLangEnvCodeSet\empty + \tracklangparsemod#4% + \else + \tracklangparsemod\@TrackLangEnvCodeSet + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\tracklangparsemod} +% Extract the modifier from the code set. +% The \texttt{@} is rather awkward as we need to change its category +% code as it's likely to be set to 12 within \cs{TrackLangEnv}. +% So change the category code of \texttt{@} to 12, but this means we +% can't use it in the command name, so although these are private +% internal commands they don't look like internal commands.) +% \begin{macrocode} +{\catcode`\@=12\relax + \gdef\tracklangparsemod#1{ + \expandafter\tracklangparseenvatmod#1@@\relax\tracklangendparseenvatmod + \let#1\tracklangtmp + }% + \gdef\tracklangparseenvatmod#1@#2@#3\tracklangendparseenvatmod{% + \def\tracklangtmp{#1}% +% \end{macrocode} +%Need to use \cs{csname} here as can't use internal commands. +% \begin{macrocode} + \expandafter\def\csname @TrackLangEnvModifier\endcsname{#2}% +% \end{macrocode} +%Sanitize in case it contains any special characters. +% \begin{macrocode} + \csname @tracklang@sanitize\expandafter\endcsname + \csname @TrackLangEnvModifier\endcsname + } +} +% \end{macrocode} +%\end{macro} +% +%\subsection{Internal Lists} % %\begin{macro}{\@tracklang@languages} % Provide a list to keep track of all the languages. @@ -1963,7 +4256,7 @@ % %\begin{macro}{\@tracklang@dialects} % Provide a list to keep track of all the dialects. Here the -% ``dialect'' isn't necessarily an actual dialect but may be a +% \qt{dialect} isn't necessarily an actual dialect but may be a % root language or a synonym. It will usually correspond to the % language name as specified by the user in the package option. % \begin{macrocode} @@ -2010,7 +4303,7 @@ % fully expanded before being added. % \begin{macrocode} \def\@tracklang@add#1#2{% -% \end{macrocode} +% \end{macrocode} % First find out if the item is empty. % \begin{macrocode} \edef\@tracklang@element{#1}% @@ -2044,19 +4337,25 @@ %\begin{definition} %\cs{AddTrackedDialect}\marg{dialect name}\marg{language name} %\end{definition} -% Add a dialect. +% Add a dialect. (v1.3 switched from unexpanded to expanded def. +% All labels should be expandable.) % \begin{macrocode} \def\AddTrackedDialect#1#2{% \@tracklang@add{#1}{\@tracklang@dialects}% \@tracklang@add{#2}{\@tracklang@languages}% - \@tracklang@namedef{@tracklang@fromdialect@#1}{#2}% + \@tracklang@enamedef{@tracklang@fromdialect@#1}{#2}% \@tracklang@ifundef{@tracklang@todialect@#2}% - {\@tracklang@namedef{@tracklang@todialect@#2}{#1}}% + {\@tracklang@enamedef{@tracklang@todialect@#2}{#1}}% {% \def\@tracklang@lang{#1}% \expandafter\@tracklang@add\expandafter\@tracklang@lang \csname @tracklang@todialect@#2\endcsname }% +% \end{macrocode} +% Provide a convenient way of referencing the last dialect to be +% tracked. +% \begin{macrocode} + \edef\TrackLangLastTrackedDialect{#1}% } % \end{macrocode} %\end{macro} @@ -2073,7 +4372,263 @@ % \end{macrocode} %\end{macro} % -%\subsubsection{Mappings} +%\subsection{Known Languages} +%\label{sec:code:knownlangs} +% +%\begin{macro}{\@tracklang@known@langs} +%\changes{1.3}{2016-10-07}{new} +%List of known (root) languages (that may or may not be tracked). +% \begin{macrocode} +\def\@tracklang@known@langs{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangNewLanguage} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangNewLanguage}\marg{language name}\marg{639-1 +%code}\marg{639-2 (T)}\marg{639-2 (B)}\marg{639-3}\marg{3166-1}\marg{default +%script} +%\end{definition} +%Identifies a new language that may be tracked. The code +%arguments may be empty if not available. +%(v1.3 switched from unexpanded to expanded def. +%All labels should be expandable.) Most +%root languages don't have an associated country code as they're +%spoken in multiple regions. The \meta{default script} is the +%default script identified with the ISO 15924 alpha script code. +%To reduce overheads, only define 639-3 if there's no 639-1 or 639-2 +%code. +% \begin{macrocode} +\def\TrackLangNewLanguage#1#2#3#4#5#6#7{% + \@tracklang@add{#1}{\@tracklang@known@langs}% + \edef\@tracklang@tmp{#2}% + \ifx\@tracklang@tmp\empty + \else + \@tracklang@enamedef{@tracklang@knownisolang@#2}{#1}% + \@tracklang@enamedef{@tracklang@knowniso@639@1@#1}{#2}% + \fi + \edef\@tracklang@tmp{#3}% + \ifx\@tracklang@tmp\empty + \else + \@tracklang@enamedef{@tracklang@knownisolang@#3}{#1}% + \@tracklang@enamedef{@tracklang@knowniso@639@2@#1}{#3}% + \fi + \edef\@tracklang@tmp{#4}% + \ifx\@tracklang@tmp\empty + \else + \@tracklang@enamedef{@tracklang@knowniso@639@2B@#1}{#4}% + \fi + \edef\@tracklang@tmp{#5}% + \ifx\@tracklang@tmp\empty + \else + \@tracklang@enamedef{@tracklang@knownisolang@#5}{#1}% + \@tracklang@enamedef{@tracklang@knowniso@639@3@#1}{#5}% + \fi + \edef\@tracklang@tmp{#6}% + \ifx\@tracklang@tmp\empty + \else + \@tracklang@enamedef{@tracklang@knowniso@3166@#1}{#6}% + \fi + \edef\@tracklang@tmp{#7}% + \ifx\@tracklang@tmp\empty + \else + \@tracklang@enamedef{@tracklang@knowniso@script@#1}{#7}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangIfKnownLang} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfKnownLang}\marg{language}\marg{true}\marg{false} +%\end{definition} +%Tests if \meta{language} is known (but not necessarily tracked). +% \begin{macrocode} +\def\TrackLangIfKnownLang#1#2#3{% + \expandafter\@tracklang@ifinlist\expandafter{#1}{\@tracklang@known@langs}% + {#2}% + {#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangIfKnownIsoTwoLetterLang} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfKnownIsoTwoLetterLang}\marg{language}\marg{true}\marg{false} +%\end{definition} +%Checks if the given language has an ISO 639-1 language code +%(but is not necessarily tracked). +% \begin{macrocode} +\def\TrackLangIfKnownIsoTwoLetterLang#1#2#3{% + \@tracklang@ifundef{@tracklang@knowniso@639@1@#1}% + {#3}% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangGetKnownIsoTwoLetterLang} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangGetKnownIsoTwoLetterLang}\marg{language} +%\end{definition} +%Gets the ISO 639-1 language code for the given language. +% \begin{macrocode} +\def\TrackLangGetKnownIsoTwoLetterLang#1{% + \@tracklang@nameuse{@tracklang@knowniso@639@1@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangIfKnownIsoThreeLetterLang} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfKnownIsoThreeLetterLang}\marg{language}\marg{true}\marg{false} +%\end{definition} +%Checks if the given language has an ISO 639-2 language code +%(but is not necessarily tracked). +% \begin{macrocode} +\def\TrackLangIfKnownIsoThreeLetterLang#1#2#3{% + \@tracklang@ifundef{@tracklang@knowniso@639@2@#1}% + {#3}% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangGetKnownIsoThreeLetterLang} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangGetKnownIsoThreeLetterLang}\marg{language} +%\end{definition} +%Gets the ISO 639-2 language code. +% \begin{macrocode} +\def\TrackLangGetKnownIsoThreeLetterLang#1{% + \@tracklang@nameuse{@tracklang@knowniso@639@2@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangIfKnownIsoThreeLetterLangB} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfKnownIsoThreeLetterLangB}\marg{language}\marg{true}\marg{false} +%\end{definition} +%Checks if the given language has an ISO 639-2 (B) language code +%(but is not necessarily tracked). +% \begin{macrocode} +\def\TrackLangIfKnownIsoThreeLetterLangB#1#2#3{% + \@tracklang@ifundef{@tracklang@knowniso@639@2B@#1}% + {#3}% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangGetKnownIsoThreeLetterLangB} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangGetKnownIsoThreeLetterLangB}\marg{language} +%\end{definition} +%Gets the ISO 639-2 (B) language code. +% \begin{macrocode} +\def\TrackLangGetKnownIsoThreeLetterLangB#1{% + \@tracklang@nameuse{@tracklang@knowniso@639@2B@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangIfKnownLangFromIso} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfKnownLangFromIso}\marg{ISO code}\marg{true}\marg{false} +%\end{definition} +%Checks if the given ISO language code (639-1 or 639-2 or 639-3) is +%recognised (but not necessarily tracked). +% \begin{macrocode} +\def\TrackLangIfKnownLangFromIso#1#2#3{% + \@tracklang@ifundef{@tracklang@knownisolang@#1}% + {#3}% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangGetKnownLangFromIso} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangGetKnownLangFromIso}\marg{ISO code} +%\end{definition} +%Gets the root language label from the given ISO code (639-1 or +%639-2). +% \begin{macrocode} +\def\TrackLangGetKnownLangFromIso#1{% + \@tracklang@nameuse{@tracklang@knownisolang@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangIfHasKnownCountry} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfHasKnownCountry}\marg{language}\marg{true}\marg{false} +%\end{definition} +%Checks if the given language has an ISO 3166-1 country code +%(but is not necessarily tracked). +% \begin{macrocode} +\def\TrackLangIfHasKnownCountry#1#2#3{% + \@tracklang@ifundef{@tracklang@knowniso@3166@#1}% + {#3}% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangGetKnownCountry} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangGetKnownCountry}\marg{language} +%\end{definition} +%Fetches the ISO 3166-1 country code for the given language. +% \begin{macrocode} +\def\TrackLangGetKnownCountry#1{% + \@tracklang@nameuse{@tracklang@knowniso@3166@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangGetDefaultScript} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangGetDefaultScript}\marg{language} +%\end{definition} +% Gets the default script for the given root language label. +% \begin{macrocode} +\def\TrackLangGetDefaultScript#1{% + \@tracklang@nameuse{@tracklang@knowniso@script@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangIfHasDefaultScript} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfHasDefaultScript}\marg{language}\marg{true}\marg{false} +%\end{definition} +%If there's a default script for \meta{language}, do \meta{true} otherwise +%do \meta{false}. +% \begin{macrocode} +\def\TrackLangIfHasDefaultScript#1#2#3{% + \@tracklang@ifundef{@tracklang@knowniso@script@#1}{#3}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\subsection{Mappings} +%\label{sec:code:mappings} % %\begin{macro}{\AddTrackedIsoLanguage} %\begin{definition} @@ -2082,12 +4637,13 @@ % Adds a~mapping between the given ISO code and language % name. There may be multiple mappings from an ISO code to a % language name, but only one mapping from a language name to an ISO -% code. +% code. (v1.3 switched from unexpanded to expanded def. +% All labels should be expandable.) % \begin{macrocode} \def\AddTrackedIsoLanguage#1#2#3{% - \@tracklang@namedef{@tracklang@#1@isofromlang@#3}{#2}% + \@tracklang@enamedef{@tracklang@#1@isofromlang@#3}{#2}% \@tracklang@ifundef{@tracklang@#1@isotolang@#2}% - {\@tracklang@namedef{@tracklang@#1@isotolang@#2}{#3}}% + {\@tracklang@enamedef{@tracklang@#1@isotolang@#2}{#3}}% {% \def\@tracklang@lang{#3}% \expandafter\@tracklang@add\expandafter\@tracklang@lang @@ -2164,2189 +4720,3781 @@ % \end{macrocode} %\end{macro} % -%\subsubsection{Predefined Dialects}\label{sec:predefined} -% -% The ISO 639-1 and 639-2 codes are used to map the root language name to the -% ISO language code. The 3166-1 codes are used to map the -% dialect\slash variant to the ISO country code. The country code is -% omitted if ambiguous (for example, the language is spoken in -% multiple countries). Some ``dialects'' are just synonyms for a -% language name, such as ``francais'' or ``frenchb''. Some of the -% languages have two ISO 639-2 codes designated as ``B'' -% (bibliographic) or ``T'' (terminology). In these cases the -% terminology code is used as the primary 639-2 code. +%\begin{macro}{\ThreeLetterExtIsoLanguageCode} +% \begin{macrocode} +\def\ThreeLetterExtIsoLanguageCode{639-3} +% \end{macrocode} +%\end{macro} % -%\begin{macro}{\TrackPredefinedDialect} +%\begin{macro}{\SetTrackedDialectModifier} +%\changes{1.3}{2016-10-07}{new} %\begin{definition} -%\cs{TrackPredefinedDialect}\marg{dialect label} +%\cs{SetTrackedDialectModifier}\marg{dialect}\marg{value} %\end{definition} +%Set the modifier for \meta{dialect}. (For example, old or new.) +%Arguments are expanded. % \begin{macrocode} -\def\TrackPredefinedDialect#1{% - \@tracklang@ifundef{@tracklang@add@#1}% - {% - \@tracklang@err{Dialect `#1' is not predefined}{}% - }% - {\@tracklang@nameuse{@tracklang@add@#1}}% +\def\SetTrackedDialectModifier#1#2{% + \@tracklang@enamedef{@tracklang@modifier@#1}{#2}% } % \end{macrocode} %\end{macro} % -% Provide some predefined languages/dialects. -%\begin{macro}{\@tracklang@declareoption} -%\changes{1.1}{2014-11-21}{new} -% Provide a hook to declare a predefined setting as a package -% option. This is defined by tracklang.sty before loading -% tracklang.tex but if this file isn't load through tracklang.sty -% provide a definition that ignores its argument if not already -% defined. +%\begin{macro}{\GetTrackedDialectModifier} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{GetTrackedDialectModifier}\marg{dialect} +%\end{definition} +%Get the modifier for \meta{dialect}. % \begin{macrocode} -\ifx\@tracklang@declareoption\undefined - \def\@tracklang@declareoption#1{} -\fi +\def\GetTrackedDialectModifier#1{% + \@tracklang@nameuse{@tracklang@modifier@#1}% +} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@acadian} +%\begin{macro}{\IfHasTrackedDialectModifier} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{IfHasTrackedDialectModifier}\marg{dialect}\marg{true}\marg{false} +%\end{definition} +%If there's a modifier for \meta{dialect}, do \meta{true} otherwise +%do \meta{false}. % \begin{macrocode} -\def\@tracklang@add@acadian{% - \AddTrackedDialect{acadian}{french}% - \AddTrackedIsoLanguage{639-1}{fr}{french}% +\def\IfHasTrackedDialectModifier#1#2#3{% + \@tracklang@ifundef{@tracklang@modifier@#1}{#3}{#2}% } -\@tracklang@declareoption{acadian} % \end{macrocode} %\end{macro} -%\begin{macro}{\@tracklang@add@afrikaans} +% +%\begin{macro}{\SetTrackedDialectScript} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{SetTrackedDialectScript}\marg{dialect}\marg{value} +%\end{definition} +%Set the script for \meta{dialect}. (For example, Latn or Cyrl.) +%Arguments are expanded. % \begin{macrocode} -\def\@tracklang@add@afrikaans{% - \AddTrackedLanguage{afrikaans}% - \AddTrackedIsoLanguage{639-1}{af}{afrikaans}% - \AddTrackedIsoLanguage{639-2}{afr}{afrikaans}% +\def\SetTrackedDialectScript#1#2{% + \@tracklang@enamedef{@tracklang@script@#1}{#2}% } -\@tracklang@declareoption{afrikaans} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@albanian} +%\begin{macro}{\GetTrackedDialectScript} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{GetTrackedDialectScript}\marg{dialect} +%\end{definition} +%Get the script for \meta{dialect}. % \begin{macrocode} -\def\@tracklang@add@albanian{% - \AddTrackedLanguage{albanian}% - \AddTrackedIsoLanguage{639-1}{sq}{albanian}% - \AddTrackedIsoLanguage{639-2-B}{alb}{albanian}% - \AddTrackedIsoLanguage{639-2-T}{sqi}{albanian}% - \AddTrackedIsoLanguage{639-2}{sqi}{albanian}% +\def\GetTrackedDialectScript#1{% + \@tracklang@nameuse{@tracklang@script@#1}% } -\@tracklang@declareoption{albanian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@amharic} +%\begin{macro}{\IfHasTrackedDialectScript} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{IfHasTrackedDialectScript}\marg{dialect}\marg{true}\marg{false} +%\end{definition} +%If there's a script for \meta{dialect}, do \meta{true} otherwise +%do \meta{false}. % \begin{macrocode} -\def\@tracklang@add@amharic{% - \AddTrackedLanguage{amharic}% - \AddTrackedIsoLanguage{639-1}{am}{amharic}% - \AddTrackedIsoLanguage{639-2}{amh}{amharic}% +\def\IfHasTrackedDialectScript#1#2#3{% + \@tracklang@ifundef{@tracklang@script@#1}{#3}{#2}% } -\@tracklang@declareoption{amharic} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@anglosaxon} -% \begin{macrocode} -\def\@tracklang@add@anglosaxon{% - \AddTrackedLanguage{anglosaxon}% - \AddTrackedIsoLanguage{639-2}{ang}{anglosaxon}% +%\begin{macro}{\IfTrackedDialectIsScriptCs} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{IfTrackedDialectIsScriptCs}\marg{dialect}\marg{cs}\marg{true}\marg{false} +%\end{definition} +%If the given tracked dialect has an associated script and that +%script code matches the replacement text for the control sequence +%\meta{cs} then do \meta{true} otherwise to \meta{false}. If the +%tracked dialect doesn't have an associated script then the default +%script for the root language is tested. The use of +%a control sequence allows \cs{ifx} for the test, which means that +%this command can expand. The supplementary package +%\sty{tracklang-script} provides control sequences for known ISO +%15924 codes. +% \begin{macrocode} +\def\IfTrackedDialectIsScriptCs#1#2#3#4{% + \IfHasTrackedDialectScript{#1}% + {% + \expandafter\ifx\expandafter#2\csname @tracklang@script@#1\endcsname + #3% + \else + #4% + \fi + }% + {% + \TrackLangIfHasDefaultScript{\TrackedLanguageFromDialect{#1}}% + {% + \expandafter\ifx\expandafter + #2\csname @tracklang@knowniso@script@\TrackedLanguageFromDialect{#1}\endcsname + #3% + \else + #4% + \fi + }% + {#4}% + }% } -\@tracklang@declareoption{anglosaxon} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@apache} +%\begin{macro}{\SetTrackedDialectVariant} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{SetTrackedDialectVariant}\marg{dialect}\marg{value} +%\end{definition} +%Set the modifier for \meta{dialect}. (For example, old or new.) +%Arguments are expanded. % \begin{macrocode} -\def\@tracklang@add@apache{% - \AddTrackedLanguage{apache}% - \AddTrackedIsoLanguage{639-2}{apa}{apache}% +\def\SetTrackedDialectVariant#1#2{% + \@tracklang@enamedef{@tracklang@variant@#1}{#2}% } -\@tracklang@declareoption{apache} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@arabic} +%\begin{macro}{\GetTrackedDialectVariant} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{GetTrackedDialectVariant}\marg{dialect} +%\end{definition} +%Get the modifier for \meta{dialect}. % \begin{macrocode} -\def\@tracklang@add@arabic{% - \AddTrackedLanguage{arabic}% - \AddTrackedIsoLanguage{639-1}{ar}{arabic}% - \AddTrackedIsoLanguage{639-2}{ara}{arabic}% +\def\GetTrackedDialectVariant#1{% + \@tracklang@nameuse{@tracklang@variant@#1}% } -\@tracklang@declareoption{arabic} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@armenian} +%\begin{macro}{\IfHasTrackedDialectVariant} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{IfHasTrackedDialectVariant}\marg{dialect}\marg{true}\marg{false} +%\end{definition} +%If there's a modifier for \meta{dialect}, do \meta{true} otherwise +%do \meta{false}. % \begin{macrocode} -\def\@tracklang@add@armenian{% - \AddTrackedLanguage{armenian}% - \AddTrackedIsoLanguage{639-1}{hy}{armenian}% - \AddTrackedIsoLanguage{639-2-B}{arm}{armenian}% - \AddTrackedIsoLanguage{639-2-T}{hye}{armenian}% - \AddTrackedIsoLanguage{639-2}{hye}{armenian}% +\def\IfHasTrackedDialectVariant#1#2#3{% + \@tracklang@ifundef{@tracklang@variant@#1}{#3}{#2}% } -\@tracklang@declareoption{armenian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@asturian} +%\begin{macro}{\SetTrackedDialectSubLang} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{SetTrackedDialectSubLang}\marg{dialect}\marg{value} +%\end{definition} +%Set the sublang for \meta{dialect}. +%Arguments are expanded. % \begin{macrocode} -\def\@tracklang@add@asturian{% - \AddTrackedLanguage{asturian}% - \AddTrackedIsoLanguage{639-2}{ast}{asturian}% +\def\SetTrackedDialectSubLang#1#2{% + \@tracklang@enamedef{@tracklang@sublang@#1}{#2}% } -\@tracklang@declareoption{asturian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@american} +%\begin{macro}{\GetTrackedDialectSubLang} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{GetTrackedDialectSubLang}\marg{dialect} +%\end{definition} +%Get the sublang for \meta{dialect}. % \begin{macrocode} -\def\@tracklang@add@american{% - \AddTrackedDialect{american}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{US}{american}% +\def\GetTrackedDialectSubLang#1{% + \@tracklang@nameuse{@tracklang@sublang@#1}% } -\@tracklang@declareoption{american} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@australian} +%\begin{macro}{\IfHasTrackedDialectSubLang} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{IfHasTrackedDialectSubLang}\marg{dialect}\marg{true}\marg{false} +%\end{definition} +%If there's a sublang for \meta{dialect}, do \meta{true} otherwise +%do \meta{false}. % \begin{macrocode} -\def\@tracklang@add@australian{% - \AddTrackedDialect{australian}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{AU}{australian}% +\def\IfHasTrackedDialectSubLang#1#2#3{% + \@tracklang@ifundef{@tracklang@sublang@#1}{#3}{#2}% } -\@tracklang@declareoption{australian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@austrian} +%\begin{macro}{\SetTrackedDialectAdditional} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{SetTrackedDialectAdditional}\marg{dialect}\marg{value} +%\end{definition} +%Set the extra for \meta{dialect}. +%Arguments are expanded. % \begin{macrocode} -\def\@tracklang@add@austrian{% - \AddTrackedDialect{austrian}{german}% - \AddTrackedIsoLanguage{639-1}{de}{german}% - \AddTrackedIsoLanguage{639-2-B}{ger}{german}% - \AddTrackedIsoLanguage{639-2-T}{deu}{german}% - \AddTrackedIsoLanguage{639-2}{deu}{german}% - \AddTrackedIsoLanguage{3166-1}{AT}{austrian}% +\def\SetTrackedDialectAdditional#1#2{% + \@tracklang@enamedef{@tracklang@extra@#1}{#2}% } -\@tracklang@declareoption{austrian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@naustrian} +%\begin{macro}{\GetTrackedDialectAdditional} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{GetTrackedDialectAdditional}\marg{dialect} +%\end{definition} +%Get the extra for \meta{dialect}. % \begin{macrocode} -\def\@tracklang@add@naustrian{% - \AddTrackedDialect{naustrian}{german}% - \AddTrackedIsoLanguage{639-1}{de}{german}% - \AddTrackedIsoLanguage{639-2-B}{ger}{german}% - \AddTrackedIsoLanguage{639-2-T}{deu}{german}% - \AddTrackedIsoLanguage{639-2}{deu}{german}% - \AddTrackedIsoLanguage{3166-1}{AT}{naustrian}% +\def\GetTrackedDialectAdditional#1{% + \@tracklang@nameuse{@tracklang@extra@#1}% } -\@tracklang@declareoption{naustrian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@bahasa} +%\begin{macro}{\IfHasTrackedDialectAdditional} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{IfHasTrackedDialectAdditional}\marg{dialect}\marg{true}\marg{false} +%\end{definition} +%If there's extra info for \meta{dialect}, do \meta{true} otherwise +%do \meta{false}. % \begin{macrocode} -\def\@tracklang@add@bahasa{% - \AddTrackedDialect{bahasa}{bahasai}% - \AddTrackedIsoLanguage{639-1}{id}{bahasai}% - \AddTrackedIsoLanguage{639-2}{ind}{bahasai}% - \AddTrackedIsoLanguage{3166-1}{IN}{bahasa}% +\def\IfHasTrackedDialectAdditional#1#2#3{% + \@tracklang@ifundef{@tracklang@extra@#1}{#3}{#2}% } -\@tracklang@declareoption{bahasa} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@bahasai} +%\begin{macro}{\GetTrackedLanguageTag} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{GetTrackedLanguageTag}\marg{dialect} +%\end{definition} +%Get the language tag for \meta{dialect}. +% \begin{macrocode} +\def\GetTrackedLanguageTag#1{% + \IfTrackedLanguageHasIsoCode{639-1}{\TrackedLanguageFromDialect{#1}}% + {\TrackedIsoCodeFromLanguage{639-1}{\TrackedLanguageFromDialect{#1}}}% + {% + \IfTrackedLanguageHasIsoCode{639-2}{\TrackedLanguageFromDialect{#1}}% + {\TrackedIsoCodeFromLanguage{639-2}{\TrackedLanguageFromDialect{#1}}}% + {% + \IfTrackedLanguageHasIsoCode{639-3}{\TrackedLanguageFromDialect{#1}}% + {\TrackedIsoCodeFromLanguage{639-3}{\TrackedLanguageFromDialect{#1}}}% + {und}% undefined + }% + }% + \@tracklang@ifundef{@tracklang@sublang@#1}% + {}% + {-\csname @tracklang@sublang@#1\endcsname}% + \@tracklang@ifundef{@tracklang@script@#1}% + {}% + {-\csname @tracklang@script@#1\endcsname}% + \IfTrackedLanguageHasIsoCode{3166-1}{#1}% + {-\TrackedIsoCodeFromLanguage{3166-1}{#1}}% + {}% + \@tracklang@ifundef{@tracklang@variant@#1}% + {}% + {-\csname @tracklang@variant@#1\endcsname}% + \@tracklang@ifundef{@tracklang@extra@#1}% + {}% + {-\csname @tracklang@extra@#1\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetCurrentTrackedDialect} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{SetCurrentTrackedDialect}\marg{dialect} +%\end{definition} +%Provided for use by language hooks to establish the current tracked +%dialect. This command doesn't change \cs{languagename} or +%hyphenation patterns etc. It just provides convenient commands that +%can be accessed. +% \begin{macrocode} +\def\SetCurrentTrackedDialect#1{% + \edef\CurrentTrackedDialect{\GetTrackedDialectFromMapping{#1}}% + \IfTrackedDialect{\CurrentTrackedDialect}% + {}% + {% +% \end{macrocode} +% Has the root language name been supplied? +% \begin{macrocode} + \IfTrackedLanguage{#1}% + {% +% \end{macrocode} +% Get the last dialect to be tracked with this language. % \begin{macrocode} -\def\@tracklang@add@bahasai{% - \AddTrackedDialect{bahasai}{bahasai}% - \AddTrackedIsoLanguage{639-1}{id}{bahasai}% - \AddTrackedIsoLanguage{639-2}{ind}{bahasai}% - \AddTrackedIsoLanguage{3166-1}{IN}{bahasai}% + \edef\@tracklang@dialects{\TrackedDialectsFromLanguage{#1}}% + \@tracklang@for\@tracklang@dialect:=\@tracklang@dialects\do{% + \let\CurrentTrackedDialect\@tracklang@dialect + }% + }% + {}% + }% + \IfTrackedDialect{\CurrentTrackedDialect}% + {% + \edef\CurrentTrackedLanguage{% + \TrackedLanguageFromDialect{\CurrentTrackedDialect}}% + \edef\CurrentTrackedDialectModifier{% + \GetTrackedDialectModifier{\CurrentTrackedDialect}}% + \edef\CurrentTrackedDialectVariant{% + \GetTrackedDialectVariant{\CurrentTrackedDialect}}% +% \end{macrocode} +% Get the default script if not set. +% \begin{macrocode} + \IfHasTrackedDialectScript{\CurrentTrackedDialect}% + {% + \edef\CurrentTrackedDialectScript{% + \GetTrackedDialectScript{\CurrentTrackedDialect}}% + }% + {% + \edef\CurrentTrackedDialectScript{% + \TrackLangGetDefaultScript\CurrentTrackedLanguage}% + }% + \edef\CurrentTrackedDialectSubLang{% + \GetTrackedDialectSubLang{\CurrentTrackedDialect}}% + \edef\CurrentTrackedDialectAdditional{% + \GetTrackedDialectAdditional{\CurrentTrackedDialect}}% + \edef\CurrentTrackedLanguageTag{% + \GetTrackedLanguageTag{\CurrentTrackedDialect}}% +% \end{macrocode} +%Region code. +% \begin{macrocode} + \IfTrackedLanguageHasIsoCode{3166-1}{\CurrentTrackedDialect}% + {% + \edef\CurrentTrackedRegion{% + \TrackedIsoCodeFromLanguage{3166-1}{\CurrentTrackedDialect}}% + }% + {\def\CurrentTrackedRegion{}}% +% \end{macrocode} +%Language code. +% \begin{macrocode} + \IfTrackedLanguageHasIsoCode{639-1}{\CurrentTrackedLanguage}% + {% + \edef\CurrentTrackedIsoCode{% + \TrackedIsoCodeFromLanguage{639-1}{\CurrentTrackedLanguage}}% + }% + {% + \IfTrackedLanguageHasIsoCode{639-2}{\CurrentTrackedLanguage}% + {% + \edef\CurrentTrackedIsoCode{% + \TrackedIsoCodeFromLanguage{639-2}{\CurrentTrackedLanguage}}% + }% + {% + \IfTrackedLanguageHasIsoCode{639-3}{\CurrentTrackedLanguage}% + {% + \edef\CurrentTrackedIsoCode{% + \TrackedIsoCodeFromLanguage{639-3}{\CurrentTrackedLanguage}}% + }% + {% + \def\CurrentTrackedIsoCode{}% + }% + }% + }% + }% + {% + \@tracklang@warn{Unknown dialect label `#1' passed to + \string\SetCurrentTrackedDialect}% + \edef\CurrentTrackedLanguage{\languagename}% + \def\CurrentTrackedDialectModifier{}% + \def\CurrentTrackedDialectVariant{}% + \def\CurrentTrackedDialectScript{}% + \def\CurrentTrackedDialectSubLang{}% + \def\CurrentTrackedDialectAdditional{}% + \def\CurrentTrackedIsoCode{}% + \def\CurrentTrackedRegion{}% + \def\CurrentTrackedLanguageTag{und}% + }% } -\@tracklang@declareoption{bahasai} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@bahasam} +% +%\begin{macro}{\AddTrackedLanguageIsoCodes} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{AddTrackedLanguageIsoCodes}\marg{language} +%\end{definition} +%Adds the ISO 639-1 and 639-2 ISO codes for the given language, +%which must have previously been declared using +%\cs{TrackLangNewLanguage}. +% \begin{macrocode} +\def\AddTrackedLanguageIsoCodes#1{% + \@tracklang@ifundef{@tracklang@knowniso@639@1@#1}% + {}% + {% + \AddTrackedIsoLanguage\TwoLetterIsoLanguageCode + {\csname @tracklang@knowniso@639@1@#1\endcsname}{#1}% + }% + \@tracklang@ifundef{@tracklang@knowniso@639@2@#1}% + {}% + {% + \AddTrackedIsoLanguage\ThreeLetterIsoLanguageCode + {\csname @tracklang@knowniso@639@2@#1\endcsname}{#1}% +% \end{macrocode} +% Does it have a different 639-2 (B) code? % \begin{macrocode} -\def\@tracklang@add@bahasam{% - \AddTrackedLanguage{bahasam}% - \AddTrackedIsoLanguage{639-1}{ms}{bahasam}% - \AddTrackedIsoLanguage{639-2-B}{may}{bahasam}% - \AddTrackedIsoLanguage{639-2-T}{msa}{bahasam}% - \AddTrackedIsoLanguage{639-2}{msa}{bahasam}% - \AddTrackedIsoLanguage{3166-1}{MY}{bahasam}% + \@tracklang@ifundef{@tracklang@knowniso@639@2B@#1}% + {}% + {% + \AddTrackedIsoLanguage{\ThreeLetterIsoLanguageCode-T}% + {\csname @tracklang@knowniso@639@2@#1\endcsname}{#1}% + \AddTrackedIsoLanguage{\ThreeLetterIsoLanguageCode-B}% + {\csname @tracklang@knowniso@639@2B@#1\endcsname}{#1}% + }% + }% + \@tracklang@ifundef{@tracklang@knowniso@639@3@#1}% + {}% + {% + \AddTrackedIsoLanguage\ThreeLetterExtIsoLanguageCode + {\csname @tracklang@knowniso@639@3@#1\endcsname}{#1}% + }% } -\@tracklang@declareoption{bahasam} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@basque} +%\begin{macro}{\AddTrackedCountryIsoCode} +%\changes{1.3}{2016-10-07}{new} +%As above but adds the 3166-1 country code if provided. Most +%root languages don't have an associated country code as they're +%spoken in multiple regions. Some of those that do have an +%associated region code may also be spoken as a minority language +%elsewhere, so this is separate from the previous command. If a +%regionless setting is required, use \cs{TrackLocale} instead of +%\cs{TrackPredefinedDialect}. % \begin{macrocode} -\def\@tracklang@add@basque{% - \AddTrackedLanguage{basque}% - \AddTrackedIsoLanguage{639-1}{eu}{basque}% - \AddTrackedIsoLanguage{639-2-B}{baq}{basque}% - \AddTrackedIsoLanguage{639-2-T}{eus}{basque}% - \AddTrackedIsoLanguage{639-2}{eus}{basque}% +\def\AddTrackedCountryIsoCode#1{% + \@tracklang@ifundef{@tracklang@knowniso@3166@#1}% + {}% + {% + \AddTrackedIsoLanguage{3166-1}% + {\csname @tracklang@knowniso@3166@#1\endcsname}{#1}% + }% } -\@tracklang@declareoption{basque} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@bengali} +%\subsection{Tracking Languages and Dialects}\label{sec:tracking} +% +% The commands here are provided to indicate that a language or dialect +% is active (tracked) in the document. +% +%\begin{macro}{\TrackPredefinedDialect} +%\begin{definition} +%\cs{TrackPredefinedDialect}\marg{dialect label} +%\end{definition} +% Track a predefined language or dialect. % \begin{macrocode} -\def\@tracklang@add@bengali{% - \AddTrackedLanguage{bengali}% - \AddTrackedIsoLanguage{639-1}{bn}{bengali}% - \AddTrackedIsoLanguage{639-2}{ben}{bengali}% +\def\TrackPredefinedDialect#1{% + \@tracklang@ifundef{@tracklang@add@#1}% + {% + \@tracklang@err{Dialect or language `#1' is not predefined}{}% + }% + {\@tracklang@nameuse{@tracklang@add@#1}}% } -\@tracklang@declareoption{bengali} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@brazil} +%\begin{macro}{\@tracklang@hassecondchar} +%\changes{1.3}{2016-10-07}{new} +%Check if second argument is present (non-empty and not \cs{relax}). % \begin{macrocode} -\def\@tracklang@add@brazil{% - \AddTrackedDialect{brazil}{portuges}% - \AddTrackedIsoLanguage{639-1}{pt}{portuges}% - \AddTrackedIsoLanguage{639-2}{por}{portuges}% - \AddTrackedIsoLanguage{3166-1}{BR}{brazil}% +\def\@tracklang@hassecondchar#1#2\@end@tracklang@hassecondchar#3#4{% + \ifx\relax#2\relax + #4% + \else + #3% + \fi } -\@tracklang@declareoption{brazil} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@brazilian} +%\begin{macro}{\@tracklang@hasthirdchar} +%\changes{1.3}{2016-10-07}{new} +%Check if third argument is present (non-empty and not \cs{relax}). % \begin{macrocode} -\def\@tracklang@add@brazilian{% - \AddTrackedDialect{brazilian}{portuges}% - \AddTrackedIsoLanguage{639-1}{pt}{portuges}% - \AddTrackedIsoLanguage{639-2}{por}{portuges}% - \AddTrackedIsoLanguage{3166-1}{BR}{brazilian}% +\def\@tracklang@hasthirdchar#1#2#3\@end@tracklang@hasthirdchar#4#5{% + \ifx\relax#3\relax + #5% + \else + #4% + \fi } -\@tracklang@declareoption{brazilian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@breton} +%\begin{macro}{\@tracklang@hasfourthchar} +%\changes{1.3}{2016-10-07}{new} +%Check if fourth argument is present (non-empty and not \cs{relax}). % \begin{macrocode} -\def\@tracklang@add@breton{% - \AddTrackedLanguage{breton}% - \AddTrackedIsoLanguage{639-1}{br}{breton}% - \AddTrackedIsoLanguage{639-2}{bre}{breton}% - \AddTrackedIsoLanguage{3166-1}{FR}{breton}% +\def\@tracklang@hasfourthchar#1#2#3#4\@end@tracklang@hasfourthchar#5#6{% + \ifx\relax#4\relax + #6% + \else + #5% + \fi } -\@tracklang@declareoption{breton} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@british} +%\begin{macro}{\@tracklang@hasfifthchar} +%\changes{1.3}{2016-10-07}{new} +%Check if fifth argument is present (non-empty and not \cs{relax}). % \begin{macrocode} -\def\@tracklang@add@british{% - \AddTrackedDialect{british}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{GB}{british}% +\def\@tracklang@hasfifthchar#1#2#3#4#5\@end@tracklang@hasfifthchar#6#7{% + \ifx\relax#5\relax + #7% + \else + #6% + \fi } -\@tracklang@declareoption{british} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@bulgarian} +%\begin{macro}{\@tracklang@hasninthchar} +%\changes{1.3}{2016-10-07}{new} +%Check if ninth argument is present (non-empty and not \cs{relax}). % \begin{macrocode} -\def\@tracklang@add@bulgarian{% - \AddTrackedLanguage{bulgarian}% - \AddTrackedIsoLanguage{639-1}{bg}{bulgarian}% - \AddTrackedIsoLanguage{639-2}{bul}{bulgarian}% +\def\@tracklang@hasninthchar#1#2#3#4#5#6#7#8#9\@end@tracklang@hasninthchar{% + \ifx\relax#9\relax + \expandafter\@tracklang@secondoftwo + \else + \expandafter\@tracklang@firstoftwo + \fi } -\@tracklang@declareoption{bulgarian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@canadian} +%\begin{macro}{\@tracklang@ifalpha} +%\changes{1.3}{2016-10-07}{new} +%Check if argument a, \ldots, z or A, \ldots, Z. % \begin{macrocode} -\def\@tracklang@add@canadian{% - \AddTrackedDialect{canadian}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{CA}{canadian}% +\def\@tracklang@ifalpha#1#2#3{% + \ifx\relax#1\relax +% \end{macrocode} +%First argument empty or \cs{relax}. +% \begin{macrocode} + #3% + \else + \ifnum\lccode`#1<`a\relax + #3% + \else + \ifnum\lccode`#1>`z\relax + #3% + \else +% \end{macrocode} +% Is alpha. +% \begin{macrocode} + #2% + \fi + \fi + \fi } -\@tracklang@declareoption{canadian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@canadien} +%\begin{macro}{\@tracklang@ifdigit} +%\changes{1.3}{2016-10-07}{new} +%Check if argument is digit (0,\ldots,9). +% \begin{macrocode} +\def\@tracklang@ifdigit#1#2#3{% + \ifx\relax#1\relax +% \end{macrocode} +%First argument empty or \cs{relax}. +% \begin{macrocode} + #3% + \else + \ifnum`#1<`0\relax + #3% + \else + \ifnum`#1>`9\relax + #3% + \else +% \end{macrocode} +% Is digit. % \begin{macrocode} -\def\@tracklang@add@canadien{% - \AddTrackedDialect{canadien}{french}% - \AddTrackedIsoLanguage{639-1}{fr}{french}% - \AddTrackedIsoLanguage{639-2-B}{fre}{french}% - \AddTrackedIsoLanguage{639-2-T}{fra}{french}% - \AddTrackedIsoLanguage{639-2}{fra}{french}% - \AddTrackedIsoLanguage{3166-1}{CA}{canadien}% + #2% + \fi + \fi + \fi } -\@tracklang@declareoption{canadien} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@catalan} +%\begin{macro}{\@tracklang@ifalldigits} +%\changes{1.3}{2016-10-07}{new} +%Check if the argument only consists of digits (no sign). % \begin{macrocode} -\def\@tracklang@add@catalan{% - \AddTrackedLanguage{catalan}% - \AddTrackedIsoLanguage{639-1}{ca}{catalan}% - \AddTrackedIsoLanguage{639-2}{cat}{catalan}% +\def\@tracklang@ifalldigits#1{% + \expandafter\ifx\relax#1\relax + \expandafter\@tracklang@secondoftwo + \else + \expandafter\@@tracklang@ifalldigits#1\@tracklang@nnil + \fi } -\@tracklang@declareoption{catalan} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@coptic} +%\begin{macro}{\@@tracklang@ifalldigits} % \begin{macrocode} -\def\@tracklang@add@coptic{% - \AddTrackedLanguage{coptic}% - \AddTrackedIsoLanguage{639-2}{cop}{coptic}% +\def\@@tracklang@ifalldigits#1{% + \ifx#1\@tracklang@nnil + \def\@tracklang@next{\expandafter\@tracklang@firstoftwo}% + \else + \@tracklang@ifdigit{#1}% + {% + \let\@tracklang@next\@@tracklang@ifalldigits + }% + {% + \def\@tracklang@next##1\@tracklang@nnil{% + \expandafter\@tracklang@secondoftwo}% + }% + \fi + \@tracklang@next } -\@tracklang@declareoption{coptic} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@croatian} +%\begin{macro}{\@tracklang@ifalphanumeric} +%\changes{1.3}{2016-10-07}{new} +%Check if argument is an alphanumeric (0,\ldots,9) or (a,\ldots,z) +%or (A,\ldots,Z). % \begin{macrocode} -\def\@tracklang@add@croatian{% - \AddTrackedLanguage{croatian}% - \AddTrackedIsoLanguage{639-1}{hr}{croatian}% - \AddTrackedIsoLanguage{639-2}{hrv}{croatian}% +\def\@tracklang@ifalphanumeric#1#2#3{% + \@tracklang@ifalpha{#1}% + {#2}% + {% + \@tracklang@ifdigit{#1}{#2}{#3}% + }% } -\@tracklang@declareoption{croatian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@croatia} +%\begin{macro}{\TrackLangIfAlphaNumericChar} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfAlphaNumericChar}\marg{tag}\marg{true}\marg{false} +%\end{definition} +%Check if the argument is a single alphanumeric character. % \begin{macrocode} -\def\@tracklang@add@croatia{% - \AddTrackedDialect{croatia}{croatian}% - \AddTrackedIsoLanguage{639-1}{hr}{croatian}% - \AddTrackedIsoLanguage{639-2}{hrv}{croatian}% - \AddTrackedIsoLanguage{3166-1}{HR}{croatia}% +\def\TrackLangIfAlphaNumericChar#1#2#3{% + \expandafter\ifx\expandafter\relax#1\relax +% \end{macrocode} +% Tag empty or \cs{relax}. +% \begin{macrocode} + #3% + \else + \expandafter\@tracklang@hassecondchar#1\relax\relax + \@end@tracklang@hassecondchar + {#3}% + {\expandafter\@tracklang@ifalphanumeric#1{#2}{#3}}% + \fi } -\@tracklang@declareoption{croatia} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@istriacountycroatian} +%\begin{macro}{\TrackLangIfLanguageTag} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfLanguageTag}\marg{tag}\marg{true}\marg{false} +%\end{definition} +%Check if the argument is a language tag (two or three letter +%lower case). +% \begin{macrocode} +\def\TrackLangIfLanguageTag#1#2#3{% + \expandafter\@tracklang@hasthirdchar#1\relax\relax\relax + \@end@tracklang@hasthirdchar + {% +% \end{macrocode} +% Has 3 or more characters. +% \begin{macrocode} + \expandafter\@tracklang@hasfourthchar#1\relax\@end@tracklang@hasfourthchar + {#3}% + {% +% \end{macrocode} +% Has 3 characters. Are they all lower case? % \begin{macrocode} -\def\@tracklang@add@istriacountycroatian{% - \AddTrackedDialect{istriacountycroatian}{croatian}% - \AddTrackedIsoLanguage{639-1}{hr}{croatian}% - \AddTrackedIsoLanguage{639-2}{hrv}{croatian}% - \AddTrackedIsoLanguage{3166-1}{HR}{istriacountycroatian}% + \expandafter\@tracklang@iflanguage@iii@tag#1{#2}{#3}% + }% + }% + {% +% \end{macrocode} +% Has less than 3 characters. +% \begin{macrocode} + \expandafter\@tracklang@hassecondchar#1\relax\relax + \@end@tracklang@hassecondchar + {% +% \end{macrocode} +%Has two characters. Are they both lower case? +% \begin{macrocode} + \expandafter\@tracklang@iflanguage@ii@tag#1{#2}{#3}% + }% + {#3}% + }% } -\@tracklang@declareoption{istriacountycroatian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@istriacountyitalian} +%\begin{macro}{\@tracklang@iflanguage@ii@tag} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@istriacountyitalian{% - \AddTrackedDialect{istriacountyitalian}{italian}% - \AddTrackedIsoLanguage{639-1}{it}{italian}% - \AddTrackedIsoLanguage{639-2}{ita}{italian}% - \AddTrackedIsoLanguage{3166-1}{HR}{istriacountyitalian}% +\def\@tracklang@iflanguage@ii@tag#1#2#3#4{% + \ifnum\lccode`#1=`#1\relax + \ifnum\lccode`#2=`#2\relax + #3% + \else + #4% + \fi + \else + #4% + \fi } -\@tracklang@declareoption{istriacountyitalian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@czech} +%\begin{macro}{\@tracklang@iflanguage@iii@tag} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@czech{% - \AddTrackedLanguage{czech}% - \AddTrackedIsoLanguage{639-1}{cs}{czech}% - \AddTrackedIsoLanguage{639-2-B}{cze}{czech}% - \AddTrackedIsoLanguage{639-2-T}{ces}{czech}% - \AddTrackedIsoLanguage{639-2}{ces}{czech}% +\def\@tracklang@iflanguage@iii@tag#1#2#3#4#5{% + \ifnum\lccode`#1=`#1\relax + \ifnum\lccode`#2=`#2\relax + \ifnum\lccode`#3=`#3\relax + #4% + \else + #5% + \fi + \else + #5% + \fi + \else + #5% + \fi } -\@tracklang@declareoption{czech} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@danish} +%\begin{macro}{\TrackLangIfRegionTag} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfRegionTag}\marg{tag}\marg{true}\marg{false} +%\end{definition} +%Check if the argument is a region tag (two letter +%upper case or three digit numeric). +% \begin{macrocode} +\def\TrackLangIfRegionTag#1#2#3{% + \expandafter\@tracklang@hasthirdchar#1\relax\relax\relax + \@end@tracklang@hasthirdchar + {% +% \end{macrocode} +% Has 3 or more characters. Is it a three digit numeric code? +% \begin{macrocode} + \expandafter\@tracklang@hasfourthchar#1\relax\@end@tracklang@hasfourthchar + {% +% \end{macrocode} +% Has 4 or more characters. +% \begin{macrocode} + #3% + }% + {% +% \end{macrocode} +% Has 3 characters. Are they all digits? +% \begin{macrocode} + \@tracklang@ifalldigits{#1}{#2}{#3}% + }% + }% + {% +% \end{macrocode} +% Has less than 3 characters. % \begin{macrocode} -\def\@tracklang@add@danish{% - \AddTrackedLanguage{danish}% - \AddTrackedIsoLanguage{639-1}{da}{danish}% - \AddTrackedIsoLanguage{639-2}{dan}{danish}% + \expandafter\@tracklang@hassecondchar#1\relax\relax + \@end@tracklang@hassecondchar + {% +% \end{macrocode} +%Has two characters. Are they both upper case? +% \begin{macrocode} + \expandafter\@tracklang@ifregion@ii@tag#1{#2}{#3}% + }% + {#3}% + }% } -\@tracklang@declareoption{danish} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@divehi} +%\begin{macro}{\@tracklang@ifregion@ii@tag} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@divehi{% - \AddTrackedLanguage{divehi}% - \AddTrackedIsoLanguage{639-1}{dv}{divehi}% - \AddTrackedIsoLanguage{639-2}{div}{divehi}% +\def\@tracklang@ifregion@ii@tag#1#2#3#4{% + \ifnum\uccode`#1=`#1\relax + \ifnum\uccode`#2=`#2\relax + #3% + \else + #4% + \fi + \else + #4% + \fi } -\@tracklang@declareoption{divehi} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@dutch} +%\begin{macro}{\@tracklang@ifregion@iii@tag} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@dutch{% - \AddTrackedLanguage{dutch}% - \AddTrackedIsoLanguage{639-1}{nl}{dutch}% - \AddTrackedIsoLanguage{639-2-B}{dut}{dutch}% - \AddTrackedIsoLanguage{639-2-T}{nld}{dutch}% - \AddTrackedIsoLanguage{639-2}{nld}{dutch}% +\def\@tracklang@ifregion@iii@tag#1#2#3#4#5{% + \ifnum\uccode`#1=`#1\relax + \ifnum\uccode`#2=`#2\relax + \ifnum\uccode`#3=`#3\relax + #4% + \else + #5% + \fi + \else + #5% + \fi + \else + #5% + \fi } -\@tracklang@declareoption{dutch} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@netherlands} -%\changes{1.1}{2014-11-21}{new} +%\begin{macro}{\TrackLangIfScriptTag} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfScriptTag}\marg{tag}\marg{true}\marg{false} +%\end{definition} +%Check if the argument is a script tag (four letter +%title case). +% \begin{macrocode} +\def\TrackLangIfScriptTag#1#2#3{% + \expandafter\@tracklang@hasfifthchar#1\relax\relax\relax\relax\relax + \@end@tracklang@hasfifthchar + {#3}% + {% +% \end{macrocode} +% Has less than 5 characters. +% \begin{macrocode} + \expandafter\@tracklang@hasfourthchar#1\relax\relax\relax\relax + \@end@tracklang@hasfourthchar + {% +% \end{macrocode} +%Has four characters. Are they title case? (First letter upper case, +%others lower case.) % \begin{macrocode} -\def\@tracklang@add@netherlands{% - \AddTrackedDialect{netherlands}{dutch}% - \AddTrackedIsoLanguage{639-1}{nl}{dutch}% - \AddTrackedIsoLanguage{639-2-B}{dut}{dutch}% - \AddTrackedIsoLanguage{639-2-T}{nld}{dutch}% - \AddTrackedIsoLanguage{639-2}{nld}{dutch}% - \AddTrackedIsoLanguage{3166-1}{NL}{netherlands}% + \expandafter\@tracklang@ifscripttag#1{#2}{#3}% + }% + {#3}% + }% } -\@tracklang@declareoption{netherlands} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@english} +%\begin{macro}{\@tracklang@ifscripttag} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@english{% - \AddTrackedLanguage{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% +\def\@tracklang@ifscripttag#1#2#3#4#5#6{% + \ifnum\uccode`#1=`#1\relax + \ifnum\lccode`#2=`#2\relax + \ifnum\lccode`#3=`#3\relax + \ifnum\lccode`#4=`#4\relax + #5% + \else + #6% + \fi + \else + #6% + \fi + \else + #6% + \fi + \else + #6% + \fi } -\@tracklang@declareoption{english} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@esperanto} +%\begin{macro}{\TrackLangIfVariantTag} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangIfVariantTag}\marg{tag}\marg{true}\marg{false} +%\end{definition} +%Check if the argument is a variant tag. +% \begin{macrocode} +\def\TrackLangIfVariantTag#1#2#3{% + \expandafter\@tracklang@hasfifthchar#1\relax\relax\relax\relax\relax + \@end@tracklang@hasfifthchar + {% +% \end{macrocode} +% Has at least 5 characters. Does it have a maximum of 8? +% \begin{macrocode} + \expandafter\@tracklang@hasninthchar#1\relax\relax\relax\relax\relax + \relax\relax\relax\relax + \@end@tracklang@hasninthchar + {#3}% + {#2}% + }% + {% +% \end{macrocode} +%Less than 5 characters. % \begin{macrocode} -\def\@tracklang@add@esperanto{% - \AddTrackedLanguage{esperanto}% - \AddTrackedIsoLanguage{639-1}{eo}{esperanto}% - \AddTrackedIsoLanguage{639-2}{epo}{esperanto}% + \expandafter\@tracklang@hasfourthchar#1\relax\relax\relax\relax + \@end@tracklang@hasfourthchar + {% +% \end{macrocode} +%Has 4 characters. +% \begin{macrocode} + \expandafter\@tracklang@ifvariant@iv@tag#1{#2}{#3}% + }% + {#3}% + }% } -\@tracklang@declareoption{esperanto} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@estonian} +%\begin{macro}{\@tracklang@ifvariant@iv@tag} +%\changes{1.3}{2016-10-07}{new} +%four character variant starting with a digit. % \begin{macrocode} -\def\@tracklang@add@estonian{% - \AddTrackedLanguage{estonian}% - \AddTrackedIsoLanguage{639-1}{et}{estonian}% - \AddTrackedIsoLanguage{639-2}{est}{estonian}% +\def\@tracklang@ifvariant@iv@tag#1#2#3#4#5#6{% + \@tracklang@ifdigit{#1}% + {#5} + {#6}% } -\@tracklang@declareoption{estonian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@farsi} +%\begin{macro}{\@tracklang@parse@extlang} +%\cs{@TrackLangEnvSubLang}, \cs{@tracklang@split@pre} and +%\cs{\@tracklang@split@post} should be initialised before use. +%This assumes the tag is well formed. % \begin{macrocode} -\def\@tracklang@add@farsi{% - \AddTrackedLanguage{farsi}% - \AddTrackedIsoLanguage{639-1}{fa}{farsi}% - \AddTrackedIsoLanguage{639-2-B}{per}{farsi}% - \AddTrackedIsoLanguage{639-2-T}{fas}{farsi}% - \AddTrackedIsoLanguage{639-2}{fas}{farsi}% +\def\@tracklang@parse@extlang{% + \TrackLangIfLanguageTag{\@tracklang@split@pre} + {% + \ifx\@TrackLangEnvSubLang\empty + \let\@TrackLangEnvSubLang\@tracklang@split@pre + \let\@TrackLangEnvFirstSubLang\@TrackLangEnvSubLang + \else + \edef\@TrackLangEnvSubLang{\@TrackLangEnvSubLang-\@tracklang@split@pre}% + \fi +% \end{macrocode} +%Split again if there's more. +% \begin{macrocode} + \ifx\@tracklang@split@post\empty + \else + \expandafter\@tracklang@split@underscoreorhyp\expandafter + {\@tracklang@split@post}% + \ifx\@tracklang@split@pre\empty + \else + \@tracklang@parse@extlang + \fi + \fi + }% + {}% } -\@tracklang@declareoption{farsi} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@persian} +%\begin{macro}{\@tracklang@parse@variant} +%\cs{@TrackLangEnvVariant}, \cs{@tracklang@split@pre} and +%\cs{\@tracklang@split@post} should be initialised before use. +% \begin{macrocode} +\def\@tracklang@parse@variant{% + \TrackLangIfVariantTag{\@tracklang@split@pre} + {% + \ifx\@TrackLangEnvVariant\empty + \let\@TrackLangEnvVariant\@tracklang@split@pre + \else + \edef\@TrackLangEnvVariant{\@TrackLangEnvVariant + -\@tracklang@split@pre}% + \fi +% \end{macrocode} +%Split again if there's more. % \begin{macrocode} -\def\@tracklang@add@persian{% - \AddTrackedDialect{persian}{farsi}% - \AddTrackedIsoLanguage{639-1}{fa}{farsi}% - \AddTrackedIsoLanguage{639-2-B}{per}{farsi}% - \AddTrackedIsoLanguage{639-2-T}{fas}{farsi}% - \AddTrackedIsoLanguage{639-2}{fas}{farsi}% + \ifx\@tracklang@split@post\empty + \else + \expandafter\@tracklang@split@underscoreorhyp\expandafter + {\@tracklang@split@post}% + \ifx\@tracklang@split@pre\empty + \else + \@tracklang@parse@variant + \fi + \fi + }% + {}% } -\@tracklang@declareoption{persian} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@finnish} +%\begin{macro}{\TrackLanguageTag} +%\begin{definition} +%\cs{TrackLanguageTag}\marg{tag} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +%Parse RFC 5646 language tag (assumes regular and well-formed). +%See also \url{https://tools.ietf.org/html/rfc5646}. +%Ensure \meta{tag} is fully-expanded. Warn if argument is +%empty. +% \begin{macrocode} +\def\TrackLanguageTag#1{% + \edef\@tracklang@tag{#1}% + \ifx\@tracklang@tag\empty + \@tracklang@warn{Empty tag in \string\TrackLanguageTag}% + \else + \expandafter\@TrackLanguageTag\expandafter{\@tracklang@tag}% + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@TrackLanguageTag} +%Argument must be expanded. +% \begin{macrocode} +\def\@TrackLanguageTag#1{% +% \end{macrocode} +%First check if it's predefined. +% \begin{macrocode} + \@tracklang@ifundef{@tracklang@add@#1}% + {% +% \end{macrocode} +%Parse language tag. % \begin{macrocode} -\def\@tracklang@add@finnish{% - \AddTrackedLanguage{finnish}% - \AddTrackedIsoLanguage{639-1}{fi}{finnish}% - \AddTrackedIsoLanguage{639-2}{fin}{finnish}% + \@tracklang@parselangtag{#1}% +% \end{macrocode} +%Track this information. +% \begin{macrocode} + \@tracklang@track@locale + }% + {% +% \end{macrocode} +%Predefined tag. +% \begin{macrocode} + \@tracklang@nameuse{@tracklang@add@#1}% + }% } -\@tracklang@declareoption{finnish} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@flemish} +%\begin{macro}{\@tracklang@parse@langtag} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\@tracklang@parselangtag#1{% +% \end{macrocode} +%Initialise. +% \begin{macrocode} + \def\@TrackLangEnvLang{}% + \def\@TrackLangEnvSubLang{}% + \def\@TrackLangEnvFirstSubLang{}% + \def\@TrackLangEnvTerritory{}% + \def\@TrackLangEnvCodeSet{}% + \def\@TrackLangEnvVariant{}% + \def\@TrackLangEnvModifier{}% + \def\@TrackLangEnvScript{}% + \def\@TrackLangEnvAdditional{}% +% \end{macrocode} +%First split to determine language code. +% \begin{macrocode} + \@tracklang@split@underscoreorhyp{#1}% +% \end{macrocode} +%Save the result. +% \begin{macrocode} + \let\@TrackLangEnvLang\@tracklang@split@pre +% \end{macrocode} +%Is there anything else? +% \begin{macrocode} + \ifx\@tracklang@split@post\empty +% \end{macrocode} +%That's it. +% \begin{macrocode} + \else +% \end{macrocode} +%Split again. +% \begin{macrocode} + \expandafter\@tracklang@split@underscoreorhyp\expandafter + {\@tracklang@split@post}% +% \end{macrocode} +%Is this an extension to the language tag? +% \begin{macrocode} + \@tracklang@parse@extlang +% \end{macrocode} +%Does this fit the format for a script? +% \begin{macrocode} + \TrackLangIfScriptTag{\@tracklang@split@pre}% + {% +% \end{macrocode} +%Found script. % \begin{macrocode} -\def\@tracklang@add@flemish{% - \AddTrackedDialect{flemish}{dutch}% - \AddTrackedIsoLanguage{639-1}{nl}{dutch}% - \AddTrackedIsoLanguage{639-2-B}{dut}{dutch}% - \AddTrackedIsoLanguage{639-2-T}{nld}{dutch}% - \AddTrackedIsoLanguage{639-2}{nld}{dutch}% - \AddTrackedIsoLanguage{3166-1}{BE}{flemish}% + \let\@TrackLangEnvScript\@tracklang@split@pre +% \end{macrocode} +%Split again if there's more. +% \begin{macrocode} + \ifx\@tracklang@split@post\empty + \else + \expandafter\@tracklang@split@underscoreorhyp\expandafter + {\@tracklang@split@post}% + \fi + }% + {}% +% \end{macrocode} +%Does this fit the format for a region? +% \begin{macrocode} + \TrackLangIfRegionTag{\@tracklang@split@pre}% + {% +% \end{macrocode} +%Found region. Is it a 2 letter alpha or a 3 digit numeric code? +% \begin{macrocode} + \expandafter\@tracklang@hasthirdchar\@tracklang@split@pre + \relax\relax\relax + \@end@tracklang@hasthirdchar + {% +% \end{macrocode} +% Is three digit numeric code. We need the mappings. Has +% \texttt{tracklang-region-codes.tex} been loaded? +% \begin{macrocode} + \ifx\TrackLangIfKnownNumericRegion\undefined + \@tracklang@input tracklang-region-codes.tex + \fi + \TrackLangIfKnownNumericRegion{\@tracklang@split@pre}% + {% + \edef\@TrackLangEnvTerritory{% + \TrackLangNumericToAlphaIIRegion{\@tracklang@split@pre}% + }% + }% + {% + \let\@TrackLangEnvTerritory\@tracklang@split@pre + \@tracklang@warn{Unrecognised numeric region code + `\@tracklang@split@pre'}% + }% + }% + {% +% \end{macrocode} +% Is two letter alpha code. +% \begin{macrocode} + \let\@TrackLangEnvTerritory\@tracklang@split@pre + }% + \expandafter\@tracklang@split@underscoreorhyp\expandafter + {\@tracklang@split@post}% + }% + {}% +% \end{macrocode} +%Parse for variant. +% \begin{macrocode} + \@tracklang@parse@variant +% \end{macrocode} +%Anything left can go in additional. +% \begin{macrocode} + \let\@TrackLangEnvAdditional\@tracklang@split@post + \fi +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GetTrackedDialectFromLanguageTag} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{GetTrackedDialectFromLanguageTag}\marg{tag}\marg{cs} +%\end{definition} +%Find the tracked dialect that matches the given language tag and +%stores the dialect label in \meta{cs}. If no match found, \meta{cs} +%will be empty. Doesn't check the additional information +% \begin{macrocode} +\def\GetTrackedDialectFromLanguageTag#1#2{% + \def#2{}% + \@tracklang@parselangtag{#1}% + \edef\@tracklang@dialect{% + \@TrackLangEnvLang + \@TrackLangEnvSubLang + \@TrackLangEnvScript + \@TrackLangEnvTerritory + \@TrackLangEnvModifier + \@TrackLangEnvVariant}% +% \end{macrocode} +% Has this dialect label been tracked? +% \begin{macrocode} + \IfTrackedDialect{\@tracklang@dialect}% + {% +% \end{macrocode} +% Found it. All done. +% \begin{macrocode} + \let#2\@tracklang@dialect + }% + {% +% \end{macrocode} +% Get the root language label. +% \begin{macrocode} + \edef\@tracklang@lang{\TrackLangGetKnownLangFromIso\@TrackLangEnvLang}% +% \end{macrocode} +% Get the default script for this language. +% \begin{macrocode} + \edef\@tracklang@defscript{\TrackLangGetDefaultScript\@tracklang@lang}% +% \end{macrocode} +% Get the list of tracked dialects for this language. +% \begin{macrocode} + \edef\@tracklang@dialects{\TrackedDialectsFromLanguage\@tracklang@lang}% +% \end{macrocode} +% For each dialect in this list, check if it matches. +% \begin{macrocode} + \@tracklang@for\@tracklang@dialect:=\@tracklang@dialects\do{% + \edef\@tracklang@tmp{% + \TrackedIsoCodeFromLanguage{3166-1}{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvTerritory +% \end{macrocode} +% Region matches. +% \begin{macrocode} + \edef\@tracklang@tmp{% + \GetTrackedDialectSubLang{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvSubLang +% \end{macrocode} +% Sub-language matches. +% \begin{macrocode} + \edef\@tracklang@tmp{% + \GetTrackedDialectVariant{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvVariant +% \end{macrocode} +% Variant matches. +% \begin{macrocode} + \edef\@tracklang@tmp{% + \GetTrackedDialectScript{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvScript +% \end{macrocode} +% Script matches. Found it. +% \begin{macrocode} + \let#2\@tracklang@dialect + \else +% \end{macrocode} +% Script doesn't match. If no script has been provided, does this +% dialect's script match the default for this language? +% \begin{macrocode} + \ifx\@TrackLangEnvScript\empty + \ifx\@tracklang@tmp\@tracklang@defscript +% \end{macrocode} +% Default script matches. Found it. +% \begin{macrocode} + \let#2\@tracklang@dialect + \fi + \fi + \fi + \fi + \fi + \fi + }% + }% } -\@tracklang@declareoption{flemish} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@francais} +% +%\begin{macro}{\TrackLangFromEnv} +%\changes{1.3}{2016-10-07}{new} +% This command performs the following steps: +% query environment variable (if \cs{TrackLangEnv} not already set), +% parse \cs{TrackLangEnv} (if it has been set), and add the dialect +% (if recognised). +% +% Note that this works slightly differently from just using +% \cs{TrackLangQueryEnv} followed by \cs{TrackLangParseFromEnv} +% and \cs{TrackPredefinedDialect}. +% \begin{macrocode} +\def\TrackLangFromEnv{% +% \end{macrocode} +%Initialise. % \begin{macrocode} -\def\@tracklang@add@francais{% - \AddTrackedDialect{francais}{french}% - \AddTrackedIsoLanguage{639-1}{fr}{french}% - \AddTrackedIsoLanguage{639-2-B}{fre}{french}% - \AddTrackedIsoLanguage{639-2-T}{fra}{french}% - \AddTrackedIsoLanguage{639-2}{fra}{french}% + \def\TrackLangEnvLang{}% + \def\TrackLangEnvTerritory{}% + \def\TrackLangEnvCodeSet{}% + \def\TrackLangEnvModifier{}% +% \end{macrocode} +%If \cs{TrackQueryEnv} is empty, assume \cs{TrackQueryEnv} has already +%been attempted but failed, so don't bother retrying. +% \begin{macrocode} + \ifx\TrackLangEnv\undefined + \TrackLangQueryEnv + \fi + \ifx\TrackLangEnv\empty + \@tracklang@warn{\string\TrackLangFromEnv\space + non-operational as \string\TrackLangEnv\space is empty}% + \else +% \end{macrocode} +% At this point \cs{TrackLangEnv} shouldn't be undefined (if +% \cs{TrackLangQueryEnv} fails it should define \cs{TrackLangEnv} to +% be empty), but check in case something unexpected has happened. +% \begin{macrocode} + \ifx\TrackLangEnv\undefined + \@tracklang@warn{\string\TrackLangFromEnv\space + non-operational as \string\TrackLangEnv\space hasn't been + defined}% + \else +% \end{macrocode} +% Parse and track. +% \begin{macrocode} + \@tracklang@parse@track@locale{\TrackLangEnv}% + \let\TrackLangEnvLang\@TrackLangEnvLang + \let\TrackLangEnvTerritory\@TrackLangEnvTerritory + \let\TrackLangEnvCodeSet\@TrackLangEnvCodeSet + \let\TrackLangEnvModifier\@TrackLangEnvModifier + \fi + \fi } -\@tracklang@declareoption{francais} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@frenchb} +%\begin{macro}{\TrackLocale} +%\begin{definition} +%\cs{TrackLocale}\marg{locale} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +%Track the dialect identified by the given locale. The argument may +%either be a predefined language\slash dialect or in the same format as +%\cs{TrackLangEnv}. +% \begin{macrocode} +\def\TrackLocale#1{% +% \end{macrocode} +% Is the argument a recognised dialect? % \begin{macrocode} -\def\@tracklang@add@frenchb{% - \AddTrackedDialect{frenchb}{french}% - \AddTrackedIsoLanguage{639-1}{fr}{french}% - \AddTrackedIsoLanguage{639-2-B}{fre}{french}% - \AddTrackedIsoLanguage{639-2-T}{fra}{french}% - \AddTrackedIsoLanguage{639-2}{fra}{french}% + \@tracklang@ifundef{@tracklang@add@#1}% + {% + \@tracklang@parse@track@locale{#1}% + }% + {% + \@tracklang@nameuse{@tracklang@add@#1}% + }% } -\@tracklang@declareoption{frenchb} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@french} +%\begin{macro}{\@tracklang@parse@track@locale} +%\changes{1.3}{2016-10-07}{new} +%Parse localisation format and track. +% \begin{macrocode} +\def\@tracklang@parse@track@locale#1{% + \@tracklang@parse@locale{#1}% + \@tracklang@track@locale +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@track@locale} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\@tracklang@track@locale{% +% \end{macrocode} +% Is the language code known? +% \begin{macrocode} + \TrackLangIfKnownLangFromIso{\@TrackLangEnvLang} + {% + \edef\@tracklang@lang{\TrackLangGetKnownLangFromIso\@TrackLangEnvLang}% + \let\@tracklang@dialect\@TrackLangEnvLang + \ifx\@TrackLangEnvSubLang\empty + \else + \edef\@tracklang@dialect{\@tracklang@dialect-\@TrackLangEnvSubLang}% + \fi + \ifx\@TrackLangEnvScript\empty + \else + \edef\@tracklang@dialect{\@tracklang@dialect-\@TrackLangEnvScript}% + \fi + \ifx\@TrackLangEnvTerritory\empty + \else + \edef\@tracklang@dialect{\@tracklang@dialect-\@TrackLangEnvTerritory}% + \fi + \ifx\@TrackLangEnvModifier\empty + \else + \edef\@tracklang@dialect{\@tracklang@dialect-\@TrackLangEnvModifier}% + \fi + \ifx\@TrackLangEnvVariant\empty + \else + \edef\@tracklang@dialect{\@tracklang@dialect-\@TrackLangEnvVariant}% + \fi +% \end{macrocode} +% Language code is recognised. Is the dialect label recognised? +% \begin{macrocode} + \@tracklang@ifundef{@tracklang@add@\@tracklang@dialect}% + {% +% \end{macrocode} +% Not a recognised dialect. +% Form new dialect name (without hyphen). +% \begin{macrocode} + \edef\@tracklang@dialect{% + \@TrackLangEnvLang + \@TrackLangEnvSubLang + \@TrackLangEnvScript + \@TrackLangEnvTerritory + \@TrackLangEnvModifier + \@TrackLangEnvVariant}% +% \end{macrocode} +% Add this new dialect. +% \begin{macrocode} + \AddTrackedDialect{\@tracklang@dialect}{\@tracklang@lang}% + \AddTrackedLanguageIsoCodes{\@tracklang@lang}% +% \end{macrocode} +% Is there a sub-language tag? +% \begin{macrocode} + \ifx\@TrackLangEnvFirstSubLang\empty + \else + \expandafter\AddTrackedIsoLanguage + \expandafter\ThreeLetterExtIsoLanguageCode + \expandafter{\@TrackLangEnvFirstSubLang}% + {\@tracklang@dialect}% + \fi + }% + {% +% \end{macrocode} +% Dialect is recognised. +% \begin{macrocode} + \csname @tracklang@add@\@tracklang@dialect\endcsname + }% + }% + {% +% \end{macrocode} +% Unknown language code. +% \begin{macrocode} + \@tracklang@warn{Unknown language code `\@TrackLangEnvLang'}% + \edef\@tracklang@dialect{% + \@TrackLangEnvLang + \@TrackLangEnvSubLang + \@TrackLangEnvScript + \@TrackLangEnvTerritory + \@TrackLangEnvModifier + \@TrackLangEnvVariant}% + \AddTrackedDialect{\@tracklang@dialect}{\@TrackLangEnvLang}% +% \end{macrocode} +% Determine if the language code is a two or three letter code. +% \begin{macrocode} + \expandafter\@tracklang@hasthirdchar + \@TrackLangEnvLang\relax\relax\relax\@end@tracklang@hasthirdchar + {% +% \end{macrocode} +% 639-2 code. Track it. +% \begin{macrocode} + \AddTrackedIsoLanguage{639-2}{\@TrackLangEnvLang}{\@tracklang@lang}% + }% + {% +% \end{macrocode} +% 639-1 code. Track it. +% \begin{macrocode} + \AddTrackedIsoLanguage{639-1}{\@TrackLangEnvLang}{\@tracklang@lang}% + }% + }% +% \end{macrocode} +% Add the territory if provided. (The territory may not have been +% defined by the dialect option.) +% \begin{macrocode} + \ifx\@TrackLangEnvTerritory\empty + \else + \AddTrackedIsoLanguage{3166-1}{\@TrackLangEnvTerritory}% + {\@tracklang@dialect}% + \fi +% \end{macrocode} +% If a modifier was provided, add that. +% \begin{macrocode} + \ifx\@TrackLangEnvModifier\empty + \else + \SetTrackedDialectModifier{\@tracklang@dialect}{\@TrackLangEnvModifier}% + \fi +% \end{macrocode} +% If a variant was provided, add that. +% \begin{macrocode} + \ifx\@TrackLangEnvVariant\empty + \else + \SetTrackedDialectVariant{\@tracklang@dialect}{\@TrackLangEnvVariant}% + \fi +% \end{macrocode} +% If a script was provided, add that. % \begin{macrocode} -\def\@tracklang@add@french{% - \AddTrackedLanguage{french}% - \AddTrackedIsoLanguage{639-1}{fr}{french}% - \AddTrackedIsoLanguage{639-2-B}{fre}{french}% - \AddTrackedIsoLanguage{639-2-T}{fra}{french}% - \AddTrackedIsoLanguage{639-2}{fra}{french}% + \ifx\@TrackLangEnvScript\empty + \else + \SetTrackedDialectScript{\@tracklang@dialect}{\@TrackLangEnvScript}% + \fi +% \end{macrocode} +% If a language extension was provided, add that. +% \begin{macrocode} + \ifx\@TrackLangEnvSubLang\empty + \else + \SetTrackedDialectSubLang{\@tracklang@dialect}{\@TrackLangEnvSubLang}% + \fi +% \end{macrocode} +% If additional information was provided, add that. +% \begin{macrocode} + \ifx\@TrackLangEnvAdditional\empty + \else + \SetTrackedDialectAdditional{\@tracklang@dialect}{\@TrackLangEnvAdditional}% + \fi } -\@tracklang@declareoption{french} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@france} +% +%\subsection{Predefined Root Languages}\label{sec:predefinedlang} +% +% The ISO 639-1 and 639-2 codes are used to map the root language name to the +% ISO language code. The 3166-1 codes are used to map the +% dialect\slash variant to the ISO country code. The country code is +% omitted if ambiguous (for example, the language is spoken in +% multiple countries). Languages that have a country code may be +% spoken as a minority language in another region. In this case, +% \cs{TrackLocale} should be used instead to set the country code as +% appropriate. Some \qt{dialects} are just synonyms for a +% language name, such as \qt{francais} or \qt{frenchb}. These are +% defined in \sectionref{sec:predefined}. Some of the +% languages have two ISO 639-2 codes designated as \qt{B} +% (bibliographic) or \qt{T} (terminology). In these cases the +% terminology code is used as the primary 639-2 code. The extra +% \qt{B} and \qt{T} codes are only provided if they are different. +% +%\begin{macro}{\@tracklang@declareoption} %\changes{1.1}{2014-11-21}{new} +% Provide a hook to declare a predefined setting as a package +% option. This is defined by tracklang.sty before loading +% tracklang.tex but if this file isn't loaded through tracklang.sty +% provide a definition that ignores its argument if not already +% defined. % \begin{macrocode} -\def\@tracklang@add@france{% - \AddTrackedDialect{france}{french}% - \AddTrackedIsoLanguage{639-1}{fr}{french}% - \AddTrackedIsoLanguage{639-2-B}{fre}{french}% - \AddTrackedIsoLanguage{639-2-T}{fra}{french}% - \AddTrackedIsoLanguage{639-2}{fra}{french}% - \AddTrackedIsoLanguage{3166-1}{FR}{france}% -} -\@tracklang@declareoption{france} +\ifx\@tracklang@declareoption\undefined + \def\@tracklang@declareoption#1{} +\fi % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@belgique} +%\begin{macro}{\TrackLangDeclareLanguageOption} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangDeclareLanguageOption}\marg{language name}\marg{639-1 +%code}\marg{639-2 (T)}\marg{639-2 (B)}\marg{639-3}\marg{3166-1}\marg{default +%script} +%\end{definition} +%Define a new root language that's declared as an option. +%The language name must be expanded before use. The default script +%is the ISO 15924 alpha script code. (Some languages may be written +%in multiple scripts. Leave empty if not obvious default.) % \begin{macrocode} -\def\@tracklang@add@belgique{% - \AddTrackedDialect{belgique}{french}% - \AddTrackedIsoLanguage{639-1}{fr}{french}% - \AddTrackedIsoLanguage{639-2-B}{fre}{french}% - \AddTrackedIsoLanguage{639-2-T}{fra}{french}% - \AddTrackedIsoLanguage{639-2}{fra}{french}% - \AddTrackedIsoLanguage{3166-1}{BE}{belgique}% +\def\TrackLangDeclareLanguageOption#1#2#3#4#5#6#7{% + \@tracklang@ifundef{@tracklang@add@#1}% + {% + \TrackLangNewLanguage{#1}{#2}{#3}{#4}{#5}{#6}{#7}% + \@tracklang@namedef{@tracklang@add@#1}{% + \AddTrackedLanguage{#1}% + \AddTrackedLanguageIsoCodes{#1}% + \AddTrackedCountryIsoCode{#1}% + }% + \@tracklang@declareoption{#1}% + }% + {% + \@tracklang@err{language option `#1' has already been defined}{}% + }% } -\@tracklang@declareoption{belgique} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@belgiangerman} +%\begin{macro}{\@tracklang@add@abkhaz} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@belgiangerman{% - \AddTrackedDialect{belgiangerman}{german}% - \AddTrackedIsoLanguage{639-1}{de}{german}% - \AddTrackedIsoLanguage{639-2-B}{ger}{german}% - \AddTrackedIsoLanguage{639-2-T}{deu}{german}% - \AddTrackedIsoLanguage{639-2}{deu}{german}% - \AddTrackedIsoLanguage{3166-1}{BE}{belgiangerman}% -} -\@tracklang@declareoption{belgiangerman} +\TrackLangDeclareLanguageOption{abkhaz}{ab}{abk}{}{}{}{Cyrl} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@friulan} +%\begin{macro}{\@tracklang@add@afar} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@friulan{% - \AddTrackedLanguage{friulan}% - \AddTrackedIsoLanguage{639-2}{fur}{friulan}% - \AddTrackedIsoLanguage{3166-1}{IT}{friulan}% -} -\@tracklang@declareoption{friulan} +\TrackLangDeclareLanguageOption{afar}{aa}{aar}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@friulian} +%\begin{macro}{\@tracklang@add@afrikaans} % \begin{macrocode} -\def\@tracklang@add@friulian{% - \AddTrackedDialect{friulian}{friulan}% - \AddTrackedIsoLanguage{639-2}{fur}{friulan}% - \AddTrackedIsoLanguage{3166-1}{IT}{friulan}% -} -\@tracklang@declareoption{friulian} +\TrackLangDeclareLanguageOption{afrikaans}{af}{afr}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@friulano} +%\begin{macro}{\@tracklang@add@akan} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@friulano{% - \AddTrackedDialect{friulano}{friulan}% - \AddTrackedIsoLanguage{639-2}{fur}{friulan}% - \AddTrackedIsoLanguage{3166-1}{IT}{friulan}% -} -\@tracklang@declareoption{friulano} +\TrackLangDeclareLanguageOption{akan}{ak}{aka}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@albanian} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{albanian}{sq}{sqi}{alb}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@amharic} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{amharic}{am}{amh}{}{}{ET}{Ethi} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@anglosaxon} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{anglosaxon}{}{ang}{}{}{}{Runr} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@apache} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{apache}{}{apa}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@arabic} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{arabic}{ar}{ara}{}{}{}{Arab} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@aragonese} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{aragonese}{an}{arg}{}{}{ES}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@armenian} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{armenian}{hy}{hye}{arm}{}{}{Armn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@assamese} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{assamese}{as}{asm}{}{}{}{Beng} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@asturian} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{asturian}{}{ast}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@avaric} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{avaric}{av}{ava}{}{}{}{Cyrl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@avestan} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{avestan}{ae}{ave}{}{}{}{Avst} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@aymara} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{aymara}{ay}{aym}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@azerbaijani} +%\changes{1.3}{2016-10-07}{new} +%The default script is dependent on the region, but this is a +%regionless definition so using Latin as the default here as +%Azerbaijani alphabet is a Latin alphabet. Other countries may be +%using a different script, such as Cyrillic in Russia. +% \begin{macrocode} +\TrackLangDeclareLanguageOption{azerbaijani}{az}{aze}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bahasai} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{bahasai}{id}{ind}{}{}{IN}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bahasam} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{bahasam}{ms}{msa}{may}{}{MY}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bambara} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{bambara}{bm}{bam}{}{}{ML}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bashkir} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{bashkir}{ba}{bak}{}{}{}{Cyrl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@basque} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{basque}{eu}{eus}{baq}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@belarusian} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{belarusian}{be}{bel}{}{}{}{Cyrl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bengali} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{bengali}{bn}{ben}{}{}{}{Beng} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@berber} +%\changes{1.3}{2016-10-07}{new} +%No default. Could be Tifinagh, Latin or Arabic. +% \begin{macrocode} +\TrackLangDeclareLanguageOption{berber}{}{ber}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bihari} +%\changes{1.3}{2016-10-07}{new} +%No clear default. +% \begin{macrocode} +\TrackLangDeclareLanguageOption{bihari}{bh}{bih}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bislama} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{bislama}{bi}{bis}{}{}{VU}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bokmal} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{bokmal}{nb}{nob}{}{}{NO}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bosnian} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{bosnian}{bs}{bos}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@breton} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{breton}{br}{bre}{}{}{FR}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bulgarian} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{bulgarian}{bg}{bul}{}{}{}{Cyrl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@burmese} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{burmese}{my}{mya}{bur}{}{}{Mymr} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@catalan} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{catalan}{ca}{cat}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@chamorro} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{chamorro}{ch}{cha}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@chechen} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{chechen}{ce}{che}{}{}{}{Cyrl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@chichewa} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{chichewa}{ny}{nya}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@chinese} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{chinese}{zh}{zho}{chi}{}{}{Hans} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@churchslavonic} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{churchslavonic}{cu}{chu}{}{}{}{Glag} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@chuvash} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{chuvash}{cv}{chv}{}{}{RU}{Cyrl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@coptic} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{coptic}{}{cop}{}{}{}{Copt} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@cornish} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{cornish}{kw}{cor}{}{}{GB}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@corsican} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{corsican}{co}{cos}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@cree} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{cree}{cr}{cre}{}{}{}{Cans} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@croatian} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{croatian}{hr}{hrv}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@czech} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{czech}{cs}{ces}{cze}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@danish} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{danish}{da}{dan}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@divehi} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{divehi}{dv}{div}{}{}{MV}{Thaa} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@dutch} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{dutch}{nl}{nld}{dut}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@dzongkha} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{dzongkha}{dz}{dzo}{}{}{BT}{Tibt} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@easternpunjabi} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{easternpunjabi}{pa}{pan}{}{}{IN}{Guru} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@english} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{english}{en}{eng}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@esperanto} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{esperanto}{eo}{epo}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@estonian} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{estonian}{et}{est}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@ewe} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{ewe}{ee}{ewe}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@faroese} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{faroese}{fo}{fao}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@farsi} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{farsi}{fa}{fas}{per}{}{}{Arab} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@fijian} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{fijian}{fj}{fij}{}{}{FJ}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@finnish} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{finnish}{fi}{fin}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@french} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{french}{fr}{fra}{fre}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@friulan} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{friulan}{}{fur}{}{}{IT}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@fula} +%\changes{1.3}{2016-10-07}{new} +%No default. Could be Latin or Arabic. +% \begin{macrocode} +\TrackLangDeclareLanguageOption{fula}{ff}{ful}{}{}{}{} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@galician} % \begin{macrocode} -\def\@tracklang@add@galician{% - \AddTrackedLanguage{galician}% - \AddTrackedIsoLanguage{639-1}{gl}{galician}% - \AddTrackedIsoLanguage{639-2}{glg}{galician}% -} -\@tracklang@declareoption{galician} +\TrackLangDeclareLanguageOption{galician}{gl}{glg}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@galicien} +%\begin{macro}{\@tracklang@add@ganda} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@galicien{% - \AddTrackedDialect{galicien}{galician}% - \AddTrackedIsoLanguage{639-1}{gl}{galician}% - \AddTrackedIsoLanguage{639-2}{glg}{galician}% -} -\@tracklang@declareoption{galicien} +\TrackLangDeclareLanguageOption{ganda}{lg}{lug}{}{}{UG}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@georgian} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{georgian}{ka}{kat}{geo}{}{}{Geor} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@german} % \begin{macrocode} -\def\@tracklang@add@german{% - \AddTrackedLanguage{german}% - \AddTrackedIsoLanguage{639-1}{de}{german}% - \AddTrackedIsoLanguage{639-2-B}{ger}{german}% - \AddTrackedIsoLanguage{639-2-T}{deu}{german}% - \AddTrackedIsoLanguage{639-2}{deu}{german}% -} -\@tracklang@declareoption{german} +\TrackLangDeclareLanguageOption{german}{de}{deu}{ger}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@deutsch} +%\begin{macro}{\@tracklang@add@greek} % \begin{macrocode} -\def\@tracklang@add@deutsch{% - \AddTrackedDialect{deutsch}{german}% - \AddTrackedIsoLanguage{639-1}{de}{german}% - \AddTrackedIsoLanguage{639-2-B}{ger}{german}% - \AddTrackedIsoLanguage{639-2-T}{deu}{german}% - \AddTrackedIsoLanguage{639-2}{deu}{german}% -} -\@tracklang@declareoption{deutsch} +\TrackLangDeclareLanguageOption{greek}{el}{ell}{gre}{}{}{Grek} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@ngerman} +%\begin{macro}{\@tracklang@add@guarani} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@ngerman{% - \AddTrackedDialect{ngerman}{german}% - \AddTrackedIsoLanguage{639-1}{de}{german}% - \AddTrackedIsoLanguage{639-2-B}{ger}{german}% - \AddTrackedIsoLanguage{639-2-T}{deu}{german}% - \AddTrackedIsoLanguage{639-2}{deu}{german}% -} -\@tracklang@declareoption{ngerman} +\TrackLangDeclareLanguageOption{guarani}{gn}{grn}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@ngermanDE} -%\changes{1.1}{2014-11-21}{new} +%\begin{macro}{\@tracklang@add@guiarati} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@ngermanDE{% - \AddTrackedDialect{ngerman}{german}% - \AddTrackedIsoLanguage{639-1}{de}{german}% - \AddTrackedIsoLanguage{639-2-B}{ger}{german}% - \AddTrackedIsoLanguage{639-2-T}{deu}{german}% - \AddTrackedIsoLanguage{639-2}{deu}{german}% - \AddTrackedIsoLanguage{3166-1}{DE}{germany}% -} -\@tracklang@declareoption{ngermanDE} +\TrackLangDeclareLanguageOption{gujarati}{gu}{guj}{}{}{}{Gujr} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@greek} +%\begin{macro}{\@tracklang@add@haitian} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@greek{% - \AddTrackedLanguage{greek}% - \AddTrackedIsoLanguage{639-1}{el}{greek}% - \AddTrackedIsoLanguage{639-2-B}{gre}{greek}% - \AddTrackedIsoLanguage{639-2-T}{ell}{greek}% - \AddTrackedIsoLanguage{639-2}{ell}{greek}% -} -\@tracklang@declareoption{greek} +\TrackLangDeclareLanguageOption{haitian}{ht}{hat}{}{}{HT}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@hausa} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{hausa}{ha}{hau}{}{}{}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@hebrew} % \begin{macrocode} -\def\@tracklang@add@hebrew{% - \AddTrackedLanguage{hebrew}% - \AddTrackedIsoLanguage{639-1}{he}{hebrew}% - \AddTrackedIsoLanguage{639-2}{heb}{hebrew}% -} -\@tracklang@declareoption{hebrew} +\TrackLangDeclareLanguageOption{hebrew}{he}{heb}{}{}{}{Hebr} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@hindi} +%\begin{macro}{\@tracklang@add@herero} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@hindi{% - \AddTrackedLanguage{hindi}% - \AddTrackedIsoLanguage{639-1}{hi}{hindi}% - \AddTrackedIsoLanguage{639-2}{hin}{hindi}% -} -\@tracklang@declareoption{hindi} +\TrackLangDeclareLanguageOption{herero}{hz}{her}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@hungarian} +%\begin{macro}{\@tracklang@add@hindi} % \begin{macrocode} -\def\@tracklang@add@hungarian{% - \AddTrackedDialect{hungarian}{magyar}% - \AddTrackedIsoLanguage{639-1}{hu}{magyar}% - \AddTrackedIsoLanguage{639-2}{hun}{magyar}% - \AddTrackedIsoLanguage{3166-1}{HU}{hungarian}% -} -\@tracklang@declareoption{hungarian} +\TrackLangDeclareLanguageOption{hindi}{hi}{hin}{}{}{}{Deva} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@magyar} +%\begin{macro}{\@tracklang@add@hirimotu} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@magyar{% - \AddTrackedLanguage{magyar}% - \AddTrackedIsoLanguage{639-1}{hu}{magyar}% - \AddTrackedIsoLanguage{639-2}{hun}{magyar}% -} -\@tracklang@declareoption{magyar} +\TrackLangDeclareLanguageOption{hirimotu}{ho}{hmo}{}{}{PG}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@icelandic} % \begin{macrocode} -\def\@tracklang@add@icelandic{% - \AddTrackedLanguage{icelandic}% - \AddTrackedIsoLanguage{639-1}{is}{icelandic}% - \AddTrackedIsoLanguage{639-2-B}{ice}{icelandic}% - \AddTrackedIsoLanguage{639-2-T}{isl}{icelandic}% - \AddTrackedIsoLanguage{639-2}{isl}{icelandic}% -} -\@tracklang@declareoption{icelandic} +\TrackLangDeclareLanguageOption{icelandic}{is}{isl}{ice}{}{IS}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@indon} +%\begin{macro}{\@tracklang@add@ido} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@indon{% - \AddTrackedDialect{indon}{bahasai}% - \AddTrackedIsoLanguage{639-1}{id}{bahasai}% - \AddTrackedIsoLanguage{639-2}{ind}{bahasai}% - \AddTrackedIsoLanguage{3166-1}{IN}{indon}% -} -\@tracklang@declareoption{indon} +\TrackLangDeclareLanguageOption{ido}{io}{ido}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@indonesian} +%\begin{macro}{\@tracklang@add@igbo} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@indonesian{% - \AddTrackedDialect{indonesian}{bahasai}% - \AddTrackedIsoLanguage{639-1}{id}{bahasai}% - \AddTrackedIsoLanguage{639-2}{ind}{bahasai}% - \AddTrackedIsoLanguage{3166-1}{IN}{indonesian}% -} -\@tracklang@declareoption{indonesian} +\TrackLangDeclareLanguageOption{igbo}{ig}{ibo}{}{}{}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@interlingua} % \begin{macrocode} -\def\@tracklang@add@interlingua{% - \AddTrackedLanguage{interlingua}% - \AddTrackedIsoLanguage{639-1}{ia}{interlingua}% - \AddTrackedIsoLanguage{639-2}{ina}{interlingua}% -} -\@tracklang@declareoption{interlingua} +\TrackLangDeclareLanguageOption{interlingua}{ia}{ina}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@interlingue} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{interlingue}{ie}{ile}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@inuktitut} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{inuktitut}{iu}{iku}{}{}{}{Cans} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@inupiaq} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{inupiaq}{ik}{ipk}{}{}{}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@irish} % \begin{macrocode} -\def\@tracklang@add@irish{% - \AddTrackedLanguage{irish}% - \AddTrackedIsoLanguage{639-1}{ga}{irish}% - \AddTrackedIsoLanguage{639-2}{gle}{irish}% -} -\@tracklang@declareoption{irish} +\TrackLangDeclareLanguageOption{irish}{ga}{gle}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@gaeilge} +%\begin{macro}{\@tracklang@add@italian} % \begin{macrocode} -\def\@tracklang@add@gaeilge{% - \AddTrackedDialect{gaeilge}{irish}% - \AddTrackedIsoLanguage{639-1}{ga}{irish}% - \AddTrackedIsoLanguage{639-2}{gle}{irish}% -} -\@tracklang@declareoption{gaeilge} +\TrackLangDeclareLanguageOption{italian}{it}{ita}{}{}{}{Latn} % \end{macrocode} %\end{macro} -%\begin{macro}{\@tracklang@add@IEirish} -%\changes{1.2}{2015-03-23}{new} -% Irish spoken in Republic of Ireland +% +%\begin{macro}{\@tracklang@add@japanese} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@IEirish{% - \AddTrackedDialect{IEirish}{irish}% - \AddTrackedIsoLanguage{639-1}{ga}{irish}% - \AddTrackedIsoLanguage{639-2}{gle}{irish}% - \AddTrackedIsoLanguage{3166-1}{IE}{IEirish}% -} -\@tracklang@declareoption{IEirish} +\TrackLangDeclareLanguageOption{japanese}{ja}{jpn}{}{}{}{Hani} % \end{macrocode} %\end{macro} -%\begin{macro}{\@tracklang@add@GBirish} -%\changes{1.2}{2015-03-23}{new} -% Irish spoken in Northern Ireland +% +%\begin{macro}{\@tracklang@add@javanese} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@GBirish{% - \AddTrackedDialect{GBirish}{irish}% - \AddTrackedIsoLanguage{639-1}{ga}{irish}% - \AddTrackedIsoLanguage{639-2}{gle}{irish}% - \AddTrackedIsoLanguage{3166-1}{GB}{GBirish}% -} -\@tracklang@declareoption{GBirish} +\TrackLangDeclareLanguageOption{javanese}{jv}{jav}{}{}{}{Latn} % \end{macrocode} %\end{macro} -%\begin{macro}{\@tracklang@add@IEenglish} -%\changes{1.2}{2015-03-23}{new} -%English spoken in the Republic of Ireland. +% +%\begin{macro}{\@tracklang@add@kalaallisut} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\@tracklang@declareoption{IEenglish} -\def\@tracklang@add@IEenglish{% - \AddTrackedDialect{IEenglish}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{IE}{IEenglish}% -} -\@tracklang@declareoption{IEenglish} +\TrackLangDeclareLanguageOption{kalaallisut}{kl}{kal}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@italian} +%\begin{macro}{\@tracklang@add@kannada} % \begin{macrocode} -\def\@tracklang@add@italian{% - \AddTrackedLanguage{italian}% - \AddTrackedIsoLanguage{639-1}{it}{italian}% - \AddTrackedIsoLanguage{639-2}{ita}{italian}% -} -\@tracklang@declareoption{italian} +\TrackLangDeclareLanguageOption{kannada}{kn}{kan}{}{}{IN}{Knda} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@italy} +%\begin{macro}{\@tracklang@add@kanuri} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@italy{% - \AddTrackedDialect{italy}{italian}% - \AddTrackedIsoLanguage{639-1}{it}{italian}% - \AddTrackedIsoLanguage{639-2}{ita}{italian}% - \AddTrackedIsoLanguage{3166-1}{IT}{italy}% -} -\@tracklang@declareoption{italy} +\TrackLangDeclareLanguageOption{kanuri}{kr}{kau}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@vatican} +%\begin{macro}{\@tracklang@add@kashmiri} +%\changes{1.3}{2016-10-07}{new} +%No default script. Could be Arabic or Devanagari. % \begin{macrocode} -\def\@tracklang@add@vatican{% - \AddTrackedDialect{vatican}{italian}% - \AddTrackedIsoLanguage{639-1}{it}{italian}% - \AddTrackedIsoLanguage{639-2}{ita}{italian}% - \AddTrackedIsoLanguage{3166-1}{VA}{vatican}% -} -\@tracklang@declareoption{vatican} +\TrackLangDeclareLanguageOption{kashmiri}{ks}{kas}{}{}{IN}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@sanmarino} +%\begin{macro}{\@tracklang@add@kazakh} +%\changes{1.3}{2016-10-07}{new} +%Default script varies according to region. % \begin{macrocode} -\def\@tracklang@add@sanmarino{% - \AddTrackedDialect{sanmarino}{italian}% - \AddTrackedIsoLanguage{639-1}{it}{italian}% - \AddTrackedIsoLanguage{639-2}{ita}{italian}% - \AddTrackedIsoLanguage{3166-1}{SM}{sanmarino}% -} -\@tracklang@declareoption{sanmarino} +\TrackLangDeclareLanguageOption{kazakh}{kk}{kaz}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@sloveneistriaitalian} +%\begin{macro}{\@tracklang@add@khmer} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@sloveneistriaitalian{% - \AddTrackedDialect{sloveneistriaitalian}{italian}% - \AddTrackedIsoLanguage{639-1}{it}{italian}% - \AddTrackedIsoLanguage{639-2}{ita}{italian}% - \AddTrackedIsoLanguage{3166-1}{SI}{sloveneistriaitalian}% -} -\@tracklang@declareoption{sloveneistriaitalian} +\TrackLangDeclareLanguageOption{khmer}{km}{khm}{}{}{}{Khmr} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@jerseyenglish} -%\changes{1.1}{2014-11-21}{new} +%\begin{macro}{\@tracklang@add@kikuyu} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@jerseyenglish{% - \AddTrackedDialect{jerseyenglish}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{JE}{jerseyenglish}% -} -\@tracklang@declareoption{jerseyenglish} +\TrackLangDeclareLanguageOption{kikuyu}{ki}{kik}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@jerseyfrench} -%\changes{1.1}{2014-11-21}{new} +%\begin{macro}{\@tracklang@add@kinyarwanda} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@jerseyfrench{% - \AddTrackedDialect{jerseyfrench}{french}% - \AddTrackedIsoLanguage{639-1}{fr}{french}% - \AddTrackedIsoLanguage{639-2-B}{fre}{french}% - \AddTrackedIsoLanguage{639-2-T}{fra}{french}% - \AddTrackedIsoLanguage{639-2}{fra}{french}% - \AddTrackedIsoLanguage{3166-1}{JE}{jerseyfrench}% -} -\@tracklang@declareoption{jerseyfrench} +\TrackLangDeclareLanguageOption{kinyarwanda}{rw}{kin}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@guernseyenglish} -%\changes{1.1}{2014-11-21}{new} +%\begin{macro}{\@tracklang@add@kirundi} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@guernseyenglish{% - \AddTrackedDialect{guernseyenglish}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{GG}{guernseyenglish}% -} -\@tracklang@declareoption{guernseyenglish} +\TrackLangDeclareLanguageOption{kirundi}{rn}{run}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@guernseyfrench} -%\changes{1.1}{2014-11-21}{new} +%\begin{macro}{\@tracklang@add@komi} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@guernseyfrench{% - \AddTrackedDialect{guernseyfrench}{french}% - \AddTrackedIsoLanguage{639-1}{fr}{french}% - \AddTrackedIsoLanguage{639-2-B}{fre}{french}% - \AddTrackedIsoLanguage{639-2-T}{fra}{french}% - \AddTrackedIsoLanguage{639-2}{fra}{french}% - \AddTrackedIsoLanguage{3166-1}{GG}{guernseyfrench}% -} -\@tracklang@declareoption{guernseyfrench} +\TrackLangDeclareLanguageOption{komi}{kv}{kom}{}{}{RU}{Cyrl} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@kannada} +%\begin{macro}{\@tracklang@add@kongo} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@kannada{% - \AddTrackedLanguage{kannada}% - \AddTrackedIsoLanguage{639-1}{kn}{kannada}% - \AddTrackedIsoLanguage{639-2}{kan}{kannada}% -} -\@tracklang@declareoption{kannada} +\TrackLangDeclareLanguageOption{kongo}{kg}{kon}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@korean} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{korean}{ko}{kor}{}{}{}{Hang} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@kurdish} +%\changes{1.3}{2016-10-07}{new} +% Script varies according to region. +% \begin{macrocode} +\TrackLangDeclareLanguageOption{kurdish}{ku}{kur}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@kwanyama} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{kwanyama}{kj}{kua}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@kyrgyz} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{kyrgyz}{ky}{kir}{}{}{}{Cyrl} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@lao} % \begin{macrocode} -\def\@tracklang@add@lao{% - \AddTrackedLanguage{lao}% - \AddTrackedIsoLanguage{639-1}{lo}{lao}% - \AddTrackedIsoLanguage{639-2}{lao}{lao}% -} -\@tracklang@declareoption{lao} +\TrackLangDeclareLanguageOption{lao}{lo}{lao}{}{}{}{Laoo} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@latin} % \begin{macrocode} -\def\@tracklang@add@latin{% - \AddTrackedLanguage{latin}% - \AddTrackedIsoLanguage{639-1}{la}{latin}% - \AddTrackedIsoLanguage{639-2}{lat}{latin}% -} -\@tracklang@declareoption{latin} +\TrackLangDeclareLanguageOption{latin}{la}{lat}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@latein} +%\begin{macro}{\@tracklang@add@latvian} % \begin{macrocode} -\def\@tracklang@add@latein{% - \AddTrackedDialect{latein}{latin}% - \AddTrackedIsoLanguage{639-1}{la}{latin}% - \AddTrackedIsoLanguage{639-2}{lat}{latin}% -} -\@tracklang@declareoption{latein} +\TrackLangDeclareLanguageOption{latvian}{lv}{lav}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@latvian} +%\begin{macro}{\@tracklang@add@limburgish} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@latvian{% - \AddTrackedLanguage{latvian}% - \AddTrackedIsoLanguage{639-1}{lv}{latvian}% - \AddTrackedIsoLanguage{639-2}{lav}{latvian}% -} -\@tracklang@declareoption{latvian} +\TrackLangDeclareLanguageOption{limburgish}{li}{lim}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@lingala} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{lingala}{ln}{lin}{}{}{}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@lithuanian} % \begin{macrocode} -\def\@tracklang@add@lithuanian{% - \AddTrackedLanguage{lithuanian}% - \AddTrackedIsoLanguage{639-1}{lt}{lithuanian}% - \AddTrackedIsoLanguage{639-2}{lit}{lithuanian}% -} -\@tracklang@declareoption{lithuanian} +\TrackLangDeclareLanguageOption{lithuanian}{lt}{lit}{}{}{}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@lsorbian} % \begin{macrocode} -\def\@tracklang@add@lsorbian{% - \AddTrackedLanguage{lsorbian}% - \AddTrackedIsoLanguage{639-2}{dsb}{lsorbian}% - \AddTrackedIsoLanguage{3166-1}{DE}{lsorbian}% -} -\@tracklang@declareoption{lsorbian} +\TrackLangDeclareLanguageOption{lsorbian}{}{dsb}{}{}{DE}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@lowersorbian} +%\begin{macro}{\@tracklang@add@lubakatanga} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@lowersorbian{% - \AddTrackedDialect{lowersorbian}{lsorbian}% - \AddTrackedIsoLanguage{639-2}{dsb}{lsorbian}% - \AddTrackedIsoLanguage{3166-1}{DE}{lowersorbian}% -} -\@tracklang@declareoption{lowersorbian} +\TrackLangDeclareLanguageOption{lubakatanga}{lu}{lub}{}{}{CD}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@malay} +%\begin{macro}{\@tracklang@add@luxembourgish} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@malay{% - \AddTrackedDialect{malay}{bahasam}% - \AddTrackedIsoLanguage{639-1}{ms}{bahasam}% - \AddTrackedIsoLanguage{639-2-B}{may}{bahasam}% - \AddTrackedIsoLanguage{639-2-T}{msa}{bahasam}% - \AddTrackedIsoLanguage{639-2}{msa}{bahasam}% - \AddTrackedIsoLanguage{3166-1}{MY}{malay}% -} -\@tracklang@declareoption{malay} +\TrackLangDeclareLanguageOption{luxembourgish}{lb}{ltz}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@meyalu} +%\begin{macro}{\@tracklang@add@macedonian} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@meyalu{% - \AddTrackedDialect{meyalu}{bahasam}% - \AddTrackedIsoLanguage{639-1}{ms}{bahasam}% - \AddTrackedIsoLanguage{639-2-B}{may}{bahasam}% - \AddTrackedIsoLanguage{639-2-T}{msa}{bahasam}% - \AddTrackedIsoLanguage{639-2}{msa}{bahasam}% - \AddTrackedIsoLanguage{3166-1}{MY}{meyalu}% -} -\@tracklang@declareoption{meyalu} +\TrackLangDeclareLanguageOption{macedonian}{mk}{mkd}{mac}{}{}{Cyrl} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@maltese} -%\changes{1.1}{2014-11-21}{new} +%\begin{macro}{\@tracklang@add@magyar} % \begin{macrocode} -\def\@tracklang@add@maltese{% - \AddTrackedLanguage{maltese}% - \AddTrackedIsoLanguage{639-1}{mt}{maltese}% - \AddTrackedIsoLanguage{639-2}{mlt}{maltese}% -} -\@tracklang@declareoption{maltese} +\TrackLangDeclareLanguageOption{magyar}{hu}{hun}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@maltamaltese} +%\begin{macro}{\@tracklang@add@malagasy} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{malagasy}{mg}{mlg}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@malayalam} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{malayalam}{ml}{mal}{}{}{IN}{Mlym} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@maltese} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@maltamaltese{% - \AddTrackedDialect{maltamaltese}{maltese}% - \AddTrackedIsoLanguage{639-1}{mt}{maltese}% - \AddTrackedIsoLanguage{639-2}{mlt}{maltese}% - \AddTrackedIsoLanguage{3166-1}{MT}{maltamaltese}% -} -\@tracklang@declareoption{maltamaltese} +\TrackLangDeclareLanguageOption{maltese}{mt}{mlt}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@maltaenglish} +%\begin{macro}{\@tracklang@add@manx} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@maltaenglish{% - \AddTrackedDialect{maltaenglish}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{MT}{maltaenglish}% -} -\@tracklang@declareoption{maltaenglish} +\TrackLangDeclareLanguageOption{manx}{gv}{glv}{}{}{IM}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@malayalam} +%\begin{macro}{\@tracklang@add@maori} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@malayalam{% - \AddTrackedLanguage{malayalam}% - \AddTrackedIsoLanguage{639-1}{ml}{malayalam}% - \AddTrackedIsoLanguage{639-2}{mal}{malayalam}% -} -\@tracklang@declareoption{malayalam} +\TrackLangDeclareLanguageOption{maori}{mi}{mri}{mao}{}{NZ}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@marathi} % \begin{macrocode} -\def\@tracklang@add@marathi{% - \AddTrackedLanguage{marathi}% - \AddTrackedIsoLanguage{639-1}{mr}{marathi}% - \AddTrackedIsoLanguage{639-2}{mar}{marathi}% -} -\@tracklang@declareoption{marathi} +\TrackLangDeclareLanguageOption{marathi}{mr}{mar}{}{}{IN}{Deva} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@newzealand} +%\begin{macro}{\@tracklang@add@marshallese} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@newzealand{% - \AddTrackedDialect{newzealand}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{NZ}{newzealand}% -} -\@tracklang@declareoption{newzealand} +\TrackLangDeclareLanguageOption{marshallese}{mh}{mah}{}{}{MH}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@isleofmanenglish} -%\changes{1.1}{2014-11-21}{new} +%\begin{macro}{\@tracklang@add@mongolian} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@isleofmanenglish{% - \AddTrackedDialect{isleofmanenglish}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{IM}{isleofmanenglish}% -} -\@tracklang@declareoption{isleofmanenglish} +\TrackLangDeclareLanguageOption{mongolian}{mn}{mon}{}{}{}{Mong} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@manx} -%\changes{1.1}{2014-11-21}{new} +%\begin{macro}{\@tracklang@add@nauruan} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@manx{% - \AddTrackedLanguage{manx}% - \AddTrackedIsoLanguage{639-1}{gv}{manx}% - \AddTrackedIsoLanguage{639-2}{glv}{manx}% - \AddTrackedIsoLanguage{3166-1}{IM}{manx}% -} -\@tracklang@declareoption{manx} +\TrackLangDeclareLanguageOption{nauruan}{na}{nau}{}{}{NR}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@navajo} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{navajo}{nv}{nav}{}{}{US}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@ndonga} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{ndonga}{ng}{ndo}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@nepali} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{nepali}{ne}{nep}{}{}{}{Deva} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@nko} % \begin{macrocode} -\def\@tracklang@add@nko{% - \AddTrackedLanguage{nko}% - \AddTrackedIsoLanguage{639-2}{nqo}{nko}% -} -\@tracklang@declareoption{nko} +\TrackLangDeclareLanguageOption{nko}{}{nqo}{}{}{}{Nkoo} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@nynorsk} +%\begin{macro}{\@tracklang@add@northernndebele} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@nynorsk{% - \AddTrackedDialect{nynorsk}{norsk}% - \AddTrackedIsoLanguage{639-1}{nn}{norsk}% - \AddTrackedIsoLanguage{639-2}{nno}{norsk}% - \AddTrackedIsoLanguage{3166-1}{NO}{nynorsk}% -} -\@tracklang@declareoption{nynorsk} +\TrackLangDeclareLanguageOption{northernndebele}{nd}{nde}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@norwegian} +%\begin{macro}{\@tracklang@add@nynorsk} % \begin{macrocode} -\def\@tracklang@add@norwegian{% - \AddTrackedDialect{norwegian}{norsk}% - \AddTrackedIsoLanguage{639-1}{nn}{norsk}% - \AddTrackedIsoLanguage{639-2}{nno}{norsk}% - \AddTrackedIsoLanguage{3166-1}{NO}{norwegian}% -} -\@tracklang@declareoption{norwegian} +\TrackLangDeclareLanguageOption{nynorsk}{nn}{nno}{}{}{NO}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@norsk} % \begin{macrocode} -\def\@tracklang@add@norsk{% - \AddTrackedLanguage{norsk}% - \AddTrackedIsoLanguage{639-1}{nn}{norsk}% - \AddTrackedIsoLanguage{639-2}{nno}{norsk}% - \AddTrackedIsoLanguage{3166-1}{NO}{norsk}% -} -\@tracklang@declareoption{norsk} +\TrackLangDeclareLanguageOption{norsk}{no}{nor}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@northernsotho} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{northernsotho}{}{nso}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@nuosu} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{nuosu}{ii}{iii}{}{}{CN}{Yiii} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@occitan} % \begin{macrocode} -\def\@tracklang@add@occitan{% - \AddTrackedLanguage{occitan}% - \AddTrackedIsoLanguage{639-1}{oc}{occitan}% - \AddTrackedIsoLanguage{639-2}{oci}{occitan}% -} -\@tracklang@declareoption{occitan} +\TrackLangDeclareLanguageOption{occitan}{oc}{oci}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@piedmontese} +%\begin{macro}{\@tracklang@add@ojibwe} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@piedmontese{% - \AddTrackedLanguage{piedmontese}% - \AddTrackedIsoLanguage{3166-1}{IT}{piedmontese}% -} -\@tracklang@declareoption{piedmontese} +\TrackLangDeclareLanguageOption{ojibwe}{oj}{oji}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@piemonteis} +%\begin{macro}{\@tracklang@add@oromo} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@piemonteis{% - \AddTrackedDialect{piemonteis}{piedmontese}% - \AddTrackedIsoLanguage{3166-1}{IT}{piemonteis}% -} -\@tracklang@declareoption{piemonteis} +\TrackLangDeclareLanguageOption{oromo}{om}{orm}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@polish} +%\begin{macro}{\@tracklang@add@oriya} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@polish{% - \AddTrackedLanguage{polish}% - \AddTrackedIsoLanguage{639-1}{pl}{polish}% - \AddTrackedIsoLanguage{639-2}{pol}{polish}% -} -\@tracklang@declareoption{polish} +\TrackLangDeclareLanguageOption{oriya}{or}{ori}{}{}{}{Orya} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@polutonikogreek} +%\begin{macro}{\@tracklang@add@ossetian} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@polutonikogreek{% - \AddTrackedDialect{polutonikogreek}{greek}% - \AddTrackedIsoLanguage{639-1}{el}{greek}% - \AddTrackedIsoLanguage{639-2-B}{gre}{greek}% - \AddTrackedIsoLanguage{639-2-T}{ell}{greek}% - \AddTrackedIsoLanguage{639-2}{ell}{greek}% -} -\@tracklang@declareoption{polutonikogreek} +\TrackLangDeclareLanguageOption{ossetian}{os}{oss}{}{}{}{Cyrl} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@polutoniko} +%\begin{macro}{\@tracklang@add@pali} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@polutoniko{% - \AddTrackedDialect{polutoniko}{greek}% - \AddTrackedIsoLanguage{639-1}{el}{greek}% - \AddTrackedIsoLanguage{639-2-B}{gre}{greek}% - \AddTrackedIsoLanguage{639-2-T}{ell}{greek}% - \AddTrackedIsoLanguage{639-2}{ell}{greek}% -} -\@tracklang@declareoption{polutoniko} +\TrackLangDeclareLanguageOption{pali}{pi}{pli}{}{}{}{Brah} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@portuguese} +%\begin{macro}{\@tracklang@add@pashto} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@portuguese{% - \AddTrackedDialect{portuguese}{portuges}% - \AddTrackedIsoLanguage{639-1}{pt}{portuges}% - \AddTrackedIsoLanguage{639-2}{por}{portuges}% -} -\@tracklang@declareoption{portuguese} +\TrackLangDeclareLanguageOption{pashto}{ps}{pus}{}{}{}{Arab} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@piedmontese} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{piedmontese}{}{}{}{pms}{IT}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@polish} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{polish}{pl}{pol}{}{}{}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@portuges} % \begin{macrocode} -\def\@tracklang@add@portuges{% - \AddTrackedLanguage{portuges}% - \AddTrackedIsoLanguage{639-1}{pt}{portuges}% - \AddTrackedIsoLanguage{639-2}{por}{portuges}% -} -\@tracklang@declareoption{portuges} +\TrackLangDeclareLanguageOption{portuges}{pt}{por}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@portugal} -%\changes{1.1}{2014-11-21}{new} +%\begin{macro}{\@tracklang@add@quechua} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@portugal{% - \AddTrackedDialect{portgual}{portuges}% - \AddTrackedIsoLanguage{639-1}{pt}{portuges}% - \AddTrackedIsoLanguage{639-2}{por}{portuges}% - \AddTrackedIsoLanguage{3166-1}{PT}{portugal}% -} -\@tracklang@declareoption{portugal} +\TrackLangDeclareLanguageOption{quechua}{qu}{que}{}{}{}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@romanian} % \begin{macrocode} -\def\@tracklang@add@romanian{% - \AddTrackedLanguage{romanian}% - \AddTrackedIsoLanguage{639-1}{ro}{romanian}% - \AddTrackedIsoLanguage{639-2-B}{rum}{romanian}% - \AddTrackedIsoLanguage{639-2-T}{ron}{romanian}% - \AddTrackedIsoLanguage{639-2}{ron}{romanian}% -} -\@tracklang@declareoption{romanian} +\TrackLangDeclareLanguageOption{romanian}{ro}{ron}{rum}{}{}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@romansh} % \begin{macrocode} -\def\@tracklang@add@romansh{% - \AddTrackedLanguage{romansh}% - \AddTrackedIsoLanguage{639-1}{rm}{romansh}% - \AddTrackedIsoLanguage{639-2}{roh}{romansh}% -} -\@tracklang@declareoption{romansh} +\TrackLangDeclareLanguageOption{romansh}{rm}{roh}{}{}{CH}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@romansch} +%\begin{macro}{\@tracklang@add@russian} % \begin{macrocode} -\def\@tracklang@add@romansch{% - \AddTrackedDialect{romansch}{romansh}% - \AddTrackedIsoLanguage{639-1}{rm}{romansh}% - \AddTrackedIsoLanguage{639-2}{roh}{romansh}% -} -\@tracklang@declareoption{romansch} +\TrackLangDeclareLanguageOption{russian}{ru}{rus}{}{}{}{Cyrl} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@rumantsch} +%\begin{macro}{\@tracklang@add@samin} % \begin{macrocode} -\def\@tracklang@add@rumantsch{% - \AddTrackedDialect{rumantsch}{romansh}% - \AddTrackedIsoLanguage{639-1}{rm}{romansh}% - \AddTrackedIsoLanguage{639-2}{roh}{romansh}% -} -\@tracklang@declareoption{rumantsch} +\TrackLangDeclareLanguageOption{samin}{se}{sme}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@romanche} +%\begin{macro}{\@tracklang@add@sanskrit} % \begin{macrocode} -\def\@tracklang@add@romanche{% - \AddTrackedDialect{romanche}{romansh}% - \AddTrackedIsoLanguage{639-1}{rm}{romansh}% - \AddTrackedIsoLanguage{639-2}{roh}{romansh}% -} -\@tracklang@declareoption{romanche} +\TrackLangDeclareLanguageOption{sanskrit}{sa}{san}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@russian} +%\begin{macro}{\@tracklang@add@samoan} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@russian{% - \AddTrackedLanguage{russian}% - \AddTrackedIsoLanguage{639-1}{ru}{russian}% - \AddTrackedIsoLanguage{639-2}{rus}{russian}% -} -\@tracklang@declareoption{russian} +\TrackLangDeclareLanguageOption{samoan}{sm}{smo}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@russianb} +%\begin{macro}{\@tracklang@add@sango} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@russianb{% - \AddTrackedDialect{russianb}{russian}% - \AddTrackedIsoLanguage{639-1}{ru}{russian}% - \AddTrackedIsoLanguage{639-2}{rus}{russian}% -} -\@tracklang@declareoption{russianb} +\TrackLangDeclareLanguageOption{sango}{sg}{sag}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@samin} +%\begin{macro}{\@tracklang@add@sardinian} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@samin{% - \AddTrackedLanguage{samin}% - \AddTrackedIsoLanguage{639-1}{se}{samin}% - \AddTrackedIsoLanguage{639-2}{sme}{samin}% -} -\@tracklang@declareoption{samin} +\TrackLangDeclareLanguageOption{sardinian}{sc}{srd}{}{}{IT}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@sanskrit} +%\begin{macro}{\@tracklang@add@scottish} +%Also spoken in Canada, so no region. % \begin{macrocode} -\def\@tracklang@add@sanskrit{% - \AddTrackedLanguage{sanskrit}% - \AddTrackedIsoLanguage{639-1}{sa}{sanskrit}% - \AddTrackedIsoLanguage{639-2}{san}{sanskrit}% -} -\@tracklang@declareoption{sanskrit} +\TrackLangDeclareLanguageOption{scottish}{gd}{gla}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@scottish} +%\begin{macro}{\@tracklang@add@serbian} % \begin{macrocode} -\def\@tracklang@add@scottish{% - \AddTrackedLanguage{scottish}% - \AddTrackedIsoLanguage{639-1}{gd}{scottish}% - \AddTrackedIsoLanguage{639-2}{gla}{scottish}% -} -\@tracklang@declareoption{scottish} +\TrackLangDeclareLanguageOption{serbian}{sr}{srp}{}{}{}{Cyrl} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@gaelic} +%\begin{macro}{\@tracklang@add@shona} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@gaelic{% - \AddTrackedDialect{gaelic}{scottish}% - \AddTrackedIsoLanguage{639-1}{gd}{scottish}% - \AddTrackedIsoLanguage{639-2}{gla}{scottish}% -} -\@tracklang@declareoption{gaelic} +\TrackLangDeclareLanguageOption{shona}{sn}{sna}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@serbian} +%\begin{macro}{\@tracklang@add@sindhi} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@serbian{% - \AddTrackedLanguage{serbian}% - \AddTrackedIsoLanguage{639-1}{sr}{serbian}% - \AddTrackedIsoLanguage{639-2}{srp}{serbian}% -} -\@tracklang@declareoption{serbian} +\TrackLangDeclareLanguageOption{sindhi}{sd}{snd}{}{}{}{Sind} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@sinhalese} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{sinhalese}{si}{sin}{}{}{LK}{Sinh} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@slovak} % \begin{macrocode} -\def\@tracklang@add@slovak{% - \AddTrackedLanguage{slovak}% - \AddTrackedIsoLanguage{639-1}{sk}{slovak}% - \AddTrackedIsoLanguage{639-2-B}{slo}{slovak}% - \AddTrackedIsoLanguage{639-2-T}{slk}{slovak}% - \AddTrackedIsoLanguage{639-2}{slk}{slovak}% -} -\@tracklang@declareoption{slovak} +\TrackLangDeclareLanguageOption{slovak}{sk}{slk}{slo}{}{}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@slovene} % \begin{macrocode} -\def\@tracklang@add@slovene{% - \AddTrackedLanguage{slovene}% - \AddTrackedIsoLanguage{639-1}{sl}{slovene}% - \AddTrackedIsoLanguage{639-2}{slv}{slovene}% -} -\@tracklang@declareoption{slovene} +\TrackLangDeclareLanguageOption{slovene}{sl}{slv}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@slovenian} +%\begin{macro}{\@tracklang@add@somali} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@slovenian{% - \AddTrackedDialect{slovenian}{slovene}% - \AddTrackedIsoLanguage{639-1}{sl}{slovene}% - \AddTrackedIsoLanguage{639-2}{slv}{slovene}% -} -\@tracklang@declareoption{slovenian} +\TrackLangDeclareLanguageOption{somali}{so}{som}{}{}{}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@slovenia} +%\begin{macro}{\@tracklang@add@southernndebele} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@slovenia{% - \AddTrackedDialect{slovenia}{slovene}% - \AddTrackedIsoLanguage{639-1}{sl}{slovene}% - \AddTrackedIsoLanguage{639-2}{slv}{slovene}% - \AddTrackedIsoLanguage{3166-1}{SI}{slovenia}% -} -\@tracklang@declareoption{slovenia} +\TrackLangDeclareLanguageOption{southernndebele}{nr}{nbl}{}{}{ZA}{Latn} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@sloveneistriaslovenian} +%\begin{macro}{\@tracklang@add@southernsotho} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@sloveneistriaslovenian{% - \AddTrackedDialect{sloveneistriaslovenian}{slovenian}% - \AddTrackedIsoLanguage{639-1}{sl}{slovene}% - \AddTrackedIsoLanguage{639-2}{slv}{slovene}% - \AddTrackedIsoLanguage{3166-1}{SI}{sloveneistriaslovenian}% -} -\@tracklang@declareoption{sloveneistriaslovenian} +\TrackLangDeclareLanguageOption{southernsotho}{st}{sot}{}{}{}{Latn} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@spanish} % \begin{macrocode} -\def\@tracklang@add@spanish{% - \AddTrackedLanguage{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% +\TrackLangDeclareLanguageOption{spanish}{es}{spa}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@sudanese} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{sudanese}{su}{sun}{}{}{}{Sund} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@swahili} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{swahili}{sw}{swa}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@swati} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{swati}{ss}{ssw}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@swedish} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{swedish}{sv}{swe}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@syriac} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{syriac}{}{syr}{}{}{}{Syrc} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tagalog} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tagalog}{tl}{tgl}{}{}{PH}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tahitian} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tahitian}{ty}{tah}{}{}{PF}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tai} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tai}{}{tai}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tajik} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tajik}{tg}{tgk}{}{}{}{Cyrl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tamil} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tamil}{ta}{tam}{}{}{}{Taml} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tatar} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tatar}{tt}{tat}{}{}{}{Cyrl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@telugu} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{telugu}{te}{tel}{}{}{IN}{Telu} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@thai} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{thai}{th}{tha}{}{}{TH}{Thai} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tibetan} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tibetan}{bo}{bod}{tib}{}{}{Tibt} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tigrinya} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tigrinya}{ti}{tir}{}{}{}{Ethi} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tonga} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tonga}{to}{ton}{}{}{TO}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tsonga} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tsonga}{ts}{tso}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@tswana} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{tswana}{tn}{tsn}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@turkish} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{turkish}{tr}{tur}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@turkmen} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{turkmen}{tk}{tuk}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@twi} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{twi}{tw}{twi}{}{}{GH}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@ukrainian} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{ukrainian}{uk}{ukr}{}{}{UA}{Cyrl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@urdu} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{urdu}{ur}{urd}{}{}{}{Arab} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@usorbian} +%\changes{1.3}{2016-10-07}{corrected ISO 639-1 code} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{usorbian}{}{hsb}{}{}{DE}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@uyghur} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{uyghur}{ug}{uig}{}{}{CN}{Arab} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@uzbek} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{uzbek}{uz}{uzb}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@venda} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{venda}{ve}{ven}{}{}{ZA}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@vietnamese} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{vietnamese}{vi}{vie}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@volapuk} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{volapuk}{vo}{vol}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@walloon} +% No country code as Walloon is spoken in multiple regions +% (Wallonia in Belgium, some villages in Northern France and north-east of +% Wisconsin.) Not the same as Belgian French. +% \begin{macrocode} +\TrackLangDeclareLanguageOption{walloon}{wa}{wln}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@welsh} +%Also spoken in Argentina, so no region. +% \begin{macrocode} +\TrackLangDeclareLanguageOption{welsh}{cy}{cym}{wel}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@westernfrisian} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{westernfrisian}{fy}{fry}{}{}{NL}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@wolof} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{wolof}{wo}{wol}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@xhosa} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{xhosa}{xh}{xho}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@yiddish} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{yiddish}{yi}{yid}{}{}{}{Hebr} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@yoruba} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{yoruba}{yo}{yor}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@zhuang} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{zhuang}{za}{zha}{}{}{CN}{Hani} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@zulu} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareLanguageOption{zulu}{zu}{zul}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +% +%\subsection{Predefined Dialects}\label{sec:predefined} +% +% Provide some predefined dialects. +%\begin{macro}{\TrackLangDeclareDialectOption} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangDeclareDialectOption}\marg{dialect}\marg{root +%language}\marg{3166-1 +%code}\marg{modifier}\marg{variant}\marg{map}\marg{script} +%\end{definition} +%The option name is the same as the dialect name. The arguments +%must be expanded before use. The final argument \meta{map} is the +%mapping from \meta{dialect} to the closest \styfmt{babel} dialect +%label. May be empty if no relevant mapping. +% \begin{macrocode} +\def\TrackLangDeclareDialectOption#1#2#3#4#5#6#7{% + \@tracklang@ifundef{@tracklang@add@#1}% + {% + \ifx\relax#3\relax +% \end{macrocode} +% No region. +% \begin{macrocode} + \ifx\relax#4\relax +% \end{macrocode} +% No modifier. +% \begin{macrocode} + \ifx\relax#5\relax +% \end{macrocode} +% No variant. +% \begin{macrocode} + \@tracklang@namedef{@tracklang@add@#1}{% + \AddTrackedDialect{#1}{#2}% + \AddTrackedLanguageIsoCodes{#2}% +% \end{macrocode} +% Make it easier for the parser to pick up the dialect label. +% Note that this should be the same as +% \cs{TrackLangLastTrackedDialect} but the parser references +% \cs{@tracklang@dialect}. +% \begin{macrocode} + \def\@tracklang@dialect{#1}% + }% + \else +% \end{macrocode} +% Has variant but no modifier. +% \begin{macrocode} + \@tracklang@namedef{@tracklang@add@#1}{% + \AddTrackedDialect{#1}{#2}% + \AddTrackedLanguageIsoCodes{#2}% + \SetTrackedDialectVariant{#1}{#5}% + \def\@tracklang@dialect{#1}% + }% + \fi + \else +% \end{macrocode} +% Has modifier. +% \begin{macrocode} + \ifx\relax#5\relax +% \end{macrocode} +% No variant. +% \begin{macrocode} + \@tracklang@namedef{@tracklang@add@#1}{% + \AddTrackedDialect{#1}{#2}% + \AddTrackedLanguageIsoCodes{#2}% + \SetTrackedDialectModifier{#1}{#4}% + \def\@tracklang@dialect{#1}% + }% + \else +% \end{macrocode} +% Variant and modifier. +% \begin{macrocode} + \@tracklang@namedef{@tracklang@add@#1}{% + \AddTrackedDialect{#1}{#2}% + \AddTrackedLanguageIsoCodes{#2}% + \SetTrackedDialectModifier{#1}{#4}% + \SetTrackedDialectVariant{#1}{#5}% + \def\@tracklang@dialect{#1}% + }% + \fi + \fi + \else +% \end{macrocode} +% Has a region. +% \begin{macrocode} + \ifx\relax#4\relax +% \end{macrocode} +% No modifier. +% \begin{macrocode} + \ifx\relax#5\relax +% \end{macrocode} +% No variant. +% \begin{macrocode} + \@tracklang@namedef{@tracklang@add@#1}{% + \AddTrackedDialect{#1}{#2}% + \AddTrackedLanguageIsoCodes{#2}% + \AddTrackedIsoLanguage{3166-1}{#3}{#1}% + \def\@tracklang@dialect{#1}% + }% + \else +% \end{macrocode} +% Variant no modifier. +% \begin{macrocode} + \@tracklang@namedef{@tracklang@add@#1}{% + \AddTrackedDialect{#1}{#2}% + \AddTrackedLanguageIsoCodes{#2}% + \AddTrackedIsoLanguage{3166-1}{#3}{#1}% + \SetTrackedDialectVariant{#1}{#5}% + \def\@tracklang@dialect{#1}% + }% + \fi + \else +% \end{macrocode} +% Has modifier. +% \begin{macrocode} + \ifx\relax#5\relax +% \end{macrocode} +% No variant. +% \begin{macrocode} + \@tracklang@namedef{@tracklang@add@#1}{% + \AddTrackedDialect{#1}{#2}% + \AddTrackedLanguageIsoCodes{#2}% + \AddTrackedIsoLanguage{3166-1}{#3}{#1}% + \SetTrackedDialectModifier{#1}{#4}% + \def\@tracklang@dialect{#1}% + }% + \else +% \end{macrocode} +% Variant and modifier. +% \begin{macrocode} + \@tracklang@namedef{@tracklang@add@#1}{% + \AddTrackedDialect{#1}{#2}% + \AddTrackedLanguageIsoCodes{#2}% + \AddTrackedIsoLanguage{3166-1}{#3}{#1}% + \SetTrackedDialectModifier{#1}{#4}% + \SetTrackedDialectVariant{#1}{#5}% + \def\@tracklang@dialect{#1}% + }% + \fi + \fi + \fi +% \end{macrocode} +% Add the mapping if provided. +% \begin{macrocode} + \ifx\relax#6\relax + \else + \expandafter + \let\expandafter\@tracklang@tmp\csname @tracklang@add@#1\endcsname + \expandafter\def\csname @tracklang@add@#1\expandafter\endcsname + \expandafter{\@tracklang@tmp\SetTrackedDialectLabelMap{#1}{#6}}% + \fi +% \end{macrocode} +% Add the script if provided. +% \begin{macrocode} + \ifx\relax#7\relax + \else + \expandafter + \let\expandafter\@tracklang@tmp\csname @tracklang@add@#1\endcsname + \expandafter\def\csname @tracklang@add@#1\expandafter\endcsname + \expandafter{\@tracklang@tmp\SetTrackedDialectScript{#1}{#7}}% + \fi + \@tracklang@declareoption{#1}% + }% + {% + \@tracklang@err{dialect option `#1' has already been defined}{}% + }% } -\@tracklang@declareoption{spanish} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@spainspanish} +%\begin{macro}{\@tracklang@add@acadian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{acadian}{french}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@american} +% \begin{macrocode} +\TrackLangDeclareDialectOption{american}{english}{US}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@australian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{australian}{english}{AU}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@austrian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{austrian}{german}{AT}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@naustrian} +%\changes{1.3}{2016-10-07}{added modifier} +% \begin{macrocode} +\TrackLangDeclareDialectOption{naustrian}{german}{AT}{new}{1996}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@bahasa} +% \begin{macrocode} +\TrackLangDeclareDialectOption{bahasa}{bahasai}{IN}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@brazil} +% \begin{macrocode} +\TrackLangDeclareDialectOption{brazil}{portuges}{BR}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@brazilian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{brazilian}{portuges}{BR}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@british} +% \begin{macrocode} +\TrackLangDeclareDialectOption{british}{english}{GB}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@canadian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{canadian}{english}{CA}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@canadien} +% \begin{macrocode} +\TrackLangDeclareDialectOption{canadien}{french}{CA}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@croatia} +% \begin{macrocode} +\TrackLangDeclareDialectOption{croatia}{croatian}{HR}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@istriacountycroatian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{istriacountycroatian}{croatian}{HR}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@istriacountyitalian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{istriacountyitalian}{italian}{HR}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@netherlands} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@spainspanish{% - \AddTrackedDialect{spainspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{ES}{spainspanish}% -} -\@tracklang@declareoption{spainspanish} +\TrackLangDeclareDialectOption{netherlands}{dutch}{NL}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@argentinespanish} +%\begin{macro}{\@tracklang@add@persian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{persian}{farsi}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@flemish} +% \begin{macrocode} +\TrackLangDeclareDialectOption{flemish}{dutch}{BE}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@francais} +% \begin{macrocode} +\TrackLangDeclareDialectOption{francais}{french}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@frenchb} +% \begin{macrocode} +\TrackLangDeclareDialectOption{frenchb}{french}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@france} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@argentinespanish{% - \AddTrackedDialect{argentinespanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{AR}{argentinespanish}% -} -\@tracklang@declareoption{argentinespanish} +\TrackLangDeclareDialectOption{france}{french}{FR}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@bolivianspanish} +%\begin{macro}{\@tracklang@add@belgique} +% \begin{macrocode} +\TrackLangDeclareDialectOption{belgique}{french}{BE}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@belgiangerman} +% \begin{macrocode} +\TrackLangDeclareDialectOption{belgiangerman}{german}{BE}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@nbelgiangerman} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareDialectOption{nbelgiangerman}{german}{BE}{new}{1996}{ngerman}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@friulian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{friulian}{friulan}{IT}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@friulano} +% \begin{macrocode} +\TrackLangDeclareDialectOption{friulano}{friulan}{IT}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@galicien} +% \begin{macrocode} +\TrackLangDeclareDialectOption{galicien}{galician}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@deutsch} +% \begin{macrocode} +\TrackLangDeclareDialectOption{deutsch}{german}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@ngerman} +%\changes{1.3}{2016-10-07}{added modifier} +% \begin{macrocode} +\TrackLangDeclareDialectOption{ngerman}{german}{}{new}{1996}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@ngermanb} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareDialectOption{ngermanb}{german}{}{new}{1996}{ngerman}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@germanb} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareDialectOption{germanb}{german}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@ngermanDE} %\changes{1.1}{2014-11-21}{new} +%\changes{1.3}{2016-10-07}{added modifier} % \begin{macrocode} -\def\@tracklang@add@bolivianspanish{% - \AddTrackedDialect{bolivianspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{BO}{bolivianspanish}% -} -\@tracklang@declareoption{bolivianspanish} +\TrackLangDeclareDialectOption{ngermanDE}{german}{DE}{new}{1996}{ngerman}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@chilianspanish} +%\begin{macro}{\@tracklang@add@germanDE} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareDialectOption{germanDE}{german}{DE}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@hungarian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{hungarian}{magyar}{HU}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@indon} +% \begin{macrocode} +\TrackLangDeclareDialectOption{indon}{bahasai}{IN}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@indonesian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{indonesian}{bahasai}{IN}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@gaeilge} +% \begin{macrocode} +\TrackLangDeclareDialectOption{gaeilge}{irish}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@IEirish} +%\changes{1.2}{2015-03-23}{new} +% Irish spoken in Republic of Ireland +% \begin{macrocode} +\TrackLangDeclareDialectOption{IEirish}{irish}{IE}{}{}{}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@GBirish} +%\changes{1.2}{2015-03-23}{new} +% Irish spoken in the United Kingdom of Great Britain and Northern Ireland +% \begin{macrocode} +\TrackLangDeclareDialectOption{GBirish}{irish}{GB}{}{}{}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@IEenglish} +%\changes{1.2}{2015-03-23}{new} +%English spoken in the Republic of Ireland. +% \begin{macrocode} +\TrackLangDeclareDialectOption{IEenglish}{english}{IE}{}{}{british}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@italy} +% \begin{macrocode} +\TrackLangDeclareDialectOption{italy}{italian}{IT}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@vatican} +% \begin{macrocode} +\TrackLangDeclareDialectOption{vatican}{italian}{VA}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@sanmarino} +% \begin{macrocode} +\TrackLangDeclareDialectOption{sanmarino}{italian}{SM}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@sloveneistriaitalian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{sloveneistriaitalian}{italian}{SI}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@jerseyenglish} %\changes{1.1}{2014-11-21}{new} +%Allow it to hook to pick up \cs{captionsbritish} as well as +%\cs{captionsenglish} since the date format closely matches +%\texttt{british}. % \begin{macrocode} -\def\@tracklang@add@chilianspanish{% - \AddTrackedDialect{chilianspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{CL}{chilianspanish}% -} -\@tracklang@declareoption{chilianspanish} +\TrackLangDeclareDialectOption{jerseyenglish}{english}{JE}{}{}{british}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@columbianspanish} +%\begin{macro}{\@tracklang@add@jerseyfrench} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@columbianspanish{% - \AddTrackedDialect{columbianspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{CO}{columbianspanish}% -} -\@tracklang@declareoption{columbianspanish} +\TrackLangDeclareDialectOption{jerseyfrench}{french}{JE}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@costaricanspanish} +%\begin{macro}{\@tracklang@add@guernseyenglish} %\changes{1.1}{2014-11-21}{new} +%Allow it to hook to pick up \cs{captionsbritish} as well as +%\cs{captionsenglish} since the date format closely matches +%\texttt{british}. % \begin{macrocode} -\def\@tracklang@add@costaricanspanish{% - \AddTrackedDialect{costaricanspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{CR}{costaricanspanish}% -} -\@tracklang@declareoption{costaricanspanish} +\TrackLangDeclareDialectOption{guernseyenglish}{english}{GG}{}{}{british}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@cubanspanish} +%\begin{macro}{\@tracklang@add@guernseyfrench} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@cubanspanish{% - \AddTrackedDialect{cubanspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{CU}{cubanspanish}% -} -\@tracklang@declareoption{cubanspanish} +\TrackLangDeclareDialectOption{guernseyfrench}{french}{GG}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@dominicanspanish} +%\begin{macro}{\@tracklang@add@latein} +% \begin{macrocode} +\TrackLangDeclareDialectOption{latein}{latin}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@lowersorbian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{lowersorbian}{lsorbian}{DE}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@malay} +% \begin{macrocode} +\TrackLangDeclareDialectOption{malay}{bahasam}{MY}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@meyalu} +% \begin{macrocode} +\TrackLangDeclareDialectOption{meyalu}{bahasam}{MY}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@maltamaltese} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@dominicanspanish{% - \AddTrackedDialect{dominicanspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{DO}{dominicanspanish}% -} -\@tracklang@declareoption{dominicanspanish} +\TrackLangDeclareDialectOption{maltamaltese}{maltese}{MT}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@ecudorianspanish} +%\begin{macro}{\@tracklang@add@maltaenglish} %\changes{1.1}{2014-11-21}{new} +%Allow it to hook to pick up \cs{captionsbritish} as well as +%\cs{captionsenglish} since the date format closely matches +%\texttt{british}. % \begin{macrocode} -\def\@tracklang@add@ecudorianspanish{% - \AddTrackedDialect{ecudorianspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{EC}{ecudorianspanish}% -} -\@tracklang@declareoption{ecudorianspanish} +\TrackLangDeclareDialectOption{maltaenglish}{english}{MT}{}{}{british}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@elsalvadorspanish} +%\begin{macro}{\@tracklang@add@newzealand} +% \begin{macrocode} +\TrackLangDeclareDialectOption{newzealand}{english}{NZ}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@isleofmanenglish} %\changes{1.1}{2014-11-21}{new} +%Allow it to hook to pick up \cs{captionsbritish} as well as +%\cs{captionsenglish} since the date format closely matches +%\texttt{british}. % \begin{macrocode} -\def\@tracklang@add@elsalvadorspanish{% - \AddTrackedDialect{elsalvadorspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{SV}{elsalvadorspanish}% -} -\@tracklang@declareoption{elsalvadorspanish} +\TrackLangDeclareDialectOption{isleofmanenglish}{english}{IM}{}{}{british}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@guatemalanspanish} +%\begin{macro}{\@tracklang@add@norwegian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{norwegian}{norsk}{NO}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@piemonteis} +% \begin{macrocode} +\TrackLangDeclareDialectOption{piemonteis}{piedmontese}{IT}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@polutonikogreek} +%\changes{1.3}{2016-10-07}{added modifier} +% \begin{macrocode} +\TrackLangDeclareDialectOption{polutonikogreek}{greek}{}{polyton}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@polutoniko} +%\changes{1.3}{2016-10-07}{added modifier} +% \begin{macrocode} +\TrackLangDeclareDialectOption{polutoniko}{greek}{}{polyton}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@portuguese} +% \begin{macrocode} +\TrackLangDeclareDialectOption{portuguese}{portuges}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@portugal} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@guatemalanspanish{% - \AddTrackedDialect{guatemalanspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{GT}{guatemalanspanish}% -} -\@tracklang@declareoption{guatemalanspanish} +\TrackLangDeclareDialectOption{portugal}{portuges}{PT}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@honduranspanish} +%\begin{macro}{\@tracklang@add@romansch} +% \begin{macrocode} +\TrackLangDeclareDialectOption{romansch}{romansh}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@rumantsch} +% \begin{macrocode} +\TrackLangDeclareDialectOption{rumantsch}{romansh}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@romanche} +% \begin{macrocode} +\TrackLangDeclareDialectOption{romanche}{romansh}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@russianb} +% \begin{macrocode} +\TrackLangDeclareDialectOption{russianb}{russian}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@gaelic} +% \begin{macrocode} +\TrackLangDeclareDialectOption{gaelic}{scottish}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@GBscottish} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareDialectOption{GBscottish}{scottish}{GB}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@serbianc} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareDialectOption{serbianc}{serbian}{}{}{}{}{Cyrl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@serbianl} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\TrackLangDeclareDialectOption{serbianl}{serbian}{}{}{}{}{Latn} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@slovenian} +% \begin{macrocode} +\TrackLangDeclareDialectOption{slovenian}{slovene}{}{}{}{}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@slovenia} +% \begin{macrocode} +\TrackLangDeclareDialectOption{slovenia}{slovene}{SI}{}{}{slovenian}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@sloveneistriaslovenian} +%\changes{1.3}{2016-10-07}{fixed root language name} +% \begin{macrocode} +\TrackLangDeclareDialectOption{sloveneistriaslovenian}{slovene}{SI}{}{}{slovenian}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@add@spainspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@honduranspanish{% - \AddTrackedDialect{honduranspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{HN}{honduranspanish}% -} -\@tracklang@declareoption{honduranspanish} +\TrackLangDeclareDialectOption{spainspanish}{spanish}{ES}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@mexicanspanish} +%\begin{macro}{\@tracklang@add@argentinespanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@mexicanspanish{% - \AddTrackedDialect{mexicanspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{MX}{mexicanspanish}% -} -\@tracklang@declareoption{mexicanspanish} +\TrackLangDeclareDialectOption{argentinespanish}{spanish}{AR}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@nicaraguanspanish} +%\begin{macro}{\@tracklang@add@bolivianspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@nicaraguanspanish{% - \AddTrackedDialect{nicaraguanspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{NI}{nicaraguanspanish}% -} -\@tracklang@declareoption{nicaraguanspanish} +\TrackLangDeclareDialectOption{bolivianspanish}{spanish}{BO}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@panamaspanish} +%\begin{macro}{\@tracklang@add@chilianspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@panamaspanish{% - \AddTrackedDialect{panamaspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{PA}{panamaspanish}% -} -\@tracklang@declareoption{panamaspanish} +\TrackLangDeclareDialectOption{chilianspanish}{spanish}{CL}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@paraguayspanish} +%\begin{macro}{\@tracklang@add@columbianspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@paraguayspanish{% - \AddTrackedDialect{paraguayspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{PY}{paraguayspanish}% -} -\@tracklang@declareoption{paraguayspanish} +\TrackLangDeclareDialectOption{columbianspanish}{spanish}{CO}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@peruvianspanish} +%\begin{macro}{\@tracklang@add@costaricanspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@peruvianspanish{% - \AddTrackedDialect{peruvianspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{PE}{peruvianspanish}% -} -\@tracklang@declareoption{peruvianspanish} +\TrackLangDeclareDialectOption{costaricanspanish}{spanish}{CR}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@puertoricospanish} +%\begin{macro}{\@tracklang@add@cubanspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@puertoricospanish{% - \AddTrackedDialect{puertoricospanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{PR}{puertoricospanish}% -} -\@tracklang@declareoption{puertoricospanish} +\TrackLangDeclareDialectOption{cubanspanish}{spanish}{CU}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@uruguayspanish} +%\begin{macro}{\@tracklang@add@dominicanspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@uruguayspanish{% - \AddTrackedDialect{uruguayspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{UY}{uruguayspanish}% -} -\@tracklang@declareoption{uruguayspanish} +\TrackLangDeclareDialectOption{dominicanspanish}{spanish}{DO}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@venezuelanspanish} +%\begin{macro}{\@tracklang@add@ecudorianspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@venezuelanspanish{% - \AddTrackedDialect{venezuelanspanish}{spanish}% - \AddTrackedIsoLanguage{639-1}{es}{spanish}% - \AddTrackedIsoLanguage{639-2}{spa}{spanish}% - \AddTrackedIsoLanguage{3166-1}{VE}{venezuelanspanish}% -} -\@tracklang@declareoption{venezuelanspanish} +\TrackLangDeclareDialectOption{ecudorianspanish}{spanish}{EC}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@swedish} +%\begin{macro}{\@tracklang@add@elsalvadorspanish} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@swedish{% - \AddTrackedLanguage{swedish}% - \AddTrackedIsoLanguage{639-1}{sv}{swedish}% - \AddTrackedIsoLanguage{639-2}{swe}{swedish}% -} -\@tracklang@declareoption{swedish} +\TrackLangDeclareDialectOption{elsalvadorspanish}{spanish}{SV}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@swissgerman} +%\begin{macro}{\@tracklang@add@guatemalanspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@swissgerman{% - \AddTrackedDialect{swissgerman}{german}% - \AddTrackedIsoLanguage{639-1}{de}{german}% - \AddTrackedIsoLanguage{639-2-B}{ger}{german}% - \AddTrackedIsoLanguage{639-2-T}{deu}{german}% - \AddTrackedIsoLanguage{639-2}{deu}{german}% - \AddTrackedIsoLanguage{3166-1}{CH}{swissgerman}% -} -\@tracklang@declareoption{swissgerman} +\TrackLangDeclareDialectOption{guatemalanspanish}{spanish}{GT}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@swissfrench} +%\begin{macro}{\@tracklang@add@honduranspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@swissfrench{% - \AddTrackedDialect{swissfrench}{french}% - \AddTrackedIsoLanguage{639-1}{fr}{french}% - \AddTrackedIsoLanguage{639-2-B}{fre}{french}% - \AddTrackedIsoLanguage{639-2-T}{fra}{french}% - \AddTrackedIsoLanguage{639-2}{fra}{french}% - \AddTrackedIsoLanguage{3166-1}{CH}{swissfrench}% -} -\@tracklang@declareoption{swissfrench} +\TrackLangDeclareDialectOption{honduranspanish}{spanish}{HN}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@swissitalian} +%\begin{macro}{\@tracklang@add@mexicanspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@swissitalian{% - \AddTrackedDialect{swissitalian}{italian}% - \AddTrackedIsoLanguage{639-1}{it}{italian}% - \AddTrackedIsoLanguage{639-2}{ita}{italian}% - \AddTrackedIsoLanguage{3166-1}{CH}{swissitalian}% -} -\@tracklang@declareoption{swissitalian} +\TrackLangDeclareDialectOption{mexicanspanish}{spanish}{MX}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@swissromansh} +%\begin{macro}{\@tracklang@add@nicaraguanspanish} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@swissromansh{% - \AddTrackedDialect{swissromansh}{romansh}% - \AddTrackedIsoLanguage{639-1}{rm}{romansh}% - \AddTrackedIsoLanguage{639-2}{roh}{romansh}% - \AddTrackedIsoLanguage{3166-1}{CH}{swissromansh}% -} -\@tracklang@declareoption{swissromansh} +\TrackLangDeclareDialectOption{nicaraguanspanish}{spanish}{NI}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@syriac} +%\begin{macro}{\@tracklang@add@panamaspanish} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@syriac{% - \AddTrackedLanguage{syriac}% - \AddTrackedIsoLanguage{639-2}{syr}{syriac}% -} -\@tracklang@declareoption{syriac} +\TrackLangDeclareDialectOption{panamaspanish}{spanish}{PA}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@tamil} +%\begin{macro}{\@tracklang@add@paraguayspanish} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@tamil{% - \AddTrackedLanguage{tamil}% - \AddTrackedIsoLanguage{639-1}{ta}{tamil}% - \AddTrackedIsoLanguage{639-2}{tam}{tamil}% -} -\@tracklang@declareoption{tamil} +\TrackLangDeclareDialectOption{paraguayspanish}{spanish}{PY}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@telugu} +%\begin{macro}{\@tracklang@add@peruvianspanish} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@telugu{% - \AddTrackedLanguage{telugu}% - \AddTrackedIsoLanguage{639-1}{te}{telugu}% - \AddTrackedIsoLanguage{639-2}{tel}{telugu}% -} -\@tracklang@declareoption{telugu} +\TrackLangDeclareDialectOption{peruvianspanish}{spanish}{PE}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@thai} +%\begin{macro}{\@tracklang@add@puertoricospanish} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@tai{% - \AddTrackedLanguage{tai}% - \AddTrackedIsoLanguage{639-2}{tai}{tai}% -} -\@tracklang@declareoption{tai} +\TrackLangDeclareDialectOption{puertoricospanish}{spanish}{PR}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@thai} +%\begin{macro}{\@tracklang@add@uruguayspanish} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@thai{% - \AddTrackedLanguage{thai}% - \AddTrackedIsoLanguage{639-1}{th}{thai}% - \AddTrackedIsoLanguage{639-2}{tha}{thai}% -} -\@tracklang@declareoption{thai} +\TrackLangDeclareDialectOption{uruguayspanish}{spanish}{UY}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@tibetan} +%\begin{macro}{\@tracklang@add@venezuelanspanish} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@tibetan{% - \AddTrackedLanguage{tibetan}% - \AddTrackedIsoLanguage{639-1}{bo}{tibetan}% - \AddTrackedIsoLanguage{639-2-B}{tib}{tibetan}% - \AddTrackedIsoLanguage{639-2-T}{bod}{tibetan}% - \AddTrackedIsoLanguage{639-2}{bod}{tibetan}% -} -\@tracklang@declareoption{tibetan} +\TrackLangDeclareDialectOption{venezuelanspanish}{spanish}{VE}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@turkish} +%\begin{macro}{\@tracklang@add@swissgerman} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@turkish{% - \AddTrackedLanguage{turkish}% - \AddTrackedIsoLanguage{639-1}{tr}{turkish}% - \AddTrackedIsoLanguage{639-2}{tur}{turkish}% -} -\@tracklang@declareoption{turkish} +\TrackLangDeclareDialectOption{swissgerman}{german}{CH}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@turkmen} +%\begin{macro}{\@tracklang@add@nswissgerman} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@turkmen{% - \AddTrackedLanguage{turkmen}% - \AddTrackedIsoLanguage{639-1}{tk}{turkmen}% - \AddTrackedIsoLanguage{639-2}{tuk}{turkmen}% -} -\@tracklang@declareoption{turkmen} +\TrackLangDeclareDialectOption{nswissgerman}{german}{CH}{new}{1996}{ngerman}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@UKenglish} +%\begin{macro}{\@tracklang@add@swissfrench} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@UKenglish{% - \AddTrackedDialect{UKenglish}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{GB}{UKenglish}% -} -\@tracklang@declareoption{UKenglish} +\TrackLangDeclareDialectOption{swissfrench}{french}{CH}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@ukrainian} +%\begin{macro}{\@tracklang@add@swissitalian} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@ukrainian{% - \AddTrackedLanguage{ukrainian}% - \AddTrackedIsoLanguage{639-1}{uk}{ukrainian}% - \AddTrackedIsoLanguage{639-2}{ukr}{ukrainian}% - \AddTrackedIsoLanguage{3166-1}{UA}{ukrainian}% -} -\@tracklang@declareoption{ukrainian} +\TrackLangDeclareDialectOption{swissitalian}{italian}{CH}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@ukraineb} +%\begin{macro}{\@tracklang@add@swissromansh} +%\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\def\@tracklang@add@ukraineb{% - \AddTrackedDialect{ukraineb}{ukrainian}% - \AddTrackedIsoLanguage{639-1}{uk}{ukrainian}% - \AddTrackedIsoLanguage{639-2}{ukr}{ukrainian}% - \AddTrackedIsoLanguage{3166-1}{UA}{ukraineb}% -} -\@tracklang@declareoption{ukraineb} +\TrackLangDeclareDialectOption{swissromansh}{romansh}{CH}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@ukraine} +%\begin{macro}{\@tracklang@add@UKenglish} % \begin{macrocode} -\def\@tracklang@add@ukraine{% - \AddTrackedDialect{ukraine}{ukrainian}% - \AddTrackedIsoLanguage{639-1}{uk}{ukrainian}% - \AddTrackedIsoLanguage{639-2}{ukr}{ukrainian}% - \AddTrackedIsoLanguage{3166-1}{UA}{ukraine}% -} -\@tracklang@declareoption{ukraine} +\TrackLangDeclareDialectOption{UKenglish}{english}{GB}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@urdu} +%\begin{macro}{\@tracklang@add@ukraineb} % \begin{macrocode} -\def\@tracklang@add@urdu{% - \AddTrackedLanguage{urdu}% - \AddTrackedIsoLanguage{639-1}{ur}{urdu}% - \AddTrackedIsoLanguage{639-2}{urd}{urdu}% -} -\@tracklang@declareoption{urdu} +\TrackLangDeclareDialectOption{ukraineb}{ukrainian}{UA}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@usorbian} +%\begin{macro}{\@tracklang@add@ukraine} % \begin{macrocode} -\def\@tracklang@add@usorbian{% - \AddTrackedLanguage{usorbian}% - \AddTrackedIsoLanguage{639-2}{dsb}{usorbian}% - \AddTrackedIsoLanguage{3166-1}{DE}{usorbian}% -} -\@tracklang@declareoption{usorbian} +\TrackLangDeclareDialectOption{ukraine}{ukrainian}{UA}{}{}{}{} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@uppersorbian} % \begin{macrocode} -\def\@tracklang@add@uppersorbian{% - \AddTrackedDialect{uppersorbian}{usorbian}% - \AddTrackedIsoLanguage{639-2}{hsb}{usorbian}% - \AddTrackedIsoLanguage{3166-1}{DE}{uppersorbian}% -} -\@tracklang@declareoption{uppersorbian} +\TrackLangDeclareDialectOption{uppersorbian}{usorbian}{DE}{}{}{}{} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@USenglish} % \begin{macrocode} -\def\@tracklang@add@USenglish{% - \AddTrackedDialect{USenglish}{english}% - \AddTrackedIsoLanguage{639-1}{en}{english}% - \AddTrackedIsoLanguage{639-2}{eng}{english}% - \AddTrackedIsoLanguage{3166-1}{US}{USenglish}% -} -\@tracklang@declareoption{USenglish} +\TrackLangDeclareDialectOption{USenglish}{english}{US}{}{}{}{} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@valencian} % \begin{macrocode} -\def\@tracklang@add@valencian{% - \AddTrackedDialect{valencian}{catalan}% - \AddTrackedIsoLanguage{639-1}{ca}{catalan}% - \AddTrackedIsoLanguage{639-2}{cat}{catalan}% -} -\@tracklang@declareoption{valencian} +\TrackLangDeclareDialectOption{valencian}{catalan}{}{}{}{}{} % \end{macrocode} %\end{macro} % %\begin{macro}{\@tracklang@add@valencien} % \begin{macrocode} -\def\@tracklang@add@valencien{% - \AddTrackedDialect{valencien}{catalan}% - \AddTrackedIsoLanguage{639-1}{ca}{catalan}% - \AddTrackedIsoLanguage{639-2}{cat}{catalan}% -} -\@tracklang@declareoption{valencien} +\TrackLangDeclareDialectOption{valencien}{catalan}{}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@vietnamese} -% \begin{macrocode} -\def\@tracklang@add@vietnamese{% - \AddTrackedLanguage{vietnamese}% - \AddTrackedIsoLanguage{639-1}{vi}{vietnamese}% - \AddTrackedIsoLanguage{639-2}{vie}{vietnamese}% -} -\@tracklang@declareoption{vietnamese} -% \end{macrocode} -%\end{macro} -% -%\begin{macro}{\@tracklang@add@walloon} -% No country code as Walloon is spoken in multiple regions -% (Wallonia in Belgium, some villages in Northern France and northeast of -% Wisconsin.) Not the same as Belgian French. +%\begin{macro}{\@tracklang@add@cymraeg} % \begin{macrocode} -\def\@tracklang@add@walloon{% - \AddTrackedLanguage{walloon}% - \AddTrackedIsoLanguage{639-1}{wa}{walloon}% - \AddTrackedIsoLanguage{639-2}{wln}{walloon}% -} -\@tracklang@declareoption{walloon} +\TrackLangDeclareDialectOption{cymraeg}{welsh}{}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@welsh} +%\begin{macro}{\@tracklang@add@GBwelsh} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@welsh{% - \AddTrackedLanguage{welsh}% - \AddTrackedIsoLanguage{639-1}{cy}{welsh}% - \AddTrackedIsoLanguage{639-2-B}{wel}{welsh}% - \AddTrackedIsoLanguage{639-2-T}{cym}{welsh}% - \AddTrackedIsoLanguage{639-2}{cym}{welsh}% -} -\@tracklang@declareoption{welsh} +\TrackLangDeclareDialectOption{GBwelsh}{welsh}{GB}{}{}{}{} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@tracklang@add@cymraeg} +%\subsection{Dialect Option Synonyms} +%\label{sec:dialectsyns} +% Add some dialect synonyms: +%\begin{macro}{\LetTrackLangSynonym} +%\changes{1.3}{2016-10-07}{new} % \begin{macrocode} -\def\@tracklang@add@cymraeg{% - \AddTrackedDialect{cymraeg}{welsh}% - \AddTrackedIsoLanguage{639-1}{cy}{welsh}% - \AddTrackedIsoLanguage{639-2-B}{wel}{welsh}% - \AddTrackedIsoLanguage{639-2-T}{cym}{welsh}% - \AddTrackedIsoLanguage{639-2}{cym}{welsh}% +\def\LetTrackLangSynonym#1#2{% + \expandafter\let\csname @tracklang@add@#1\expandafter\endcsname + \csname @tracklang@add@#2\endcsname } -\@tracklang@declareoption{cymraeg} % \end{macrocode} %\end{macro} -% -% Add some dialect synonyms: %\begin{macro}{\LetTrackLangOption} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} \def\LetTrackLangOption#1#2{% - \expandafter\let\csname @tracklang@add@#1\expandafter\endcsname - \csname @tracklang@add@#2\endcsname + \LetTrackLangSynonym{#1}{#2}% \@tracklang@declareoption{#1}% } % \end{macrocode} @@ -4420,7 +8568,7 @@ %\begin{macro}{\@tracklang@add@de-DE} %\changes{1.1}{2014-11-21}{new} % \begin{macrocode} -\LetTrackLangOption{de-DE}{ngermanDE} +\LetTrackLangOption{de-DE}{germanDE} % \end{macrocode} %\end{macro} %\begin{macro}{\@tracklang@add@de-BE} @@ -4678,8 +8826,68 @@ \LetTrackLangOption{en-IE}{IEenglish} % \end{macrocode} %\end{macro} +%\begin{macro}{\@tracklang@add@de-AT-1996} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\LetTrackLangOption{de-AT-1996}{naustrian} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@de-AT} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\LetTrackLangOption{de-AT}{austrian} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@id-IN} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\LetTrackLangOption{id-IN}{bahasa} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@ms-MY} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\LetTrackLangOption{ms-MY}{malay} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@hr-HR} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\LetTrackLangOption{hr-HR}{croatia} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@de-DE-1996} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\LetTrackLangOption{de-DE-1996}{ngermanDE} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@de-CH-1996} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\LetTrackLangOption{de-CH-1996}{nswissgerman} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@hu-HU} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\LetTrackLangOption{hu-HU}{hungarian} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@gd-GB} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\LetTrackLangOption{gd-GB}{GBscottish} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@tracklang@add@cy-GB} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\LetTrackLangOption{cy-GB}{GBwelsh} +% \end{macrocode} +%\end{macro} % -%\subsubsection{Conditionals and Loops} +%\subsection{Conditionals and Loops} % %\begin{macro}{\IfTrackedLanguage} %\begin{definition} @@ -4688,7 +8896,7 @@ %\end{definition} % \begin{macrocode} \long\def\IfTrackedLanguage#1#2#3{% -% \end{macrocode} +% \end{macrocode} % First find out if the language name is empty. % \begin{macrocode} \edef\@tracklang@element{#1}% @@ -4812,26 +9020,16 @@ % is performed, otherwise \meta{false part} is performed. % \begin{macrocode} \long\def\IfTrackedLanguageFileExists#1#2#3#4#5{% - \def\CurrentTrackedTag{}% - \def\CurrentTrackedDialect{#1}% - \def\CurrentTrackedLanguage{}% - \def\CurrentTrackedRegion{}% - \def\CurrentTrackedIsoCode{}% - \IfTrackedDialect{#1}% - {% % \end{macrocode} -% Fetch the region if defined. +%Initialise. % \begin{macrocode} - \IfTrackedLanguageHasIsoCode{3166-1}{#1}% - {% - \edef\CurrentTrackedRegion{% - \TrackedIsoCodeFromLanguage{3166-1}{#1}}% - }% - {}% + \def\CurrentTrackedTag{}% % \end{macrocode} -% Fetch the root language. +%Select this dialect. % \begin{macrocode} - \edef\CurrentTrackedLanguage{\TrackedLanguageFromDialect{#1}}% + \SetCurrentTrackedDialect{#1}% + \IfTrackedDialect{#1}% + {% % \end{macrocode} % Try just the dialect label. % \begin{macrocode} @@ -4849,7 +9047,7 @@ \edef\CurrentTrackedIsoCode{% \TrackedIsoCodeFromLanguage {639-1}{\CurrentTrackedLanguage}}% - \ifx\CurrentTrackedRegion\@empty + \ifx\CurrentTrackedRegion\empty % \end{macrocode} % No region, just try ISO 639-1 code % \begin{macrocode} @@ -4859,6 +9057,7 @@ {% % \end{macrocode} % No region and file for just \meta{ISO 639-1 code}. Try ISO 639-2 code. +% (No check for 639-3 since it has 639-1 code.) % \begin{macrocode} \IfTrackedLanguageHasIsoCode {639-2}{\CurrentTrackedLanguage} @@ -4984,9 +9183,54 @@ \edef\CurrentTrackedIsoCode{% \TrackedIsoCodeFromLanguage {639-2}{\CurrentTrackedLanguage}}% - \ifx\CurrentTrackedRegion\@empty + }% + {% +% \end{macrocode} +% No ISO 639-1 code or ISO 639-2 code. Try 639-3 code. +% \begin{macrocode} + \IfTrackedLanguageHasIsoCode + {639-3}{\CurrentTrackedLanguage} + {% + \edef\CurrentTrackedIsoCode{% + \TrackedIsoCodeFromLanguage + {639-3}{\CurrentTrackedLanguage}}% + }% + {% + \let\CurrentTrackedIsoCode\empty + }% + }% + \ifx\CurrentTrackedIsoCode\empty +% \end{macrocode} +% No ISO 639-1 code or ISO 639-2 code. Try just the region. +% \begin{macrocode} + \ifx\CurrentTrackedRegion\empty +% \end{macrocode} +% No region. Try the root language. +% \begin{macrocode} + \let\CurrentTrackedTag\CurrentTrackedLanguage + \@tracklang@IfFileExists{#2\CurrentTrackedTag#3}{#4}{#5}% + \else +% \end{macrocode} +% Try the region. +% \begin{macrocode} + \let\CurrentTrackedTag\CurrentTrackedRegion + \@tracklang@IfFileExists{#2\CurrentTrackedTag#3}% + {#4}% + {% +% \end{macrocode} +% Try the root language. +% \begin{macrocode} + \let\CurrentTrackedTag\CurrentTrackedLanguage + \@tracklang@IfFileExists{#2\CurrentTrackedTag#3}{#4}{#5}% + }% + \fi + \else +% \end{macrocode} +% Has ISO 639-2 or 639-3 code. +% \begin{macrocode} + \ifx\CurrentTrackedRegion\empty % \end{macrocode} -% Has ISO 639-2 code but no region +% Has ISO 639-2 or 639-3 code but no region. % \begin{macrocode} \let\CurrentTrackedTag\CurrentTrackedIsoCode \@tracklang@IfFileExists{#2\CurrentTrackedTag#3}% @@ -5000,8 +9244,8 @@ }% \else % \end{macrocode} -% Has ISO 639-2 code and a region. Try \meta{ISO -% 639-2}\texttt{-}\meta{region} first. +% Has ISO 639-2 or 639-3 code and a region. Try \meta{ISO +% 639-2 or 639-3}\texttt{-}\meta{region} first. % \begin{macrocode} \edef\CurrentTrackedTag{% \CurrentTrackedIsoCode-\CurrentTrackedRegion}% @@ -5009,17 +9253,17 @@ {#4}% {% % \end{macrocode} -% Has ISO 639-2 code and a region but \meta{ISO -% 639-2}\texttt{-}\meta{region} doesn't exist. Try just \meta{ISO -% 639-2} +% Has ISO 639-2 or 639-3 code and a region but \meta{ISO +% 639-2 or 639-3}\texttt{-}\meta{region} doesn't exist. Try just \meta{ISO +% 639-2 or 639-3} % \begin{macrocode} \let\CurrentTrackedTag\CurrentTrackedIsoCode \@tracklang@IfFileExists{#2\CurrentTrackedTag#3}% {#4}% {% % \end{macrocode} -% Has ISO 639-2 code and a region but \meta{ISO -% 639-2} doesn't exist. Try just \meta{region} +% Has ISO 639-2 or 639-3 code and a region but \meta{ISO +% 639-2 or 639-3} doesn't exist. Try just \meta{region} % \begin{macrocode} \let\CurrentTrackedTag\CurrentTrackedRegion \@tracklang@IfFileExists{#2\CurrentTrackedTag#3}% @@ -5034,45 +9278,1334 @@ }% }% \fi - }% - {% + \fi + }% + }% + }% + {#5}% unknown dialect +} % \end{macrocode} -% No ISO 639-1 code or ISO 639-2 code. Try just the region. +%\end{macro} +% +%\subsection{Resources} +%Provide some commands to make it easier for package authors to +%integrate the package code with \styfmt{tracklang}. In the +%command definition describes below, \meta{pkgname} indicates the +%initial part of the resource files that follow the naming +%convention, \meta{pkgname}\texttt{-}\meta{tag}\texttt{.ldf}. +%Typically this will match the base name of the package that uses +%those resource files, but this isn't compulsory. +% The argument \meta{tag} is the current tracked tag obtained from +% \cs{IfTrackedLanguageFileExists}. +% +%\begin{macro}{\TrackLangProvidesResource} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangProvidesResource}\marg{tag}\oarg{version} +%\end{definition} +%If \cs{ProvidesFile} exists, we can use that, otherwise we need to +%provide a generic version. % \begin{macrocode} - \ifx\CurrentTrackedRegion\@empty +\ifx\ProvidesFile\undefined % \end{macrocode} -% No region. Try the root language. +%Generic code uses simplistic method to grab the version +%details in the final optional argument. Since we're not using +%\LaTeX\ we don't have commands like \cs{@ifnextchar} available. % \begin{macrocode} - \let\CurrentTrackedTag\CurrentTrackedLanguage - \@tracklang@IfFileExists{#2\CurrentTrackedTag#3}{#4}{#5}% - \else + \long\def\TrackLangProvidesResource#1#2{% + \ifx\TrackLangRequireDialectPrefix\undefined + \@tracklang@err{Resources files using + \string\TrackLangProvidesResource\space + must be loaded with \string\TrackLangRequireDialect}% + \fi + \ifx#2[\relax + \def\@tracklang@next{% + \@tracklang@providesresource{\TrackLangRequireDialectPrefix-#1.ldf}#2% + } + \else + \expandafter\xdef\csname ver@\TrackLangRequireDialectPrefix + -#1.ldf\endcsname{}% + {% + \newlinechar=`\^^J + \def\MessageBreak{^^J}% + \message{^^JFile: \TrackLangRequireDialectPrefix-#1.ldf^^J}% + }% + \long\def\@tracklang@next{#2}% + \fi + \@tracklang@next + } + \def\@tracklang@providesresource#1[#2]{% + \expandafter\xdef\csname ver@#1\endcsname{#2}% + {% + \newlinechar=`\^^J + \def\MessageBreak{^^J}% + \message{^^JFile: #1 #2^^J}% + }% + } +\else % \end{macrocode} -% Try the region. +%\LaTeX\ code can simply use \cs{ProvidesFile}. % \begin{macrocode} - \let\CurrentTrackedTag\CurrentTrackedRegion - \@tracklang@IfFileExists{#2\CurrentTrackedTag#3}% - {#4}% - {% + \def\TrackLangProvidesResource#1{% + \ifx\TrackLangRequireDialectPrefix\undefined + \@tracklang@err{Resources files using + \string\TrackLangProvidesResource\space + must be loaded with \string\TrackLangRequireDialect}% + \fi + \ProvidesFile{\TrackLangRequireDialectPrefix-#1.ldf}% + } +\fi % \end{macrocode} -% Try the root language. +%\end{macro} +% +%\begin{macro}{\TrackLangAddToHook} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangAddToHook}\marg{code}\marg{type} +%\end{definition} +%Within the resource files, a check is required for the language +%hook, where the hook type is given by \meta{type}. +% For example, if \meta{type} is \texttt{captions}, the for \sty{babel}, +%this is \cs{captions\meta{dialect}} (dialect +%obtained through \cs{CurrentTrackedDialect}) and +%for \sty{polyglossia}, this is \cs{captions\meta{language}} +%(language obtained through \cs{CurrentTrackedLanguage}). +%This command is not permitted outside resource files. % \begin{macrocode} - \let\CurrentTrackedTag\CurrentTrackedLanguage - \@tracklang@IfFileExists{#2\CurrentTrackedTag#3}{#4}{#5}% - }% - \fi - }% - }% - }% +\def\TrackLangAddToHook{\noop@TrackLangAddToHook} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\noop@TrackLangAddToHook} +% \begin{macrocode} +\def\noop@TrackLangAddToHook#1#2{% + \@tracklang@err{\string\TrackLangAddToHook\space + only permitted within resource files} +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@TrackLangAddToHook} +% \begin{macrocode} +\def\@TrackLangAddToHook#1#2{% +% \end{macrocode} +% \sty{babel} check first. +% \begin{macrocode} + \@tracklang@ifundef{#2\CurrentTrackedDialect}% + {% +% \end{macrocode} +% Does the dialect label have a mapping? +% \begin{macrocode} + \IfTrackedDialectHasMapping{\CurrentTrackedDialect}% + {% +% \end{macrocode} +% Try the mapping label next. +% \begin{macrocode} + \edef\@tracklang@tmp{% + \csname @tracklang@dialectmap@to@\CurrentTrackedDialect\endcsname}% + \@tracklang@ifundef{#2\@tracklang@tmp}% + {% +% \end{macrocode} +% No captions hook. Try \sty{polyglossia}. +% \begin{macrocode} + \@tracklang@ifundef{#2\CurrentTrackedLanguage}% + {% +% \end{macrocode} +% No captions hook. Do the code now. +% \begin{macrocode} + #1% + }% + {% + \@tracklang@addtohook{#2}{\CurrentTrackedLanguage}{#1}% + }% + }% + {% + \@tracklang@addtohook{#2}{\@tracklang@tmp}{#1}% + }% + }% + {% +% \end{macrocode} +% \sty{polyglossia} check next. +% \begin{macrocode} + \@tracklang@ifundef{#2\CurrentTrackedLanguage}% + {% +% \end{macrocode} +% No captions hook. +% \begin{macrocode} + }% + {% + \@tracklang@addtohook{#2}{\CurrentTrackedLanguage}{#1}% + }% + }% + }% + {% + \@tracklang@addtohook{#2}{\CurrentTrackedDialect}{#1}% + }% +% \end{macrocode} +% Do the code now. (This is needed for cases such as the \sty{ngerman} +% which defines \cs{captionsngerman} but calls it immediately rather +% than at the start of the document.) +% \begin{macrocode} + #1% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@tracklang@addtohook} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{@tracklang@addtohook}\marg{type}\marg{label}\marg{code} +%\end{definition} +% \begin{macrocode} +\def\@tracklang@addtohook#1#2#3{% + \expandafter\let\expandafter\@tracklang@hook\csname #1#2\endcsname + \expandafter + \gdef\csname#1#2\expandafter\endcsname\expandafter{\@tracklang@hook#3}% +} +% \end{macrocode} +%\end{macro} +% +%Since the captions hook is the most common, provide a shortcut. +%\begin{macro}{\TrackLangAddToCaptions} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangAddToCaptions}\marg{code} +%\end{definition} +% \begin{macrocode} +\def\TrackLangAddToCaptions#1{\TrackLangAddToHook{#1}{captions}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetTrackedDialectLabelMap} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{SetTrackedDialectLabelMap}\marg{from}\marg{to} +%\end{definition} +%Define a mapping between a \styfmt{tracklang} dialect label and the +%corresponding label used by the language hook. For example, +%\texttt{ngermanDE} is a recognised \styfmt{tracklang} dialect +%label, but the closest \sty{babel} equivalent is \texttt{ngerman}, +%so \texttt{ngermanDE} would need to be mapped to \texttt{ngerman} +%for the language hooks. The arguments are \meta{from} (the +%\styfmt{tracklang} dialect label) and \meta{to} (the \sty{babel}, +%\sty{polyglossia} etc label). +% \begin{macrocode} +\def\SetTrackedDialectLabelMap#1#2{% + \@tracklang@enamedef{@tracklang@dialectmap@to@#1}{#2}% + \@tracklang@enamedef{@tracklang@dialectmap@from@#2}{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\IfTrackedDialectHasMapping} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{IfTrackedDialectHasMapping}\marg{label}\marg{true}\marg{false} +%\end{definition} +%Tests if the \sty{tracklang} dialect \meta{label} has been assigned +%a mapping. +% \begin{macrocode} +\def\IfTrackedDialectHasMapping#1#2#3{% + \@tracklang@ifundef{@tracklang@dialectmap@to@#1}{#3}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GetTrackedDialectToMapping} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{GetTrackedDialectToMapping}\marg{label} +%\end{definition} +%Gets the mapping for the given \sty{tracklang} dialect label or the +%\meta{label} itself if no mapping has been defined. +% \begin{macrocode} +\def\GetTrackedDialectToMapping#1{% + \@tracklang@ifundef{@tracklang@dialectmap@to@#1}{#1}% + {\csname @tracklang@dialectmap@to@#1\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GetTrackedDialectFromMapping} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{GetTrackedDialectFromMapping}\marg{map} +%\end{definition} +%Gets the \sty{tracklang} dialect label from the \meta{map} or the +%\meta{map} itself if no mapping has been defined. +% \begin{macrocode} +\def\GetTrackedDialectFromMapping#1{% + \@tracklang@ifundef{@tracklang@dialectmap@from@#1}{#1}% + {\csname @tracklang@dialectmap@from@#1\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangRequireResource} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangRequireResource}\marg{tag} +%\end{definition} +% \begin{macrocode} +\def\TrackLangRequireResource{\noop@TrackLangRequireResource} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\noop@TrackLangRequireResource} +%\changes{1.3}{2016-10-07}{new} +%Default behaviour outside of resources files: generate an +%error and ignore arguments. +% \begin{macrocode} +\def\noop@TrackLangRequireResource#1{% + \@tracklang@err{\string\TrackLangRequireResource\space + only permitted within resource files} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@TrackLangRequireResource} +%\changes{1.3}{2016-10-07}{new} +%Actual behaviour. +% \begin{macrocode} +\def\@TrackLangRequireResource#1{% + \@tracklang@ifundef{ver@\TrackLangRequireDialectPrefix-#1.ldf}% + {% + \@tracklang@IfFileExists{\TrackLangRequireDialectPrefix-#1.ldf}% + {% + \input \TrackLangRequireDialectPrefix-#1.ldf + }% + {% + \@tracklang@warn{No `\TrackLangRequireDialectPrefix' support for + language/region `#1'\MessageBreak + (resource file `\TrackLangRequireDialectPrefix-#1.ldf' not found)}% + }% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangRequireResourceOrDo} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangRequireResourceOrDo}\marg{tag}\marg{resource +%loaded code}\marg{resource already loaded code} +%\end{definition} +%Like \cs{TrackLangRequireResource} but also does \meta{resource +%loaded code} if the resource file is loaded or \meta{resource +%already loaded code} if the resource file has already been loaded. +% \begin{macrocode} +\def\TrackLangRequireResourceOrDo{% + \noop@TrackLangRequireResourceOrDo +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\noop@TrackLangRequireResourceOrDo} +%\changes{1.3}{2016-10-07}{new} +%Default behaviour outside of resources files: generate an +%error and ignore arguments. +% \begin{macrocode} +\def\noop@TrackLangRequireResourceOrDo#1#2#3{% + \@tracklang@err{\string\TrackLangRequireResourceOrDo\space + only permitted within resource files} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@TrackLangRequireResourceOrDo} +%\changes{1.3}{2016-10-07}{new} +%Actual behaviour. +% \begin{macrocode} +\def\@TrackLangRequireResourceOrDo#1#2#3{% + \@tracklang@ifundef{ver@\TrackLangRequireDialectPrefix-#1.ldf}% + {% + \@tracklang@IfFileExists{\TrackLangRequireDialectPrefix-#1.ldf}% + {% + \input \TrackLangRequireDialectPrefix-#1.ldf + #2% + }% + {% + \@tracklang@warn{No `\TrackLangRequireDialectPrefix' support for + language/region `#1'\MessageBreak + (resource file `\TrackLangRequireDialectPrefix-#1.ldf' not found)}% + }% + }% + {#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangRequestResource} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangRequestResource}\marg{tag}\marg{not found code} +%\end{definition} +%Like \cs{TrackLangRequireResource} but does \meta{not found code} +%if the file doesn't exist. +% \begin{macrocode} +\def\TrackLangRequestResource{\noop@TrackLangRequestResource} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\noop@TrackLangRequestResource} +%\changes{1.3}{2016-10-07}{new} +%Default behaviour outside of resources files: generate an +%error and ignore arguments. +% \begin{macrocode} +\def\noop@TrackLangRequestResource#1#2{% + \@tracklang@err{\string\TrackLangRequestResource\space + only permitted within resource files} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@TrackLangRequestResource} +%\changes{1.3}{2016-10-07}{new} +%Actual behaviour. +% \begin{macrocode} +\def\@TrackLangRequestResource#1#2{% + \@tracklang@ifundef{ver@\TrackLangRequireDialectPrefix-#1.ldf}% + {% + \@tracklang@IfFileExists{\TrackLangRequireDialectPrefix-#1.ldf}% + {% + \input \TrackLangRequireDialectPrefix-#1.ldf + }% + {#2}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangRequireDialect} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangRequireDialect}\oarg{load code}\marg{pkgname}\marg{dialect} +%\end{definition} +% \begin{macrocode} +\def\TrackLangRequireDialect{\@TrackLangRequireDialect} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\noop@TrackLangRequireDialect} +%\changes{1.3}{2016-10-07}{new} +%No-op code. +% \begin{macrocode} +\def\noop@TrackLangRequireDialect#1{% + \ifx[#1\relax + \def\@tracklang@next{\@noop@TrackLangRequireDialect[}% + \else + \def\@tracklang@next{\@noop@TrackLangRequireDialect[]{#1}}% + \fi + \@tracklang@next +} +\def\@noop@TrackLangRequireDialect[#1]#2#3{% + \@tracklang@err{\string\TrackLangRequireDialect\space + only permitted within resource files} +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@TrackLangRequireDialect} +%\changes{1.3}{2016-10-07}{new} +%Actual code. +% \begin{macrocode} +\def\@TrackLangRequireDialect#1{% + \ifx[#1\relax + \def\@tracklang@next{\@@TrackLangRequireDialect[}% + \else + \def\@tracklang@next{% + \@@TrackLangRequireDialect + [\TrackLangRequireResource{\CurrentTrackedTag}]{#1}}% + \fi + \@tracklang@next +} +\def\@@TrackLangRequireDialect[#1]#2#3{% + \def\TrackLangRequireDialectPrefix{#2}% + \IfTrackedLanguageFileExists{#3}% + {#2-}% prefix + {.ldf}% suffix + {% +% \end{macrocode} +%Enable \cs{TrackLangRequireResource} etc so that they can only be used in +%resource files. +% \begin{macrocode} + \let\TrackLangRequireResource\@TrackLangRequireResource + \let\TrackLangRequireResourceOrDo\@TrackLangRequireResourceOrDo + \let\TrackLangRequestResource\@TrackLangRequestResource +% \end{macrocode} +%Disable \cs{TrackLangRequireDialect} so that it can't be used in +%resource files. +% \begin{macrocode} + \let\TrackLangRequireDialect\noop@TrackLangRequireDialect +% \end{macrocode} +%Enable \cs{TrackLangAddToHook}. +% \begin{macrocode} + \let\TrackLangAddToHook\@TrackLangAddToHook +% \end{macrocode} +%Load resource file using the code provided in the first argument. +% \begin{macrocode} + #1% +% \end{macrocode} +%Disable \cs{TrackLangRequireResource} etc. +% \begin{macrocode} + \let\TrackLangRequireResource\noop@TrackLangRequireResource + \let\TrackLangRequireResourceOrDo\noop@TrackLangRequireResourceOrDo + \let\TrackLangRequestResource\noop@TrackLangRequestResource +% \end{macrocode} +%Enable \cs{TrackLangRequireDialect}. +% \begin{macrocode} + \let\TrackLangRequireDialect\@TrackLangRequireDialect +% \end{macrocode} +%Disable \cs{TrackLangAddToHook}. +% \begin{macrocode} + \let\TrackLangAddToHook\noop@TrackLangAddToHook + }% + {% + \@tracklang@warn{No `#2' support for dialect `#3'}% }% - {#5}% unknown dialect } % \end{macrocode} %\end{macro} % +%Restore category code for \texttt{@} if necessary. +% \begin{macrocode} +\@tracklang@restore@at +% \end{macrocode} %\iffalse % \begin{macrocode} %</tracklang.tex> % \end{macrocode} %\fi +%\iffalse +% \begin{macrocode} +%<*tracklang-region-codes.tex> +% \end{macrocode} +%\fi +%\section{Regions Generic Code (\texttt{tracklang-region-codes.tex})} +%This is only loaded if a mapping is required between +%numeric and alphabetic region codes. (It would slow down the +%package loading to automatically load if not required.) +%Since this is loaded on the fly, we need to be careful about +%spurious spaces. +%\changes{1.3}{2016-10-07}{added tracklang-region-codes.tex} +% \begin{macrocode} +\ifnum\catcode`\@=11\relax + \def\@tracklang@regions@restore@at{}% +\else + \expandafter\edef\csname @tracklang@regions@restore@at\endcsname{% + \noexpand\catcode`\noexpand\@=\number\catcode`\@\relax + }% + \catcode`\@=11\relax +\fi +% \end{macrocode} +% Check if this file has already been loaded: +% \begin{macrocode} +\ifx\TrackLangRegionMap\undefined +\else + \@tracklang@regions@restore@at + \expandafter\endinput +\fi +% \end{macrocode} +% Version info. +% \begin{macrocode} +\expandafter\def\csname ver@tracklang-region-codes.tex\endcsname{2016/10/08 v1.3.1 +(NLCT) Track Languages Regions}% +% \end{macrocode} +% +%\begin{macro}{\TrackLangRegionMap} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangRegionMap}\marg{numeric code}\marg{alpha-2 +%code}\marg{alpha-3 code} +%\end{definition} +%Define mapping. +% \begin{macrocode} +\def\TrackLangRegionMap#1#2#3{% + \@tracklang@enamedef{@tracklang@region@numtoalphaii@#1}{#2}% + \@tracklang@enamedef{@tracklang@region@numtoalphaiii@#1}{#3}% + \@tracklang@enamedef{@tracklang@region@alphaiitonum@#2}{#1}% + \@tracklang@enamedef{@tracklang@region@alphaiiitonum@#3}{#1}% + \@tracklang@enamedef{@tracklang@region@alphaiitoalphaiii@#2}{#3}% + \@tracklang@enamedef{@tracklang@region@alphaiiitoalphaii@#3}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangAlphaIIToNumericRegion} +%\begin{definition} +%\cs{TrackLangAlphaIIToNumericRegion}\marg{alpha-2 code} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangAlphaIIToNumericRegion#1{% + \@tracklang@nameuse{@tracklang@region@alphaiitonum@#1}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangNumericToAlphaIIRegion} +%\begin{definition} +%\cs{TrackLangNumericToAlphaIIRegion}\marg{numeric code} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangNumericToAlphaIIRegion#1{% + \@tracklang@nameuse{@tracklang@region@numtoalphaii@#1}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangIfKnownAlphaIIRegion} +%\begin{definition} +%\cs{TrackLangIfKnownAlphaIIRegion}\marg{alpha-2 +%code}\marg{true}\marg{false} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangIfKnownAlphaIIRegion#1#2#3{% + \@tracklang@ifundef{@tracklang@region@alphaiitonum@#1}% + {#3}% + {#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangIfKnownNumericRegion} +%\begin{definition} +%\cs{TrackLangIfKnownNumericRegion}\marg{numeric +%code}\marg{true}\marg{false} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangIfKnownNumericRegion#1#2#3{% + \@tracklang@ifundef{@tracklang@region@numtoalphaii@#1}% + {#3}% + {#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangAlphaIIIToNumericRegion} +%\begin{definition} +%\cs{TrackLangAlphaIIIToNumericRegion}\marg{alpha-3 code} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangAlphaIIIToNumericRegion#1{% + \@tracklang@nameuse{@tracklang@region@alphaiiitonum@#1}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangNumericToAlphaIIIRegion} +%\begin{definition} +%\cs{TrackLangNumericToAlphaIIIRegion}\marg{numeric code} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangNumericToAlphaIIIRegion#1{% + \@tracklang@nameuse{@tracklang@region@numtoalphaiii@#1}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangIfKnownAlphaIIIRegion} +%\begin{definition} +%\cs{TrackLangIfKnownAlphaIIIRegion}\marg{alpha-3 +%code}\marg{true}\marg{false} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangIfKnownAlphaIIIRegion#1#2#3{% + \@tracklang@ifundef{@tracklang@region@alphaiiitonum@#1}% + {#3}% + {#2}% +}% +% \end{macrocode} +%\end{macro} +% +%Define mappings. +% \begin{macrocode} +\TrackLangRegionMap{004}{AF}{AFG}% +\TrackLangRegionMap{248}{AX}{ALA}% +\TrackLangRegionMap{008}{AL}{ALB}% +\TrackLangRegionMap{012}{DZ}{DZA}% +\TrackLangRegionMap{016}{AS}{ASM}% +\TrackLangRegionMap{020}{AD}{AND}% +\TrackLangRegionMap{024}{AO}{AGO}% +\TrackLangRegionMap{660}{AI}{AIA}% +\TrackLangRegionMap{010}{AQ}{ATA}% +\TrackLangRegionMap{028}{AG}{ATG}% +\TrackLangRegionMap{032}{AR}{ARG}% +\TrackLangRegionMap{051}{AM}{ARM}% +\TrackLangRegionMap{533}{AW}{ABW}% +\TrackLangRegionMap{036}{AU}{AUS}% +\TrackLangRegionMap{040}{AT}{AUT}% +\TrackLangRegionMap{031}{AZ}{AZE}% +\TrackLangRegionMap{044}{BS}{BHS}% +\TrackLangRegionMap{048}{BH}{BHR}% +\TrackLangRegionMap{050}{BD}{BGD}% +\TrackLangRegionMap{052}{BB}{BRB}% +\TrackLangRegionMap{112}{BY}{BLR}% +\TrackLangRegionMap{056}{BE}{BEL}% +\TrackLangRegionMap{084}{BZ}{BLZ}% +\TrackLangRegionMap{204}{BJ}{BEN}% +\TrackLangRegionMap{060}{BM}{BMU}% +\TrackLangRegionMap{064}{BT}{BTN}% +\TrackLangRegionMap{068}{BO}{BOL}% +\TrackLangRegionMap{535}{BQ}{BES}% +\TrackLangRegionMap{070}{BA}{BIH}% +\TrackLangRegionMap{072}{BW}{BWA}% +\TrackLangRegionMap{074}{BV}{BVT}% +\TrackLangRegionMap{076}{BR}{BRA}% +\TrackLangRegionMap{086}{IO}{IOT}% +\TrackLangRegionMap{096}{BN}{BRN}% +\TrackLangRegionMap{100}{BG}{BGR}% +\TrackLangRegionMap{854}{BF}{BFA}% +\TrackLangRegionMap{108}{BI}{BDI}% +\TrackLangRegionMap{132}{CV}{CPV}% +\TrackLangRegionMap{116}{KH}{KHM}% +\TrackLangRegionMap{120}{CM}{CMR}% +\TrackLangRegionMap{124}{CA}{CAN}% +\TrackLangRegionMap{136}{KY}{CYM}% +\TrackLangRegionMap{140}{CF}{CAF}% +\TrackLangRegionMap{148}{TD}{TCD}% +\TrackLangRegionMap{152}{CL}{CHL}% +\TrackLangRegionMap{156}{CN}{CHN}% +\TrackLangRegionMap{162}{CX}{CXR}% +\TrackLangRegionMap{166}{CC}{CCK}% +\TrackLangRegionMap{170}{CO}{COL}% +\TrackLangRegionMap{174}{KM}{COM}% +\TrackLangRegionMap{180}{CD}{COD}% +\TrackLangRegionMap{178}{CG}{COG}% +\TrackLangRegionMap{184}{CK}{COK}% +\TrackLangRegionMap{188}{CR}{CRI}% +\TrackLangRegionMap{384}{CI}{CIV}% +\TrackLangRegionMap{191}{HR}{HRV}% +\TrackLangRegionMap{192}{CU}{CUB}% +\TrackLangRegionMap{531}{CW}{CUW}% +\TrackLangRegionMap{196}{CY}{CYP}% +\TrackLangRegionMap{203}{CZ}{CZE}% +\TrackLangRegionMap{208}{DK}{DNK}% +\TrackLangRegionMap{262}{DJ}{DJI}% +\TrackLangRegionMap{212}{DM}{DMA}% +\TrackLangRegionMap{214}{DO}{DOM}% +\TrackLangRegionMap{218}{EC}{ECU}% +\TrackLangRegionMap{818}{EG}{EGY}% +\TrackLangRegionMap{222}{SV}{SLV}% +\TrackLangRegionMap{226}{GQ}{GNQ}% +\TrackLangRegionMap{232}{ER}{ERI}% +\TrackLangRegionMap{233}{EE}{EST}% +\TrackLangRegionMap{231}{ET}{ETH}% +\TrackLangRegionMap{238}{FK}{FLK}% +\TrackLangRegionMap{234}{FO}{FRO}% +\TrackLangRegionMap{242}{FJ}{FJI}% +\TrackLangRegionMap{246}{FI}{FIN}% +\TrackLangRegionMap{250}{FR}{FRA}% +\TrackLangRegionMap{254}{GF}{GUF}% +\TrackLangRegionMap{258}{PF}{PYF}% +\TrackLangRegionMap{260}{TF}{ATF}% +\TrackLangRegionMap{266}{GA}{GAB}% +\TrackLangRegionMap{270}{GM}{GMB}% +\TrackLangRegionMap{268}{GE}{GEO}% +\TrackLangRegionMap{276}{DE}{DEU}% +\TrackLangRegionMap{288}{GH}{GHA}% +\TrackLangRegionMap{292}{GI}{GIB}% +\TrackLangRegionMap{300}{GR}{GRC}% +\TrackLangRegionMap{304}{GL}{GRL}% +\TrackLangRegionMap{308}{GD}{GRD}% +\TrackLangRegionMap{312}{GP}{GLP}% +\TrackLangRegionMap{316}{GU}{GUM}% +\TrackLangRegionMap{320}{GT}{GTM}% +\TrackLangRegionMap{831}{GG}{GGY}% +\TrackLangRegionMap{324}{GN}{GIN}% +\TrackLangRegionMap{624}{GW}{GNB}% +\TrackLangRegionMap{328}{GY}{GUY}% +\TrackLangRegionMap{332}{HT}{HTI}% +\TrackLangRegionMap{334}{HM}{HMD}% +\TrackLangRegionMap{336}{VA}{VAT}% +\TrackLangRegionMap{340}{HN}{HND}% +\TrackLangRegionMap{344}{HK}{HKG}% +\TrackLangRegionMap{348}{HU}{HUN}% +\TrackLangRegionMap{352}{IS}{ISL}% +\TrackLangRegionMap{356}{IN}{IND}% +\TrackLangRegionMap{360}{ID}{IDN}% +\TrackLangRegionMap{364}{IR}{IRN}% +\TrackLangRegionMap{368}{IQ}{IRQ}% +\TrackLangRegionMap{372}{IE}{IRL}% +\TrackLangRegionMap{833}{IM}{IMN}% +\TrackLangRegionMap{376}{IL}{ISR}% +\TrackLangRegionMap{380}{IT}{ITA}% +\TrackLangRegionMap{388}{JM}{JAM}% +\TrackLangRegionMap{392}{JP}{JPN}% +\TrackLangRegionMap{832}{JE}{JEY}% +\TrackLangRegionMap{400}{JO}{JOR}% +\TrackLangRegionMap{398}{KZ}{KAZ}% +\TrackLangRegionMap{404}{KE}{KEN}% +\TrackLangRegionMap{296}{KI}{KIR}% +\TrackLangRegionMap{408}{KP}{PRK}% +\TrackLangRegionMap{410}{KR}{KOR}% +\TrackLangRegionMap{414}{KW}{KWT}% +\TrackLangRegionMap{417}{KG}{KGZ}% +\TrackLangRegionMap{418}{LA}{LAO}% +\TrackLangRegionMap{428}{LV}{LVA}% +\TrackLangRegionMap{422}{LB}{LBN}% +\TrackLangRegionMap{426}{LS}{LSO}% +\TrackLangRegionMap{430}{LR}{LBR}% +\TrackLangRegionMap{434}{LY}{LBY}% +\TrackLangRegionMap{438}{LI}{LIE}% +\TrackLangRegionMap{440}{LT}{LTU}% +\TrackLangRegionMap{442}{LU}{LUX}% +\TrackLangRegionMap{446}{MO}{MAC}% +\TrackLangRegionMap{807}{MK}{MKD}% +\TrackLangRegionMap{450}{MG}{MDG}% +\TrackLangRegionMap{454}{MW}{MWI}% +\TrackLangRegionMap{458}{MY}{MYS}% +\TrackLangRegionMap{462}{MV}{MDV}% +\TrackLangRegionMap{466}{ML}{MLI}% +\TrackLangRegionMap{470}{MT}{MLT}% +\TrackLangRegionMap{584}{MH}{MHL}% +\TrackLangRegionMap{474}{MQ}{MTQ}% +\TrackLangRegionMap{478}{MR}{MRT}% +\TrackLangRegionMap{480}{MU}{MUS}% +\TrackLangRegionMap{175}{YT}{MYT}% +\TrackLangRegionMap{484}{MX}{MEX}% +\TrackLangRegionMap{583}{FM}{FSM}% +\TrackLangRegionMap{498}{MD}{MDA}% +\TrackLangRegionMap{492}{MC}{MCO}% +\TrackLangRegionMap{496}{MN}{MNG}% +\TrackLangRegionMap{499}{ME}{MNE}% +\TrackLangRegionMap{500}{MS}{MSR}% +\TrackLangRegionMap{504}{MA}{MAR}% +\TrackLangRegionMap{508}{MZ}{MOZ}% +\TrackLangRegionMap{104}{MM}{MMR}% +\TrackLangRegionMap{516}{NA}{NAM}% +\TrackLangRegionMap{520}{NR}{NRU}% +\TrackLangRegionMap{524}{NP}{NPL}% +\TrackLangRegionMap{528}{NL}{NLD}% +\TrackLangRegionMap{540}{NC}{NCL}% +\TrackLangRegionMap{554}{NZ}{NZL}% +\TrackLangRegionMap{558}{NI}{NIC}% +\TrackLangRegionMap{562}{NE}{NER}% +\TrackLangRegionMap{566}{NG}{NGA}% +\TrackLangRegionMap{570}{NU}{NIU}% +\TrackLangRegionMap{574}{NF}{NFK}% +\TrackLangRegionMap{580}{MP}{MNP}% +\TrackLangRegionMap{578}{NO}{NOR}% +\TrackLangRegionMap{512}{OM}{OMN}% +\TrackLangRegionMap{586}{PK}{PAK}% +\TrackLangRegionMap{585}{PW}{PLW}% +\TrackLangRegionMap{275}{PS}{PSE}% +\TrackLangRegionMap{591}{PA}{PAN}% +\TrackLangRegionMap{598}{PG}{PNG}% +\TrackLangRegionMap{600}{PY}{PRY}% +\TrackLangRegionMap{604}{PE}{PER}% +\TrackLangRegionMap{608}{PH}{PHL}% +\TrackLangRegionMap{612}{PN}{PCN}% +\TrackLangRegionMap{616}{PL}{POL}% +\TrackLangRegionMap{620}{PT}{PRT}% +\TrackLangRegionMap{630}{PR}{PRI}% +\TrackLangRegionMap{634}{QA}{QAT}% +\TrackLangRegionMap{638}{RE}{REU}% +\TrackLangRegionMap{642}{RO}{ROU}% +\TrackLangRegionMap{643}{RU}{RUS}% +\TrackLangRegionMap{646}{RW}{RWA}% +\TrackLangRegionMap{652}{BL}{BLM}% +\TrackLangRegionMap{654}{SH}{SHN}% +\TrackLangRegionMap{659}{KN}{KNA}% +\TrackLangRegionMap{662}{LC}{LCA}% +\TrackLangRegionMap{663}{MF}{MAF}% +\TrackLangRegionMap{666}{PM}{SPM}% +\TrackLangRegionMap{670}{VC}{VCT}% +\TrackLangRegionMap{882}{WS}{WSM}% +\TrackLangRegionMap{674}{SM}{SMR}% +\TrackLangRegionMap{678}{ST}{STP}% +\TrackLangRegionMap{682}{SA}{SAU}% +\TrackLangRegionMap{686}{SN}{SEN}% +\TrackLangRegionMap{688}{RS}{SRB}% +\TrackLangRegionMap{690}{SC}{SYC}% +\TrackLangRegionMap{694}{SL}{SLE}% +\TrackLangRegionMap{702}{SG}{SGP}% +\TrackLangRegionMap{534}{SX}{SXM}% +\TrackLangRegionMap{703}{SK}{SVK}% +\TrackLangRegionMap{705}{SI}{SVN}% +\TrackLangRegionMap{090}{SB}{SLB}% +\TrackLangRegionMap{706}{SO}{SOM}% +\TrackLangRegionMap{710}{ZA}{ZAF}% +\TrackLangRegionMap{239}{GS}{SGS}% +\TrackLangRegionMap{728}{SS}{SSD}% +\TrackLangRegionMap{724}{ES}{ESP}% +\TrackLangRegionMap{144}{LK}{LKA}% +\TrackLangRegionMap{729}{SD}{SDN}% +\TrackLangRegionMap{740}{SR}{SUR}% +\TrackLangRegionMap{744}{SJ}{SJM}% +\TrackLangRegionMap{748}{SZ}{SWZ}% +\TrackLangRegionMap{752}{SE}{SWE}% +\TrackLangRegionMap{756}{CH}{CHE}% +\TrackLangRegionMap{760}{SY}{SYR}% +\TrackLangRegionMap{158}{TW}{TWN}% +\TrackLangRegionMap{762}{TJ}{TJK}% +\TrackLangRegionMap{834}{TZ}{TZA}% +\TrackLangRegionMap{764}{TH}{THA}% +\TrackLangRegionMap{626}{TL}{TLS}% +\TrackLangRegionMap{768}{TG}{TGO}% +\TrackLangRegionMap{772}{TK}{TKL}% +\TrackLangRegionMap{776}{TO}{TON}% +\TrackLangRegionMap{780}{TT}{TTO}% +\TrackLangRegionMap{788}{TN}{TUN}% +\TrackLangRegionMap{792}{TR}{TUR}% +\TrackLangRegionMap{795}{TM}{TKM}% +\TrackLangRegionMap{796}{TC}{TCA}% +\TrackLangRegionMap{798}{TV}{TUV}% +\TrackLangRegionMap{800}{UG}{UGA}% +\TrackLangRegionMap{804}{UA}{UKR}% +\TrackLangRegionMap{784}{AE}{ARE}% +\TrackLangRegionMap{826}{GB}{GBR}% +\TrackLangRegionMap{581}{UM}{UMI}% +\TrackLangRegionMap{840}{US}{USA}% +\TrackLangRegionMap{858}{UY}{URY}% +\TrackLangRegionMap{860}{UZ}{UZB}% +\TrackLangRegionMap{548}{VU}{VUT}% +\TrackLangRegionMap{862}{VE}{VEN}% +\TrackLangRegionMap{704}{VN}{VNM}% +\TrackLangRegionMap{092}{VG}{VGB}% +\TrackLangRegionMap{850}{VI}{VIR}% +\TrackLangRegionMap{876}{WF}{WLF}% +\TrackLangRegionMap{732}{EH}{ESH}% +\TrackLangRegionMap{887}{YE}{YEM}% +\TrackLangRegionMap{894}{ZM}{ZMB}% +\TrackLangRegionMap{716}{ZW}{ZWE}% +% \end{macrocode} +% +%Restore category code of \texttt{@}. +% \begin{macrocode} +\@tracklang@regions@restore@at +% \end{macrocode} +%\iffalse +% \begin{macrocode} +%</tracklang-region-codes.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*tracklang-scripts.sty> +% \end{macrocode} +%\fi +%\section{ISO 15924 Scripts \LaTeX\ Package +%(\texttt{tracklang-scripts.sty})} +%This is just a \LaTeX\ package wrapper for the generic code in +%\texttt{tracklang-scripts.tex}. +%\changes{1.3}{2016-10-07}{added tracklang-scripts.sty} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{tracklang-scripts}[2016/10/08 v1.3.1 (NLCT) Track +Language Scripts (LaTeX)] +\RequirePackage{tracklang} +\input{tracklang-scripts} +% \end{macrocode} +%\iffalse +% \begin{macrocode} +%</tracklang-scripts.sty> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*tracklang-scripts.tex> +% \end{macrocode} +%\fi +%\section{ISO 15924 Scripts Generic Code +%(\texttt{tracklang-scripts.tex})} +%\label{sec:tracklang-scripts.tex} +%Provides information about ISO 15924 scripts. Not automatically +%loaded. +%\changes{1.3}{2016-10-07}{added tracklang-scripts.tex} +% \begin{macrocode} +\ifnum\catcode`\@=11\relax + \def\@tracklang@scripts@restore@at{}% +\else + \expandafter\edef\csname @tracklang@scripts@restore@at\endcsname{% + \noexpand\catcode`\noexpand\@=\number\catcode`\@\relax + }% + \catcode`\@=11\relax +\fi +% \end{macrocode} +% Check if this file has already been loaded: +% \begin{macrocode} +\ifx\TrackLangScriptMap\undefined +\else + \@tracklang@scripts@restore@at + \expandafter\endinput +\fi +% \end{macrocode} +% Version info. +% \begin{macrocode} +\expandafter\def\csname ver@tracklang-scripts.tex\endcsname{2016/10/08 v1.3.1 +(NLCT) Track Languages Scripts (Generic)}% +% \end{macrocode} +% +%\begin{macro}{\TrackLangScriptsMap} +%\changes{1.3}{2016-10-07}{new} +%\begin{definition} +%\cs{TrackLangScriptMap}\marg{letter +%code}\marg{number}\marg{name}\marg{direction}\marg{parent} +%\end{definition} +%Define mapping. To avoid problems with encodings, only use ASCII +%characters in the arguments. The first argument is the four-letter +%ISO 15924 code. The second argument is the numeric code. The third +%argument is just intended for informational purposes. The fourth +%argument indicates the direction. This may be \texttt{LR} +%(left-to-right), \texttt{RL} (right-to-left), \texttt{TB} +%(top-to-bottom), \texttt{varies} or \texttt{inherited}. +%The \meta{parent} argument is for the parent writing system, which +%may be left blank. (Currently, this is blank for all the mappings +%provided here, but the syntax has five arguments in case of future +%development.) +% \begin{macrocode} +\def\TrackLangScriptMap#1#2#3#4#5{% +% \end{macrocode} +%This user command is provided to make it easier to test the script +%using \cs{ifx}. +% \begin{macrocode} + \@tracklang@enamedef{TrackLangScript#1}{#1}% + \@tracklang@enamedef{@tracklang@script@numtoalpha@#2}{#1}% + \@tracklang@enamedef{@tracklang@script@alphatonum@#1}{#2}% + \@tracklang@enamedef{@tracklang@script@alphatoname@#1}{#3}% + \@tracklang@enamedef{@tracklang@script@alphatodir@#1}{#4}% + \ifx\relax#5\relax + \else + \@tracklang@enamedef{@tracklang@script@parent@#1}{#5}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangScriptAlphaToNumeric} +%\begin{definition} +%\cs{TrackLangScriptAlphaToNumeric}\marg{alpha code} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangScriptAlphaToNumeric#1{% + \@tracklang@nameuse{@tracklang@script@alphatonum@#1}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangScriptIfKnownAlpha} +%\begin{definition} +%\cs{TrackLangScriptIfKnownAlpha}\marg{alpha +%code}\marg{true}\marg{false} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangScriptIfKnownAlpha#1#2#3{% + \@tracklang@ifundef{@tracklang@script@alphatonum@#1}% + {#3}% + {#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangScriptNumericToAlpha} +%\begin{definition} +%\cs{TrackLangScriptNumericToAlpha}\marg{numeric code} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangScriptNumericToAlpha#1{% + \@tracklang@nameuse{@tracklang@script@numtoalpha@#1}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangScriptIfKnownNumeric} +%\begin{definition} +%\cs{TrackLangScriptIfKnownNumeric}\marg{numeric +%code}\marg{true}\marg{false} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangScriptIfKnownNumeric#1#2#3{% + \@tracklang@ifundef{@tracklang@script@numtoalpha@#1}% + {#3}% + {#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangScriptAlphaToName} +%\begin{definition} +%\cs{TrackLangScriptAlphaToName}\marg{alpha code} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangScriptAlphaToName#1{% + \@tracklang@nameuse{@tracklang@script@alphatoname@#1}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangScriptAlphaToDir} +%\begin{definition} +%\cs{TrackLangScriptAlphaToDir}\marg{alpha code} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangScriptAlphaToDir#1{% + \@tracklang@nameuse{@tracklang@script@alphatodir@#1}% +}% +% \end{macrocode} +%\end{macro} +% +%I wasn't sure whether or not to implement a parent, but it's here +%if required. Unlike the other elements above, there's also a +%command to set this field. +%\begin{macro}{\TrackLangScriptSetParent} +%\begin{definition} +%\cs{TrackLangScriptSetParent}\marg{alpha code}\marg{parent alpha +%code} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangScriptSetParent#1#2{% + \@tracklang@enamedef{@tracklang@script@parent@#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangScriptGetParent} +%\begin{definition} +%\cs{TrackLangScriptGetParent}\marg{alpha code} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangScriptGetParent#1{% + \@tracklang@nameuse{@tracklang@script@parent@#1}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\TrackLangScriptIfHasParent} +%\begin{definition} +%\cs{TrackLangScriptIfHasParent}\marg{alpha +%code}\marg{true}\marg{false} +%\end{definition} +%\changes{1.3}{2016-10-07}{new} +% \begin{macrocode} +\def\TrackLangScriptIfHasParent#1#2#3{% + \@tracklang@ifundef{@tracklang@script@parent@#1}% + {#3}% + {#2}% +}% +% \end{macrocode} +%\end{macro} +% +%Define mappings. The parent information is currently missing. +% \begin{macrocode} +\TrackLangScriptMap{Adlm}{166}{Adlam}{RL}{} +\TrackLangScriptMap{Afak}{439}{Afaka}{varies}{} +\TrackLangScriptMap{Aghb}{239}{Caucasian Albanian}{LR}{} +\TrackLangScriptMap{Ahom}{338}{Ahom, Tai Ahom}{LR}{} +\TrackLangScriptMap{Arab}{160}{Arabic}{RL}{} +\TrackLangScriptMap{Aran}{161}{Arabic (Nastaliq variant)}{RL}{} +\TrackLangScriptMap{Armi}{124}{Imperial Aramaic}{RL}{} +\TrackLangScriptMap{Armn}{230}{Armenian}{LR}{} +\TrackLangScriptMap{Avst}{134}{Avestan}{RL}{} +\TrackLangScriptMap{Bali}{360}{Balinese}{LR}{} +\TrackLangScriptMap{Bamu}{435}{Bamum}{LR}{} +\TrackLangScriptMap{Bass}{259}{Bassa Vah}{LR}{} +\TrackLangScriptMap{Batk}{365}{Batak}{LR}{} +\TrackLangScriptMap{Beng}{334}{Bhaiksuki}{LR}{} +\TrackLangScriptMap{Blis}{550}{Blissymbols}{varies}{} +\TrackLangScriptMap{Bopo}{285}{Bopomofo}{LR}{} +\TrackLangScriptMap{Brah}{300}{Brahmi}{LR}{} +\TrackLangScriptMap{Brai}{570}{Braille}{LR}{} +\TrackLangScriptMap{Bugi}{367}{Buginese}{LR}{} +\TrackLangScriptMap{Buhd}{372}{Buhid}{LR}{} +\TrackLangScriptMap{Cakm}{349}{Chakma}{LR}{} +\TrackLangScriptMap{Cans}{440}{Unified Canadian Aboriginal Syllabics}{LR}{} +\TrackLangScriptMap{Cari}{201}{Carian}{LR}{} +\TrackLangScriptMap{Cham}{358}{Cham}{LR}{} +\TrackLangScriptMap{Cher}{445}{Cherokee}{LR}{} +\TrackLangScriptMap{Cirt}{291}{Cirth}{varies}{} +\TrackLangScriptMap{Copt}{204}{Coptic}{LR}{} +\TrackLangScriptMap{Cprt}{403}{Cypriot}{RL}{} +\TrackLangScriptMap{Cyrl}{220}{Cyrillic}{LR}{} +\TrackLangScriptMap{Cyrs}{221}{Cyrillic (Old Church Slavonic{} +variant)}{varies}{} +\TrackLangScriptMap{Deva}{315}{Devanagari (Nagari)}{LR}{} +\TrackLangScriptMap{Dsrt}{250}{Deseret (Mormon)}{LR}{} +\TrackLangScriptMap{Dupl}{755}{Duployan shorthand, Duployan{} +stenography}{LR}{} +\TrackLangScriptMap{Egyd}{070}{Egyptian demotic}{RL}{} +\TrackLangScriptMap{Egyh}{060}{Egyptian hieratic}{RL}{} +\TrackLangScriptMap{Egyp}{050}{Egyptian hieroglyphs}{LR}{} +\TrackLangScriptMap{Elba}{226}{Elbasan}{LR}{} +\TrackLangScriptMap{Ethi}{430}{Ethiopic (Ge'ez)}{LR}{} +\TrackLangScriptMap{Geok}{241}{Khutsuri (Asomtavruli and{} +Nuskhuri)}{LR}{} +\TrackLangScriptMap{Geor}{240}{Georgian (Mkhedruli)}{LR}{} +\TrackLangScriptMap{Glag}{225}{Glagolitic}{LR}{} +\TrackLangScriptMap{Goth}{206}{Gothic}{LR}{} +\TrackLangScriptMap{Gran}{343}{Grantha}{LR}{} +\TrackLangScriptMap{Grek}{200}{Greek}{LR}{} +\TrackLangScriptMap{Gujr}{320}{Gujarati}{LR}{} +\TrackLangScriptMap{Guru}{310}{Gurmukhi}{LR}{} +\TrackLangScriptMap{Hanb}{503}{Han with Bopomofo (alias for Han +{} +Bopomofo)}{LR}{} +\TrackLangScriptMap{Hang}{286}{Hangul}{LR}{} +\TrackLangScriptMap{Hani}{500}{Han (Hanzi, Kanji, Hanja)}{LR}{} +\TrackLangScriptMap{Hano}{371}{Hanunoo}{LR}{} +\TrackLangScriptMap{Hans}{501}{Han (Simplified variant)}{varies}{} +\TrackLangScriptMap{Hant}{502}{Han (Traditional variant)}{varies}{} +\TrackLangScriptMap{Hatr}{127}{Hatran}{RL}{} +\TrackLangScriptMap{Hebr}{125}{Hebrew}{RL}{} +\TrackLangScriptMap{Hira}{410}{Hiragana}{LR}{} +\TrackLangScriptMap{Hluw}{080}{Anatolian Hieroglyphs (Luwian{} +Hieroglyphs, Hittite Hieroglyphs)}{LR}{} +\TrackLangScriptMap{Hmng}{450}{Pahawh Hmong}{LR}{} +\TrackLangScriptMap{Hrkt}{412}{Japanese syllabaries (alias for{} +Hiragana + Katakana)}{varies}{} +\TrackLangScriptMap{Hung}{176}{Old Hungarian (Hungarian Runic)}{RL}{} +\TrackLangScriptMap{Inds}{610}{Indus (Harappan)}{RL}{} +\TrackLangScriptMap{Ital}{210}{Old Italic (Etruscan, Oscan, etc.)}{LR}{} +\TrackLangScriptMap{Jamo}{284}{Jamo (alias for Jamo subset of{} +Hangul)}{LR}{} +\TrackLangScriptMap{Java}{361}{Javanese}{LR}{} +\TrackLangScriptMap{Jpan}{413}{Japanese (alias for Han + Hiragana +{} +Katakana)}{varies}{} +\TrackLangScriptMap{Jurc}{510}{Jurchen}{LR}{} +\TrackLangScriptMap{Kali}{357}{Kayah Li}{LR}{} +\TrackLangScriptMap{Kana}{411}{Katakana}{LR}{} +\TrackLangScriptMap{Khar}{305}{Kharoshthi}{RL}{} +\TrackLangScriptMap{Khmr}{355}{Khmer}{LR}{} +\TrackLangScriptMap{Khoj}{322}{Khojki}{LR}{} +\TrackLangScriptMap{Kitl}{505}{Khitan large script}{LR}{} +\TrackLangScriptMap{Kits}{288}{Khitan small script}{TB}{} +\TrackLangScriptMap{Knda}{345}{Kannada}{LR}{} +\TrackLangScriptMap{Kore}{287}{Korean (alias for Hangul + Han)}{LR}{} +\TrackLangScriptMap{Kpel}{436}{Kpelle}{LR}{} +\TrackLangScriptMap{Kthi}{317}{Kaithi}{LR}{} +\TrackLangScriptMap{Lana}{351}{Tai Tham (Lanna)}{LR}{} +\TrackLangScriptMap{Laoo}{356}{Lao}{LR}{} +\TrackLangScriptMap{Latf}{217}{Latin (Fraktur variant)}{varies}{} +\TrackLangScriptMap{Latg}{216}{Latin (Gaelic variant)}{LR}{} +\TrackLangScriptMap{Latn}{215}{Latin}{LR}{} +\TrackLangScriptMap{Leke}{364}{Leke}{LR}{} +\TrackLangScriptMap{Lepc}{335}{Lepcha}{LR}{} +\TrackLangScriptMap{Limb}{336}{Limbu}{LR}{} +\TrackLangScriptMap{Lina}{400}{Linear A}{LR}{} +\TrackLangScriptMap{Linb}{401}{Linear B}{LR}{} +\TrackLangScriptMap{Lisu}{399}{Lisu (Fraser)}{LR}{} +\TrackLangScriptMap{Loma}{437}{Loma}{LR}{} +\TrackLangScriptMap{Lyci}{202}{Lycian}{LR}{} +\TrackLangScriptMap{Lydi}{116}{Lydian}{RL}{} +\TrackLangScriptMap{Mahj}{314}{Mahajani}{LR}{} +\TrackLangScriptMap{Mand}{140}{Mandaic, Mandaean}{RL}{} +\TrackLangScriptMap{Mani}{139}{Manichaean}{RL}{} +\TrackLangScriptMap{Marc}{332}{Marchen}{LR}{} +\TrackLangScriptMap{Maya}{090}{Mayan hieroglyphs}{varies}{} +\TrackLangScriptMap{Mend}{438}{Mende Kikakui}{RL}{} +\TrackLangScriptMap{Merc}{101}{Meroitic Cursive}{RL}{} +\TrackLangScriptMap{Mero}{100}{Meroitic Hieroglyphs}{RL}{} +\TrackLangScriptMap{Mlym}{347}{Malayalam}{LR}{} +\TrackLangScriptMap{Modi}{324}{Modi}{LR}{} +\TrackLangScriptMap{Mong}{145}{Mongolian}{TB}{} +\TrackLangScriptMap{Moon}{218}{Moon (Moon code, Moon script, Moon{} +type)}{varies}{} +\TrackLangScriptMap{Mroo}{199}{Mro, Mru}{LR}{} +\TrackLangScriptMap{Mtei}{337}{Meitei Mayek (Meithei, Meetei)}{LR}{} +\TrackLangScriptMap{Mult}{323}{Multani}{LR}{} +\TrackLangScriptMap{Mymr}{350}{Myanmar (Burmese)}{LR}{} +\TrackLangScriptMap{Narb}{106}{Old North Arabian (Ancient North{} +Arabian)}{RL}{} +\TrackLangScriptMap{Nbat}{159}{Nabataean}{RL}{} +\TrackLangScriptMap{Newa}{333}{Newa, Newar, Newari}{LR}{} +\TrackLangScriptMap{Nkgb}{420}{Nakhi Geba}{LR}{} +\TrackLangScriptMap{Nkoo}{165}{N'Ko}{RL}{} +\TrackLangScriptMap{Nshu}{499}{Nushu}{LR}{} +\TrackLangScriptMap{Ogam}{212}{Ogham}{varies}{} +\TrackLangScriptMap{Olck}{261}{Ol Chiki}{LR}{} +\TrackLangScriptMap{Orkh}{175}{Old Turkic, Orkhon Runic}{RL}{} +\TrackLangScriptMap{Orya}{327}{Oriya}{LR}{} +\TrackLangScriptMap{Osge}{219}{Osage}{LR}{} +\TrackLangScriptMap{Osma}{260}{Osmanya}{LR}{} +\TrackLangScriptMap{Palm}{126}{Palmyrene}{RL}{} +\TrackLangScriptMap{Pauc}{263}{Pau Cin Hau}{LR}{} +\TrackLangScriptMap{Perm}{227}{Old Permic}{LR}{} +\TrackLangScriptMap{Phag}{331}{Phags-pa}{TB}{} +\TrackLangScriptMap{Phli}{131}{Inscriptional Pahlavi}{RL}{} +\TrackLangScriptMap{Phlp}{132}{Psalter Pahlavi}{RL}{} +\TrackLangScriptMap{Phlv}{133}{Book Pahlavi}{RL}{} +\TrackLangScriptMap{Phnx}{115}{Phoenician}{RL}{} +\TrackLangScriptMap{Piqd}{293}{Klingon (KLI plqaD)}{LR}{} +\TrackLangScriptMap{Plrd}{282}{Miao (Pollard)}{LR}{} +\TrackLangScriptMap{Prti}{130}{Inscriptional Parthian}{RL}{} +\TrackLangScriptMap{Qaaa}{900}{Reserved for private use{} +(start)}{varies}{} +\TrackLangScriptMap{Qaai}{908}{Private use}{varies}{} +\TrackLangScriptMap{Qabx}{949}{Reserved for private use{} +(end)}{varies}{} +\TrackLangScriptMap{Rjng}{363}{Rejang (Redjang, Kaganga)}{LR}{} +\TrackLangScriptMap{Roro}{620}{Rongorongo}{varies}{} +\TrackLangScriptMap{Runr}{211}{Runic}{LR}{} +\TrackLangScriptMap{Samr}{123}{Samaritan}{RL}{} +\TrackLangScriptMap{Sara}{292}{Sarati}{varies}{} +\TrackLangScriptMap{Sarb}{105}{Old South Arabian}{RL}{} +\TrackLangScriptMap{Saur}{344}{Saurashtra}{LR}{} +\TrackLangScriptMap{Sgnw}{095}{SignWriting}{TB}{} +\TrackLangScriptMap{Shaw}{281}{Shavian (Shaw)}{LR}{} +\TrackLangScriptMap{Shrd}{319}{Sharada}{LR}{} +\TrackLangScriptMap{Sidd}{302}{Siddham}{LR}{} +\TrackLangScriptMap{Sind}{318}{Khudawadi, Sindhi}{LR}{} +\TrackLangScriptMap{Sinh}{348}{Sinhala}{LR}{} +\TrackLangScriptMap{Sora}{398}{Sora Sompeng}{LR}{} +\TrackLangScriptMap{Sund}{362}{Sundanese}{LR}{} +\TrackLangScriptMap{Sylo}{316}{Syloti Nagri}{LR}{} +\TrackLangScriptMap{Syrc}{135}{Syriac}{RL}{} +\TrackLangScriptMap{Syre}{138}{Syriac (Estrangelo variant)}{RL}{} +\TrackLangScriptMap{Syrj}{137}{Syriac (Western variant)}{RL}{} +\TrackLangScriptMap{Syrn}{136}{Syriac (Eastern variant)}{RL}{} +\TrackLangScriptMap{Tagb}{373}{Tagbanwa}{LR}{} +\TrackLangScriptMap{Takr}{321}{Takri}{LR}{} +\TrackLangScriptMap{Tale}{353}{Tai Le}{LR}{} +\TrackLangScriptMap{Talu}{354}{New Tai Lue}{LR}{} +\TrackLangScriptMap{Taml}{346}{Tamil}{LR}{} +\TrackLangScriptMap{Taml}{346}{Tamil}{LR}{} +\TrackLangScriptMap{Tang}{520}{Tangut}{LR}{} +\TrackLangScriptMap{Tavt}{359}{Tai Viet}{LR}{} +\TrackLangScriptMap{Telu}{340}{Telugu}{LR}{} +\TrackLangScriptMap{Teng}{290}{Tengwar}{LR}{} +\TrackLangScriptMap{Tfng}{120}{Tifinagh (Berber)}{LR}{} +\TrackLangScriptMap{Tglg}{370}{Tagalog (Baybayin, Alibata)}{LR}{} +\TrackLangScriptMap{Thaa}{170}{Thaana}{RL}{} +\TrackLangScriptMap{Thai}{352}{Thai}{LR}{} +\TrackLangScriptMap{Tibt}{330}{Tibetan}{LR}{} +\TrackLangScriptMap{Tirh}{326}{Tirhuta}{LR}{} +\TrackLangScriptMap{Ugar}{040}{Ugaritic}{LR}{} +\TrackLangScriptMap{Vaii}{470}{Vai}{LR}{} +\TrackLangScriptMap{Visp}{280}{Visible Speech}{LR}{} +\TrackLangScriptMap{Wara}{262}{Warang Citi (Varang Kshiti)}{LR}{} +\TrackLangScriptMap{Wole}{480}{Woleai}{RL}{} +\TrackLangScriptMap{Xpeo}{030}{Old Persian}{LR}{} +\TrackLangScriptMap{Xsux}{020}{Cuneiform, Sumero-Akkadian}{LR}{} +\TrackLangScriptMap{Yiii}{460}{Yi}{LR}{} +\TrackLangScriptMap{Zinh}{994}{Inherited script}{inherited}{} +\TrackLangScriptMap{Zmth}{995}{Mathematical notation}{LR}{} +\TrackLangScriptMap{Zsym}{996}{Symbols}{varies}{} +\TrackLangScriptMap{Zsye}{993}{Symbols (emoji variant)}{varies}{} +\TrackLangScriptMap{Zxxx}{997}{Unwritten documents}{varies}{} +\TrackLangScriptMap{Zyyy}{998}{Undetermined script}{varies}{} +\TrackLangScriptMap{Zzzz}{999}{Uncoded script}{varies}{} +% \end{macrocode} +% +%Restore category code of \texttt{@}. +% \begin{macrocode} +\@tracklang@scripts@restore@at +% \end{macrocode} + +%\iffalse +% \begin{macrocode} +%</tracklang-scripts.tex> +% \end{macrocode} +%\fi %\Finale \endinput diff --git a/Master/texmf-dist/source/latex/tracklang/tracklang.ins b/Master/texmf-dist/source/latex/tracklang/tracklang.ins index 7418969bcd7..4f65a244e0f 100644 --- a/Master/texmf-dist/source/latex/tracklang/tracklang.ins +++ b/Master/texmf-dist/source/latex/tracklang/tracklang.ins @@ -1,10 +1,10 @@ -% tracklang.ins generated using makedtx version 1.1 2015/3/23 13:50 +% tracklang.ins generated using makedtx version 1.1 2016/10/8 12:58 \input docstrip \preamble tracklang.dtx - Copyright 2015 Nicola Talbot + Copyright 2016 Nicola Talbot This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 @@ -18,7 +18,7 @@ The Current Maintainer of this work is Nicola Talbot. - This work consists of the files tracklang.dtx and tracklang.ins and the derived files tracklang.sty, tracklang.tex. + This work consists of the files tracklang.dtx and tracklang.ins and the derived files tracklang.sty, tracklang.tex, tracklang-region-codes.tex, tracklang-scripts.sty, tracklang-scripts.tex. \endpreamble @@ -28,6 +28,12 @@ \usepostamble\defaultpostamble\from{tracklang.dtx}{tracklang.sty,package}} \file{tracklang.tex}{\usepreamble\defaultpreamble \usepostamble\defaultpostamble\from{tracklang.dtx}{tracklang.tex,package}} +\file{tracklang-region-codes.tex}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{tracklang.dtx}{tracklang-region-codes.tex,package}} +\file{tracklang-scripts.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{tracklang.dtx}{tracklang-scripts.sty,package}} +\file{tracklang-scripts.tex}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{tracklang.dtx}{tracklang-scripts.tex,package}} } \endbatchfile |