| 1 |
%\iffalse |
| 2 |
% tex-locale.dtx generated using makedtx version 1.2 (c) Nicola Talbot |
| 3 |
% Command line args: |
| 4 |
% -src "tex-locale.sty\Z=>tex-locale.sty" |
| 5 |
% -src "tex-locale.tex\Z=>tex-locale.tex" |
| 6 |
% -src "tex-locale-scripts-enc.def\Z=>tex-locale-scripts-enc.def" |
| 7 |
% -src "tex-locale-encodings.def\Z=>tex-locale-encodings.def" |
| 8 |
% -src "tex-locale-support.def\Z=>tex-locale-support.def" |
| 9 |
% -author "Nicola Talbot" |
| 10 |
% -section "chapter" |
| 11 |
% -doc "tex-locale-manual.tex" |
| 12 |
% tex-locale |
| 13 |
% Created on 2018/8/26 19:14 |
| 14 |
%\fi |
| 15 |
%\iffalse |
| 16 |
%<*package> |
| 17 |
%% \CharacterTable |
| 18 |
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 19 |
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 20 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 21 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 22 |
%% Dollar \$ Percent \% Ampersand \& |
| 23 |
%% Acute accent \' Left paren \( Right paren \) |
| 24 |
%% Asterisk \* Plus \+ Comma \, |
| 25 |
%% Minus \- Point \. Solidus \/ |
| 26 |
%% Colon \: Semicolon \; Less than \< |
| 27 |
%% Equals \= Greater than \> Question mark \? |
| 28 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 29 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 30 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 31 |
%% Right brace \} Tilde \~} |
| 32 |
%</package> |
| 33 |
%\fi |
| 34 |
% \iffalse |
| 35 |
% Doc-Source file to use with LaTeX2e |
| 36 |
% Copyright (C) 2018 Nicola Talbot, all rights reserved. |
| 37 |
% \fi |
| 38 |
% \iffalse |
| 39 |
%<*driver> |
| 40 |
\documentclass[report,widecs,inlinetitle]{nlctdoc} |
| 41 |
|
| 42 |
\DeleteShortVerb{|} |
| 43 |
|
| 44 |
\usepackage{metalogo} |
| 45 |
|
| 46 |
\let\orgtheindex\theindex |
| 47 |
\let\orgendtheindex\endtheindex |
| 48 |
\usepackage{imakeidx} |
| 49 |
\usepackage[a4paper,left=1.5in,right=0.5in]{geometry} |
| 50 |
\usepackage[colorlinks, |
| 51 |
bookmarks, |
| 52 |
hyperindex=false, |
| 53 |
pdfauthor={Nicola L.C. Talbot}, |
| 54 |
pdftitle={tex-locale: setup document locale}]{hyperref} |
| 55 |
|
| 56 |
\CheckSum{3313} |
| 57 |
|
| 58 |
\newcommand{\file}[1]{\texttt{#1}} |
| 59 |
|
| 60 |
\doxitem{Option}{option}{package options} |
| 61 |
|
| 62 |
\renewcommand{\nlctdocmarginfmt}{\scriptsize\raggedright} |
| 63 |
\renewcommand\MacroFont{\ttfamily\mdseries} |
| 64 |
|
| 65 |
\renewcommand*{\usage}[1]{\textit{\hyperpage{#1}}} |
| 66 |
\renewcommand*{\main}[1]{\underline{\hyperpage{#1}}} |
| 67 |
\PageIndex |
| 68 |
\setcounter{IndexColumns}{2} |
| 69 |
\newcommand*{\PrintCodeIndex}{% |
| 70 |
\bgroup |
| 71 |
\let\theindex\orgtheindex |
| 72 |
\let\endtheindex\orgendtheindex |
| 73 |
\PrintIndex |
| 74 |
\egroup |
| 75 |
} |
| 76 |
\IndexPrologue{% |
| 77 |
\clearpage\phantomsection |
| 78 |
\addcontentsline{toc}{chapter}{Code Index}% |
| 79 |
\chapter*{Code Index}\markboth{Code Index}{Code Index}% |
| 80 |
} |
| 81 |
|
| 82 |
\newenvironment{code}% |
| 83 |
{\begin{flushleft}\ttfamily\obeylines\obeyspaces} |
| 84 |
{\end{flushleft}\ignorespacesafterend} |
| 85 |
|
| 86 |
\makeindex[name=user,title=Main Index,intoc] |
| 87 |
\renewcommand{\iapp}[1]{\index[user]{#1@\appfmt{#1}|hyperpage}} |
| 88 |
\renewcommand{\iterm}[1]{\index[user]{#1|hyperpage}} |
| 89 |
\renewcommand{\ics}[1]{\cs{#1}\index[user]{#1@\protect\cs{#1}|hyperpage}} |
| 90 |
\renewcommand*{\ipkgopt}[2][]{% |
| 91 |
\ifstrempty{#1}% |
| 92 |
{\index[user]{package options:!#2@\pkgoptfmt{#2}|hyperpage}}% |
| 93 |
{\index[user]{package options:!#2@\pkgoptfmt{#2}!#1@\pkgoptfmt{#1}|hyperpage}}% |
| 94 |
} |
| 95 |
\renewcommand*{\pkgopt}[2][]{% |
| 96 |
\pkgoptfmt{#2}\ifstrempty{#1}% |
| 97 |
{\index[user]{package options:!#2@\pkgoptfmt{#2}|hyperpage}}% |
| 98 |
{\index[user]{package options:!#2@\pkgoptfmt{#2}!#1@\pkgoptfmt{#1}|hyperpage}}% |
| 99 |
} |
| 100 |
\renewcommand*{\isty}[1]{% |
| 101 |
\index[user]{#1 package@\styfmt{#1} package|hyperpage}} |
| 102 |
|
| 103 |
\newcommand{\attrfmt}[1]{\texttt{#1}} |
| 104 |
|
| 105 |
\newcommand{\attr}[2]{% |
| 106 |
\attrfmt{#2}% |
| 107 |
\index[user]{attributes!#1!#2@\protect\attrfmt{#2}}} |
| 108 |
|
| 109 |
\newcommand{\mattr}[2]{% |
| 110 |
\attr{#1@\protect\meta{#1}}{#2}% |
| 111 |
} |
| 112 |
|
| 113 |
\newcommand{\dattr}[1]{\mattr{dialect}{#1}} |
| 114 |
\newcommand{\rattr}[1]{\mattr{region}{#1}} |
| 115 |
\newcommand{\cattr}[1]{\mattr{currency}{#1}} |
| 116 |
|
| 117 |
\newcommand{\longarg}[1]{\texttt{-{}-#1}} |
| 118 |
\newcommand{\shortarg}[1]{\texttt{-#1}} |
| 119 |
|
| 120 |
\newcommand{\PDFLaTeX}{PDF\LaTeX} |
| 121 |
|
| 122 |
\setcounter{secnumdepth}{3} |
| 123 |
\setcounter{tocdepth}{3} |
| 124 |
|
| 125 |
\begin{document} |
| 126 |
\DocInput{tex-locale.dtx} |
| 127 |
\end{document} |
| 128 |
%</driver> |
| 129 |
%\fi |
| 130 |
% |
| 131 |
%\MakeShortVerb{"} |
| 132 |
% |
| 133 |
%\title{tex-locale v1.0: |
| 134 |
%setup document locale} |
| 135 |
%\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}} |
| 136 |
% |
| 137 |
%\date{2018-08-26} |
| 138 |
%\maketitle |
| 139 |
% |
| 140 |
%\begin{abstract} |
| 141 |
%The generic \TeX\ \file{tex-locale.tex} code uses both \sty{tracklang} |
| 142 |
%(at least v1.3.4) and \sty{texosquery} (at least v1.2, but newest |
| 143 |
%version recommended) to look up the locale information from the |
| 144 |
%operating system and provide commands that can access |
| 145 |
%locale-dependent information, such as the currency symbol and |
| 146 |
%numeric separators. This works best with the shell escape when |
| 147 |
%building the document. (Some \hyperref[sec:noshell]{adjustments} are |
| 148 |
%needed to work without the shell escape.) \TeX\ Live 2017 now |
| 149 |
%includes \app{texosquery-jre8} on the restricted list, but the |
| 150 |
%\sty{texosquery} installation needs to be set up to enable this. |
| 151 |
%Set up instructions are in the file \file{texosquery.cfg}, which is |
| 152 |
%distributed with the \sty{texosquery} package. If the application |
| 153 |
%isn't on the restricted list, then you'll need to enable the |
| 154 |
%unrestricted mode, but take care as this mode is insecure. |
| 155 |
% |
| 156 |
%Example plain \XeTeX\ document: |
| 157 |
%\begin{verbatim} |
| 158 |
%\font\nimbus="NimbusRoman-Regular" at 10pt |
| 159 |
%\nimbus |
| 160 |
% |
| 161 |
%\input locale |
| 162 |
% |
| 163 |
%Currency: \CurrentLocaleCurrency. |
| 164 |
%Date: \CurrentLocaleDate. |
| 165 |
%Time: \CurrentLocaleTime. |
| 166 |
%\bye |
| 167 |
%\end{verbatim} |
| 168 |
% |
| 169 |
%The \LaTeX\ package \file{tex-locale.sty} can additionally load |
| 170 |
%\sty{babel} or \sty{polyglossia} with the locale's language |
| 171 |
%setting, as well as various other |
| 172 |
%packages such as \sty{fontspec} (\XeLaTeX\ or \LuaLaTeX) or |
| 173 |
%\sty{fontenc} and \sty{inputenc}. Packages that provide currency |
| 174 |
%symbols can also be loaded automatically (\sty{textcomp} by default). |
| 175 |
%Example \LaTeX\ document: |
| 176 |
%\begin{verbatim} |
| 177 |
%\documentclass{article} |
| 178 |
% |
| 179 |
%\usepackage{tex-locale} |
| 180 |
% |
| 181 |
%\begin{document} |
| 182 |
%Currency: \CurrentLocaleCurrency. |
| 183 |
%Date: \CurrentLocaleDate. |
| 184 |
%Time: \CurrentLocaleTime. |
| 185 |
%\end{document} |
| 186 |
%\end{verbatim} |
| 187 |
%\end{abstract} |
| 188 |
% |
| 189 |
%\begin{important} |
| 190 |
%\TeX's restricted mode prohibits the use of quotes in the shell |
| 191 |
%escape for security reasons. This means that if you want the file |
| 192 |
%modification date and you have spaces in your filename you must use |
| 193 |
%the unrestricted mode to allow the filename to be delimited by |
| 194 |
%quotes. In general it's best to avoid spaces in file names. |
| 195 |
%\end{important} |
| 196 |
% |
| 197 |
% |
| 198 |
%\tableofcontents |
| 199 |
%\chapter{Introduction} |
| 200 |
% |
| 201 |
%The \sty{tex-locale} package is designed to set up the document's |
| 202 |
%locale-sensitive information by querying the relevant information |
| 203 |
%from the operating system using \app{texosquery}. |
| 204 |
%\sectionref{sec:generic} describes generic commands that can be used |
| 205 |
%in \LaTeX\ or plain \TeX\ documents. \sectionref{sec:latex} |
| 206 |
%describes the \LaTeX-specific package \file{tex-locale.sty}, which does |
| 207 |
%more than simply input \file{tex-locale.tex}. |
| 208 |
% |
| 209 |
%The generic code \file{tex-locale.tex} requires: \file{tracklang.tex} and |
| 210 |
%\file{texosquery.tex}. The \LaTeX\ package \file{tex-locale.sty} |
| 211 |
%additionally requires: \file{tracklang.sty}, \file{texosquery.sty}, |
| 212 |
%\sty{etoolbox}, \sty{xfor}, \sty{ifxetex}, \sty{ifluatex}, \sty{xkeyval} |
| 213 |
%and optionally: |
| 214 |
%\begin{itemize} |
| 215 |
%\item \sty{datetime2} (and associated language modules); |
| 216 |
%\item \sty{textcomp} or \sty{fontawesome}; |
| 217 |
%\item \sty{fontspec} or \sty{fontenc}\&\sty{inputenc}; |
| 218 |
%\item \sty{polyglossia} or \sty{babel}; |
| 219 |
%\item \sty{CJK}, \sty{CJKutf8} or \sty{xeCJK}; |
| 220 |
%\item \sty{tracklang-scripts} (provided with \sty{tracklang}). |
| 221 |
%\end{itemize} |
| 222 |
% |
| 223 |
%The \sty{texosquery} package (distributed separately) comes with generic |
| 224 |
%\TeX\ code \file{texosquery.tex}, a simple \LaTeX\ package wrapper |
| 225 |
%\file{texosquery.sty} and a Java application that comes in three |
| 226 |
%variants: |
| 227 |
%\begin{itemize} |
| 228 |
%\item \file{texosquery-jre8.jar}: the full application, requires at |
| 229 |
%least Java 8. |
| 230 |
%\item \file{texosquery.jar}: a slightly cut-down version of the |
| 231 |
%application with less locale support, requires at least Java 7. |
| 232 |
%\item \file{texosquery-jre5.jar}: a significantly reduced version of |
| 233 |
%the application with poor locale support, requires at least Java 5. |
| 234 |
%\emph{Less secure than the other variants.} |
| 235 |
%\end{itemize} |
| 236 |
%The Java~8 variant (\app{texosquery-jre8}) is on \TeX~Live |
| 237 |
%2017's restricted list, so it's possible to use it with |
| 238 |
%the restricted shell escape. The other variants should not be added |
| 239 |
%to the restricted list as old versions of Java are deprecated and |
| 240 |
%considered security risks. In particular, the Java~5 variant's file |
| 241 |
%listing actions are less secure as they allow file listings outside |
| 242 |
%of the current directory path, which the Java~7 and 8 variants |
| 243 |
%prohibit. If you have Java~8 installed, I recommend that you make |
| 244 |
%\app{texosquery-jre8} the default. This can be done by editing the |
| 245 |
%configuration file \file{texosquery.cfg}. See the \sty{texosquery} |
| 246 |
%documentation for further details. (This document assumes |
| 247 |
%\app{texosquery-jre8} in the examples. Substitute the appropriate command if you |
| 248 |
%have a different set up.) |
| 249 |
% |
| 250 |
%\begin{important} |
| 251 |
%MiKTeX users will need to enable piped shell escape with |
| 252 |
%\longarg{enable-pipes} (unless the non-shell escape method described |
| 253 |
%in \sectionref{sec:noshell} is used). |
| 254 |
%\end{important} |
| 255 |
% |
| 256 |
%The information returned by \app{texosquery} has special markup |
| 257 |
%that's converted by \cs{TeXOSQuery} or \cs{TeXOSQueryFromFile}. For |
| 258 |
%example, \ics{fhyn} is used to represent a literal hyphen (category |
| 259 |
%code~12) whereas \ics{thyn} is used for a textual hyphen. |
| 260 |
%For example, if a file name containing a hyphen is returned, the |
| 261 |
%hyphen will be marked as \cs{fhyn}, whereas a date containing a |
| 262 |
%hyphen will use \cs{thyn}. |
| 263 |
% |
| 264 |
%\section{Using the package without the shell escape} |
| 265 |
%\label{sec:noshell} |
| 266 |
% |
| 267 |
%The \sty{tex-locale} package is designed for use with the piped shell escape |
| 268 |
%(preferably the restricted mode for greater security), but it's |
| 269 |
%still possible to use \file{tex-locale.tex} when the shell escape is disabled, |
| 270 |
%although it's less convenient. (You will need at least |
| 271 |
%\sty{texosquery} v1.4 for this method.) |
| 272 |
% |
| 273 |
%First compile your document with the shell escape disabled. The dry |
| 274 |
%run mode will automatically be on, and the \sty{texosquery} command |
| 275 |
%\cs{TeXOSQuery} will simply write the command it would've tried to |
| 276 |
%the transcript. This will be prefixed by \texttt{TeXOSQuery:} |
| 277 |
% |
| 278 |
%For example, suppose the file \texttt{test.tex} contains: |
| 279 |
%\begin{verbatim} |
| 280 |
%\def\LocaleMain{en-GB} |
| 281 |
%\def\LocaleOther{de-CH-1996,fr-BE} |
| 282 |
% |
| 283 |
%\input locale |
| 284 |
% |
| 285 |
%Currency: \CurrentLocaleCurrency. |
| 286 |
% |
| 287 |
%\bye |
| 288 |
%\end{verbatim} |
| 289 |
%Here the main locale has been explicitly set to |
| 290 |
%\texttt{en-GB} and the other locales have been set to |
| 291 |
%\texttt{de-CH-1996} and \texttt{fr-BE}, so the transcript file |
| 292 |
%\texttt{test.log} will include: |
| 293 |
%\begin{verbatim} |
| 294 |
%TeXOSQuery: texosquery-jre8 -o -r -a -n -N -C -d 'test.tex' -D en-GB |
| 295 |
%-D de-CH-1996 -D fr-BE |
| 296 |
%\end{verbatim} |
| 297 |
%Copy and paste this command into a command prompt or terminal and redirect the |
| 298 |
%output to a file. (Don't include the initial \texttt{TeXOSQuery:} |
| 299 |
%and don't include any line breaks.) For example (omit line break): |
| 300 |
%\begin{verbatim} |
| 301 |
%texosquery-jre8 -o -r -a -n -N -C -d 'test.tex' -D en-GB |
| 302 |
%-D de-CH-1996 -D fr-BE > localesettings.tex |
| 303 |
%\end{verbatim} |
| 304 |
%Then define |
| 305 |
%\begin{definition}[\DescribeMacro\LocaleQueryFile] |
| 306 |
%\cs{LocaleQueryFile} |
| 307 |
%\end{definition} |
| 308 |
%to the file name before loading \sty{tex-locale}: |
| 309 |
%\begin{verbatim} |
| 310 |
%\def\LocaleQueryFile{localesettings} |
| 311 |
%\def\LocaleMain{en-GB} |
| 312 |
%\def\LocaleOther{de-CH-1996,fr-BE} |
| 313 |
% |
| 314 |
%\input locale |
| 315 |
% |
| 316 |
%Currency: \CurrentLocaleCurrency. |
| 317 |
% |
| 318 |
%\bye |
| 319 |
%\end{verbatim} |
| 320 |
%If you change any of the document settings you'll need to re-run |
| 321 |
%\app{texosquery} to update the query result file. |
| 322 |
% |
| 323 |
%\begin{important} |
| 324 |
%If you want the current date or time, the result files will need to |
| 325 |
%be updated before every document build. |
| 326 |
%\end{important} |
| 327 |
% |
| 328 |
%For example, if the file \texttt{test.tex} is simply: |
| 329 |
%\begin{verbatim} |
| 330 |
%\input locale |
| 331 |
% |
| 332 |
%Today: \CurrentLocaleShortDate. |
| 333 |
%Currency: \CurrentLocaleCurrency. |
| 334 |
% |
| 335 |
%\bye |
| 336 |
%\end{verbatim} |
| 337 |
%Then the document build process would be: |
| 338 |
%\begin{verbatim} |
| 339 |
%texosquery-jre8 -o -r -a -n -N -C -d 'test.tex' -D > testsettings.tex |
| 340 |
%etex '\def\LocaleQueryFile{testsettings}\input test' |
| 341 |
%\end{verbatim} |
| 342 |
%(Replace \app{etex} with \app{pdftex} or \app{xetex}, as required.) |
| 343 |
% |
| 344 |
%\begin{important} |
| 345 |
%If \cs{LocaleQueryFile} is defined and non-empty, the non-shell escape method |
| 346 |
%will automatically be implemented even if the shell escape is actually |
| 347 |
%enabled. |
| 348 |
%\end{important} |
| 349 |
% |
| 350 |
%If you're using \LaTeX\ (\file{tex-locale.sty}), there may be an initial query with |
| 351 |
%\texttt{-b} or \texttt{-C} (or both) before \file{tex-locale.tex} is |
| 352 |
%input. The result of this will also need to be captured in a file. |
| 353 |
%For example: |
| 354 |
%\begin{verbatim} |
| 355 |
%texosquery-jre8 -b -C > localestysettings.tex |
| 356 |
%\end{verbatim} |
| 357 |
%This file name should be provided in the command |
| 358 |
%\begin{definition}[\DescribeMacro\LocaleStyQueryFile] |
| 359 |
%\cs{LocaleStyQueryFile} |
| 360 |
%\end{definition} |
| 361 |
%In this case you only need to update the file if you change the |
| 362 |
%document locales, encoding or engine. (For example, if you change the |
| 363 |
%value of the package options \pkgopt{main}, \pkgopt{other}, |
| 364 |
%\pkgopt{support}, \pkgopt{inputenc} or \pkgopt{fontenc}.) |
| 365 |
% |
| 366 |
%\LaTeX\ example: |
| 367 |
%\begin{verbatim} |
| 368 |
%\documentclass{article} |
| 369 |
%\newcommand{\LocaleStyQueryFile}{localestysettings} |
| 370 |
%\newcommand{\LocaleQueryFile}{localesettings} |
| 371 |
%\usepackage[main=en-GB,other={de-CH-1996,fr-BE}]{tex-locale} |
| 372 |
%\begin{document} |
| 373 |
%Currency: \CurrentLocaleCurrency. |
| 374 |
%\end{document} |
| 375 |
%\end{verbatim} |
| 376 |
% |
| 377 |
%\begin{important} |
| 378 |
%Even if the shell escape is on, if \cs{LocaleQueryFile} or |
| 379 |
%\cs{LocaleStyQueryFile} have been set (to a non-empty value), |
| 380 |
%they'll be used instead. |
| 381 |
%\end{important} |
| 382 |
% |
| 383 |
%It's possible to define one but not the other command. For example: |
| 384 |
%\begin{verbatim} |
| 385 |
%\documentclass{article} |
| 386 |
%\newcommand{\LocaleStyQueryFile}{localestysettings} |
| 387 |
%\usepackage[main=en-GB,other={de-CH-1996,fr-BE}]{tex-locale} |
| 388 |
%\begin{document} |
| 389 |
%Currency: \CurrentLocaleCurrency. |
| 390 |
%\end{document} |
| 391 |
%\end{verbatim} |
| 392 |
%This requires the shell escape for the main locale information |
| 393 |
%(used in \file{tex-locale.tex}) but omits the \LaTeX-specific shell |
| 394 |
%escape used in \file{tex-locale.sty}. |
| 395 |
% |
| 396 |
%\section{Encoding} |
| 397 |
%\label{sec:encoding} |
| 398 |
% |
| 399 |
%The default encoding used by \app{texosquery} when writing the |
| 400 |
%results to STDOUT (which are piped in through the shell escape) |
| 401 |
%can be obtained with \longarg{codeset} (from v1.6). For example: |
| 402 |
%\begin{verbatim} |
| 403 |
%texosquery-jre8 --codeset |
| 404 |
%\end{verbatim} |
| 405 |
%The short form of this switch is \shortarg{cs}. So the above is |
| 406 |
%equivalent to |
| 407 |
%\begin{verbatim} |
| 408 |
%texosquery-jre8 -cs |
| 409 |
%\end{verbatim} |
| 410 |
%For example, if the encoding is UTF-8, then this returns |
| 411 |
%\begin{verbatim} |
| 412 |
%UTF\fhyn 8 |
| 413 |
%\end{verbatim} |
| 414 |
% |
| 415 |
%There's a similar switch \longarg{codeset-lcs} (from v1.2) that |
| 416 |
%converts the encoding name to lower case and strips hyphens. |
| 417 |
%For example |
| 418 |
%\begin{verbatim} |
| 419 |
%texosquery-jre8 --codeset-lcs |
| 420 |
%\end{verbatim} |
| 421 |
%The short form is \shortarg{C} |
| 422 |
%\begin{verbatim} |
| 423 |
%texosquery-jre8 -C |
| 424 |
%\end{verbatim} |
| 425 |
%For example, if the encoding is UTF-8, then this returns |
| 426 |
%\begin{verbatim} |
| 427 |
%utf8 |
| 428 |
%\end{verbatim} |
| 429 |
%(The switches are case-sensitive. The lower case \shortarg{c} has a |
| 430 |
%different meaning.) |
| 431 |
% |
| 432 |
%The document encoding must match the encoding used by |
| 433 |
%\app{texosquery} when the query is made (through \cs{TeXOSQuery} or |
| 434 |
%\cs{TeXOSQueryFromFile}). This is why the \LaTeX\ package |
| 435 |
%\file{tex-locale.sty} makes an initial query with \shortarg{C} so that |
| 436 |
%it can set up the appropriate input encoding when used with the |
| 437 |
%\pkgoptfmt{inputenc=auto} package option. If the document doesn't use |
| 438 |
%this interface, then the encoding needs to be correctly set before |
| 439 |
%the query is made. |
| 440 |
% |
| 441 |
%You have a choice of either changing the document encoding to match |
| 442 |
%the encoding used by \app{texosquery} or by changing |
| 443 |
%\app{texosquery}'s encoding to match all your documents. |
| 444 |
%For example, if your Java runtime environment is set up so that the |
| 445 |
%default file encoding is ISO~8859-1 (Latin-1) but you always use |
| 446 |
%UTF-8 in your source code, then you can instruct \app{texosquery} to |
| 447 |
%use UTF-8 with the \longarg{encoding} option (from v1.6). For example: |
| 448 |
%\begin{verbatim} |
| 449 |
%texosquery-jre8 --encoding UTF-8 -N |
| 450 |
%\end{verbatim} |
| 451 |
%will ensure that the currency symbol is written as a UTF-8 |
| 452 |
%character. The short form is \shortarg{enc}. For example: |
| 453 |
%\begin{verbatim} |
| 454 |
%texosquery-jre8 -enc UTF-8 -N |
| 455 |
%\end{verbatim} |
| 456 |
%You can append this option to the definition of |
| 457 |
%\cs{TeXOSInvokerName}. For example: |
| 458 |
%\begin{verbatim} |
| 459 |
%\def\TeXOSInvokerName{texosquery-jre8 -enc UTF-8} |
| 460 |
%\end{verbatim} |
| 461 |
% |
| 462 |
%There are two hooks which, if defined, are used immediately before |
| 463 |
%or immediately after the main query is made in \file{tex-locale.tex}. |
| 464 |
%The hook used before the query is |
| 465 |
%\begin{definition}[\DescribeMacro\localeprequery] |
| 466 |
%\cs{localeprequery} |
| 467 |
%\end{definition} |
| 468 |
%and the hook used after the query is |
| 469 |
%\begin{definition}[\DescribeMacro\localepostquery] |
| 470 |
%\cs{localepostquery} |
| 471 |
%\end{definition} |
| 472 |
%These may start and end a grouping, if required, as the result from |
| 473 |
%the query is given a global assignment, so these may be used to |
| 474 |
%temporarily switch the input encoding just for the query. This is |
| 475 |
%done by \file{tex-locale.sty} if it detects that the document requires |
| 476 |
%\sty{CJKutf8}. In this case it defines the hooks to locally switch |
| 477 |
%the encoding while the CJK characters are read from the query result. |
| 478 |
% |
| 479 |
%In addition to using markup commands like \cs{fhyn} and \cs{thyn}, |
| 480 |
%\app{texosquery} also wraps non-ASCII characters in the argument of |
| 481 |
%\cs{fwrp} (which expands to \cs{texosquerynonasciidetokwrap}) and |
| 482 |
%\cs{twrp} (which expands to \cs{texosquerynonasciiwrap}). The |
| 483 |
%expanded versions of these commands may be changed to deal with |
| 484 |
%non-ASCII characters, but in general it's simpler to either use the |
| 485 |
%same encoding as the document or use the hooks to temporarily switch |
| 486 |
%encoding while the information is read. |
| 487 |
% |
| 488 |
%\chapter{Generic Use} |
| 489 |
%\label{sec:generic} |
| 490 |
% |
| 491 |
%The commands available for generic use are defined in |
| 492 |
%\file{tex-locale.tex}. Plain \TeX\ users can load this using \cs{input}: |
| 493 |
%\begin{verbatim} |
| 494 |
%\input locale |
| 495 |
%\end{verbatim} |
| 496 |
%\LaTeX\ users are also able to do this, but are better off loading |
| 497 |
%\file{tex-locale.sty} instead: |
| 498 |
%\begin{verbatim} |
| 499 |
%\usepackage{tex-locale} |
| 500 |
%\end{verbatim} |
| 501 |
%This does more than simply inputting \file{tex-locale.tex} as it also |
| 502 |
%loads other packages as well, such as \sty{babel} or |
| 503 |
%\sty{polyglossia}. See \sectionref{sec:latex} for \LaTeX\ package options. |
| 504 |
% |
| 505 |
%By default \file{tex-locale.tex} assumes that the document locale should |
| 506 |
%match your own locale as identified by your operating system. This |
| 507 |
%means that the same document code will produce different results |
| 508 |
%when compiled in different locations. If you want information for a |
| 509 |
%specific locale, then you need to identify the document's main |
| 510 |
%locale and optionally other locales. For plain \TeX\ users, this |
| 511 |
%means defining \cs{LocaleMain} and \cs{LocaleOther} \emph{before} loading |
| 512 |
%\file{tex-locale.tex}. For \LaTeX\ users, this is done through the |
| 513 |
%package options provided by \file{tex-locale.sty}. |
| 514 |
% |
| 515 |
%\begin{definition}[\DescribeMacro\LocaleMain] |
| 516 |
%\cs{LocaleMain} |
| 517 |
%\end{definition} |
| 518 |
%If this is defined before \file{tex-locale.tex} is input, then this may |
| 519 |
%be defined as the keyword \texttt{locale}: |
| 520 |
%\begin{verbatim} |
| 521 |
%\def\LocaleMain{locale} |
| 522 |
%\end{verbatim} |
| 523 |
%or the relevant language tag. For example: |
| 524 |
%\begin{verbatim} |
| 525 |
%\def\LocaleMain{de-CH-1996} |
| 526 |
%\end{verbatim} |
| 527 |
%The \texttt{locale} keyword indicates that the main locale should be |
| 528 |
%found by querying the operating system (using \app{texosquery}). |
| 529 |
%After \file{tex-locale.tex} has been input, this command will be set to |
| 530 |
%the language tag for the main locale. If \cs{LocaleMain} is undefined before |
| 531 |
%\file{tex-locale.tex} is input, then \texttt{locale} is assumed. |
| 532 |
% |
| 533 |
%\begin{definition}[\DescribeMacro\LocaleOther] |
| 534 |
%\cs{LocaleOther} |
| 535 |
%\end{definition} |
| 536 |
%If this is defined before \file{tex-locale.tex} is input, then this |
| 537 |
%should be a comma-separated list of language tags for the other |
| 538 |
%locales. If \cs{LocaleMain} has been defined to a language tag, the |
| 539 |
%list may also include the keyword \texttt{locale} to indicate the |
| 540 |
%operating system's locale. |
| 541 |
% |
| 542 |
%Note that the generic \file{tex-locale.tex} doesn't load \sty{babel} or |
| 543 |
%\sty{polyglossia}, but it does track each language using |
| 544 |
%\sty{tracklang}'s interface. You can switch to any of these locales |
| 545 |
%using\label{pg:selectlocale} |
| 546 |
%\begin{definition}[\DescribeMacro\selectlocale] |
| 547 |
%\cs{selectlocale}\marg{locale} |
| 548 |
%\end{definition} |
| 549 |
%where \meta{locale} is either a language tag or \sty{tracklang} |
| 550 |
%dialect label. If the locale is unrecognised, an error will occur |
| 551 |
%unless \sty{texosquery}'s dry run mode is on, in which case it will |
| 552 |
%just be a warning. |
| 553 |
% |
| 554 |
%This uses \sty{tracklang}'s |
| 555 |
%\cs{SetCurrentTrackedDialect}\marg{dialect} but additionally, if |
| 556 |
%\cs{selectlanguage} has been defined, it will try to determine the |
| 557 |
%correct label to pass to \ics{selectlanguage}. |
| 558 |
% |
| 559 |
%This means that if you use \LaTeX\ with \file{tex-locale.sty}, which |
| 560 |
%loads \sty{babel} or \sty{polyglossia}, then you don't need to |
| 561 |
%remember, for example, that \texttt{en-GB} has the \sty{babel} |
| 562 |
%dialect label \texttt{british}, and can simply do |
| 563 |
%\begin{verbatim} |
| 564 |
%\selectlocale{en-GB} |
| 565 |
%\end{verbatim} |
| 566 |
%If \cs{selectlanguage} isn't defined, then this command doesn't |
| 567 |
%switch the document language (that is, it doesn't change the |
| 568 |
%hyphenation patterns or \cs{languagename}) but it does allow |
| 569 |
%the \cs{CurrentLocale\ldots} commands (described in \sectionref{sec:currentlocale}) to reflect |
| 570 |
%the change in locale. |
| 571 |
% |
| 572 |
%Here's a plain \XeTeX\ document that sets up three locales for the |
| 573 |
%document. The first (main one) is obtained from the operating system |
| 574 |
%(because \cs{LocaleMain} isn't defined) and the other two are |
| 575 |
%explicitly set by defining \cs{LocaleOther} before \file{tex-locale.tex} |
| 576 |
%is input: |
| 577 |
%\begin{verbatim} |
| 578 |
%\def\LocaleOther{fr-BE,de-CH-1996} |
| 579 |
% |
| 580 |
%\input locale |
| 581 |
% |
| 582 |
%Currency: \CurrentLocaleCurrency. |
| 583 |
% |
| 584 |
%\selectlocale{fr-BE} |
| 585 |
% |
| 586 |
%Currency: \CurrentLocaleCurrency. |
| 587 |
% |
| 588 |
%\selectlocale{de-CH-1996} |
| 589 |
% |
| 590 |
%Currency: \CurrentLocaleCurrency. |
| 591 |
%\bye |
| 592 |
%\end{verbatim} |
| 593 |
%If this document is in a file called \file{test.tex}, then it can be |
| 594 |
%compiled using: |
| 595 |
%\begin{verbatim} |
| 596 |
%pdftex --shell-escape test |
| 597 |
%\end{verbatim} |
| 598 |
%or |
| 599 |
%\begin{verbatim} |
| 600 |
%etex --shell-escape test |
| 601 |
%\end{verbatim} |
| 602 |
%or |
| 603 |
%\begin{verbatim} |
| 604 |
%xetex --shell-escape test |
| 605 |
%\end{verbatim} |
| 606 |
%or |
| 607 |
%\begin{verbatim} |
| 608 |
%luatex --shell-escape test |
| 609 |
%\end{verbatim} |
| 610 |
%(Omit \longarg{shell-escape} if the application given by |
| 611 |
%\cs{TeXOSInvokerName} is on the restricted list.) |
| 612 |
% |
| 613 |
%The equivalent \LaTeX\ document is: |
| 614 |
%\begin{verbatim} |
| 615 |
%\documentclass{article} |
| 616 |
% |
| 617 |
%\usepackage[other={fr-BE,de-CH-1996}]{tex-locale} |
| 618 |
% |
| 619 |
%\begin{document} |
| 620 |
%Currency: \CurrentLocaleCurrency. |
| 621 |
% |
| 622 |
%\selectlocale{fr-BE} |
| 623 |
% |
| 624 |
%Currency: \CurrentLocaleCurrency. |
| 625 |
% |
| 626 |
%\selectlocale{de-CH-1996} |
| 627 |
% |
| 628 |
%Currency: \CurrentLocaleCurrency. |
| 629 |
% |
| 630 |
%\end{document} |
| 631 |
%\end{verbatim} |
| 632 |
%If this document is in a file called \file{test.tex}, then it can be |
| 633 |
%compiled using: |
| 634 |
%\begin{verbatim} |
| 635 |
%pdflatex --shell-escape test |
| 636 |
%\end{verbatim} |
| 637 |
%or |
| 638 |
%\begin{verbatim} |
| 639 |
%latex --shell-escape test |
| 640 |
%\end{verbatim} |
| 641 |
%or |
| 642 |
%\begin{verbatim} |
| 643 |
%xelatex --shell-escape test |
| 644 |
%\end{verbatim} |
| 645 |
%or |
| 646 |
%\begin{verbatim} |
| 647 |
%lualatex --shell-escape test |
| 648 |
%\end{verbatim} |
| 649 |
%(Again, omit \longarg{shell-escape} if the application given by |
| 650 |
%\cs{TeXOSInvokerName} is on the restricted list.) |
| 651 |
% |
| 652 |
%In the first two cases (\texttt{pdflatex} or \texttt{latex}), |
| 653 |
%\sty{babel} will be loaded (and also \sty{fontenc} and \sty{inputenc} |
| 654 |
%and various other packages). Whereas in the last two cases |
| 655 |
%(\texttt{xelatex} or \texttt{lualatex}), |
| 656 |
%\sty{polyglossia} will be loaded (and also \sty{fontspec} and |
| 657 |
%various other packages). This means that \cs{selectlocale} will also |
| 658 |
%use \cs{selectlanguage} to switch the document language. In the |
| 659 |
%plain \TeX\ version, \cs{languagename} remains undefined. |
| 660 |
% |
| 661 |
%The other difference between the plain \TeX\ and the \LaTeX\ |
| 662 |
%examples, is the default output produced by |
| 663 |
%\cs{CurrentLocaleCurrency}. The plain \TeX\ version uses the |
| 664 |
%currency codes (for example, EUR) whereas the \LaTeX\ version uses |
| 665 |
%currency symbols. These differences are described in more detail |
| 666 |
%below. |
| 667 |
% |
| 668 |
%\section{General Information} |
| 669 |
%\label{sec:general} |
| 670 |
% |
| 671 |
%Each invocation of \app{texosquery} requires starting up the |
| 672 |
%Java Virtual Machine, so \file{tex-locale.tex} minimises this overhead by |
| 673 |
%only using a single system call. The \file{tex-locale.sty} \LaTeX\ |
| 674 |
%package may need additional information that also requires a |
| 675 |
%\app{texosquery} call before \file{tex-locale.tex} is input. So \LaTeX\ |
| 676 |
%users will have at most two system calls to \app{texosquery} when |
| 677 |
%loading \file{tex-locale.sty} whereas plain \TeX\ users will only have a |
| 678 |
%single system call when loading just \file{tex-locale.tex}. |
| 679 |
% |
| 680 |
%Since it's necessary to run \app{texosquery} to obtain all the |
| 681 |
%locale information, \file{tex-locale.tex} uses the opportunity to also |
| 682 |
%fetch more general information that may be of use. |
| 683 |
% |
| 684 |
%\begin{definition}[\DescribeMacro\LocaleOSname] |
| 685 |
%\cs{LocaleOSname} |
| 686 |
%\end{definition} |
| 687 |
%This expands to the operating system name. For example, |
| 688 |
%\texttt{Linux}. |
| 689 |
% |
| 690 |
%\begin{definition}[\DescribeMacro\LocaleOSversion] |
| 691 |
%\cs{LocaleOSversion} |
| 692 |
%\end{definition} |
| 693 |
%This expands to the operating system version. For example, |
| 694 |
%\verb|4.1.13-100.fc21.x86_64|. (Note that the underscore in this |
| 695 |
%case has been detokenized.) |
| 696 |
% |
| 697 |
%\begin{definition}[\DescribeMacro\LocaleOSarch] |
| 698 |
%\cs{LocaleOSarch} |
| 699 |
%\end{definition} |
| 700 |
%This expands to the architecture. For example, |
| 701 |
%\texttt{amd64}. |
| 702 |
% |
| 703 |
%\begin{definition}[\DescribeMacro\LocaleOScodeset] |
| 704 |
%\cs{LocaleOScodeset} |
| 705 |
%\end{definition} |
| 706 |
%This expands to the operating system's default file encoding (or the |
| 707 |
%value of the Java setting \texttt{file.encoding}). This uses |
| 708 |
%\app{texosquery}'s \shortarg{C} switch, which converts the encoding |
| 709 |
%name to lower case and strips the hyphens. (For example, \texttt{UTF-8} |
| 710 |
%is converted to \texttt{utf8}.) If you prefer to use the |
| 711 |
%\shortarg{cs} (or \longarg{codeset}) switch, you can define |
| 712 |
%\begin{definition}[\DescribeMacro\LocaleQueryCodesetParam] |
| 713 |
%\cs{LocaleQueryCodesetParam} |
| 714 |
%\end{definition} |
| 715 |
%to the required switch. For example: |
| 716 |
%\begin{verbatim} |
| 717 |
%\def\LocaleQueryCodesetParam{-cs} |
| 718 |
%\input locale |
| 719 |
%Encoding: \LocaleOScodeset. |
| 720 |
%\bye |
| 721 |
%\end{verbatim} |
| 722 |
%(Note that \cs{codeset} was added to \app{texosquery} v1.6.) |
| 723 |
% |
| 724 |
%\begin{definition}[\DescribeMacro\LocaleOStag] |
| 725 |
%\cs{LocaleOStag} |
| 726 |
%\end{definition} |
| 727 |
%This expands to the operating system's language tag, but note that |
| 728 |
%this doesn't mean that this locale has been tracked (either as the |
| 729 |
%main locale or one of the other document locales). It's for |
| 730 |
%informational purposes only. |
| 731 |
% |
| 732 |
%\begin{definition}[\DescribeMacro\LocaleNowStamp] |
| 733 |
%\cs{LocaleNowStamp} |
| 734 |
%\end{definition} |
| 735 |
%This expands to the current date-time in PDF format. This is like |
| 736 |
%the PDF primitive \ics{pdfcreationdate} (also available with \LuaTeX\ |
| 737 |
%through \cs{pdffeedback}). Since \cs{pdfcreationdate} isn't provided |
| 738 |
%by \XeTeX, \cs{LocaleNowStamp} can be used instead if required. |
| 739 |
% |
| 740 |
%You can also obtain the file modification date of the document |
| 741 |
%source file. The file is assumed to be \cs{jobname}\texttt{.tex}, |
| 742 |
%but you can choose another instead by first defining |
| 743 |
%\begin{definition}[\DescribeMacro\LocaleMainFile] |
| 744 |
%\cs{LocaleMainFile} |
| 745 |
%\end{definition} |
| 746 |
%before loading \file{tex-locale.tex}. The value should be the file name. |
| 747 |
%For example: |
| 748 |
%\begin{verbatim} |
| 749 |
%\def\LocaleMainFile{mydoc.tex} |
| 750 |
%\input locale |
| 751 |
%\end{verbatim} |
| 752 |
%You can define this command to empty if you don't want the file |
| 753 |
%modification PDF date-stamp. For example: |
| 754 |
%\begin{verbatim} |
| 755 |
%\def\LocaleMainFile{} |
| 756 |
%\input locale |
| 757 |
%\end{verbatim} |
| 758 |
%If the file name contains spaces, you can't use the restricted shell |
| 759 |
%escape and will have to use the less secure unrestricted mode instead. |
| 760 |
% |
| 761 |
%If \cs{LocaleMainFile} is not empty, the modification date can be |
| 762 |
%accessed using |
| 763 |
%\begin{definition}[\DescribeMacro\LocaleFileMod] |
| 764 |
%\cs{LocaleFileMod} |
| 765 |
%\end{definition} |
| 766 |
%For example: |
| 767 |
%\begin{verbatim} |
| 768 |
%\input locale |
| 769 |
% |
| 770 |
%\pdfinfo{ |
| 771 |
% /CreationDate (\LocaleNowStamp) |
| 772 |
% /ModDate (\LocaleFileMod) |
| 773 |
%} |
| 774 |
% |
| 775 |
%Now: \LocaleNowStamp. |
| 776 |
%Mod: \LocaleFileMod. |
| 777 |
% |
| 778 |
%\bye |
| 779 |
%\end{verbatim} |
| 780 |
%This command will be empty if the modification date wasn't found. |
| 781 |
% |
| 782 |
%\section{Attributes} |
| 783 |
%\label{sec:attributes} |
| 784 |
% |
| 785 |
%The \file{tex-locale.tex} package stores and references information |
| 786 |
%through the use of attributes. These are set using: |
| 787 |
%\begin{definition}[\DescribeMacro\LocaleSetAttribute] |
| 788 |
%\cs{LocaleSetAttribute}\marg{label}\marg{attribute}\marg{value} |
| 789 |
%\end{definition} |
| 790 |
%and accessed using |
| 791 |
%\begin{definition}[\DescribeMacro\LocaleGetAttribute] |
| 792 |
%\cs{LocaleGetAttribute}\marg{label}\marg{attribute} |
| 793 |
%\end{definition} |
| 794 |
%The \meta{label} identifies the type of information, |
| 795 |
%\meta{attribute} is the attribute's label and \meta{value} is the |
| 796 |
%attribute's value. |
| 797 |
% |
| 798 |
%There are three particular types of identifiers: locales, regions |
| 799 |
%and currencies. For convenience, there are some shortcut commands so |
| 800 |
%you don't need to use the special prefix part of the label. |
| 801 |
% |
| 802 |
%For locales, where \meta{dialect} is the \sty{tracklang} dialect |
| 803 |
%label associated with that locale: |
| 804 |
%\begin{definition}[\DescribeMacro\LocaleSetDialectAttribute] |
| 805 |
%\cs{LocaleSetDialectAttribute}\marg{dialect}\marg{attribute}\marg{value} |
| 806 |
%\end{definition} |
| 807 |
%\begin{definition}[\DescribeMacro\LocaleGetDialectAttribute] |
| 808 |
%\cs{LocaleGetDialectAttribute}\marg{dialect}\marg{attribute} |
| 809 |
%\end{definition} |
| 810 |
% |
| 811 |
%Region attributes are set using: |
| 812 |
%\begin{definition}[\DescribeMacro\LocaleSetRegionAttribute] |
| 813 |
%\cs{LocaleSetRegionAttribute}\marg{region code}\marg{attribute}\marg{value} |
| 814 |
%\end{definition} |
| 815 |
%where \meta{region code} is the ISO territory code (for example, |
| 816 |
%\texttt{GB} or \texttt{CH}). |
| 817 |
%You can fetch a region's attribute value using: |
| 818 |
%\begin{definition}[\DescribeMacro\LocaleGetRegionAttribute] |
| 819 |
%\cs{LocaleGetRegionAttribute}\marg{region code}\marg{attribute} |
| 820 |
%\end{definition} |
| 821 |
% |
| 822 |
%Currency attributes are set using: |
| 823 |
%\begin{definition}[\DescribeMacro\LocaleSetCurrencyAttribute] |
| 824 |
%\cs{LocaleSetCurrencyAttribute}\marg{currency code}\marg{attribute}\marg{value} |
| 825 |
%\end{definition} |
| 826 |
%where \meta{currency code} is the ISO currency code (for example, |
| 827 |
%\texttt{GBP} or \texttt{EUR}). |
| 828 |
%You can fetch a currency's attribute value using: |
| 829 |
%\begin{definition}[\DescribeMacro\LocaleGetCurrencyAttribute] |
| 830 |
%\cs{LocaleGetCurrencyAttribute}\marg{currency code}\marg{attribute} |
| 831 |
%\end{definition} |
| 832 |
% |
| 833 |
%There's a debugging command available that uses \ics{show} to show |
| 834 |
%an attribute's value (or an error if undefined): |
| 835 |
%\begin{definition}[\DescribeMacro\localeshowattribute] |
| 836 |
%\cs{localeshowattribute}\marg{label}\marg{attribute} |
| 837 |
%\end{definition} |
| 838 |
% |
| 839 |
%Again there are shortcuts for the dialect, region and currency attribute groups: |
| 840 |
%\begin{definition}[\DescribeMacro\localeshowdialectattribute] |
| 841 |
%\cs{localeshowdialectattribute}\marg{dialect}\marg{attribute} |
| 842 |
%\end{definition} |
| 843 |
%\begin{definition}[\DescribeMacro\localeshowregionattribute] |
| 844 |
%\cs{localeshowregionattribute}\marg{region code}\marg{attribute} |
| 845 |
%\end{definition} |
| 846 |
%\begin{definition}[\DescribeMacro\localeshowcurrencyattribute] |
| 847 |
%\cs{localeshowcurrencyattribute}\marg{currency code}\marg{attribute} |
| 848 |
%\end{definition} |
| 849 |
%Further details of these and other attribute commands can be found in |
| 850 |
%\sectionref{sec:code.attributes}. |
| 851 |
% |
| 852 |
%For the most part, the attributes are stored and accessed internally |
| 853 |
%by the various commands described in this chapter, so you |
| 854 |
%won't usually need to worry about them. However, you can modify the |
| 855 |
%attributes. For example, the \texttt{de-CH-1996} locale uses an |
| 856 |
%apostrophe \verb|'| as the numeric group separator. This is actually |
| 857 |
%returned by \app{texosquery} as the 0x27 straight apostrophe from |
| 858 |
%the Basic Latin block. This isn't a problem for plain \TeX\ using |
| 859 |
%the default Computer Modern font, as illustrated by the following |
| 860 |
%document: |
| 861 |
%\begin{verbatim} |
| 862 |
%1'234.5 |
| 863 |
%\bye |
| 864 |
%\end{verbatim} |
| 865 |
%This uses a curly quote in the resulting 1'234.5. However, changing the font can result in a |
| 866 |
%straight apostrophe instead, as illustrated in this plain \XeTeX\ |
| 867 |
%document: |
| 868 |
%\begin{verbatim} |
| 869 |
%\font\nimbus="NimbusRoman-Regular" at 10pt |
| 870 |
%\nimbus |
| 871 |
% |
| 872 |
%1'234.5 |
| 873 |
%\bye |
| 874 |
%\end{verbatim} |
| 875 |
%This isn't a problem with \XeLaTeX\ if the \sty{fontspec} package is |
| 876 |
%used: |
| 877 |
%\begin{verbatim} |
| 878 |
%\documentclass{article} |
| 879 |
%\usepackage{fontspec} |
| 880 |
%\setmainfont{NimbusRoman-Regular} |
| 881 |
% |
| 882 |
%\begin{document} |
| 883 |
%1'234.5 |
| 884 |
%\end{document} |
| 885 |
%\end{verbatim} |
| 886 |
% |
| 887 |
%So a plain \XeTeX\ user might prefer to change the numeric group |
| 888 |
%separator to the right single quote character ' (0x2019). |
| 889 |
%The numeric group separator is provided by the \dattr{groupsep} |
| 890 |
%dialect attribute. The \sty{tracklang} dialect label corresponding |
| 891 |
%to the \texttt{de-CH-1996} locale is \texttt{nswissgerman}. So the |
| 892 |
%group separator for this dialect can be changed by setting the |
| 893 |
%attribute to the new value using: |
| 894 |
%\begin{code} |
| 895 |
%\cs{LocaleSetDialectAttribute}\{nswissgerman\}\{groupsep\}\{\textquoteright\} |
| 896 |
%\end{code} |
| 897 |
%(See \sectionref{sec:generalattr} to convert a language tag to |
| 898 |
%dialect label.) |
| 899 |
% |
| 900 |
%\subsection{Attribute Lists} |
| 901 |
%\label{sec:attrlists} |
| 902 |
% |
| 903 |
%Some attribute values may be comma-separated lists. You can |
| 904 |
%add a unique item to a list using: |
| 905 |
%\begin{definition}[\DescribeMacro\LocaleAddToAttributeList] |
| 906 |
%\cs{LocaleAddToAttributeList}\marg{label}\marg{attribute}\marg{item} |
| 907 |
%\end{definition} |
| 908 |
%This will do nothing if the item is already in the list, otherwise |
| 909 |
%it will append \meta{item} to the list. No |
| 910 |
%expansion is performed on \meta{item}. The item may be empty. |
| 911 |
% |
| 912 |
%\begin{definition}[\DescribeMacro\LocaleXpAddToAttributeList] |
| 913 |
%\cs{LocaleXpAddToAttributeList}\marg{label}\marg{attribute}\marg{item} |
| 914 |
%\end{definition} |
| 915 |
%As above but the first token of \meta{item} is expanded before |
| 916 |
%being added to the list. |
| 917 |
% |
| 918 |
%You can test if an item is in one of those lists using: |
| 919 |
%\begin{definition}[\DescribeMacro\LocaleIfInAttributeList] |
| 920 |
%\cs{LocaleIfInAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false} |
| 921 |
%\end{definition} |
| 922 |
%where \meta{item} is the item. This does \meta{true} if |
| 923 |
%\meta{item} is found in the \meta{attribute} list for |
| 924 |
%\meta{label}, otherwise it does \meta{false}. If the attribute |
| 925 |
%hasn't been defined, \meta{false} is done. |
| 926 |
% |
| 927 |
%There's a similar command that expands the first token of |
| 928 |
%\meta{item} before performing the test: |
| 929 |
%\begin{definition}[\DescribeMacro\LocaleIfInAttributeList] |
| 930 |
%\cs{LocaleIfXpInAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false} |
| 931 |
%\end{definition} |
| 932 |
% |
| 933 |
%You can iterate over the list using: |
| 934 |
%\begin{definition}[\DescribeMacro\LocaleForEachInAttributeList] |
| 935 |
%\cs{LocaleForEachInAttributeList}\marg{label}\marg{attribute}\marg{cs}\marg{body} |
| 936 |
%\end{definition} |
| 937 |
%This iterates over each element of the list, setting |
| 938 |
%the control sequence \meta{cs} to the current item and performing |
| 939 |
%\meta{body}. Note that this doesn't skip empty items. |
| 940 |
% |
| 941 |
%There are shortcut commands for the dialect, region and currency |
| 942 |
%attributes: |
| 943 |
% |
| 944 |
%\begin{definition}[\DescribeMacro\LocaleAddToDialectAttributeList] |
| 945 |
%\cs{LocaleAddToDialectAttributeList}\marg{label}\marg{attribute}\marg{item} |
| 946 |
%\end{definition} |
| 947 |
% |
| 948 |
%\begin{definition}[\DescribeMacro\LocaleXpAddToDialectAttributeList] |
| 949 |
%\cs{LocaleXpAddToDialectAttributeList}\marg{label}\marg{attribute}\marg{item} |
| 950 |
%\end{definition} |
| 951 |
% |
| 952 |
%\begin{definition}[\DescribeMacro\LocaleIfInDialectAttributeList] |
| 953 |
%\cs{LocaleIfInDialectAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false} |
| 954 |
%\end{definition} |
| 955 |
% |
| 956 |
%\begin{definition}[\DescribeMacro\LocaleIfInDialectAttributeList] |
| 957 |
%\cs{LocaleIfXpInDialectAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false} |
| 958 |
%\end{definition} |
| 959 |
% |
| 960 |
%\begin{definition}[\DescribeMacro\LocaleForEachInDialectAttributeList] |
| 961 |
%\cs{LocaleForEachInDialectAttributeList}\marg{label}\marg{attribute}\marg{cs}\marg{body} |
| 962 |
%\end{definition} |
| 963 |
% |
| 964 |
%\begin{definition}[\DescribeMacro\LocaleAddToRegionAttributeList] |
| 965 |
%\cs{LocaleAddToRegionAttributeList}\marg{label}\marg{attribute}\marg{item} |
| 966 |
%\end{definition} |
| 967 |
% |
| 968 |
%\begin{definition}[\DescribeMacro\LocaleXpAddToRegionAttributeList] |
| 969 |
%\cs{LocaleXpAddToRegionAttributeList}\marg{label}\marg{attribute}\marg{item} |
| 970 |
%\end{definition} |
| 971 |
% |
| 972 |
%\begin{definition}[\DescribeMacro\LocaleIfInRegionAttributeList] |
| 973 |
%\cs{LocaleIfInRegionAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false} |
| 974 |
%\end{definition} |
| 975 |
% |
| 976 |
%\begin{definition}[\DescribeMacro\LocaleIfInRegionAttributeList] |
| 977 |
%\cs{LocaleIfXpInRegionAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false} |
| 978 |
%\end{definition} |
| 979 |
% |
| 980 |
%\begin{definition}[\DescribeMacro\LocaleForEachInRegionAttributeList] |
| 981 |
%\cs{LocaleForEachInRegionAttributeList}\marg{label}\marg{attribute}\marg{cs}\marg{body} |
| 982 |
%\end{definition} |
| 983 |
% |
| 984 |
%\begin{definition}[\DescribeMacro\LocaleAddToCurrencyAttributeList] |
| 985 |
%\cs{LocaleAddToCurrencyAttributeList}\marg{label}\marg{attribute}\marg{item} |
| 986 |
%\end{definition} |
| 987 |
% |
| 988 |
%\begin{definition}[\DescribeMacro\LocaleXpAddToCurrencyAttributeList] |
| 989 |
%\cs{LocaleXpAddToCurrencyAttributeList}\marg{label}\marg{attribute}\marg{item} |
| 990 |
%\end{definition} |
| 991 |
% |
| 992 |
%\begin{definition}[\DescribeMacro\LocaleIfInCurrencyAttributeList] |
| 993 |
%\cs{LocaleIfInCurrencyAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false} |
| 994 |
%\end{definition} |
| 995 |
% |
| 996 |
%\begin{definition}[\DescribeMacro\LocaleIfInCurrencyAttributeList] |
| 997 |
%\cs{LocaleIfXpInCurrencyAttributeList}\marg{label}\marg{attribute}\marg{item}\marg{true}\marg{false} |
| 998 |
%\end{definition} |
| 999 |
% |
| 1000 |
%\begin{definition}[\DescribeMacro\LocaleForEachInCurrencyAttributeList] |
| 1001 |
%\cs{LocaleForEachInCurrencyAttributeList}\marg{label}\marg{attribute}\marg{cs}\marg{body} |
| 1002 |
%\end{definition} |
| 1003 |
% |
| 1004 |
%\subsection{General Attributes} |
| 1005 |
%\label{sec:generalattr} |
| 1006 |
% |
| 1007 |
%The language tag attribute type \mattr{lang tag}{tagtodialect} is set using |
| 1008 |
%\begin{code} |
| 1009 |
%\cs{LocaleSetAttribute}\marg{label}\{tagtodialect\}\marg{value} |
| 1010 |
%\end{code} |
| 1011 |
%and can be accessed using |
| 1012 |
%\begin{code} |
| 1013 |
%\cs{LocaleGetAttribute}\marg{label}\{tagtodialect\} |
| 1014 |
%\end{code} |
| 1015 |
%The \meta{label} is a language tag (such as \texttt{de-CH-1996}) |
| 1016 |
%and the \meta{value} is the associated \sty{tracklang} dialect label |
| 1017 |
%(for example, \texttt{nswissgerman}). |
| 1018 |
%This attribute is used by \ics{selectlocale} to convert the language |
| 1019 |
%tag to the corresponding dialect label. |
| 1020 |
% |
| 1021 |
%If the time zone information was fetched with \app{texosquery}'s |
| 1022 |
%\texttt{-Z} switch, then the time zone IDs will be stored |
| 1023 |
%in the time zone \attr{timezone}{id} attribute list that can be fetched with |
| 1024 |
%\begin{verbatim} |
| 1025 |
%\LocaleGetAttribute{timezone}{id} |
| 1026 |
%\end{verbatim} |
| 1027 |
%or iterated over using \cs{LocaleForEachInAttributeList}. |
| 1028 |
%For example: |
| 1029 |
%\begin{verbatim} |
| 1030 |
%\def\LocaleIfDateTimePatternsSupported#1#2{#1} |
| 1031 |
% |
| 1032 |
%\input locale |
| 1033 |
% |
| 1034 |
%Time zone IDs: |
| 1035 |
% |
| 1036 |
%\LocaleForEachInAttributeList{timezone}{id}{\ThisId}{\ThisId\endgraf} |
| 1037 |
% |
| 1038 |
%\bye |
| 1039 |
%\end{verbatim} |
| 1040 |
%This simply lists all the known time zone identifiers. (Since |
| 1041 |
%\cs{LocaleForEachInAttributeList} is a short command, |
| 1042 |
%\cs{endgraf} is used to create a paragraph break in the above |
| 1043 |
%example.) |
| 1044 |
% |
| 1045 |
%There are two general currency attribute lists, where the |
| 1046 |
%\meta{label} is \texttt{currencies} and the attribute values |
| 1047 |
%are \attr{currencies}{official} for the list of official currency codes |
| 1048 |
%and \attr{currencies}{regional} for the regional currency codes. |
| 1049 |
%For example: |
| 1050 |
%\begin{verbatim} |
| 1051 |
%\def\LocaleMain{en-GB} |
| 1052 |
%\def\LocaleOther{en-IM,en-GG,fr-BE,nl-BE,de-DE-1996} |
| 1053 |
% |
| 1054 |
%\input locale |
| 1055 |
% |
| 1056 |
%Official: \LocaleGetAttribute{currencies}{official}. |
| 1057 |
%Regional: \LocaleGetAttribute{currencies}{regional}. |
| 1058 |
% |
| 1059 |
%\bye |
| 1060 |
%\end{verbatim} |
| 1061 |
%produces: |
| 1062 |
%\begin{quote} |
| 1063 |
%Official: GBP,EUR. Regional: GBP,IMP,GGP,EUR. |
| 1064 |
%\end{quote} |
| 1065 |
% |
| 1066 |
%You can iterate over these lists using |
| 1067 |
%\cs{LocaleForEachInAttributeList}. For example: |
| 1068 |
%\begin{verbatim} |
| 1069 |
%% arara: xetex: {shell: on} |
| 1070 |
%\font\nimbus="NimbusRoman-Regular" at 10pt |
| 1071 |
%\nimbus |
| 1072 |
% |
| 1073 |
%\def\LocaleMain{en-GB} |
| 1074 |
%\def\LocaleOther{en-IM,en-GG,fr-BE,nl-BE,de-DE-1996} |
| 1075 |
% |
| 1076 |
%\input locale |
| 1077 |
% |
| 1078 |
%\LocaleForEachInAttributeList{currencies}{regional}{\thiscode}% |
| 1079 |
%{\thiscode\ (\LocaleGetCurrencyAttribute{\thiscode}{sym}) } |
| 1080 |
% |
| 1081 |
%\bye |
| 1082 |
%\end{verbatim} |
| 1083 |
%which produces: |
| 1084 |
%\begin{quote} |
| 1085 |
%GBP (\pounds) IMP (M\pounds) GGP (\pounds) EUR (\texteuro) |
| 1086 |
%\end{quote} |
| 1087 |
% |
| 1088 |
%\subsection{Dialect Attributes} |
| 1089 |
%\label{sec:dialectattr} |
| 1090 |
% |
| 1091 |
%The following attributes are associated with dialects and can be set |
| 1092 |
%using |
| 1093 |
%\begin{code} |
| 1094 |
%\cs{LocaleSetDialectAttribute}\marg{dialect}\marg{attribute}\marg{value} |
| 1095 |
%\end{code} |
| 1096 |
%or fetched with |
| 1097 |
%\begin{code} |
| 1098 |
%\cs{LocaleGetDialectAttribute}\marg{dialect}\marg{attribute} |
| 1099 |
%\end{code} |
| 1100 |
%where \meta{dialect} is the \sty{tracklang} dialect label. |
| 1101 |
%Known values of \meta{attribute} are listed below. |
| 1102 |
% |
| 1103 |
%\subsubsection{General Dialect Attributes} |
| 1104 |
%\label{sec:dialectgenattr} |
| 1105 |
% |
| 1106 |
%\begin{itemize} |
| 1107 |
%\item\dattr{langtag}: the \meta{value} is the language tag associated with the |
| 1108 |
%dialect label \meta{dialect}. |
| 1109 |
%\item\dattr{langname}: the \meta{value} is the language name associated with the |
| 1110 |
%dialect label \meta{dialect}. |
| 1111 |
%\item\dattr{nativelangname}: the \meta{value} is the native language name |
| 1112 |
%associated with the dialect label \meta{dialect}. |
| 1113 |
%\item\dattr{regionname}: the \meta{value} is the region name associated with the |
| 1114 |
%dialect label \meta{dialect}. |
| 1115 |
%\item\dattr{nativeregionname}: the \meta{value} is the native region name |
| 1116 |
%associated with the dialect label \meta{dialect}. |
| 1117 |
%\item\dattr{variantname}: the \meta{value} is the variant name associated with the |
| 1118 |
%dialect label \meta{dialect}. |
| 1119 |
%\item\dattr{nativevariantname}: the \meta{value} is the native variant name associated with the |
| 1120 |
%dialect label \meta{dialect}. |
| 1121 |
%\end{itemize} |
| 1122 |
% |
| 1123 |
%\subsubsection{Dates and Times Dialect Attributes} |
| 1124 |
%\label{sec:attrdatetime} |
| 1125 |
% |
| 1126 |
%The commands described in \sectionref{sec:datetimes} use these attributes. |
| 1127 |
% |
| 1128 |
%\begin{itemize} |
| 1129 |
%\item\dattr{fulldate}: the \meta{value} is the full date associated with the |
| 1130 |
%dialect label \meta{dialect}. (Used by \ics{LocaleFullDate}.) |
| 1131 |
%\item\dattr{longdate}: the \meta{value} is the long date associated with the |
| 1132 |
%dialect label \meta{dialect}. (Used by \ics{LocaleLongDate}.) |
| 1133 |
%\item\dattr{meddate}: the \meta{value} is the medium date associated with the |
| 1134 |
%dialect label \meta{dialect}. (Used by \ics{LocaleMediumDate}.) |
| 1135 |
%\item\dattr{shortdate}: the \meta{value} is the short date associated with the |
| 1136 |
%dialect label \meta{dialect}. (Used by \ics{LocaleShortDate}.) |
| 1137 |
%\item\dattr{firstday}: the \meta{value} is the index of the first day of the week associated with the |
| 1138 |
%dialect label \meta{dialect}. (Used by \ics{LocaleFirstDayIndex}.) |
| 1139 |
%\item\dattr{fulltime}: the \meta{value} is the full time associated with the |
| 1140 |
%dialect label \meta{dialect}. (Used by \ics{LocaleFullTime}.) |
| 1141 |
%\item\dattr{longtime}: the \meta{value} is the long time associated with the |
| 1142 |
%dialect label \meta{dialect}. (Used by \ics{LocaleLongTime}.) |
| 1143 |
%\item\dattr{medtime}: the \meta{value} is the medium time associated with the |
| 1144 |
%dialect label \meta{dialect}. (Used by \ics{LocaleMediumTime}.) |
| 1145 |
%\item\dattr{shorttime}: the \meta{value} is the short time associated with the |
| 1146 |
%dialect label \meta{dialect}. (Used by \ics{LocaleShortTime}.) |
| 1147 |
%\item\dattr{fulldatetime}: the \meta{value} is the full date and time |
| 1148 |
%associated with the dialect label \meta{dialect}. (Used by |
| 1149 |
%\ics{LocaleFullDateTime}.) |
| 1150 |
%\item\dattr{longdatetime}: the \meta{value} is the long date and time |
| 1151 |
%associated with the dialect label \meta{dialect}. (Used by |
| 1152 |
%\ics{LocaleLongDateTime}.) |
| 1153 |
%\item\dattr{meddatetime}: the \meta{value} is the medium date and time |
| 1154 |
%associated with the dialect label \meta{dialect}. (Used by |
| 1155 |
%\ics{LocaleMediumDateTime}.) |
| 1156 |
%\item\dattr{shortdatetime}: the \meta{value} is the short date and time |
| 1157 |
%associated with the dialect label \meta{dialect}. (Used by |
| 1158 |
%\ics{LocaleShortDateTime}.) |
| 1159 |
%\end{itemize} |
| 1160 |
%Note that the combined date and time attributes (such as |
| 1161 |
%\attrfmt{fulldatetime}) aren't used by |
| 1162 |
%\ics{CurrentLocaleDateTime}. |
| 1163 |
% |
| 1164 |
%\paragraph{Patterns} |
| 1165 |
%The following attributes store date or time patterns (see |
| 1166 |
%\sectionref{sec:datetimepat}). |
| 1167 |
%\begin{itemize} |
| 1168 |
%\item\dattr{fulldatefmt}: the \meta{value} is the full date format associated |
| 1169 |
%with the dialect label \meta{dialect}. |
| 1170 |
%\item\dattr{longdatefmt}: the \meta{value} is the long date format associated |
| 1171 |
%with the dialect label \meta{dialect}. |
| 1172 |
%\item\dattr{meddatefmt}: the \meta{value} is the medium date format associated |
| 1173 |
%with the dialect label \meta{dialect}. |
| 1174 |
%\item\dattr{shortdatefmt}: the \meta{value} is the short date format associated |
| 1175 |
%with the dialect label \meta{dialect}. |
| 1176 |
%\item\dattr{fulltimefmt}: the \meta{value} is the full time format associated |
| 1177 |
%with the dialect label \meta{dialect}. |
| 1178 |
%\item\dattr{longtimefmt}: the \meta{value} is the long time format associated |
| 1179 |
%with the dialect label \meta{dialect}. |
| 1180 |
%\item\dattr{medtimefmt}: the \meta{value} is the medium time format associated |
| 1181 |
%with the dialect label \meta{dialect}. |
| 1182 |
%\item\dattr{shorttimefmt}: the \meta{value} is the short time format associated |
| 1183 |
%with the dialect label \meta{dialect}. |
| 1184 |
%\item\dattr{fulldatetimefmt}: the \meta{value} is the full date time format |
| 1185 |
%associated with the dialect label \meta{dialect}. |
| 1186 |
%\item\dattr{longdatetimefmt}: the \meta{value} is the long date time format |
| 1187 |
%associated with the dialect label \meta{dialect}. |
| 1188 |
%\item\dattr{meddatetimefmt}: the \meta{value} is the medium date time format |
| 1189 |
%associated with the dialect label \meta{dialect}. |
| 1190 |
%\item\dattr{shortdatetimefmt}: the \meta{value} is the short date time format |
| 1191 |
%associated with the dialect label \meta{dialect}. |
| 1192 |
%\end{itemize} |
| 1193 |
% |
| 1194 |
%\paragraph{Day Names} |
| 1195 |
% |
| 1196 |
%The commands \ics{LocaleDayName}, \ics{LocaleShortDayName}, |
| 1197 |
%\ics{LocaleStandaloneDayName} and \ics{LocaleStandaloneShortDayName} |
| 1198 |
%use these attributes. |
| 1199 |
% |
| 1200 |
%\begin{itemize} |
| 1201 |
%\item\dattr{day.0}: the \meta{value} is the name for day~0 (Monday) |
| 1202 |
%associated with the dialect label \meta{dialect}. |
| 1203 |
%\item\dattr{day.1}: the \meta{value} is the name for day~1 (Tuesday) |
| 1204 |
%associated with the dialect label \meta{dialect}. |
| 1205 |
%\item\dattr{day.2}: the \meta{value} is the name for day~2 (Wednesday) |
| 1206 |
%associated with the dialect label \meta{dialect}. |
| 1207 |
%\item\dattr{day.3}: the \meta{value} is the name for day~3 (Thursday) |
| 1208 |
%associated with the dialect label \meta{dialect}. |
| 1209 |
%\item\dattr{day.4}: the \meta{value} is the name for day~4 (Friday) |
| 1210 |
%associated with the dialect label \meta{dialect}. |
| 1211 |
%\item\dattr{day.5}: the \meta{value} is the name for day~5 (Saturday) |
| 1212 |
%associated with the dialect label \meta{dialect}. |
| 1213 |
%\item\dattr{day.6}: the \meta{value} is the name for day~6 (Sunday) |
| 1214 |
%associated with the dialect label \meta{dialect}. |
| 1215 |
%\item\dattr{shortday.0}: the \meta{value} is the short name for day~0 (Monday) |
| 1216 |
%associated with the dialect label \meta{dialect}. |
| 1217 |
%\item\dattr{shortday.1}: the \meta{value} is the short name for day~1 (Tuesday) |
| 1218 |
%associated with the dialect label \meta{dialect}. |
| 1219 |
%\item\dattr{shortday.2}: the \meta{value} is the short name for day~2 (Wednesday) |
| 1220 |
%associated with the dialect label \meta{dialect}. |
| 1221 |
%\item\dattr{shortday.3}: the \meta{value} is the short name for day~3 (Thursday) |
| 1222 |
%associated with the dialect label \meta{dialect}. |
| 1223 |
%\item\dattr{shortday.4}: the \meta{value} is the short name for day~4 (Friday) |
| 1224 |
%associated with the dialect label \meta{dialect}. |
| 1225 |
%\item\dattr{shortday.5}: the \meta{value} is the short name for day~5 (Saturday) |
| 1226 |
%associated with the dialect label \meta{dialect}. |
| 1227 |
%\item\dattr{shortday.6}: the \meta{value} is the short name for day~6 (Sunday) |
| 1228 |
%associated with the dialect label \meta{dialect}. |
| 1229 |
%\item\dattr{standalone.day.0}: the \meta{value} is the name for day~0 (Monday) |
| 1230 |
%associated with the dialect label \meta{dialect}. |
| 1231 |
%\item\dattr{standalone.day.1}: the \meta{value} is the standalone name for day~1 (Tuesday) |
| 1232 |
%associated with the dialect label \meta{dialect}. |
| 1233 |
%\item\dattr{standalone.day.2}: the \meta{value} is the standalone name for day~2 (Wednesday) |
| 1234 |
%associated with the dialect label \meta{dialect}. |
| 1235 |
%\item\dattr{standalone.day.3}: the \meta{value} is the standalone name for day~3 (Thursday) |
| 1236 |
%associated with the dialect label \meta{dialect}. |
| 1237 |
%\item\dattr{standalone.day.4}: the \meta{value} is the standalone name for day~4 (Friday) |
| 1238 |
%associated with the dialect label \meta{dialect}. |
| 1239 |
%\item\dattr{standalone.day.5}: the \meta{value} is the standalone name for day~5 (Saturday) |
| 1240 |
%associated with the dialect label \meta{dialect}. |
| 1241 |
%\item\dattr{standalone.day.6}: the \meta{value} is the standalone name for day~6 (Sunday) |
| 1242 |
%associated with the dialect label \meta{dialect}. |
| 1243 |
%\item\dattr{standalone.shortday.0}: the \meta{value} is the standalone short name for day~0 (Monday) |
| 1244 |
%associated with the dialect label \meta{dialect}. |
| 1245 |
%\item\dattr{standalone.shortday.1}: the \meta{value} is the standalone short name for day~1 (Tuesday) |
| 1246 |
%associated with the dialect label \meta{dialect}. |
| 1247 |
%\item\dattr{standalone.shortday.2}: the \meta{value} is the standalone short name for day~2 (Wednesday) |
| 1248 |
%associated with the dialect label \meta{dialect}. |
| 1249 |
%\item\dattr{standalone.shortday.3}: the \meta{value} is the standalone short name for day~3 (Thursday) |
| 1250 |
%associated with the dialect label \meta{dialect}. |
| 1251 |
%\item\dattr{standalone.shortday.4}: the \meta{value} is the standalone short name for day~4 (Friday) |
| 1252 |
%associated with the dialect label \meta{dialect}. |
| 1253 |
%\item\dattr{standalone.shortday.5}: the \meta{value} is the standalone short name for day~5 (Saturday) |
| 1254 |
%associated with the dialect label \meta{dialect}. |
| 1255 |
%\item\dattr{standalone.shortday.6}: the \meta{value} is the standalone short name for day~6 (Sunday) |
| 1256 |
%associated with the dialect label \meta{dialect}. |
| 1257 |
%\end{itemize} |
| 1258 |
% |
| 1259 |
%\paragraph{Month Names} |
| 1260 |
% |
| 1261 |
%The commands \ics{LocaleMonthName}, \ics{LocaleShortMonthName}, |
| 1262 |
%\ics{LocaleStandaloneMonthName} and \ics{LocaleStandaloneShortMonthName} |
| 1263 |
%use these attributes. |
| 1264 |
% |
| 1265 |
%\begin{itemize} |
| 1266 |
%\item\dattr{month.1}: the \meta{value} is the name for month~1 |
| 1267 |
%(January) associated with the dialect label \meta{dialect}. |
| 1268 |
%\item\dattr{month.2}: the \meta{value} is the name for month~2 |
| 1269 |
%(February) associated with the dialect label \meta{dialect}. |
| 1270 |
%\item\dattr{month.3}: the \meta{value} is the name for month~3 |
| 1271 |
%(March) associated with the dialect label \meta{dialect}. |
| 1272 |
%\item\dattr{month.4}: the \meta{value} is the name for month~4 |
| 1273 |
%(April) associated with the dialect label \meta{dialect}. |
| 1274 |
%\item\dattr{month.5}: the \meta{value} is the name for month~5 |
| 1275 |
%(May) associated with the dialect label \meta{dialect}. |
| 1276 |
%\item\dattr{month.6}: the \meta{value} is the name for month~6 |
| 1277 |
%(June) associated with the dialect label \meta{dialect}. |
| 1278 |
%\item\dattr{month.7}: the \meta{value} is the name for month~7 |
| 1279 |
%(July) associated with the dialect label \meta{dialect}. |
| 1280 |
%\item\dattr{month.8}: the \meta{value} is the name for month~8 |
| 1281 |
%(August) associated with the dialect label \meta{dialect}. |
| 1282 |
%\item\dattr{month.9}: the \meta{value} is the name for month~9 |
| 1283 |
%(September) associated with the dialect label \meta{dialect}. |
| 1284 |
%\item\dattr{month.10}: the \meta{value} is the name for month~10 |
| 1285 |
%(October) associated with the dialect label \meta{dialect}. |
| 1286 |
%\item\dattr{month.11}: the \meta{value} is the name for month~11 |
| 1287 |
%(November) associated with the dialect label \meta{dialect}. |
| 1288 |
%\item\dattr{month.12}: the \meta{value} is the name for month~12 |
| 1289 |
%(December) associated with the dialect label \meta{dialect}. |
| 1290 |
%\item\dattr{shortmonth.1}: the \meta{value} is the short name for month~1 |
| 1291 |
%(January) associated with the dialect label \meta{dialect}. |
| 1292 |
%\item\dattr{shortmonth.2}: the \meta{value} is the short name for month~2 |
| 1293 |
%(February) associated with the dialect label \meta{dialect}. |
| 1294 |
%\item\dattr{shortmonth.3}: the \meta{value} is the short name for month~3 |
| 1295 |
%(March) associated with the dialect label \meta{dialect}. |
| 1296 |
%\item\dattr{shortmonth.4}: the \meta{value} is the short name for month~4 |
| 1297 |
%(April) associated with the dialect label \meta{dialect}. |
| 1298 |
%\item\dattr{shortmonth.5}: the \meta{value} is the short name for month~5 |
| 1299 |
%(May) associated with the dialect label \meta{dialect}. |
| 1300 |
%\item\dattr{shortmonth.6}: the \meta{value} is the short name for month~6 |
| 1301 |
%(June) associated with the dialect label \meta{dialect}. |
| 1302 |
%\item\dattr{shortmonth.7}: the \meta{value} is the short name for month~7 |
| 1303 |
%(July) associated with the dialect label \meta{dialect}. |
| 1304 |
%\item\dattr{shortmonth.8}: the \meta{value} is the short name for month~8 |
| 1305 |
%(August) associated with the dialect label \meta{dialect}. |
| 1306 |
%\item\dattr{shortmonth.9}: the \meta{value} is the short name for month~9 |
| 1307 |
%(September) associated with the dialect label \meta{dialect}. |
| 1308 |
%\item\dattr{shortmonth.10}: the \meta{value} is the short name for month~10 |
| 1309 |
%(October) associated with the dialect label \meta{dialect}. |
| 1310 |
%\item\dattr{shortmonth.11}: the \meta{value} is the short name for month~11 |
| 1311 |
%(November) associated with the dialect label \meta{dialect}. |
| 1312 |
%\item\dattr{shortmonth.12}: the \meta{value} is the short name for month~12 |
| 1313 |
%(December) associated with the dialect label \meta{dialect}. |
| 1314 |
%\item\dattr{standalone.month.1}: the \meta{value} is the standalone name for month~1 |
| 1315 |
%(January) associated with the dialect label \meta{dialect}. |
| 1316 |
%\item\dattr{standalone.month.2}: the \meta{value} is the standalone name for month~2 |
| 1317 |
%(February) associated with the dialect label \meta{dialect}. |
| 1318 |
%\item\dattr{standalone.month.3}: the \meta{value} is the standalone name for month~3 |
| 1319 |
%(March) associated with the dialect label \meta{dialect}. |
| 1320 |
%\item\dattr{standalone.month.4}: the \meta{value} is the standalone name for month~4 |
| 1321 |
%(April) associated with the dialect label \meta{dialect}. |
| 1322 |
%\item\dattr{standalone.month.5}: the \meta{value} is the standalone name for month~5 |
| 1323 |
%(May) associated with the dialect label \meta{dialect}. |
| 1324 |
%\item\dattr{standalone.month.6}: the \meta{value} is the standalone name for month~6 |
| 1325 |
%(June) associated with the dialect label \meta{dialect}. |
| 1326 |
%\item\dattr{standalone.month.7}: the \meta{value} is the standalone name for month~7 |
| 1327 |
%(July) associated with the dialect label \meta{dialect}. |
| 1328 |
%\item\dattr{standalone.month.8}: the \meta{value} is the standalone name for month~8 |
| 1329 |
%(August) associated with the dialect label \meta{dialect}. |
| 1330 |
%\item\dattr{standalone.month.9}: the \meta{value} is the standalone name for month~9 |
| 1331 |
%(September) associated with the dialect label \meta{dialect}. |
| 1332 |
%\item\dattr{standalone.month.10}: the \meta{value} is the standalone name for month~10 |
| 1333 |
%(October) associated with the dialect label \meta{dialect}. |
| 1334 |
%\item\dattr{standalone.month.11}: the \meta{value} is the standalone name for month~11 |
| 1335 |
%(November) associated with the dialect label \meta{dialect}. |
| 1336 |
%\item\dattr{standalone.month.12}: the \meta{value} is the standalone name for month~12 |
| 1337 |
%(December) associated with the dialect label \meta{dialect}. |
| 1338 |
%\item\dattr{standalone.shortmonth.1}: the \meta{value} is the standalone short name for month~1 |
| 1339 |
%(January) associated with the dialect label \meta{dialect}. |
| 1340 |
%\item\dattr{standalone.shortmonth.2}: the \meta{value} is the standalone short name for month~2 |
| 1341 |
%(February) associated with the dialect label \meta{dialect}. |
| 1342 |
%\item\dattr{standalone.shortmonth.3}: the \meta{value} is the standalone short name for month~3 |
| 1343 |
%(March) associated with the dialect label \meta{dialect}. |
| 1344 |
%\item\dattr{standalone.shortmonth.4}: the \meta{value} is the standalone short name for month~4 |
| 1345 |
%(April) associated with the dialect label \meta{dialect}. |
| 1346 |
%\item\dattr{standalone.shortmonth.5}: the \meta{value} is the standalone short name for month~5 |
| 1347 |
%(May) associated with the dialect label \meta{dialect}. |
| 1348 |
%\item\dattr{standalone.shortmonth.6}: the \meta{value} is the standalone short name for month~6 |
| 1349 |
%(June) associated with the dialect label \meta{dialect}. |
| 1350 |
%\item\dattr{standalone.shortmonth.7}: the \meta{value} is the standalone short name for month~7 |
| 1351 |
%(July) associated with the dialect label \meta{dialect}. |
| 1352 |
%\item\dattr{standalone.shortmonth.8}: the \meta{value} is the standalone short name for month~8 |
| 1353 |
%(August) associated with the dialect label \meta{dialect}. |
| 1354 |
%\item\dattr{standalone.shortmonth.9}: the \meta{value} is the standalone short name for month~9 |
| 1355 |
%(September) associated with the dialect label \meta{dialect}. |
| 1356 |
%\item\dattr{standalone.shortmonth.10}: the \meta{value} is the standalone short name for month~10 |
| 1357 |
%(October) associated with the dialect label \meta{dialect}. |
| 1358 |
%\item\dattr{standalone.shortmonth.11}: the \meta{value} is the standalone short name for month~11 |
| 1359 |
%(November) associated with the dialect label \meta{dialect}. |
| 1360 |
%\item\dattr{standalone.shortmonth.12}: the \meta{value} is the standalone short name for month~12 |
| 1361 |
%(December) associated with the dialect label \meta{dialect}. |
| 1362 |
%\end{itemize} |
| 1363 |
% |
| 1364 |
%\subsubsection{Time Zones} |
| 1365 |
% |
| 1366 |
%These attributes won't be set if the time zone information wasn't |
| 1367 |
%fetched (with \app{texosquery}'s \texttt{-Z} switch). These attributes |
| 1368 |
%include the time zone identifier in the |
| 1369 |
%attribute label. (The list of known identifiers is stored |
| 1370 |
%in the \texttt{timezone} \attr{timezone}{id} attribute.) For example, \texttt{Europe/London} is the |
| 1371 |
%identifier for the UK time zone. So the attribute |
| 1372 |
%\texttt{timezone.Europe/London.short} is for the short name for that |
| 1373 |
%zone (\texttt{GMT}) and \texttt{timezone.Europe/London.shortdst} |
| 1374 |
%is for the short daylight saving name for that zone (\texttt{BST}). |
| 1375 |
% |
| 1376 |
%\begin{itemize} |
| 1377 |
%\item\dattr{timezone.\meta{zone}.short}: the \meta{value} is the |
| 1378 |
%short name for the zone identified by \meta{zone} |
| 1379 |
%associated with the dialect label \meta{dialect}. |
| 1380 |
%\item\dattr{timezone.\meta{zone}.long}: the \meta{value} is the |
| 1381 |
%long name for the zone identified by \meta{zone} |
| 1382 |
%associated with the dialect label \meta{dialect}. |
| 1383 |
%\item\dattr{timezone.\meta{zone}.shortdst}: the \meta{value} is the |
| 1384 |
%short daylight saving name for the zone identified by \meta{zone} |
| 1385 |
%associated with the dialect label \meta{dialect}. |
| 1386 |
%\item\dattr{timezone.\meta{zone}.longdst}: the \meta{value} is the |
| 1387 |
%long daylight saving name for the zone identified by \meta{zone} |
| 1388 |
%associated with the dialect label \meta{dialect}. |
| 1389 |
%\end{itemize} |
| 1390 |
% |
| 1391 |
%\subsubsection{Numeric} |
| 1392 |
%\label{sec:attrnum} |
| 1393 |
% |
| 1394 |
%\begin{itemize} |
| 1395 |
%\item\dattr{groupsep}: the \meta{value} is the numeric group |
| 1396 |
%separator associated with the dialect label \meta{dialect}. (Used by |
| 1397 |
%\ics{LocaleNumericGroupSep}.) |
| 1398 |
%\item\dattr{decsep}: the \meta{value} is the numeric decimal |
| 1399 |
%separator associated with the dialect label \meta{dialect}. (Used by |
| 1400 |
%\ics{LocaleNumericDecimalSep}.) |
| 1401 |
%\item\dattr{currencysep}: the \meta{value} is the numeric currency |
| 1402 |
%separator associated with the dialect label \meta{dialect}. (Used by |
| 1403 |
%\ics{LocaleNumericMonetarySep}.) |
| 1404 |
%\item\dattr{exp}: the \meta{value} is the exponent symbol associated |
| 1405 |
%with the dialect label \meta{dialect}. (Used by |
| 1406 |
%\ics{LocaleNumericExponent}.) |
| 1407 |
%\item\dattr{usesgroup}: the \meta{value} (either 1 or 0) indicates if |
| 1408 |
%the number group separator should be used |
| 1409 |
%with the dialect label \meta{dialect}. (Used by |
| 1410 |
%\ics{LocaleIfNumericUsesGroup}.) |
| 1411 |
%\item\dattr{percent}: the \meta{value} is the percentage symbol associated |
| 1412 |
%with the dialect label \meta{dialect}. (Used by |
| 1413 |
%\ics{LocaleNumericPercent}.) |
| 1414 |
%\item\dattr{permill}: the \meta{value} is the per mill symbol associated |
| 1415 |
%with the dialect label \meta{dialect}. (Used by |
| 1416 |
%\ics{LocaleNumericPermill}.) |
| 1417 |
%\item\dattr{decfmt}: the \meta{value} is the decimal format associated |
| 1418 |
%with the dialect label \meta{dialect}. (Used by |
| 1419 |
%\ics{CurrentLocaleDecimalPattern}.) |
| 1420 |
%\item\dattr{intfmt}: the \meta{value} is the integer format associated |
| 1421 |
%with the dialect label \meta{dialect}. (Used by |
| 1422 |
%\ics{CurrentLocaleIntegerPattern}.) |
| 1423 |
%\item\dattr{curfmt}: the \meta{value} is the currency format associated |
| 1424 |
%with the dialect label \meta{dialect}. (Used by |
| 1425 |
%\ics{CurrentLocaleCurrencyPattern}.) |
| 1426 |
%\item\dattr{perfmt}: the \meta{value} is the percent format associated |
| 1427 |
%with the dialect label \meta{dialect}. (Used by |
| 1428 |
%\ics{CurrentLocalePercentPattern}.) |
| 1429 |
%\item\dattr{currency}: the \meta{value} is the currency code associated |
| 1430 |
%with the dialect label \meta{dialect}. (Used by |
| 1431 |
%\ics{LocaleCurrencyLabel}.) |
| 1432 |
%\item\dattr{regionalcurrency}: the \meta{value} is the regional currency code |
| 1433 |
%associated with the dialect label \meta{dialect}. (Used by |
| 1434 |
%\ics{LocaleCurrencyRegionalLabel}.) |
| 1435 |
%\item\dattr{currencysym}: the \meta{value} is the currency symbol associated |
| 1436 |
%with the dialect label \meta{dialect}. (Used by |
| 1437 |
%\ics{LocaleCurrencySymbol}, if the \attrfmt{currency} |
| 1438 |
%attribute isn't \texttt{XXX}.) |
| 1439 |
%\item\dattr{currencytex}: the \meta{value} is the \TeX\ code |
| 1440 |
%representing the currency symbol associated |
| 1441 |
%with the dialect label \meta{dialect}. (Used by |
| 1442 |
%\ics{LocaleCurrencyTeXSymbol}, if the \attrfmt{currency} |
| 1443 |
%attribute isn't \texttt{XXX}.) |
| 1444 |
%\end{itemize} |
| 1445 |
% |
| 1446 |
%Note that the currency information is also available through |
| 1447 |
%the currency attributes \cattr{official}, \cattr{sym} and \cattr{tex}. |
| 1448 |
%The dialect attribute allows for a different symbol to be |
| 1449 |
%used within the context of a specific dialect. For example, |
| 1450 |
%if a country has multiple scripts (such as Latin and Cyrillic) |
| 1451 |
%then the dialect currency symbol can reflect a specific script, |
| 1452 |
%whereas the currency \cattr{sym} attribute might be in the default |
| 1453 |
%script. |
| 1454 |
% |
| 1455 |
% |
| 1456 |
%\subsection{Region Attributes} |
| 1457 |
%\label{sec:regionattr} |
| 1458 |
% |
| 1459 |
%The following attributes are associated with region and can be set |
| 1460 |
%using |
| 1461 |
%\begin{code} |
| 1462 |
%\cs{LocaleSetRegionAttribute}\marg{region code}\marg{attribute}\marg{value} |
| 1463 |
%\end{code} |
| 1464 |
%or fetched with |
| 1465 |
%\begin{code} |
| 1466 |
%\cs{LocaleGetRegionAttribute}\marg{region code}\marg{attribute} |
| 1467 |
%\end{code} |
| 1468 |
% |
| 1469 |
%\begin{itemize} |
| 1470 |
%\item\rattr{currency}: the regional currency code (for |
| 1471 |
%example, \texttt{IMP}). |
| 1472 |
%\item\rattr{dialect}: a comma-separated list of the dialects |
| 1473 |
%associated with this region. For example: |
| 1474 |
%\begin{verbatim} |
| 1475 |
%\def\LocaleMain{en-GB} |
| 1476 |
%\def\LocaleOther{fr-BE,nl-BE} |
| 1477 |
%\input locale |
| 1478 |
% |
| 1479 |
%GB: \LocaleGetRegionAttribute{GB}{dialect}. |
| 1480 |
%BE: \LocaleGetRegionAttribute{BE}{dialect}. |
| 1481 |
% |
| 1482 |
%\bye |
| 1483 |
%\end{verbatim} |
| 1484 |
%produces: GB: british. BE: belgique,flemish. |
| 1485 |
%\end{itemize} |
| 1486 |
% |
| 1487 |
% |
| 1488 |
%\subsection{Currency Attributes} |
| 1489 |
%\label{sec:currencyattr} |
| 1490 |
% |
| 1491 |
%The following attributes are associated with currency and can be set |
| 1492 |
%using |
| 1493 |
%\begin{code} |
| 1494 |
%\cs{LocaleSetCurrencyAttribute}\marg{code}\marg{attribute}\marg{value} |
| 1495 |
%\end{code} |
| 1496 |
%or fetched with |
| 1497 |
%\begin{code} |
| 1498 |
%\cs{LocaleGetCurrencyAttribute}\marg{code}\marg{attribute} |
| 1499 |
%\end{code} |
| 1500 |
%where \meta{code} is the ISO currency code or regional currency |
| 1501 |
%code. |
| 1502 |
% |
| 1503 |
%\begin{itemize} |
| 1504 |
%\item\cattr{region}: a comma-separated list of regions that |
| 1505 |
%use this currency. If the regional currency code is different from |
| 1506 |
%the official ISO currency code, then both codes will have this |
| 1507 |
%attribute set. For example: |
| 1508 |
%\begin{verbatim} |
| 1509 |
%\def\LocaleMain{en-GB} |
| 1510 |
%\def\LocaleOther{en-IM} |
| 1511 |
% |
| 1512 |
%\input locale |
| 1513 |
% |
| 1514 |
%GBP: \LocaleGetCurrencyAttribute{GBP}{region}. |
| 1515 |
%IMP: \LocaleGetCurrencyAttribute{IMP}{region}. |
| 1516 |
% |
| 1517 |
%\bye |
| 1518 |
%\end{verbatim} |
| 1519 |
%produces: GBP: GB,IM. IMP: IM. |
| 1520 |
% |
| 1521 |
%\item \cattr{official}: the official ISO currency code for |
| 1522 |
%\meta{code}. In most cases this will be the same as \meta{code}. |
| 1523 |
%For example: |
| 1524 |
%\begin{verbatim} |
| 1525 |
%\def\LocaleMain{en-GB} |
| 1526 |
%\def\LocaleOther{en-IM} |
| 1527 |
% |
| 1528 |
%\input locale |
| 1529 |
% |
| 1530 |
%GBP: \LocaleGetCurrencyAttribute{GBP}{official}. |
| 1531 |
%IMP: \LocaleGetCurrencyAttribute{IMP}{official}. |
| 1532 |
% |
| 1533 |
%\bye |
| 1534 |
%\end{verbatim} |
| 1535 |
%produces: GBP: GBP. IMP: GBP. |
| 1536 |
% |
| 1537 |
%\item\cattr{sym}: the currency symbol (using characters, not |
| 1538 |
%\TeX\ commands, except for \verb|\$|) for regional currency |
| 1539 |
%\meta{code}. |
| 1540 |
% |
| 1541 |
%\item\cattr{tex}: the currency symbol using \TeX\ code (such |
| 1542 |
%as \cs{texosquerycurrencypound}) for regional currency |
| 1543 |
%\meta{code}. |
| 1544 |
%\end{itemize} |
| 1545 |
% |
| 1546 |
%\section{Patterns} |
| 1547 |
%\label{sec:patterns} |
| 1548 |
% |
| 1549 |
%The \sty{texosquery} package provides for two types of patterns: |
| 1550 |
%date-time and numeric. The date-time patterns may just display a |
| 1551 |
%date, or just a time or both. They may or may not include a time |
| 1552 |
%zone. The numeric patterns can be used to format integers, decimals, |
| 1553 |
%scientific notation, percentages or currency. New patterns can be |
| 1554 |
%defined by commands provided in \file{texosquery.tex}. The |
| 1555 |
%\sty{tex-locale} package can also fetch the patterns for the document |
| 1556 |
%locales so that they can be applied to data in the document |
| 1557 |
%to match the current locale. |
| 1558 |
% |
| 1559 |
%The numeric patterns are fairly easy to use but are tricky to |
| 1560 |
%define. The date-time patterns are fairly easy to define but are |
| 1561 |
%tricky to use. |
| 1562 |
% |
| 1563 |
%\subsection{Numeric Patterns} |
| 1564 |
%\label{sec:numpatterns} |
| 1565 |
% |
| 1566 |
%The \sty{texosquery} numeric pattern symbol commands are redefined |
| 1567 |
%by \sty{tex-locale} to use the appropriate symbol from the current |
| 1568 |
%locale. For example, \ics{texosquerypatfmtgroupsep} is redefined to |
| 1569 |
%use \cs{CurrentLocaleNumericGroupSep}. (See the \sty{texosquery} |
| 1570 |
%documentation for further details of these pattern commands.) |
| 1571 |
% |
| 1572 |
%You can access a numeric pattern for a particular locale by querying |
| 1573 |
%one of the dialect attributes listed in \sectionref{sec:attrnum}: \dattr{intfmt} (integer pattern), |
| 1574 |
%\dattr{decfmt} (decimal pattern), \dattr{curfmt} (currency pattern) or |
| 1575 |
%\dattr{perfmt} (percent pattern). |
| 1576 |
% |
| 1577 |
%These can be accessed explicitly using |
| 1578 |
%\begin{definition} |
| 1579 |
%\ics{LocaleGetDialectAttribute}\marg{dialect}\marg{attribute} |
| 1580 |
%\end{definition} |
| 1581 |
%For example: |
| 1582 |
%\begin{verbatim} |
| 1583 |
%\LocaleGetDialectAttribute{british}{intfmt} |
| 1584 |
%\end{verbatim} |
| 1585 |
%However it's simpler to use the shortcut commands described in |
| 1586 |
%\sectionref{sec:currpat}. For example: |
| 1587 |
%\begin{verbatim} |
| 1588 |
%\CurrentLocaleIntegerPattern |
| 1589 |
%\end{verbatim} |
| 1590 |
% |
| 1591 |
%A pattern can be used in two ways. If it's simply used in the |
| 1592 |
%document, then it just reproduces the pattern specification. For |
| 1593 |
%example: |
| 1594 |
%\begin{verbatim} |
| 1595 |
%\def\LocaleMain{en-GB} |
| 1596 |
%\input locale |
| 1597 |
% |
| 1598 |
%{\tt \CurrentLocaleDecimalPattern} |
| 1599 |
%\bye |
| 1600 |
%\end{verbatim} |
| 1601 |
%This simply produces: |
| 1602 |
%\begin{quote} |
| 1603 |
%\texttt{\#,\#\#\#,\#\#\#,\#\#0.\#\#\#\#\#\#\#\#\#\#} |
| 1604 |
%\end{quote} |
| 1605 |
%This can be used for debugging purposes to check the pattern. |
| 1606 |
% |
| 1607 |
%The second use is to apply the pattern to a number. This is done |
| 1608 |
%with \sty{texosquery}'s \cs{texosqueryfmtnumber} command: |
| 1609 |
%\begin{definition} |
| 1610 |
%\ics{texosqueryfmtnumber}\marg{pattern}\marg{int part}\marg{frac |
| 1611 |
%part}\marg{mantissa} |
| 1612 |
%\end{definition} |
| 1613 |
%where \meta{pattern} is the pattern (defined using |
| 1614 |
%\cs{texosquerydefpattern} or fetched with the \app{texosquery} |
| 1615 |
%application), \meta{int part} is the integer part, \meta{frac part} |
| 1616 |
%is the fractional part and \meta{mantissa} is the exponent part. |
| 1617 |
% |
| 1618 |
%For example: |
| 1619 |
%\begin{verbatim} |
| 1620 |
%% arara: xetex: {shell: on} |
| 1621 |
% |
| 1622 |
%\def\LocaleMain{en-GB} |
| 1623 |
%\input locale |
| 1624 |
% |
| 1625 |
%\texosqueryfmtnumber{\CurrentLocaleIntegerPattern}{12}{34567}{4} |
| 1626 |
% |
| 1627 |
%\texosqueryfmtnumber{\CurrentLocaleCurrencyPattern}{12345}{67}{0} |
| 1628 |
% |
| 1629 |
%\texosqueryfmtnumber{\CurrentLocaleDecimalPattern}{123}{4567}{2} |
| 1630 |
% |
| 1631 |
%\texosqueryfmtnumber{\CurrentLocalePercentPattern}{123}{4567}{2} |
| 1632 |
%\bye |
| 1633 |
%\end{verbatim} |
| 1634 |
%This produces: |
| 1635 |
%\begin{quote} |
| 1636 |
%123,456 |
| 1637 |
% |
| 1638 |
%GBP12,345.67 |
| 1639 |
% |
| 1640 |
%12,345.67 |
| 1641 |
% |
| 1642 |
%1,234,567\% |
| 1643 |
%\end{quote} |
| 1644 |
%There are some shortcut commands provided, to allow for more |
| 1645 |
%convenient code. |
| 1646 |
% |
| 1647 |
%A numeric pattern can be applied to a numeric value using |
| 1648 |
%\begin{definition}[\DescribeMacro\localenumfmt] |
| 1649 |
%\cs{localenumfmt}\marg{pattern}\marg{decimal} |
| 1650 |
%\end{definition} |
| 1651 |
%where \meta{pattern} is the pattern (as for \cs{texosqueryfmtnumber}) |
| 1652 |
%and \meta{decimal} is the numeric value in the form |
| 1653 |
%\meta{int}\texttt{.}\meta{frac}\texttt{E}\meta{mantissa} |
| 1654 |
%(where \texttt{.} represents the decimal separator and \texttt{E} represents |
| 1655 |
%the exponent separator, regardless of locale). The \texttt{.}\meta{frac} and |
| 1656 |
%\texttt{E}\meta{mantissa} parts are optional. |
| 1657 |
% |
| 1658 |
%The \cs{localenumfmt} command splits up \meta{decimal} into the |
| 1659 |
%\meta{int part}, \meta{frac part} and \meta{mantissa} required by |
| 1660 |
%\cs{texosqueryfmtnumber}. It then does |
| 1661 |
%\begin{code} |
| 1662 |
%\meta{fmt cs}\{\cs{texosqueryfmtnumber}\marg{pattern}\marg{int part}\marg{frac part}\marg{mantissa} |
| 1663 |
%\end{code} |
| 1664 |
%where \meta{fmt cs} is one of: |
| 1665 |
%\begin{definition}[\DescribeMacro\localenumfmtneg] |
| 1666 |
%\cs{localenumfmtneg}\marg{text} |
| 1667 |
%\end{definition} |
| 1668 |
%if the \meta{int part} is negative, |
| 1669 |
%\begin{definition}[\DescribeMacro\localenumfmtzero] |
| 1670 |
%\cs{localenumfmtzero}\marg{text} |
| 1671 |
%\end{definition} |
| 1672 |
%if the \meta{int part}, \meta{frac part} and \meta{mantissa} are all |
| 1673 |
%zero, otherwise |
| 1674 |
%\begin{definition}[\DescribeMacro\localenumfmtpos] |
| 1675 |
%\cs{localenumfmtpos}\marg{text} |
| 1676 |
%\end{definition} |
| 1677 |
%These three commands all simply default to just doing \meta{text}. |
| 1678 |
% |
| 1679 |
%\begin{definition}[\DescribeMacro\localeint] |
| 1680 |
%\cs{localeint}\marg{value} |
| 1681 |
%\end{definition} |
| 1682 |
%This is equivalent to |
| 1683 |
%\begin{definition} |
| 1684 |
%\cs{localenumfmt}\{\cs{CurrentLocaleIntegerPattern}\}\marg{value} |
| 1685 |
%\end{definition} |
| 1686 |
% |
| 1687 |
%\begin{definition}[\DescribeMacro\localedec] |
| 1688 |
%\cs{localedec}\marg{decimal} |
| 1689 |
%\end{definition} |
| 1690 |
%As above but uses \cs{CurrentLocaleDecimalPattern}. |
| 1691 |
% |
| 1692 |
%\begin{definition}[\DescribeMacro\localecur] |
| 1693 |
%\cs{localecur}\marg{decimal} |
| 1694 |
%\end{definition} |
| 1695 |
%As above but uses \cs{CurrentLocaleCurrencyPattern}. |
| 1696 |
% |
| 1697 |
%\begin{definition}[\DescribeMacro\localeper] |
| 1698 |
%\cs{localeper}\marg{decimal} |
| 1699 |
%\end{definition} |
| 1700 |
%As above but uses \cs{CurrentLocalePercentPattern}. |
| 1701 |
% |
| 1702 |
%The above example can be simplified to: |
| 1703 |
%\begin{verbatim} |
| 1704 |
%\def\LocaleMain{en-GB} |
| 1705 |
%\input locale |
| 1706 |
% |
| 1707 |
%\localeint{12.34567E4} |
| 1708 |
% |
| 1709 |
%\localecur{12345.67} |
| 1710 |
% |
| 1711 |
%\localedec{123.4567E2} |
| 1712 |
% |
| 1713 |
%\localeper{123.4567E2} |
| 1714 |
%\bye |
| 1715 |
%\end{verbatim} |
| 1716 |
%This produces the same result as before. |
| 1717 |
% |
| 1718 |
%As described in \sectionref{sec:currnumsym}, the currency unit can |
| 1719 |
%be switched to a symbol by redefining \cs{localecurrchoice}. For |
| 1720 |
%example: |
| 1721 |
%\begin{verbatim} |
| 1722 |
%\font\nimbus="NimbusRoman-Regular" at 10pt |
| 1723 |
%\nimbus |
| 1724 |
% |
| 1725 |
%\def\LocaleMain{en-GB} |
| 1726 |
%\def\LocaleOther{pt-BR,de-CH-1996} |
| 1727 |
%\input locale |
| 1728 |
% |
| 1729 |
%\def\localecurrchoice#1#2#3#4{#3} |
| 1730 |
% |
| 1731 |
%en-GB: \localecur{12345.67} |
| 1732 |
% |
| 1733 |
%\selectlocale{pt-BR} |
| 1734 |
%pt-BR: \localecur{12345.67} |
| 1735 |
% |
| 1736 |
%\selectlocale{de-CH-1996} |
| 1737 |
%de-CH-1996: \localecur{12345.67} |
| 1738 |
% |
| 1739 |
%\bye |
| 1740 |
%\end{verbatim} |
| 1741 |
%This produces: |
| 1742 |
%\begin{quote} |
| 1743 |
%en-GB: \pounds 12,345.67 |
| 1744 |
% |
| 1745 |
%pt-BR: R\$ 12.345,67 |
| 1746 |
% |
| 1747 |
%de-CH-1996: SFr. 12'345.67 |
| 1748 |
%\end{quote} |
| 1749 |
% |
| 1750 |
%You can define your own pattern using the commands provided by |
| 1751 |
%\sty{texosquery}. For example: |
| 1752 |
%\begin{verbatim} |
| 1753 |
%\texosquerydefpattern{\sinumpattern}{% |
| 1754 |
% \sinumfmt |
| 1755 |
% {\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\#\#\#\#\#\#\#\#\#}}% |
| 1756 |
% {\-\#\#\#\#\#\#\#\#\0\0}% |
| 1757 |
%} |
| 1758 |
%\end{verbatim} |
| 1759 |
%This can then be used with \cs{localenumfmt}. The \sty{texosquery} |
| 1760 |
%documentation includes other examples, including a currency pattern |
| 1761 |
%that shifts the sign before the currency symbol for negative |
| 1762 |
%amounts: |
| 1763 |
%\begin{verbatim} |
| 1764 |
%\texosquerydefpattern{\curpattern}{% |
| 1765 |
%\pmnumfmt |
| 1766 |
%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{}}% |
| 1767 |
%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{\-}}} |
| 1768 |
%\end{verbatim} |
| 1769 |
%(No sign is used for positive amounts.) |
| 1770 |
% |
| 1771 |
%Here's a complete document: |
| 1772 |
%\begin{verbatim} |
| 1773 |
%\font\nimbus="NimbusRoman-Regular" at 10pt |
| 1774 |
%\nimbus |
| 1775 |
% |
| 1776 |
%\def\LocaleMain{en-GB} |
| 1777 |
%\def\LocaleOther{pt-BR,de-CH-1996} |
| 1778 |
%\input locale |
| 1779 |
% |
| 1780 |
%\def\localecurrchoice#1#2#3#4{#3} |
| 1781 |
% |
| 1782 |
%\texosquerydefpattern{\sinumpattern}{% |
| 1783 |
% \sinumfmt |
| 1784 |
% {\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\#\#\#\#\#\#\#\#\#}}% |
| 1785 |
% {\-\#\#\#\#\#\#\#\#\0\0}% |
| 1786 |
%} |
| 1787 |
% |
| 1788 |
%\texosquerydefpattern{\curpattern}{% |
| 1789 |
%\pmnumfmt |
| 1790 |
%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{}}% |
| 1791 |
%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{\-}}} |
| 1792 |
% |
| 1793 |
%en-GB: |
| 1794 |
%\localenumfmt{\sinumpattern}{1.2345E-3}. |
| 1795 |
%\localenumfmt{\curpattern}{12345.6}. |
| 1796 |
%\localenumfmt{\curpattern}{-12345.6}. |
| 1797 |
%\localenumfmt{\curpattern}{0}. |
| 1798 |
% |
| 1799 |
%\selectlocale{pt-BR} |
| 1800 |
%pt-BR: |
| 1801 |
%\localenumfmt{\sinumpattern}{1.2345E-3}. |
| 1802 |
%\localenumfmt{\curpattern}{12345.6}. |
| 1803 |
%\localenumfmt{\curpattern}{-12345.6}. |
| 1804 |
%\localenumfmt{\curpattern}{0}. |
| 1805 |
% |
| 1806 |
%\selectlocale{de-CH-1996} |
| 1807 |
%de-CH-1996: |
| 1808 |
%\localenumfmt{\sinumpattern}{1.2345E-3}. |
| 1809 |
%\localenumfmt{\curpattern}{12345.6}. |
| 1810 |
%\localenumfmt{\curpattern}{-12345.6}. |
| 1811 |
%\localenumfmt{\curpattern}{0}. |
| 1812 |
% |
| 1813 |
%\bye |
| 1814 |
%\end{verbatim} |
| 1815 |
%This produces: |
| 1816 |
%\begin{quote} |
| 1817 |
%en-GB: 1.2345E$-$03. \pounds 12,345.60. $-$\pounds12,345.60. |
| 1818 |
%\pounds0.00. |
| 1819 |
% |
| 1820 |
%pt-BR: 1,2345E$-$03. R\$12.345,60. $-$R\$12.345,60. |
| 1821 |
%R\$0,00. |
| 1822 |
% |
| 1823 |
%de-CH-1996: 1.2345E$-$03. SFr.12'345.60. $-$SFr.12'345.60. |
| 1824 |
%SFr.0.00. |
| 1825 |
%\end{quote} |
| 1826 |
% |
| 1827 |
%Here's a \LaTeX\ alternative that redefines the formatting commands |
| 1828 |
%used by \cs{localenumfmt}: |
| 1829 |
%\begin{verbatim} |
| 1830 |
%\documentclass{article} |
| 1831 |
% |
| 1832 |
%\usepackage{color} |
| 1833 |
%\usepackage[main={en-GB},other={pt-BR,de-CH-1996}]{tex-locale} |
| 1834 |
%\setmainfont{NimbusRoman-Regular} |
| 1835 |
% |
| 1836 |
%\texosquerydefpattern{\sinumpattern}{% |
| 1837 |
% \sinumfmt |
| 1838 |
% {\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\#\#\#\#\#\#\#\#\#}}% |
| 1839 |
% {\-\#\#\#\#\#\#\#\#\0\0}% |
| 1840 |
%} |
| 1841 |
% |
| 1842 |
%\texosquerydefpattern{\curpattern}{% |
| 1843 |
%\pmnumfmt |
| 1844 |
%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{}}% |
| 1845 |
%{\pcur{\decfmt{\#\,\#\#\#\,\#\#\#\,\#\#\0}{\0\0\#\#\#\#\#\#\#\#}}{\-}}} |
| 1846 |
% |
| 1847 |
%\renewcommand*{\localenumfmtpos}[1]{\textcolor{green}{#1}} |
| 1848 |
%\renewcommand*{\localenumfmtneg}[1]{\textcolor{red}{#1}} |
| 1849 |
%\renewcommand*{\localenumfmtzero}[1]{\textbf{#1}} |
| 1850 |
% |
| 1851 |
%\begin{document} |
| 1852 |
% |
| 1853 |
%en-GB: |
| 1854 |
%\localenumfmt{\sinumpattern}{1.2345E-3}. |
| 1855 |
%\localenumfmt{\curpattern}{12345.6}. |
| 1856 |
%\localenumfmt{\curpattern}{-12345.6}. |
| 1857 |
%\localenumfmt{\curpattern}{0}. |
| 1858 |
% |
| 1859 |
%\selectlocale{pt-BR} |
| 1860 |
%pt-BR: |
| 1861 |
%\localenumfmt{\sinumpattern}{1.2345E-3}. |
| 1862 |
%\localenumfmt{\curpattern}{12345.6}. |
| 1863 |
%\localenumfmt{\curpattern}{-12345.6}. |
| 1864 |
%\localenumfmt{\curpattern}{0}. |
| 1865 |
% |
| 1866 |
%\selectlocale{de-CH-1996} |
| 1867 |
%de-CH-1996: |
| 1868 |
%\localenumfmt{\sinumpattern}{1.2345E-3}. |
| 1869 |
%\localenumfmt{\curpattern}{12345.6}. |
| 1870 |
%\localenumfmt{\curpattern}{-12345.6}. |
| 1871 |
%\localenumfmt{\curpattern}{0}. |
| 1872 |
%\end{document} |
| 1873 |
%\end{verbatim} |
| 1874 |
%This produces: |
| 1875 |
%\begin{quote} |
| 1876 |
%en-GB: \textcolor{green}{1.2345E$-$03}. |
| 1877 |
%\textcolor{green}{\pounds 12,345.60}. |
| 1878 |
%\textcolor{red}{$-$\pounds12,345.60}. |
| 1879 |
%\textbf{\pounds0.00}. |
| 1880 |
% |
| 1881 |
%pt-BR: \textcolor{green}{1,2345E$-$03}. |
| 1882 |
%\textcolor{green}{R\$12.345,60}. |
| 1883 |
%\textcolor{red}{$-$R\$12.345,60}. |
| 1884 |
%\textbf{R\$0,00}. |
| 1885 |
% |
| 1886 |
%de-CH-1996: \textcolor{green}{1.2345E$-$03}. |
| 1887 |
%\textcolor{green}{SFr.12'345.60}. |
| 1888 |
%\textcolor{red}{$-$SFr.12'345.60}. |
| 1889 |
%\textbf{SFr.0.00}. |
| 1890 |
%\end{quote} |
| 1891 |
% |
| 1892 |
%\subsection{Date-Time Patterns} |
| 1893 |
%\label{sec:datetimepat} |
| 1894 |
% |
| 1895 |
%In addition to providing locale-sensitive strings for the current |
| 1896 |
%date-time, the \app{texosquery} application can also provide the |
| 1897 |
%locale's pattern that's used to describe how the dates and times |
| 1898 |
%should be formatted. Additionally, it can provide time-zone mappings |
| 1899 |
%from identifying labels to locale-sensitive names. Both these things |
| 1900 |
%require extra overhead and so these functions aren't on by default. |
| 1901 |
% |
| 1902 |
%You can enable them by defining |
| 1903 |
%\begin{definition}[\DescribeMacro\LocaleIfDateTimePatternsSupported] |
| 1904 |
%\cs{LocaleIfDateTimePatternsSupported}\marg{true}\marg{false} |
| 1905 |
%\end{definition} |
| 1906 |
%\emph{before} you input \file{tex-locale.tex}. \LaTeX\ users can use the |
| 1907 |
%more convenient \pkgopt{timedata} package option: |
| 1908 |
%\begin{verbatim} |
| 1909 |
%\usepackage[timedata]{tex-locale} |
| 1910 |
%\end{verbatim} |
| 1911 |
%Plain \TeX\ users need to define |
| 1912 |
%\cs{LocaleIfDateTimePatternsSupported} so that it does the \meta{true} |
| 1913 |
%argument and ignores the \meta{false} argument: |
| 1914 |
%\begin{verbatim} |
| 1915 |
%\def\LocaleIfDateTimePatternsSupported#1#2{#1} |
| 1916 |
%\input locale |
| 1917 |
%\end{verbatim} |
| 1918 |
% |
| 1919 |
%If enabled, \sty{tex-locale} will add the \texttt{-M} and \texttt{-Z} |
| 1920 |
%switches to the \app{texosquery} command invocation. This will |
| 1921 |
%additionally redefine \sty{texosquery}'s pattern format commands |
| 1922 |
%(such as \cs{texosqueryfmtpatMMM}) to use the appropriate commands |
| 1923 |
%for the current locale. For example, \cs{texosqueryfmtpatMMM}\marg{n} is |
| 1924 |
%redefined to use \cs{CurrentLocaleShortMonthName}\marg{n}. (See the |
| 1925 |
%\sty{texosquery} documentation for further details on these |
| 1926 |
%commands.) |
| 1927 |
% |
| 1928 |
%If date-time patterns are supported then the current date-time data will be |
| 1929 |
%stored in |
| 1930 |
%\begin{definition}[\DescribeMacro\LocaleDateTimeInfo] |
| 1931 |
%\cs{LocaleDateTimeInfo} |
| 1932 |
%\end{definition} |
| 1933 |
%This will be empty if date-time patterns aren't supported. |
| 1934 |
% |
| 1935 |
%The value of this command contains all the information for the current date-time provided |
| 1936 |
%in a format that can easily be parsed by date or time patterns. |
| 1937 |
%(This is done through \sty{texosquery}'s \ics{texosqueryfmtdatetime} |
| 1938 |
%command, which is internally used by |
| 1939 |
%\ics{LocaleApplyDateTimePattern}, described below.) |
| 1940 |
%For example, \cs{LocaleDateTimeInfo} might be set to |
| 1941 |
%\begin{verbatim} |
| 1942 |
%{1}{2017}{2017}{3}{12}{4}{85}{26}{4}{7}{1}{19}{19}{7}{7}{16}{39}{136} |
| 1943 |
%{{1}{0}{Europe/London}{1}} |
| 1944 |
%\end{verbatim} |
| 1945 |
%(Line break inserted above for clarity.) See the \sty{texosquery} |
| 1946 |
%documentation for details of this syntax. |
| 1947 |
% |
| 1948 |
%Alternatively you can use \sty{texosquery}'s pattern generator to |
| 1949 |
%create your own date-time pattern and explicitly use |
| 1950 |
%\cs{texosqueryfmtdatetime}. In which case \cs{LocaleDateTimeInfo} |
| 1951 |
%provides a convenient way of applying the pattern to the current |
| 1952 |
%date-time. For example: |
| 1953 |
%\begin{verbatim} |
| 1954 |
%\def\LocaleIfDateTimePatternsSupported#1#2{#1} |
| 1955 |
%\def\LocaleMain{en-GB} |
| 1956 |
%\input locale |
| 1957 |
% |
| 1958 |
%\texosquerydefpattern{\pattern}{\%3E \%1d \%3M \%4y \%2H:\%2m:\%2s \%2z} |
| 1959 |
% |
| 1960 |
%\ifx\LocaleDateTimeInfo\empty |
| 1961 |
%\else |
| 1962 |
% \expandafter\texosqueryfmtdatetime\expandafter\pattern\LocaleDateTimeInfo |
| 1963 |
%\fi |
| 1964 |
%\bye |
| 1965 |
%\end{verbatim} |
| 1966 |
%This produces: |
| 1967 |
%\begin{quote} |
| 1968 |
%Sun 26 Mar 2017 21:38:06 BST |
| 1969 |
%\end{quote} |
| 1970 |
%(assuming that was the date and time of the document build). The |
| 1971 |
%textual elements (\qt{Sun}, \qt{Mar} and \qt{BST}) are obtained from |
| 1972 |
%the current locale. |
| 1973 |
% |
| 1974 |
%If the date-time patterns are supported, you can apply a pattern to |
| 1975 |
%a specific date or time using |
| 1976 |
%\begin{definition}[\DescribeMacro\LocaleApplyDateTimePattern] |
| 1977 |
%\cs{LocaleApplyDateTimePattern}\marg{dialect}\marg{attribute}\marg{data} |
| 1978 |
%\end{definition} |
| 1979 |
%This uses \sty{texosquery}'s \cs{texosqueryfmtdatetime} command to |
| 1980 |
%format a date or time according to a date-time pattern (identified |
| 1981 |
%by \meta{attribute}) for the locale identified by \meta{dialect}. |
| 1982 |
%The \sty{texosquery} manual provides further details on this |
| 1983 |
%command, but essentially the first argument of \cs{texosqueryfmtdatetime} |
| 1984 |
%should be a control sequence containing the special pattern markup |
| 1985 |
%and the remaining arguments are the date-time data, which are |
| 1986 |
%supplied in the \meta{data} argument of \cs{LocaleApplyDateTimePattern}. |
| 1987 |
% |
| 1988 |
%The \ics{LocaleDateTimeInfo} command will either be empty or set to |
| 1989 |
%the correct data for the current date and time. This can be used |
| 1990 |
%in the \meta{data} argument. Since \cs{LocaleDateTimeInfo} might be |
| 1991 |
%empty, \cs{LocaleApplyDateTimePattern} will first test for this and |
| 1992 |
%not try applying the pattern in that case. (Remember that you can |
| 1993 |
%also define your own custom date-time patterns, as mentioned in |
| 1994 |
%\sectionref{sec:general}.) |
| 1995 |
% |
| 1996 |
%Note that the \meta{dialect} is used to fetch the pattern data, but |
| 1997 |
%the month and day names will be obtained using the |
| 1998 |
%\cs{CurrentLocale\ldots} commands described in |
| 1999 |
%\sectionref{sec:currdatetime}, which may not match \meta{dialect}. |
| 2000 |
%In general it's easiest to use the shortcut |
| 2001 |
%\ics{CurrentLocaleApplyDateTimePattern} (\sectionref{sec:currpat}) instead to ensure the |
| 2002 |
%pattern matches the current locale. |
| 2003 |
% |
| 2004 |
%The attributes associated with date-time patterns are listed below |
| 2005 |
%(see \sectionref{sec:attrdatetime}). |
| 2006 |
%\begin{itemize} |
| 2007 |
%\item \dattr{fulldatefmt}: the full date format pattern (as used in |
| 2008 |
%\cs{LocaleFullDate}). |
| 2009 |
%\item \dattr{longdatefmt}: the long date format pattern (as used in |
| 2010 |
%\cs{LocaleLongDate}). |
| 2011 |
%\item \dattr{meddatefmt}: the medium date format pattern (as used in |
| 2012 |
%\cs{LocaleMediumDate}). |
| 2013 |
%\item \dattr{shortdatefmt}: the short date format pattern (as used in |
| 2014 |
%\cs{LocaleShortDate}). |
| 2015 |
%\item \dattr{fulltimefmt}: the full time format pattern (as used in |
| 2016 |
%\cs{LocaleFullTime}). |
| 2017 |
%\item \dattr{longtimefmt}: the long time format pattern (as used in |
| 2018 |
%\cs{LocaleLongTime}). |
| 2019 |
%\item \dattr{medtimefmt}: the medium time format pattern (as used in |
| 2020 |
%\cs{LocaleMediumTime}). |
| 2021 |
%\item \dattr{shorttimefmt}: the short time format pattern (as used in |
| 2022 |
%\cs{LocaleShortTime}). |
| 2023 |
%\item \dattr{fulldatetimefmt}: the full date and time format pattern. |
| 2024 |
%\item \dattr{longdatetimefmt}: the long date and time format pattern. |
| 2025 |
%\item \dattr{meddatetimefmt}: the medium date and time format pattern. |
| 2026 |
%\item \dattr{shortdatetimefmt}: the short date and time format pattern. |
| 2027 |
%\end{itemize} |
| 2028 |
% |
| 2029 |
%For example: |
| 2030 |
%\begin{verbatim} |
| 2031 |
%\def\LocaleIfDateTimePatternsSupported#1#2{#1} |
| 2032 |
%\def\LocaleMain{en-GB} |
| 2033 |
% |
| 2034 |
%\input locale |
| 2035 |
% |
| 2036 |
%Now: |
| 2037 |
%\CurrentLocaleApplyDateTimePattern{fulldatetimefmt}{\LocaleDateTimeInfo}. |
| 2038 |
%\bye |
| 2039 |
%\end{verbatim} |
| 2040 |
%This displays: |
| 2041 |
%\begin{quote} |
| 2042 |
%Now: Sunday, 26 March 2017 21:12:10 British Summer Time. |
| 2043 |
%\end{quote} |
| 2044 |
%However, it's simpler to just use: |
| 2045 |
%\begin{verbatim} |
| 2046 |
%\def\LocaleIfDateTimePatternsSupported#1#2{#1} |
| 2047 |
%\def\LocaleMain{en-GB} |
| 2048 |
% |
| 2049 |
%\input locale |
| 2050 |
% |
| 2051 |
%\def\localedatechoice#1#2#3#4{#1} |
| 2052 |
%\def\localetimechoice#1#2#3#4{#1} |
| 2053 |
% |
| 2054 |
%Now: \CurrentLocaleDateTime. |
| 2055 |
%\bye |
| 2056 |
%\end{verbatim} |
| 2057 |
%or with \LaTeX: |
| 2058 |
%\begin{verbatim} |
| 2059 |
%\documentclass{article} |
| 2060 |
% |
| 2061 |
%\usepackage[timedata,date=full,time=full,main={en-GB}]{tex-locale} |
| 2062 |
% |
| 2063 |
%\begin{document} |
| 2064 |
%Now: \CurrentLocaleDateTime. |
| 2065 |
%\end{document} |
| 2066 |
%\end{verbatim} |
| 2067 |
% |
| 2068 |
%The date-time patterns are therefore more useful when applied to |
| 2069 |
%something other that the current date-time. However, it's more |
| 2070 |
%complicated to work out the data. |
| 2071 |
% |
| 2072 |
%For example: |
| 2073 |
%\begin{verbatim} |
| 2074 |
%\def\LocaleIfDateTimePatternsSupported#1#2{#1} |
| 2075 |
%\def\LocaleMain{en-GB} |
| 2076 |
% |
| 2077 |
%\input locale |
| 2078 |
% |
| 2079 |
%\CurrentLocaleApplyDateTimePattern{fulldatetimefmt}% |
| 2080 |
%{{1}{2017}{2017}{3}{12}{4}{85}{26}{4}{7}{1}{21}{21}{9}{9}{23}{36}{140}% |
| 2081 |
%{{1}{0}{Europe/London}{1}}} |
| 2082 |
%\bye |
| 2083 |
%\end{verbatim} |
| 2084 |
%This produces: |
| 2085 |
%\begin{quote} |
| 2086 |
%Sunday, 26 March 2017 21:23:36 British Summer Time. |
| 2087 |
%\end{quote} |
| 2088 |
% |
| 2089 |
% |
| 2090 |
%\section{Locale Information} |
| 2091 |
%\label{sec:localedata} |
| 2092 |
% |
| 2093 |
%Information about each locale is fetched for each tracked dialect (the |
| 2094 |
%main locale, identified by \cs{LocaleMain}, and the other locales, |
| 2095 |
%identified by \cs{LocaleOther}). This information can be accessed |
| 2096 |
%using the commands described below, where \meta{dialect} is a |
| 2097 |
%\sty{tracklang} dialect label that identifies the locale. There are convenient commands |
| 2098 |
%(\cs{CurrentLocale\ldots}) that select the appropriate command with |
| 2099 |
%the label provided by the currently selected dialect. (See |
| 2100 |
%\sectionref{sec:currentlocale}.) |
| 2101 |
% |
| 2102 |
%Most of the commands in this package are intended to be used in an |
| 2103 |
%expandable context, and so will expand to nothing if the dialect isn't |
| 2104 |
%recognised. |
| 2105 |
% |
| 2106 |
%\begin{definition}[\DescribeMacro\LocaleMainDialect] |
| 2107 |
%\cs{LocaleMainDialect} |
| 2108 |
%\end{definition} |
| 2109 |
%This expands to the main locale's dialect label. For example with: |
| 2110 |
%\begin{verbatim} |
| 2111 |
%\def\LocaleMain{en-GB} |
| 2112 |
%\input locale |
| 2113 |
%\end{verbatim} |
| 2114 |
%the main dialect is \texttt{british}. |
| 2115 |
% |
| 2116 |
%\begin{definition}[\DescribeMacro\LocaleMainRegion] |
| 2117 |
%\cs{LocaleMainRegion} |
| 2118 |
%\end{definition} |
| 2119 |
%This expands to the main locale's region. For example, if the main |
| 2120 |
%locale is \texttt{en-GB}, then the main region is \texttt{GB}. |
| 2121 |
% |
| 2122 |
%\begin{definition}[\DescribeMacro\LocaleLanguageTag] |
| 2123 |
%\cs{LocaleLanguageTag}\marg{dialect} |
| 2124 |
%\end{definition} |
| 2125 |
%Expands to the language tag for the given dialect. For example, if |
| 2126 |
%the document locales are set using: |
| 2127 |
%\begin{verbatim} |
| 2128 |
%\def\LocaleMain{en-GB} |
| 2129 |
%\def\LocaleOther{pt-BR,fr-BE,de-CH-1996} |
| 2130 |
%\input locale |
| 2131 |
%\end{verbatim} |
| 2132 |
%then |
| 2133 |
%\begin{verbatim} |
| 2134 |
%\LocaleLanguageTag{british} |
| 2135 |
%\end{verbatim} |
| 2136 |
%will expand to \texttt{en-GB} and |
| 2137 |
%\begin{verbatim} |
| 2138 |
%\LocaleLanguageTag{nswissgerman} |
| 2139 |
%\end{verbatim} |
| 2140 |
%will expand to \texttt{de-CH-1996}. |
| 2141 |
% |
| 2142 |
%\begin{definition}[\DescribeMacro\LocaleLanguageName] |
| 2143 |
%\cs{LocaleLanguageName}\marg{dialect} |
| 2144 |
%\end{definition} |
| 2145 |
%The name of the language associated with \meta{dialect} provided in |
| 2146 |
%the Java virtual machine's default language. |
| 2147 |
% |
| 2148 |
%\begin{definition}[\DescribeMacro\LocaleLanguageNativeName] |
| 2149 |
%\cs{LocaleLanguageNativeName}\marg{dialect} |
| 2150 |
%\end{definition} |
| 2151 |
%The name of the language associated with \meta{dialect} provided in |
| 2152 |
%that language. |
| 2153 |
% |
| 2154 |
%For example: |
| 2155 |
%\begin{verbatim} |
| 2156 |
%\font\nimbus="NimbusRoman-Regular" at 10pt |
| 2157 |
%\nimbus |
| 2158 |
% |
| 2159 |
%\def\LocaleMain{en-GB} |
| 2160 |
%\def\LocaleOther{pt-BR,fr-BE} |
| 2161 |
% |
| 2162 |
%\input locale |
| 2163 |
% |
| 2164 |
%en-GB: \LocaleLanguageName{british}. |
| 2165 |
%pt-BR: \LocaleLanguageName{brazilian}. |
| 2166 |
%fr-BE: \LocaleLanguageName{belgique}. |
| 2167 |
%\bye |
| 2168 |
%\end{verbatim} |
| 2169 |
%For me this produces: |
| 2170 |
%\begin{quote} |
| 2171 |
%en-GB: English. pt-BR: Portuguese. fr-BE: French. |
| 2172 |
%\end{quote} |
| 2173 |
%because my operating system's default language is English. If I |
| 2174 |
%edit the \app{texosquery-jre8} bash script so that it includes |
| 2175 |
%\begin{verbatim} |
| 2176 |
%-Duser.language=fr |
| 2177 |
%\end{verbatim} |
| 2178 |
%in the \app{java} arguments, then the same document will produce: |
| 2179 |
%\begin{quote} |
| 2180 |
%en-GB: anglais. pt-BR: portugais. fr-BE: fran\c{c}ais. |
| 2181 |
%\end{quote} |
| 2182 |
%So this isn't necessarily in the same language as the main locale (or |
| 2183 |
%any of the other locales tracked in the document). It's in the Java |
| 2184 |
%virtual machine's default language. Compare this document with: |
| 2185 |
%\begin{verbatim} |
| 2186 |
%\font\nimbus="NimbusRoman-Regular" at 10pt |
| 2187 |
%\nimbus |
| 2188 |
% |
| 2189 |
%\def\LocaleMain{en-GB} |
| 2190 |
%\def\LocaleOther{pt-BR,fr-BE} |
| 2191 |
% |
| 2192 |
%\input locale |
| 2193 |
% |
| 2194 |
%en-GB: \LocaleLanguageNativeName{british}. |
| 2195 |
%pt-BR: \LocaleLanguageNativeName{brazilian}. |
| 2196 |
%fr-BE: \LocaleLanguageNativeName{belgique}. |
| 2197 |
%\bye |
| 2198 |
%\end{verbatim} |
| 2199 |
%This produces: |
| 2200 |
%\begin{quote} |
| 2201 |
%en-GB: English. pt-BR: portugu\^es. fr-BE: fran\c{c}ais. |
| 2202 |
%\end{quote} |
| 2203 |
%So in this case each name is displayed according to its own language. |
| 2204 |
% |
| 2205 |
%There are similar commands for the region and variant. |
| 2206 |
%\begin{definition}[\DescribeMacro\LocaleRegionName] |
| 2207 |
%\cs{LocaleRegionName}\marg{dialect} |
| 2208 |
%\end{definition} |
| 2209 |
%The name of the region associated with \meta{dialect} provided in |
| 2210 |
%the Java virtual machine's default language. This will be an empty |
| 2211 |
%string if the region wasn't supplied. |
| 2212 |
% |
| 2213 |
%\begin{definition}[\DescribeMacro\LocaleRegionNativeName] |
| 2214 |
%\cs{LocaleRegionNativeName}\marg{dialect} |
| 2215 |
%\end{definition} |
| 2216 |
%The name of the region associated with \meta{dialect} provided in |
| 2217 |
%that language. This will be an empty string if the region wasn't supplied. |
| 2218 |
% |
| 2219 |
%\begin{definition}[\DescribeMacro\LocaleVariantName] |
| 2220 |
%\cs{LocaleVariantName}\marg{dialect} |
| 2221 |
%\end{definition} |
| 2222 |
%The name of the variant associated with \meta{dialect} provided in |
| 2223 |
%the Java virtual machine's default language. This will be an empty |
| 2224 |
%string if a variant wasn't supplied. |
| 2225 |
% |
| 2226 |
%\begin{definition}[\DescribeMacro\LocaleVariantNativeName] |
| 2227 |
%\cs{LocaleVariantNativeName}\marg{dialect} |
| 2228 |
%\end{definition} |
| 2229 |
%The name of the variant associated with \meta{dialect} provided in |
| 2230 |
%that language. This will be an empty string if a variant wasn't supplied. |
| 2231 |
%This may well be the same as \cs{LocaleVariantName} as the variants |
| 2232 |
%are often identifiers (such as \texttt{1996} in the case of |
| 2233 |
%\texttt{de-CH-1996}) that remain the same in different languages. |
| 2234 |
% |
| 2235 |
%You can find out if the language name, region name or variant have |
| 2236 |
%been set using the commands listed below. In each case, |
| 2237 |
%\meta{dialect} is again the dialect label, \meta{true} is the code |
| 2238 |
%to do if the condition is true and \meta{false} is the code to do if |
| 2239 |
%the condition is false. |
| 2240 |
% |
| 2241 |
%\begin{definition}[\DescribeMacro\LocaleIfHasLanguageName] |
| 2242 |
%\cs{LocaleIfHasLanguageName}\marg{dialect}\marg{true}\marg{false} |
| 2243 |
%\end{definition} |
| 2244 |
%This tests if the dialect has an associated language name. This will |
| 2245 |
%typically be true. |
| 2246 |
% |
| 2247 |
%\begin{definition}[\DescribeMacro\LocaleIfHasRegionName] |
| 2248 |
%\cs{LocaleIfHasRegionName}\marg{dialect}\marg{true}\marg{false} |
| 2249 |
%\end{definition} |
| 2250 |
%This tests if the dialect has an associated region name. Some |
| 2251 |
%language tags don't have regions supplied. For example: |
| 2252 |
%\begin{verbatim} |
| 2253 |
%\def\LocaleMain{en} |
| 2254 |
%\input locale |
| 2255 |
%\end{verbatim} |
| 2256 |
%In this case, there's no region associated with the main locale. |
| 2257 |
% |
| 2258 |
%\begin{definition}[\DescribeMacro\LocaleIfHasVariantName] |
| 2259 |
%\cs{LocaleIfHasVariantName}\marg{dialect}\marg{true}\marg{false} |
| 2260 |
%\end{definition} |
| 2261 |
%This tests if the dialect has an associated variant name. For |
| 2262 |
%example, there's no variant in \texttt{de-DE} but there is a variant |
| 2263 |
%in \texttt{de-DE-1996}. |
| 2264 |
% |
| 2265 |
%\section{Dates and Times} |
| 2266 |
%\label{sec:datetimes} |
| 2267 |
% |
| 2268 |
%Date and time information is fetched for each tracked dialect. |
| 2269 |
%The \file{tex-locale.tex} code doesn't |
| 2270 |
%modify \ics{today} (although the \file{tex-locale.sty} \LaTeX\ package |
| 2271 |
%can load \sty{datetime2}, which does). Instead, the dates or times |
| 2272 |
%for a specific locale can be obtained using the commands listed |
| 2273 |
%below. The \meta{dialect} argument indicates the \sty{tracklang} |
| 2274 |
%dialect label. See \sectionref{sec:currentlocale} for shortcut |
| 2275 |
%commands that select the appropriate command with the label of the |
| 2276 |
%currently selected locale. |
| 2277 |
% |
| 2278 |
%Dates and times are wrapped in a formatting command: |
| 2279 |
%\begin{definition}[\DescribeMacro\localedatetimefmt] |
| 2280 |
%\cs{localedatetimefmt}\marg{date-time text} |
| 2281 |
%\end{definition} |
| 2282 |
%By default this simply does its argument. For example: |
| 2283 |
%\begin{verbatim} |
| 2284 |
%\def\LocaleMain{en-GB} |
| 2285 |
% |
| 2286 |
%\input locale |
| 2287 |
% |
| 2288 |
%\def\localedatetimefmt#1{{\it #1}} |
| 2289 |
% |
| 2290 |
%Date: \LocaleFullDate{british}. |
| 2291 |
% |
| 2292 |
%\bye |
| 2293 |
%\end{verbatim} |
| 2294 |
%This displays the date in italic. The \LaTeX\ equivalent is: |
| 2295 |
%\begin{verbatim} |
| 2296 |
%\documentclass{article} |
| 2297 |
%\usepackage[main=en-GB]{tex-locale} |
| 2298 |
% |
| 2299 |
%\renewcommand*{\localedatetimefmt}[1]{\textit{#1}} |
| 2300 |
% |
| 2301 |
%\begin{document} |
| 2302 |
%Date: \LocaleFullDate{british}. |
| 2303 |
%\end{document} |
| 2304 |
%\end{verbatim} |
| 2305 |
% |
| 2306 |
%\subsection{Dates} |
| 2307 |
%\label{sec:localedates} |
| 2308 |
% |
| 2309 |
%\begin{definition}[\DescribeMacro\LocaleFullDate] |
| 2310 |
%\cs{LocaleFullDate}\marg{dialect} |
| 2311 |
%\end{definition} |
| 2312 |
%This displays the full date for the locale identified by \meta{dialect} |
| 2313 |
%as provided by \app{texosquery}. |
| 2314 |
% |
| 2315 |
%\begin{definition}[\DescribeMacro\LocaleLongDate] |
| 2316 |
%\cs{LocaleLongDate}\marg{dialect} |
| 2317 |
%\end{definition} |
| 2318 |
%This displays the long date for the locale identified by \meta{dialect} |
| 2319 |
%as provided by \app{texosquery}. |
| 2320 |
% |
| 2321 |
%\begin{definition}[\DescribeMacro\LocaleMediumDate] |
| 2322 |
%\cs{LocaleMediumDate}\marg{dialect} |
| 2323 |
%\end{definition} |
| 2324 |
%This displays the medium date for the locale identified by \meta{dialect} |
| 2325 |
%as provided by \app{texosquery}. |
| 2326 |
% |
| 2327 |
%\begin{definition}[\DescribeMacro\LocaleShortDate] |
| 2328 |
%\cs{LocaleShortDate}\marg{dialect} |
| 2329 |
%\end{definition} |
| 2330 |
%This displays the short date for the locale identified by \meta{dialect} |
| 2331 |
%as provided by \app{texosquery}. |
| 2332 |
% |
| 2333 |
%For example: |
| 2334 |
%\begin{verbatim} |
| 2335 |
%\def\LocaleMain{en-GB} |
| 2336 |
% |
| 2337 |
%\input locale |
| 2338 |
% |
| 2339 |
%Full: \LocaleFullDate{british}. |
| 2340 |
%Long: \LocaleLongDate{british}. |
| 2341 |
%Medium: \LocaleMediumDate{british}. |
| 2342 |
%Short: \LocaleShortDate{british}. |
| 2343 |
%\bye |
| 2344 |
%\end{verbatim} |
| 2345 |
%In the above, the main locale is explicitly set by defining \cs{LocaleMain} |
| 2346 |
%before loading \file{tex-locale.tex}. The \sty{tracklang} package |
| 2347 |
%identifies the \texttt{en-GB} locale with the label |
| 2348 |
%\texttt{british}. |
| 2349 |
% |
| 2350 |
%Different locales have different concepts of full, long, medium and |
| 2351 |
%short dates. In most cases the short form is numeric and the full |
| 2352 |
%form is textual. The medium form may be numeric or it may use an |
| 2353 |
%abbreviated month name. The locale provided used by Java may also |
| 2354 |
%influence the result. For example, if you are using |
| 2355 |
%\app{texosquery-jre8} with \texttt{java.locale.providers} set to |
| 2356 |
%\texttt{CLDR,JRE} then the above document will display (assuming |
| 2357 |
%today is 2017-03-26): |
| 2358 |
%\begin{quote} |
| 2359 |
%Full: Sunday, 26 March 2017. Long: 26 March 2017. Medium: 26 Mar |
| 2360 |
%2017. Short: 26/03/2017. |
| 2361 |
%\end{quote} |
| 2362 |
%However, if I instead use the Java 7 version (\file{texosquery.jar}) |
| 2363 |
%which doesn't support the CLDR, then the above document will |
| 2364 |
%display: |
| 2365 |
%\begin{quote} |
| 2366 |
%Full: Sunday, 26 March 2017. Long: 26 March 2017. Medium: |
| 2367 |
%26-Mar-2017. Short: 26/03/17. |
| 2368 |
%\end{quote} |
| 2369 |
%The CLDR provides more extensive locale support than the JRE. In the |
| 2370 |
%case of \texttt{en-GB}, the difference is minor (as shown above), |
| 2371 |
%but in some cases a language may be supported in the CLDR but not in |
| 2372 |
%the JRE. For example, if in the above document I change the main |
| 2373 |
%locale to \texttt{cy-GB} (which maps to the \sty{tracklang dialect |
| 2374 |
%label \texttt{GBwelsh}}): |
| 2375 |
%\begin{verbatim} |
| 2376 |
%\def\LocaleMain{cy-GB} |
| 2377 |
% |
| 2378 |
%\input locale |
| 2379 |
% |
| 2380 |
%Full: \LocaleFullDate{GBwelsh}. |
| 2381 |
%Long: \LocaleLongDate{GBwelsh}. |
| 2382 |
%Medium: \LocaleMediumDate{GBwelsh}. |
| 2383 |
%Short: \LocaleShortDate{GBwelsh}. |
| 2384 |
%\bye |
| 2385 |
%\end{verbatim} |
| 2386 |
%then the Java 7 version produces US English dates: |
| 2387 |
%\begin{quote} |
| 2388 |
%Full: Sunday, March 26, 2017. Long: March 26, 2017. Medium: Mar 26, |
| 2389 |
%2017. Short: 3/26/17. |
| 2390 |
%\end{quote} |
| 2391 |
%This is because Welsh isn't supported by the JRE, but it is |
| 2392 |
%supported by the CLDR, so the Java 8 version (\app{texosquery-jre8}) |
| 2393 |
%does work (provided \texttt{java.locale.providers} is set to |
| 2394 |
%\texttt{CLDR,JRE}): |
| 2395 |
%\begin{quote} |
| 2396 |
%Full: Dydd Sul, 26 Mawrth 2017. Long: 26 Mawrth 2017. Medium: 26 |
| 2397 |
%Mawrth 2017. Short: 26/03/2017. |
| 2398 |
%\end{quote} |
| 2399 |
% |
| 2400 |
%\subsubsection{Week Days} |
| 2401 |
%\label{sec:weekdays} |
| 2402 |
% |
| 2403 |
%In order to be compatible with \sty{pgfcalendar} (and hence |
| 2404 |
%\sty{datetime2}), the \sty{tex-locale} package uses |
| 2405 |
%a zero-based indexing where 0 represents Monday, 1 represents |
| 2406 |
%Tuesday, etc. If you can't remember the index for a particular day, |
| 2407 |
%you can use the following commands: |
| 2408 |
%\begin{definition}[\DescribeMacro\dtmMondayIndex] |
| 2409 |
%\cs{dtmMondayIndex} |
| 2410 |
%\end{definition} |
| 2411 |
%This expands to 0, the index for Monday. |
| 2412 |
% |
| 2413 |
%\begin{definition}[\DescribeMacro\dtmTuesdayIndex] |
| 2414 |
%\cs{dtmTuesdayIndex} |
| 2415 |
%\end{definition} |
| 2416 |
%This expands to 1, the index for Tuesday. |
| 2417 |
% |
| 2418 |
%\begin{definition}[\DescribeMacro\dtmWednesdayIndex] |
| 2419 |
%\cs{dtmWednesdayIndex} |
| 2420 |
%\end{definition} |
| 2421 |
%This expands to 2, the index for Wednesday. |
| 2422 |
% |
| 2423 |
%\begin{definition}[\DescribeMacro\dtmThursdayIndex] |
| 2424 |
%\cs{dtmThursdayIndex} |
| 2425 |
%\end{definition} |
| 2426 |
%This expands to 3, the index for Thursday. |
| 2427 |
% |
| 2428 |
%\begin{definition}[\DescribeMacro\dtmFridayIndex] |
| 2429 |
%\cs{dtmFridayIndex} |
| 2430 |
%\end{definition} |
| 2431 |
%This expands to 4, the index for Friday. |
| 2432 |
% |
| 2433 |
%\begin{definition}[\DescribeMacro\dtmSaturdayIndex] |
| 2434 |
%\cs{dtmSaturdayIndex} |
| 2435 |
%\end{definition} |
| 2436 |
%This expands to 5, the index for Saturday. |
| 2437 |
% |
| 2438 |
%\begin{definition}[\DescribeMacro\dtmSundayIndex] |
| 2439 |
%\cs{dtmSundayIndex} |
| 2440 |
%\end{definition} |
| 2441 |
%This expands to 6, the index for Sunday. |
| 2442 |
% |
| 2443 |
%You can get the day of week name identified by the Monday=0 based |
| 2444 |
%index for a particular dialect using |
| 2445 |
%\begin{definition}[\DescribeMacro\LocaleDayName] |
| 2446 |
%\cs{LocaleDayName}\marg{dialect}\marg{index} |
| 2447 |
%\end{definition} |
| 2448 |
%For example: |
| 2449 |
%\begin{verbatim} |
| 2450 |
%\def\LocaleMain{en-GB} |
| 2451 |
%\def\LocaleOther{pt-BR} |
| 2452 |
% |
| 2453 |
%\input locale |
| 2454 |
% |
| 2455 |
%en-GB: \LocaleDayName{british}{0}. |
| 2456 |
%pt-BR: \LocaleDayName{brazilian}{0}. |
| 2457 |
%\bye |
| 2458 |
%\end{verbatim} |
| 2459 |
%This produces: |
| 2460 |
%\begin{quote} |
| 2461 |
%en-GB: Monday. pt-BR: Segunda-feira. |
| 2462 |
%\end{quote} |
| 2463 |
% |
| 2464 |
%The abbreviated day of week name can be obtained with: |
| 2465 |
%\begin{definition}[\DescribeMacro\LocaleShortDayName] |
| 2466 |
%\cs{LocaleShortDayName}\marg{dialect}\marg{index} |
| 2467 |
%\end{definition} |
| 2468 |
%This has the same syntax as the previous command. As with the date |
| 2469 |
%commands described in the \hyperref[sec:localedates]{previous |
| 2470 |
%section}, the support for the given locale depends on the locale |
| 2471 |
%provider used by \app{texosquery}. |
| 2472 |
% |
| 2473 |
%Some languages have a different form for day of week names when used in a |
| 2474 |
%standalone context, such as in a column header. These can be |
| 2475 |
%obtained using the commands below, \emph{but only with |
| 2476 |
%\app{texosquery-jre8}}. If you are using Java 7 or earlier, these |
| 2477 |
%commands will produce identical results to the analogous command |
| 2478 |
%above. |
| 2479 |
% |
| 2480 |
%\begin{definition}[\DescribeMacro\LocaleStandaloneDayName] |
| 2481 |
%\cs{LocaleStandaloneDayName}\marg{dialect}\marg{index} |
| 2482 |
%\end{definition} |
| 2483 |
%The same syntax as above, this produces the standalone day of week |
| 2484 |
%name. The abbreviated name is produced with: |
| 2485 |
%\begin{definition}[\DescribeMacro\LocaleStandaloneShortDayName] |
| 2486 |
%\cs{LocaleStandaloneShortDayName}\marg{dialect}\marg{index} |
| 2487 |
%\end{definition} |
| 2488 |
% |
| 2489 |
%The first day of the week varies according to region. In some |
| 2490 |
%locales, Monday is considered the first day of the week (for |
| 2491 |
%example, en-GB), but in other locales, Sunday is the first day |
| 2492 |
%(for example, pt-BR). You can find out which day of the week is |
| 2493 |
%considered the first day using: |
| 2494 |
%\begin{definition}[\DescribeMacro\LocaleFirstDayIndex] |
| 2495 |
%\cs{LocaleFirstDayIndex}\marg{dialect} |
| 2496 |
%\end{definition} |
| 2497 |
%This expands to an integer index identifying the day. |
| 2498 |
% |
| 2499 |
%For example, Monday (0) is the first day of the week in \texttt{en-GB}, |
| 2500 |
%but Sunday (6) is the first day of the week in \texttt{pt-BR}. |
| 2501 |
%\begin{verbatim} |
| 2502 |
%\def\LocaleMain{en-GB} |
| 2503 |
%\def\LocaleOther{pt-BR} |
| 2504 |
% |
| 2505 |
%\input locale |
| 2506 |
% |
| 2507 |
%First day (en-GB): \LocaleFirstDayIndex{british}. |
| 2508 |
%First day (pt-BR): \LocaleFirstDayIndex{brazilian}. |
| 2509 |
% |
| 2510 |
%\bye |
| 2511 |
%\end{verbatim} |
| 2512 |
%So the above produces: |
| 2513 |
%\begin{quote} |
| 2514 |
%First day (en-GB): 0. First day (pt-BR): 6. |
| 2515 |
%\end{quote} |
| 2516 |
% |
| 2517 |
%Since it's possible that you may want to use a different indexing |
| 2518 |
%system, there are commands provided to convert between them: |
| 2519 |
%\begin{definition}[\DescribeMacro\LocaleDayIndexFromZeroMonToOneSun] |
| 2520 |
%\cs{LocaleDayIndexFromZeroMonToOneSun}\marg{index} |
| 2521 |
%\end{definition} |
| 2522 |
%This converts a day index from the Monday=0 based system to the |
| 2523 |
%Sunday=1 based system. For example, in Monday=0 indexing then the |
| 2524 |
%index 3 represents Thursday. In the Sunday=1 based system, the index |
| 2525 |
%5 represents Thursday, so |
| 2526 |
%\begin{verbatim} |
| 2527 |
%\LocaleDayIndexFromZeroMonToOneSun{3} |
| 2528 |
%\end{verbatim} |
| 2529 |
%expands to 5. |
| 2530 |
% |
| 2531 |
%\begin{definition}[\DescribeMacro\LocaleDayIndexFromZeroMonToOneMon] |
| 2532 |
%\cs{LocaleDayIndexFromZeroMonToOneMon}\marg{index} |
| 2533 |
%\end{definition} |
| 2534 |
%This converts a day index from the Monday=0 (Sunday=6) based system to |
| 2535 |
%the ISO-8601 Monday=1 (Sunday=7) based system. For example |
| 2536 |
%\begin{verbatim} |
| 2537 |
%\LocaleDayIndexFromZeroMonToOneMon{3} |
| 2538 |
%\end{verbatim} |
| 2539 |
%expands to 4. |
| 2540 |
% |
| 2541 |
%\begin{definition}[\DescribeMacro\LocaleDayIndexFromOneSunToZeroMon] |
| 2542 |
%\cs{LocaleDayIndexFromOneSunToZeroMon}\marg{index} |
| 2543 |
%\end{definition} |
| 2544 |
%This converts a day index from the Sunday=1 based system to the |
| 2545 |
%Monday=0 based system. For example |
| 2546 |
%\begin{verbatim} |
| 2547 |
%\LocaleDayIndexFromOneSunToZeroMon{5} |
| 2548 |
%\end{verbatim} |
| 2549 |
%expands to 3. (That is, it performs the reverse of |
| 2550 |
%\cs{LocaleDayIndexFromZeroMonToOneSun}.) |
| 2551 |
% |
| 2552 |
%\begin{definition}[\DescribeMacro\LocaleDayIndexFromOneMonToZeroMon] |
| 2553 |
%\cs{LocaleDayIndexFromOneMonToZeroMon}\marg{index} |
| 2554 |
%\end{definition} |
| 2555 |
%This converts a day index from the ISO-8601 Monday=1 (Sunday=7) based system |
| 2556 |
%to the Monday=0 (Sunday=6) based system. For example |
| 2557 |
%\begin{verbatim} |
| 2558 |
%\LocaleDayIndexFromOneMonToZeroMon{4} |
| 2559 |
%\end{verbatim} |
| 2560 |
%expands to 3. (That is, it performs the reverse of |
| 2561 |
%\cs{LocaleDayIndexFromZeroMonToOneMon}.) |
| 2562 |
% |
| 2563 |
%\begin{definition}[\DescribeMacro\LocaleDayIndexFromRegion] |
| 2564 |
%\cs{LocaleDayIndexFromRegion}\marg{dialect}\marg{index} |
| 2565 |
%\end{definition} |
| 2566 |
%This converts the region's day of the week (starting from 1 for the |
| 2567 |
%region's first day) to Monday=0 based indexing. The region is identified by |
| 2568 |
%\meta{dialect}. This first uses |
| 2569 |
%\cs{LocaleFirstDayIndex}\marg{dialect} to find the |
| 2570 |
%1-based first day of week index for the region and then converts it |
| 2571 |
%to the Monday=0 based system. An invalid \meta{index} results in |
| 2572 |
%\texttt{-1}. |
| 2573 |
% |
| 2574 |
%For example, the \texttt{en-GB} locale has Monday as the first day |
| 2575 |
%of the week. So if the \meta{index} argument is 1 |
| 2576 |
%\begin{verbatim} |
| 2577 |
%\LocaleDayIndexFromRegion{british}{1} |
| 2578 |
%\end{verbatim} |
| 2579 |
%that indicates Monday. This is then converted to 0 (using |
| 2580 |
%\cs{LocaleDayIndexFromOneMonToZeroMon}). If the \meta{index} |
| 2581 |
%argument is 7 |
| 2582 |
%\begin{verbatim} |
| 2583 |
%\LocaleDayIndexFromRegion{british}{7} |
| 2584 |
%\end{verbatim} |
| 2585 |
%that indicates Sunday, so this would be converted to 6. |
| 2586 |
% |
| 2587 |
%The \texttt{pt-BR} locale has Sunday as the first day of the week. |
| 2588 |
%So if the \meta{index} argument is 2 |
| 2589 |
%\begin{verbatim} |
| 2590 |
%\LocaleDayIndexFromRegion{brazilian}{2} |
| 2591 |
%\end{verbatim} |
| 2592 |
%that indicates Monday. This is |
| 2593 |
%converted to 0 (using \cs{LocaleDayIndexFromOneSunToZeroMon}). If |
| 2594 |
%the \meta{index} argument is 1 |
| 2595 |
%\begin{verbatim} |
| 2596 |
%\LocaleDayIndexFromRegion{brazilian}{1} |
| 2597 |
%\end{verbatim} |
| 2598 |
%that indicates Sunday, so this would be converted to 6. |
| 2599 |
% |
| 2600 |
%\begin{definition}[\DescribeMacro\LocaleDayIndexToRegion] |
| 2601 |
%\cs{LocaleDayIndexToRegion}\marg{dialect}\marg{index} |
| 2602 |
%\end{definition} |
| 2603 |
%This performs the reverse operation. In this case the \meta{index} |
| 2604 |
%argument is Monday=0 based and the result is the locale's day index |
| 2605 |
%(starting with 1 for the first day of the week). |
| 2606 |
% |
| 2607 |
%\subsubsection{Month Names} |
| 2608 |
%\label{sec:monthnames} |
| 2609 |
% |
| 2610 |
%The month name for a given locale can be obtained using |
| 2611 |
%\begin{definition}[\DescribeMacro\LocaleMonthName] |
| 2612 |
%\cs{LocaleMonthName}\marg{dialect}\marg{index} |
| 2613 |
%\end{definition} |
| 2614 |
%where \meta{dialect} is the \sty{tracklang} dialect label that |
| 2615 |
%identifies the locale and \meta{index} is an integer from 1 |
| 2616 |
%(January) to 12 (December) indicating the month. |
| 2617 |
% |
| 2618 |
%For example: |
| 2619 |
%\begin{verbatim} |
| 2620 |
%\def\LocaleMain{en-GB} |
| 2621 |
%\def\LocaleOther{pt-BR} |
| 2622 |
% |
| 2623 |
%\input locale |
| 2624 |
% |
| 2625 |
%en-GB: \LocaleMonthName{british}{1}. |
| 2626 |
%pt-BR: \LocaleMonthName{brazilian}{1}. |
| 2627 |
% |
| 2628 |
%\bye |
| 2629 |
%\end{verbatim} |
| 2630 |
%produces: |
| 2631 |
%\begin{quote} |
| 2632 |
%en-GB: January. pt-BR: Janeiro. |
| 2633 |
%\end{quote} |
| 2634 |
% |
| 2635 |
%The abbreviated month name can be obtained using |
| 2636 |
%\begin{definition}[\DescribeMacro\LocaleShortMonthName] |
| 2637 |
%\cs{LocaleShortMonthName}\marg{dialect}\marg{index} |
| 2638 |
%\end{definition} |
| 2639 |
%which has the same syntax as the previous command. |
| 2640 |
% |
| 2641 |
%Some languages have a different form for month names when used in a |
| 2642 |
%standalone context, such as in a column header. These can be |
| 2643 |
%obtained using the commands below, \emph{but only with |
| 2644 |
%\app{texosquery-jre8}}. If you are using Java 7 or earlier, these |
| 2645 |
%commands will produce identical results to the analogous command |
| 2646 |
%above. |
| 2647 |
% |
| 2648 |
%\begin{definition}[\DescribeMacro\LocaleStandaloneMonthName] |
| 2649 |
%\cs{LocaleStandaloneMonthName}\marg{dialect}\marg{index} |
| 2650 |
%\end{definition} |
| 2651 |
%The same syntax as above, this produces the standalone month |
| 2652 |
%name. The abbreviated name is produced with: |
| 2653 |
%\begin{definition}[\DescribeMacro\LocaleStandaloneShortMonthName] |
| 2654 |
%\cs{LocaleStandaloneShortMonthName}\marg{dialect}\marg{index} |
| 2655 |
%\end{definition} |
| 2656 |
% |
| 2657 |
%\subsection{Times} |
| 2658 |
%\label{sec:localetimes} |
| 2659 |
% |
| 2660 |
%\begin{definition}[\DescribeMacro\LocaleFullTime] |
| 2661 |
%\cs{LocaleFullTime}\marg{dialect} |
| 2662 |
%\end{definition} |
| 2663 |
%This displays the full time for the locale identified by \meta{dialect} |
| 2664 |
%as provided by \app{texosquery}. |
| 2665 |
% |
| 2666 |
%\begin{definition}[\DescribeMacro\LocaleLongTime] |
| 2667 |
%\cs{LocaleLongTime}\marg{dialect} |
| 2668 |
%\end{definition} |
| 2669 |
%This displays the long time for the locale identified by \meta{dialect} |
| 2670 |
%as provided by \app{texosquery}. |
| 2671 |
% |
| 2672 |
%\begin{definition}[\DescribeMacro\LocaleMediumTime] |
| 2673 |
%\cs{LocaleMediumTime}\marg{dialect} |
| 2674 |
%\end{definition} |
| 2675 |
%This displays the medium time for the locale identified by \meta{dialect} |
| 2676 |
%as provided by \app{texosquery}. |
| 2677 |
% |
| 2678 |
%\begin{definition}[\DescribeMacro\LocaleShortTime] |
| 2679 |
%\cs{LocaleShortTime}\marg{dialect} |
| 2680 |
%\end{definition} |
| 2681 |
%This displays the short time for the locale identified by \meta{dialect} |
| 2682 |
%as provided by \app{texosquery}. |
| 2683 |
% |
| 2684 |
%As with \hyperref[sec:localedates]{dates}, the results are |
| 2685 |
%determined by the locale provider used by \app{texosquery}. |
| 2686 |
%For example, the Java 8 variant (\app{texosquery-jre8}) with |
| 2687 |
%\texttt{java.locale.providers} set to \texttt{CLDR,JRE} may produce |
| 2688 |
%a different result to a variant of \app{texosquery} that only uses |
| 2689 |
%the JRE provider. |
| 2690 |
% |
| 2691 |
%For example: |
| 2692 |
%\begin{verbatim} |
| 2693 |
%\def\LocaleMain{en-GB} |
| 2694 |
% |
| 2695 |
%\input locale |
| 2696 |
% |
| 2697 |
%Full: \LocaleLongTime{british}. |
| 2698 |
%Long: \LocaleLongTime{british}. |
| 2699 |
%Medium: \LocaleMediumTime{british}. |
| 2700 |
%Short: \LocaleShortTime{british}. |
| 2701 |
% |
| 2702 |
%\bye |
| 2703 |
%\end{verbatim} |
| 2704 |
%This produces: |
| 2705 |
%\begin{quote} |
| 2706 |
%Full: 13:43:53 BST. Long: 13:43:53 BST. Medium: 13:43:53. Short: |
| 2707 |
%13:43. |
| 2708 |
%\end{quote} |
| 2709 |
%In this particular case there's no difference between using the CLDR |
| 2710 |
%and the JRE locale providers, but note that there's no difference in |
| 2711 |
%the full and long forms. |
| 2712 |
% |
| 2713 |
%There are also commands for the combined date and time: |
| 2714 |
%\begin{definition}[\DescribeMacro\LocaleFullDateTime] |
| 2715 |
%\cs{LocaleFullDateTime}\marg{dialect} |
| 2716 |
%\end{definition} |
| 2717 |
%This displays the full date and time for the locale identified by \meta{dialect} |
| 2718 |
%as provided by \app{texosquery}. |
| 2719 |
% |
| 2720 |
%\begin{definition}[\DescribeMacro\LocaleLongDateTime] |
| 2721 |
%\cs{LocaleLongDateTime}\marg{dialect} |
| 2722 |
%\end{definition} |
| 2723 |
%This displays the long date and time for the locale identified by \meta{dialect} |
| 2724 |
%as provided by \app{texosquery}. |
| 2725 |
% |
| 2726 |
%\begin{definition}[\DescribeMacro\LocaleMediumDateTime] |
| 2727 |
%\cs{LocaleMediumDateTime}\marg{dialect} |
| 2728 |
%\end{definition} |
| 2729 |
%This displays the medium date and time for the locale identified by \meta{dialect} |
| 2730 |
%as provided by \app{texosquery}. |
| 2731 |
% |
| 2732 |
%\begin{definition}[\DescribeMacro\LocaleShortDateTime] |
| 2733 |
%\cs{LocaleShortDateTime}\marg{dialect} |
| 2734 |
%\end{definition} |
| 2735 |
%This displays the short date and time for the locale identified by \meta{dialect} |
| 2736 |
%as provided by \app{texosquery}. |
| 2737 |
% |
| 2738 |
% |
| 2739 |
%\section{Numbers} |
| 2740 |
%\label{sec:numbers} |
| 2741 |
% |
| 2742 |
%Different locales use different symbols to denote the decimal mark |
| 2743 |
%or the number group separator when displaying numbers. There are |
| 2744 |
%other numeric-related symbols that may also vary according to |
| 2745 |
%region, such as the currency symbol, exponent, percent or per mill |
| 2746 |
%signs. Since most of these are outside of the Basic Latin set, the |
| 2747 |
%examples here use \XeTeX\ with a font that supports those symbols. |
| 2748 |
%If you don't have that font installed, you will need to adapt the |
| 2749 |
%examples accordingly. |
| 2750 |
% |
| 2751 |
%As with date and times, the commands describe here need the |
| 2752 |
%\sty{tracklang} dialect label that identifies the required locale. |
| 2753 |
%See \sectionref{sec:currentlocale} for shortcut commands that |
| 2754 |
%automatically select the current locale's dialect label. |
| 2755 |
% |
| 2756 |
%In general, most of these commands won't need to be used explicitly |
| 2757 |
%as it's easier to use a numeric pattern instead (see |
| 2758 |
%\sectionref{sec:numpatterns}). |
| 2759 |
% |
| 2760 |
%\subsection{Numeric Symbols} |
| 2761 |
%\label{sec:numsyms} |
| 2762 |
% |
| 2763 |
%The number group separator for a particular locale can be obtained |
| 2764 |
%using: |
| 2765 |
%\begin{definition}[\DescribeMacro\LocaleNumericGroupSep] |
| 2766 |
%\cs{LocaleNumericGroupSep}\marg{dialect} |
| 2767 |
%\end{definition} |
| 2768 |
%where \meta{dialect} is the \sty{tracklang} dialect label |
| 2769 |
%representing the locale. |
| 2770 |
% |
| 2771 |
%You can determine whether or not the locale uses a number group |
| 2772 |
%separator using: |
| 2773 |
%\begin{definition}[\DescribeMacro\LocaleIfNumericUsesGroup] |
| 2774 |
%\cs{LocaleIfNumericUsesGroup}\marg{dialect}\marg{true |
| 2775 |
%code}\marg{false code} |
| 2776 |
%\end{definition} |
| 2777 |
%This does \meta{true code} if the locale identified by \meta{dialect} |
| 2778 |
%uses a number group separator otherwise it does \meta{false code}. |
| 2779 |
% |
| 2780 |
%The decimal mark is obtained using: |
| 2781 |
%\begin{definition}[\DescribeMacro\LocaleNumericDecimalSep] |
| 2782 |
%\cs{LocaleNumericDecimalSep}\marg{dialect} |
| 2783 |
%\end{definition} |
| 2784 |
% |
| 2785 |
%The monetary separator is often the same as the decimal separator, |
| 2786 |
%but isn't always, so there's a separate command for it: |
| 2787 |
%\begin{definition}[\DescribeMacro\LocaleNumericMonetarySep] |
| 2788 |
%\cs{LocaleNumericMonetarySep}\marg{dialect} |
| 2789 |
%\end{definition} |
| 2790 |
% |
| 2791 |
%The exponent symbol is obtained using: |
| 2792 |
%\begin{definition}[\DescribeMacro\LocaleNumericExponent] |
| 2793 |
%\cs{LocaleNumericExponent}\marg{dialect} |
| 2794 |
%\end{definition} |
| 2795 |
% |
| 2796 |
%The percent symbol is obtained using: |
| 2797 |
%\begin{definition}[\DescribeMacro\LocaleNumericPercent] |
| 2798 |
%\cs{LocaleNumericPercent}\marg{dialect} |
| 2799 |
%\end{definition} |
| 2800 |
%This will typically use \verb|\%| (the percent symbol \%). |
| 2801 |
% |
| 2802 |
%The per mill symbol is obtained using: |
| 2803 |
%\begin{definition}[\DescribeMacro\LocaleNumericPermill] |
| 2804 |
%\cs{LocaleNumericPermill}\marg{dialect} |
| 2805 |
%\end{definition} |
| 2806 |
%This will typically be a character outside the Basic Latin set, so |
| 2807 |
%the document will need to support this symbol if required. |
| 2808 |
% |
| 2809 |
%\subsection{Currencies} |
| 2810 |
%\label{sec:currencies} |
| 2811 |
% |
| 2812 |
%The official currency code (such as \texttt{GBP} or \texttt{USD}) is |
| 2813 |
%obtained using: |
| 2814 |
%\begin{definition}[\DescribeMacro\LocaleCurrencyLabel] |
| 2815 |
%\cs{LocaleCurrencyLabel}\marg{dialect} |
| 2816 |
%\end{definition} |
| 2817 |
%This first checks if the \dattr{currency} attribute for the given |
| 2818 |
%dialect is \texttt{XXX} (which denotes an unknown currency, |
| 2819 |
%typically because there's no region associated with \meta{dialect}). |
| 2820 |
%If the currency for \meta{dialect} is known (that is, the attribute |
| 2821 |
%value isn't \texttt{XXX}), then that currency's official code is |
| 2822 |
%produced. If the currency is unknown, then it will try to fallback |
| 2823 |
%on the main dialect's currency code if the main dialect has an |
| 2824 |
%associated region, otherwise it will fallback on the OS currency |
| 2825 |
%code. |
| 2826 |
% |
| 2827 |
%Remember that with the language tag, you're not restricted to using |
| 2828 |
%official languages for a given region. For example, if you're |
| 2829 |
%writing in English in Belgium, it's valid to use \texttt{en-BE} as a |
| 2830 |
%locale. For example: |
| 2831 |
%\begin{verbatim} |
| 2832 |
%\def\LocaleMain{en-GB} |
| 2833 |
%\def\LocaleOther{en-BE,pt-BR} |
| 2834 |
% |
| 2835 |
%\input locale |
| 2836 |
% |
| 2837 |
%en-GB: \LocaleCurrencyLabel{british}. |
| 2838 |
%en-BE: \LocaleCurrencyLabel{enBE}. |
| 2839 |
%pt-BR: \LocaleCurrencyLabel{brazilian}. |
| 2840 |
% |
| 2841 |
%\bye |
| 2842 |
%\end{verbatim} |
| 2843 |
%This produces: |
| 2844 |
%\begin{quote} |
| 2845 |
%en-GB: GBP. en-BE: EUR. pt-BR: BRL. |
| 2846 |
%\end{quote} |
| 2847 |
% |
| 2848 |
%There are a few currencies that have an unofficial currency code. |
| 2849 |
%These are typically currencies pegged to another currency with a |
| 2850 |
%fixed exchange rate of 1.0. The |
| 2851 |
%official ISO currency code for one |
| 2852 |
%region may be the code for the other currency. For example, the Isle |
| 2853 |
%of Man currency is the Manx pound, which is kept in parity with |
| 2854 |
%pound sterling. The currency code for \texttt{en-IM} is returned as |
| 2855 |
%\texttt{GBP} by Java (since IMP has no official recognition in |
| 2856 |
%ISO~4217), but \app{texosquery} recognises that this |
| 2857 |
%region has an unofficial currency code \texttt{IMP}. This can be |
| 2858 |
%obtained using |
| 2859 |
%\begin{definition}[\DescribeMacro\LocaleCurrencyRegionalLabel] |
| 2860 |
%\cs{LocaleCurrencyRegionalLabel}\marg{dialect} |
| 2861 |
%\end{definition} |
| 2862 |
%This command is much the same as the previous command in that it |
| 2863 |
%will fallback on the main or OS currency code if not known. |
| 2864 |
%The dialect attribute \dattr{regionalcurrency} is queried for the |
| 2865 |
%required information. |
| 2866 |
%For most regions, this command will return the same as |
| 2867 |
%\cs{LocaleCurrencyLabel}. |
| 2868 |
% |
| 2869 |
%For example: |
| 2870 |
%\begin{verbatim} |
| 2871 |
%\def\LocaleMain{en-GB} |
| 2872 |
%\def\LocaleOther{en-IM,pt-BR} |
| 2873 |
% |
| 2874 |
%\input locale |
| 2875 |
% |
| 2876 |
%en-GB: \LocaleCurrencyRegionalLabel{british}. |
| 2877 |
%en-IM: \LocaleCurrencyRegionalLabel{isleofmanenglish}. |
| 2878 |
%pt-BR: \LocaleCurrencyRegionalLabel{brazilian}. |
| 2879 |
% |
| 2880 |
%\bye |
| 2881 |
%\end{verbatim} |
| 2882 |
%This produces: |
| 2883 |
%\begin{quote} |
| 2884 |
%en-GB: GBP. en-IM: IMP. pt-BR: BRL. |
| 2885 |
%\end{quote} |
| 2886 |
%If I had used \cs{LocaleCurrencyLabel} instead, the \texttt{en-IM} |
| 2887 |
%currency label would've been displayed as GBP. |
| 2888 |
% |
| 2889 |
%The currency symbol (for example, \$ or \pounds) is obtained using |
| 2890 |
%\begin{definition}[\DescribeMacro\LocaleCurrencySymbol] |
| 2891 |
%\cs{LocaleCurrencySymbol}\marg{dialect} |
| 2892 |
%\end{definition} |
| 2893 |
%Except in the case of \$ this will include symbols outside the Basic |
| 2894 |
%Latin set. This means that if you use this command in your document, |
| 2895 |
%you need to ensure that the document encoding has been set up before |
| 2896 |
%\file{tex-locale.tex} is loaded. (The \LaTeX\ \file{tex-locale.sty} package |
| 2897 |
%can automatically load \sty{fontspec} or |
| 2898 |
%\sty{inputenc} \& \sty{fontenc}, if required.) As with the previous |
| 2899 |
%commands, if the currency is unknown it will try to fallback on the |
| 2900 |
%main or OS currency. If the \dattr{currencysym} dialect attribute |
| 2901 |
%is the same as the currency code, then the \cattr{sym} currency |
| 2902 |
%attribute will be used instead. |
| 2903 |
% |
| 2904 |
%Modifying the above example: |
| 2905 |
%\begin{verbatim} |
| 2906 |
%\font\nimbus="NimbusRoman-Regular" at 10pt |
| 2907 |
%\nimbus |
| 2908 |
% |
| 2909 |
%\def\LocaleMain{en-GB} |
| 2910 |
%\def\LocaleOther{en-IM,pt-BR} |
| 2911 |
% |
| 2912 |
%\input locale |
| 2913 |
% |
| 2914 |
%en-GB: \LocaleCurrencySymbol{british}. |
| 2915 |
%en-IM: \LocaleCurrencySymbol{isleofmanenglish}. |
| 2916 |
%pt-BR: \LocaleCurrencySymbol{brazilian}. |
| 2917 |
% |
| 2918 |
%\bye |
| 2919 |
%\end{verbatim} |
| 2920 |
%This produces: |
| 2921 |
%\begin{quote} |
| 2922 |
%en-GB: \pounds. en-IM: M\pounds. pt-BR: R\$. |
| 2923 |
%\end{quote} |
| 2924 |
%The \XeLaTeX\ equivalent is: |
| 2925 |
%\begin{verbatim} |
| 2926 |
%\documentclass{article} |
| 2927 |
% |
| 2928 |
%\usepackage[main={en-GB},other={en-IM,pt-BR}]{tex-locale} |
| 2929 |
%\setmainfont{NimbusRoman-Regular} |
| 2930 |
% |
| 2931 |
%\begin{document} |
| 2932 |
%en-GB: \LocaleCurrencySymbol{british}. |
| 2933 |
%en-IM: \LocaleCurrencySymbol{isleofmanenglish}. |
| 2934 |
%pt-BR: \LocaleCurrencySymbol{brazilian}. |
| 2935 |
%\end{document} |
| 2936 |
%\end{verbatim} |
| 2937 |
% |
| 2938 |
%Alternatively, you can use: |
| 2939 |
%\begin{definition}[\DescribeMacro\LocaleCurrencyTeXSymbol] |
| 2940 |
%\cs{LocaleCurrencyTeXSymbol}\marg{dialect} |
| 2941 |
%\end{definition} |
| 2942 |
%This works in the same way as the previous command, except |
| 2943 |
%that it checks the \dattr{currencytex} dialect attribute. |
| 2944 |
%If this attribute is the same as the currency code, then |
| 2945 |
%the \cattr{tex} currency attribute is used instead. |
| 2946 |
% |
| 2947 |
%This command uses control sequences instead of the actual currency |
| 2948 |
%character. Since both \sty{texosquery} and \sty{tex-locale} are designed |
| 2949 |
%for generic \TeX\ use, \sty{texosquery} just performs some limited |
| 2950 |
%tests for the existence of common command names (such as \cs{pounds} |
| 2951 |
%or \cs{euro}). If it can't find an appropriate command to use, the |
| 2952 |
%currency commands simply expand to a textual tag. |
| 2953 |
% |
| 2954 |
%For example, when \file{texosquery.tex} is input, it checks for the |
| 2955 |
%existence of \cs{faGbp} and \cs{pounds}. If one of those commands |
| 2956 |
%exist, then \ics{texosquerycurrencypound} is defined to that |
| 2957 |
%commands, otherwise it's defined to just \qt{pound}. For the Euro |
| 2958 |
%symbol (\ics{texosquerycurrencyeuro}) the code checks for |
| 2959 |
%\cs{faEuro}, \cs{texteuro} and \cs{euro}. (See the \sty{texosquery} |
| 2960 |
%package for more information about these currency commands.) |
| 2961 |
% |
| 2962 |
%The \LaTeX\ \file{tex-locale.sty} package will automatically load the |
| 2963 |
%\sty{textcomp} package by default. You can switch this to another |
| 2964 |
%package (for example, \sty{fontawesome}) using the \pkgopt{symbols} |
| 2965 |
%package option (for example, \pkgoptfmt{symbols=fontawesome}). |
| 2966 |
% |
| 2967 |
%\section{Current Locale} |
| 2968 |
%\label{sec:currentlocale} |
| 2969 |
% |
| 2970 |
%The commands described above mostly require a recognised \sty{tracklang} |
| 2971 |
%dialect label in the argument to identify the locale. These labels |
| 2972 |
%aren't intuitively obvious. There are some predefined dialect labels |
| 2973 |
%that try to be compatible with known \sty{babel} dialects, but |
| 2974 |
%neither \sty{babel} nor \sty{polyglossia} provide as much detail |
| 2975 |
%about the non-language aspects of the dialect (such as the region or |
| 2976 |
%variant). For example, there's no \sty{babel} or \sty{polyglossia} |
| 2977 |
%setting for English in the Isle of Man (\texttt{en-IM}). Users need |
| 2978 |
%to select the closest matching dialect (\texttt{british} in the case |
| 2979 |
%of \texttt{en-IM}). The \sty{tracklang} package also allows an |
| 2980 |
%unofficial language and region combination. |
| 2981 |
%For example, a document written in English but with the regional information, |
| 2982 |
%such as currencies, matching those for Belgium, should be identified |
| 2983 |
%with \texttt{en-BE}. This isn't recognised as a predefined |
| 2984 |
%\sty{tracklang} dialect, so \sty{tracklang} creates its own dialect |
| 2985 |
%label (\texttt{enBE} in this case) when it parses this language tag. |
| 2986 |
% |
| 2987 |
%This makes it a bit awkward to directly use the above commands and |
| 2988 |
%it's most likely that the required dialect will be the currently selected |
| 2989 |
%language setting, so \file{tex-locale.tex} provides some convenient |
| 2990 |
%wrapper commands, listed below. These \cs{CurrentLocale\ldots} commands are redefined every |
| 2991 |
%time the locale is changed (except for \cs{CurrentLocaleDateTime}). For a document that doesn't use |
| 2992 |
%\sty{babel} or \sty{polyglossia}, these commands can be reset using |
| 2993 |
%\ics{selectlocale} (described on page~\pageref{pg:selectlocale}). If \file{tex-locale.tex} detects |
| 2994 |
%any language hooks \cs{captions}\meta{language} (such as |
| 2995 |
%\cs{captionsenglish} or \cs{captionsbritish}) then code is added to |
| 2996 |
%those hooks to ensure that the locale is switched when the language |
| 2997 |
%changes. |
| 2998 |
% |
| 2999 |
%\TeX's \ics{show} command provides a useful way of checking the |
| 3000 |
%current settings. For example: |
| 3001 |
%\begin{verbatim} |
| 3002 |
%\def\LocaleMain{en-GB} |
| 3003 |
%\def\LocaleOther{en-IM,pt-BR} |
| 3004 |
% |
| 3005 |
%\input locale |
| 3006 |
% |
| 3007 |
%\show\CurrentLocaleMonthName |
| 3008 |
% |
| 3009 |
%\selectlocale{en-IM} |
| 3010 |
%\show\CurrentLocaleMonthName |
| 3011 |
% |
| 3012 |
%\selectlocale{pt-BR} |
| 3013 |
%\show\CurrentLocaleMonthName |
| 3014 |
% |
| 3015 |
%\bye |
| 3016 |
%\end{verbatim} |
| 3017 |
%These cause three interruptions to the \TeX\ build, which look like |
| 3018 |
%errors but are the results from each \cs{show} command. In the first |
| 3019 |
%case the transcript shows: |
| 3020 |
%\begin{verbatim} |
| 3021 |
%> \CurrentLocaleMonthName=macro: |
| 3022 |
%->\LocaleMonthName {british}. |
| 3023 |
%\end{verbatim} |
| 3024 |
%I haven't specifically set the locale at this point. At the end of |
| 3025 |
%the \file{tex-locale.tex} code, the main locale was automatically |
| 3026 |
%selected. So the current locale dialect label is \texttt{british} |
| 3027 |
%and \cs{CurrentLocaleMonthName} has been defined as |
| 3028 |
%\begin{verbatim} |
| 3029 |
%\LocaleMonthName{british} |
| 3030 |
%\end{verbatim} |
| 3031 |
%Note that there's no check for \cs{languagename} or similar command |
| 3032 |
%here. The dialect label is hard-coded into the definition of |
| 3033 |
%\cs{CurrentLocaleMonthName}, so it's fully-expandable (unless the |
| 3034 |
%month name contains any awkward non-expandable characters, which can |
| 3035 |
%occur with \sty{inputenc} and non-ASCII characters). |
| 3036 |
% |
| 3037 |
%The next instance of \cs{show} produces the following lines in the |
| 3038 |
%transcript: |
| 3039 |
%\begin{verbatim} |
| 3040 |
%> \CurrentLocaleMonthName=macro: |
| 3041 |
%->\LocaleMonthName {isleofmanenglish}. |
| 3042 |
%\end{verbatim} |
| 3043 |
%The command \cs{CurrentLocaleMonthName} was redefined when |
| 3044 |
%\verb|\selectlocale{en-IM}| was used. |
| 3045 |
% |
| 3046 |
%Similarly for the final instance of \cs{show}: |
| 3047 |
%\begin{verbatim} |
| 3048 |
%> \CurrentLocaleMonthName=macro: |
| 3049 |
%->\LocaleMonthName {brazilian}. |
| 3050 |
%\end{verbatim} |
| 3051 |
% |
| 3052 |
%All the commands that are redefined with each instance of \cs{selectlocale} |
| 3053 |
%are listed below. Note that \cs{selectlocale} also uses |
| 3054 |
%\sty{tracklang}'s \cs{SetCurrentTrackedDialect}, which also defines |
| 3055 |
%a set of commands that can be used to identify information about the |
| 3056 |
%current dialect. (See the \sty{tracklang} documentation for further |
| 3057 |
%details.) |
| 3058 |
% |
| 3059 |
%\begin{definition}[\DescribeMacro\CurrentLocaleLanguageName] |
| 3060 |
%\cs{CurrentLocaleLanguageName} |
| 3061 |
%\end{definition} |
| 3062 |
%This is a shortcut for \ics{LocaleLanguageName}\marg{dialect}. |
| 3063 |
% |
| 3064 |
%\begin{definition}[\DescribeMacro\CurrentLocaleLanguageNativeName] |
| 3065 |
%\cs{CurrentLocaleLanguageNativeName} |
| 3066 |
%\end{definition} |
| 3067 |
%This is a shortcut for \ics{LocaleLanguageNativeName}\marg{dialect}. |
| 3068 |
% |
| 3069 |
%\begin{definition}[\DescribeMacro\CurrentLocaleRegionName] |
| 3070 |
%\cs{CurrentLocaleRegionName} |
| 3071 |
%\end{definition} |
| 3072 |
%This is a shortcut for \ics{LocaleRegionName}\marg{dialect}. |
| 3073 |
% |
| 3074 |
%\begin{definition}[\DescribeMacro\CurrentLocaleRegionNativeName] |
| 3075 |
%\cs{CurrentLocaleRegionNativeName} |
| 3076 |
%\end{definition} |
| 3077 |
%This is a shortcut for \ics{LocaleRegionNativeName}\marg{dialect}. |
| 3078 |
% |
| 3079 |
%\begin{definition}[\DescribeMacro\CurrentLocaleVariantName] |
| 3080 |
%\cs{CurrentLocaleVariantName} |
| 3081 |
%\end{definition} |
| 3082 |
%This is a shortcut for \ics{LocaleVariantName}\marg{dialect}. |
| 3083 |
% |
| 3084 |
%\begin{definition}[\DescribeMacro\CurrentLocaleVariantNativeName] |
| 3085 |
%\cs{CurrentLocaleVariantNativeName} |
| 3086 |
%\end{definition} |
| 3087 |
%This is a shortcut for \ics{LocaleRegionNativeName}\marg{dialect}. |
| 3088 |
% |
| 3089 |
%\subsection{Dates and Times} |
| 3090 |
%\label{sec:currdatetime} |
| 3091 |
% |
| 3092 |
%\begin{definition}[\DescribeMacro\CurrentLocaleFirstDayIndex] |
| 3093 |
%\cs{CurrentLocaleFirstDayIndex} |
| 3094 |
%\end{definition} |
| 3095 |
%This is a shortcut for \ics{LocaleFirstDayIndex}\marg{dialect}. |
| 3096 |
% |
| 3097 |
%\begin{definition}[\DescribeMacro\CurrentLocaleDayIndexFromRegion] |
| 3098 |
%\cs{CurrentLocaleDayIndexFromRegion}\marg{index} |
| 3099 |
%\end{definition} |
| 3100 |
%This is a shortcut for |
| 3101 |
%\ics{LocaleDayIndexFromRegion}\marg{dialect}\marg{index}. |
| 3102 |
% |
| 3103 |
%\begin{definition}[\DescribeMacro\CurrentLocaleDayName] |
| 3104 |
%\cs{CurrentLocaleDayName}\marg{index} |
| 3105 |
%\end{definition} |
| 3106 |
%This is a shortcut for \ics{LocaleDayName}\marg{dialect}\marg{index}. |
| 3107 |
% |
| 3108 |
%\begin{definition}[\DescribeMacro\CurrentLocaleShortDayName] |
| 3109 |
%\cs{CurrentLocaleShortDayName}\marg{index} |
| 3110 |
%\end{definition} |
| 3111 |
%This is a shortcut for \ics{LocaleShortDayName}\marg{dialect}\marg{index}. |
| 3112 |
% |
| 3113 |
%\begin{definition}[\DescribeMacro\CurrentLocaleStandaloneDayName] |
| 3114 |
%\cs{CurrentLocaleStandaloneDayName}\marg{index} |
| 3115 |
%\end{definition} |
| 3116 |
%This is a shortcut for \ics{LocaleStandaloneDayName}\marg{dialect}\marg{index}. |
| 3117 |
% |
| 3118 |
%\begin{definition}[\DescribeMacro\CurrentLocaleStandaloneShortDayName] |
| 3119 |
%\cs{CurrentLocaleStandaloneShortDayName}\marg{index} |
| 3120 |
%\end{definition} |
| 3121 |
%This is a shortcut for \ics{LocaleStandaloneShortDayName}\marg{dialect}\marg{index}. |
| 3122 |
% |
| 3123 |
%\begin{definition}[\DescribeMacro\CurrentLocaleMonthName] |
| 3124 |
%\cs{CurrentLocaleMonthName}\marg{index} |
| 3125 |
%\end{definition} |
| 3126 |
%This is a shortcut for \ics{LocaleMonthName}\marg{dialect}\marg{index}. |
| 3127 |
% |
| 3128 |
%\begin{definition}[\DescribeMacro\CurrentLocaleShortMonthName] |
| 3129 |
%\cs{CurrentLocaleShortMonthName}\marg{index} |
| 3130 |
%\end{definition} |
| 3131 |
%This is a shortcut for \ics{LocaleShortMonthName}\marg{dialect}\marg{index}. |
| 3132 |
% |
| 3133 |
%\begin{definition}[\DescribeMacro\CurrentLocaleStandaloneMonthName] |
| 3134 |
%\cs{CurrentLocaleStandaloneMonthName}\marg{index} |
| 3135 |
%\end{definition} |
| 3136 |
%This is a shortcut for \ics{LocaleStandaloneMonthName}\marg{dialect}\marg{index}. |
| 3137 |
% |
| 3138 |
%\begin{definition}[\DescribeMacro\CurrentLocaleStandaloneShortMonthName] |
| 3139 |
%\cs{CurrentLocaleStandaloneShortMonthName}\marg{index} |
| 3140 |
%\end{definition} |
| 3141 |
%This is a shortcut for \ics{LocaleStandaloneShortMonthName}\marg{dialect}\marg{index}. |
| 3142 |
% |
| 3143 |
%\begin{definition}[\DescribeMacro\CurrentLocaleDate] |
| 3144 |
%\cs{CurrentLocaleDate} |
| 3145 |
%\end{definition} |
| 3146 |
%This is slightly more complicated that the above. It uses |
| 3147 |
%\begin{definition}[\DescribeMacro\localedatechoice] |
| 3148 |
%\cs{localedatechoice}\marg{full}\marg{long}\marg{medium}\marg{short} |
| 3149 |
%\end{definition} |
| 3150 |
%to determine whether to use the full date \ics{LocaleFullDate}\marg{dialect}, |
| 3151 |
%the long date \ics{LocaleLongDate}\marg{dialect}, |
| 3152 |
%the medium date \ics{LocaleMediumDate}\marg{dialect} or |
| 3153 |
%the short date \ics{LocaleShortDate}\marg{dialect}. |
| 3154 |
% |
| 3155 |
%This command may be defined before \file{tex-locale.tex} is loaded or |
| 3156 |
%redefined afterwards. For example, to ensure that |
| 3157 |
%\cs{CurrentLocaleDate} uses the medium form: |
| 3158 |
%\begin{verbatim} |
| 3159 |
%\def\localedatechoice#1#2#3#4{#3} |
| 3160 |
%\input locale |
| 3161 |
%\end{verbatim} |
| 3162 |
%\LaTeX\ users should instead use the \pkgopt{date} package option in |
| 3163 |
%the \file{tex-locale.sty} package interface: |
| 3164 |
%\begin{verbatim} |
| 3165 |
%\usepackage[date=medium]{tex-locale} |
| 3166 |
%\end{verbatim} |
| 3167 |
%\LaTeX\ users can also redefine the command afterwards. For example: |
| 3168 |
%\begin{verbatim} |
| 3169 |
%\renewcommand*{\localedatechoice}[4]{#3} |
| 3170 |
%\end{verbatim} |
| 3171 |
% |
| 3172 |
%There is a similar command for the time: |
| 3173 |
%\begin{definition}[\DescribeMacro\CurrentLocaleTime] |
| 3174 |
%\cs{CurrentLocaleTime} |
| 3175 |
%\end{definition} |
| 3176 |
%This uses |
| 3177 |
%\begin{definition}[\DescribeMacro\localetimechoice] |
| 3178 |
%\cs{localetimechoice}\marg{full}\marg{long}\marg{medium}\marg{short} |
| 3179 |
%\end{definition} |
| 3180 |
%to determine whether to use the full time \ics{LocaleFullTime}\marg{dialect}, |
| 3181 |
%the long time \ics{LocaleLongTime}\marg{dialect}, |
| 3182 |
%the medium time \ics{LocaleMediumTime}\marg{dialect} or |
| 3183 |
%the short time \ics{LocaleShortTime}\marg{dialect}. As with the date choice, this command |
| 3184 |
%may be defined by plain \TeX\ users before \file{tex-locale.tex} is |
| 3185 |
%input. \LaTeX\ users should use the \pkgopt{time} package option |
| 3186 |
%instead. In both formats, the command may be redefined after |
| 3187 |
%\sty{tex-locale} has been loaded. |
| 3188 |
% |
| 3189 |
%There is also a command for the combined date and time: |
| 3190 |
%\begin{definition}[\DescribeMacro\CurrentLocaleDateTime] |
| 3191 |
%\cs{CurrentLocaleDateTime} |
| 3192 |
%\end{definition} |
| 3193 |
%This doesn't use the analogous \cs{LocaleFullDateTime} etc |
| 3194 |
%commands, but instead is simply defined as: |
| 3195 |
%\begin{code} |
| 3196 |
%\cs{CurrentLocaleDate}\cs{space}\cs{CurrentLocaleTime} |
| 3197 |
%\end{code} |
| 3198 |
%This allows for a mix of date and time styles, reflecting |
| 3199 |
%the definitions of \cs{localedatechoice} and \cs{localetimechoice}. |
| 3200 |
% |
| 3201 |
%If you want a specific style (ignoring \cs{localedatechoice} |
| 3202 |
%and \cs{localetimechoice}), you can use the following commands: |
| 3203 |
%\begin{definition}[\DescribeMacro\CurrentLocaleFullDate] |
| 3204 |
%\cs{CurrentLocaleFullDate} |
| 3205 |
%\end{definition} |
| 3206 |
%This just uses \cs{LocaleFullDate}\marg{dialect}. |
| 3207 |
% |
| 3208 |
%\begin{definition}[\DescribeMacro\CurrentLocaleLongDate] |
| 3209 |
%\cs{CurrentLocaleLongDate} |
| 3210 |
%\end{definition} |
| 3211 |
%This just uses \cs{LocaleLongDate}\marg{dialect}. |
| 3212 |
% |
| 3213 |
%\begin{definition}[\DescribeMacro\CurrentLocaleMediumDate] |
| 3214 |
%\cs{CurrentLocaleMediumDate} |
| 3215 |
%\end{definition} |
| 3216 |
%This just uses \cs{LocaleMediumDate}\marg{dialect}. |
| 3217 |
% |
| 3218 |
%\begin{definition}[\DescribeMacro\CurrentLocaleShortDate] |
| 3219 |
%\cs{CurrentLocaleShortDate} |
| 3220 |
%\end{definition} |
| 3221 |
%This just uses \cs{LocaleShortDate}\marg{dialect}. |
| 3222 |
% |
| 3223 |
%\begin{definition}[\DescribeMacro\CurrentLocaleFullTime] |
| 3224 |
%\cs{CurrentLocaleFullTime} |
| 3225 |
%\end{definition} |
| 3226 |
%This just uses \cs{LocaleFullTime}\marg{dialect}. |
| 3227 |
% |
| 3228 |
%\begin{definition}[\DescribeMacro\CurrentLocaleLongTime] |
| 3229 |
%\cs{CurrentLocaleLongTime} |
| 3230 |
%\end{definition} |
| 3231 |
%This just uses \cs{LocaleLongTime}\marg{dialect}. |
| 3232 |
% |
| 3233 |
%\begin{definition}[\DescribeMacro\CurrentLocaleMediumTime] |
| 3234 |
%\cs{CurrentLocaleMediumTime} |
| 3235 |
%\end{definition} |
| 3236 |
%This just uses \cs{LocaleMediumTime}\marg{dialect}. |
| 3237 |
% |
| 3238 |
%\begin{definition}[\DescribeMacro\CurrentLocaleShortTime] |
| 3239 |
%\cs{CurrentLocaleShortTime} |
| 3240 |
%\end{definition} |
| 3241 |
%This just uses \cs{LocaleShortTime}\marg{dialect}. |
| 3242 |
% |
| 3243 |
%\begin{definition}[\DescribeMacro\CurrentLocaleFullDateTime] |
| 3244 |
%\cs{CurrentLocaleFullDateTime} |
| 3245 |
%\end{definition} |
| 3246 |
%This just uses \cs{LocaleFullDateTime}\marg{dialect}. |
| 3247 |
% |
| 3248 |
%\begin{definition}[\DescribeMacro\CurrentLocaleLongDateTime] |
| 3249 |
%\cs{CurrentLocaleLongDateTime} |
| 3250 |
%\end{definition} |
| 3251 |
%This just uses \cs{LocaleLongDateTime}\marg{dialect}. |
| 3252 |
% |
| 3253 |
%\begin{definition}[\DescribeMacro\CurrentLocaleMediumDateTime] |
| 3254 |
%\cs{CurrentLocaleMediumDateTime} |
| 3255 |
%\end{definition} |
| 3256 |
%This just uses \cs{LocaleMediumDateTime}\marg{dialect}. |
| 3257 |
% |
| 3258 |
%\begin{definition}[\DescribeMacro\CurrentLocaleShortDateTime] |
| 3259 |
%\cs{CurrentLocaleShortDateTime} |
| 3260 |
%\end{definition} |
| 3261 |
%This just uses \cs{LocaleShortDateTime}\marg{dialect}. |
| 3262 |
% |
| 3263 |
% |
| 3264 |
%\subsection{Numeric Symbols} |
| 3265 |
%\label{sec:currnumsym} |
| 3266 |
% |
| 3267 |
%The currency for the current locale is similar in construct to the |
| 3268 |
%current locale's date and time commands listed above. |
| 3269 |
%\begin{definition}[\DescribeMacro\CurrentLocaleCurrency] |
| 3270 |
%\cs{CurrentLocaleCurrency} |
| 3271 |
%\end{definition} |
| 3272 |
%This uses |
| 3273 |
%\begin{definition}[\DescribeMacro\localecurrchoice] |
| 3274 |
%\cs{localecurrchoice}\marg{label}\marg{regional}\marg{symbol}\marg{\TeX} |
| 3275 |
%\end{definition} |
| 3276 |
%to determine whether to use \ics{LocaleCurrencyLabel}\marg{dialect}, |
| 3277 |
%\ics{LocaleCurrencyRegionalLabel}\marg{dialect}, |
| 3278 |
%\ics{LocaleCurrencySymbol}\marg{dialect} or |
| 3279 |
%\ics{LocaleCurrencyTeXSymbol}\marg{dialect}. |
| 3280 |
%This can similarly be defined before \file{tex-locale.tex} is input or |
| 3281 |
%redefined afterwards. \LaTeX\ users can use the \pkgopt{currency} |
| 3282 |
%package option. |
| 3283 |
% |
| 3284 |
%\begin{definition}[\DescribeMacro\CurrentLocaleNumericGroupSep] |
| 3285 |
%\cs{CurrentLocaleNumericGroupSep} |
| 3286 |
%\end{definition} |
| 3287 |
%This is a shortcut for \ics{LocaleNumericGroupSep}\marg{dialect}. |
| 3288 |
% |
| 3289 |
%\begin{definition}[\DescribeMacro\CurrentLocaleIfNumericUsesGroup] |
| 3290 |
%\cs{CurrentLocaleIfNumericUsesGroup}\marg{true code}\marg{false code} |
| 3291 |
%\end{definition} |
| 3292 |
%This is a shortcut for |
| 3293 |
%\ics{LocaleIfNumericUsesGroup}\marg{dialect}\marg{true |
| 3294 |
%code}\marg{false code}. |
| 3295 |
% |
| 3296 |
%The next few commands have a slightly different pattern to the |
| 3297 |
%shortcut control sequence name. For brevity, the shortcut command |
| 3298 |
%omits the \qt{Numeric} part of the corresponding name. |
| 3299 |
% |
| 3300 |
%\begin{definition}[\DescribeMacro\CurrentLocaleDecimalSep] |
| 3301 |
%\cs{CurrentLocaleDecimalSep} |
| 3302 |
%\end{definition} |
| 3303 |
%This is a shortcut for \ics{LocaleNumericDecimalSep}\marg{dialect}. |
| 3304 |
% |
| 3305 |
%\begin{definition}[\DescribeMacro\CurrentLocaleMonetarySep] |
| 3306 |
%\cs{CurrentLocaleMonetarySep} |
| 3307 |
%\end{definition} |
| 3308 |
%This is a shortcut for \ics{LocaleNumericMonetarySep}\marg{dialect}. |
| 3309 |
% |
| 3310 |
%\begin{definition}[\DescribeMacro\CurrentLocaleExponent] |
| 3311 |
%\cs{CurrentLocaleExponent} |
| 3312 |
%\end{definition} |
| 3313 |
%This is a shortcut for \ics{LocaleNumericExponent}\marg{dialect}. |
| 3314 |
% |
| 3315 |
%\subsection{Current Locale Patterns} |
| 3316 |
%\label{sec:currpat} |
| 3317 |
% |
| 3318 |
%\begin{definition}[\DescribeMacro\CurrentLocaleIntegerPattern] |
| 3319 |
%\cs{CurrentLocaleIntegerPattern} |
| 3320 |
%\end{definition} |
| 3321 |
%This is a convenient shortcut to access the integer pattern for the |
| 3322 |
%current dialect. |
| 3323 |
% |
| 3324 |
%\begin{definition}[\DescribeMacro\CurrentLocaleDecimalPattern] |
| 3325 |
%\cs{CurrentLocaleDecimalPattern} |
| 3326 |
%\end{definition} |
| 3327 |
%This is a convenient shortcut to access the decimal pattern for the |
| 3328 |
%current dialect. |
| 3329 |
% |
| 3330 |
%\begin{definition}[\DescribeMacro\CurrentLocaleCurrencyPattern] |
| 3331 |
%\cs{CurrentLocaleCurrencyPattern} |
| 3332 |
%\end{definition} |
| 3333 |
%This is a convenient shortcut to access the currency pattern for the |
| 3334 |
%current dialect. |
| 3335 |
% |
| 3336 |
%\begin{definition}[\DescribeMacro\CurrentLocalePercentPattern] |
| 3337 |
%\cs{CurrentLocalePercentPattern} |
| 3338 |
%\end{definition} |
| 3339 |
%This is a convenient shortcut to access the percent pattern for the |
| 3340 |
%current dialect. |
| 3341 |
% |
| 3342 |
%\begin{definition}[\DescribeMacro\CurrentLocaleApplyDateTimePattern] |
| 3343 |
%\cs{CurrentLocaleApplyDateTimePattern} |
| 3344 |
%\end{definition} |
| 3345 |
%This is a convenient shortcut for |
| 3346 |
%\ics{LocaleApplyDateTimePattern}\marg{dialect}. |
| 3347 |
% |
| 3348 |
%\chapter{\texorpdfstring{\LaTeX}{LaTeX}\ Use} |
| 3349 |
%\label{sec:latex} |
| 3350 |
% |
| 3351 |
%The \sty{tex-locale} package is loaded in \LaTeX\ with the usual |
| 3352 |
%\cs{usepackage} syntax: |
| 3353 |
%\begin{verbatim} |
| 3354 |
%\usepackage{tex-locale} |
| 3355 |
%\end{verbatim} |
| 3356 |
%This does more than simply input \file{tex-locale.tex}. The options |
| 3357 |
%are listed below. |
| 3358 |
% |
| 3359 |
%\begin{description} |
| 3360 |
%\item[\pkgopt{main}=\marg{tag}] This option identifies the main locale for the |
| 3361 |
%document. The value should be a valid language tag. If this option |
| 3362 |
%is omitted, the main language will be obtained from the Java Runtime |
| 3363 |
%Environment, which should match your operating system's default |
| 3364 |
%locale. If any languages have already been tracked in your document with |
| 3365 |
%\sty{tracklang} prior to loading \sty{tex-locale}, the main |
| 3366 |
%language is set to the first tracked dialect. Normally you don't |
| 3367 |
%need to explicitly load \sty{tracklang}. |
| 3368 |
% |
| 3369 |
%\item[\pkgopt{other}=\marg{list}] This option identifies other |
| 3370 |
%locales required by the document. The value should be a |
| 3371 |
%comma-separated list of language tags or the keyword \pkgoptfmt{locale} |
| 3372 |
%to indicate the system's default locale. The value must be grouped |
| 3373 |
%to protect any commas from the key=value parser. |
| 3374 |
%\begin{important} |
| 3375 |
%This option has a cumulative effect. |
| 3376 |
%\end{important} |
| 3377 |
% |
| 3378 |
%\item[\pkgopt{symbols}=\marg{name}] This option identifies the |
| 3379 |
%symbol package to automatically load. For example, |
| 3380 |
%\pkgoptfmt{symbols=textcomp} or \pkgoptfmt{symbols=fontawesome}. If |
| 3381 |
%another package is required, \sty{texosquery}'s currency symbol commands |
| 3382 |
%will need to be redefined as appropriate. |
| 3383 |
% |
| 3384 |
%The keyword \pkgoptfmt{none} indicates that no package is required. The |
| 3385 |
%default is \pkgoptfmt{symbols=none} for \XeLaTeX\ or \LuaLaTeX, |
| 3386 |
%otherwise it's \pkgoptfmt{symbols=textcomp}. |
| 3387 |
% |
| 3388 |
%\item[\pkgopt{support}=\marg{value}] This option identifies the |
| 3389 |
%language support value. Available values are: |
| 3390 |
%\begin{itemize} |
| 3391 |
%\item \pkgoptfmt{none}: don't load any language support package; |
| 3392 |
%\item \pkgoptfmt{auto}: load \sty{polyglossia} for \XeLaTeX\ or |
| 3393 |
%\LuaLaTeX, otherwise load \sty{babel}; |
| 3394 |
%\item \pkgoptfmt{babel}: load \sty{babel} regardless of the \LaTeX\ |
| 3395 |
%format; |
| 3396 |
%\item \pkgoptfmt{polyglossia}: load \sty{polyglossia} without checking |
| 3397 |
%the \LaTeX\ format (but remember that \sty{polyglossia} doesn't work |
| 3398 |
%with \PDFLaTeX); |
| 3399 |
%\item \pkgoptfmt{cjk}: load CJK support with either \sty{xeCJK} |
| 3400 |
%(\XeLaTeX/\LuaLaTeX) or \sty{CJKutf8}. This isn't fully tested, and |
| 3401 |
%there's no support for non-UTF encoding. |
| 3402 |
%\end{itemize} |
| 3403 |
% |
| 3404 |
%\item[\pkgopt{fontenc}=\marg{value}] This option indicates whether |
| 3405 |
%or not to load the \sty{fontenc} package. The value should be one |
| 3406 |
%of: \pkgoptfmt{none} (don't load), \pkgoptfmt{auto} (automatically load |
| 3407 |
%with the encoding determined from the language settings), or |
| 3408 |
%\meta{option} (indicating the package option to pass to |
| 3409 |
%\sty{fontenc}). The default is \pkgoptfmt{fontenc=auto} unless |
| 3410 |
%\sty{fontenc} has already been loaded. |
| 3411 |
% |
| 3412 |
%This option is ignored with \XeLaTeX\ or \LuaLaTeX. |
| 3413 |
% |
| 3414 |
%\item[\pkgopt{inputenc}=\marg{value}] This option indicates whether |
| 3415 |
%or not to load the \sty{inputenc} package. The value should be one |
| 3416 |
%of: \pkgoptfmt{none} (don't load), \pkgoptfmt{auto} (automatically load |
| 3417 |
%with the encoding determined from the default obtained from |
| 3418 |
%\sty{texosquery}), or \meta{option} (indicating the package option |
| 3419 |
%to pass to \sty{inputenc}). The default is \pkgoptfmt{inputenc=auto} |
| 3420 |
%but \sty{inputenc} won't be loaded if the appropriate encoding can't |
| 3421 |
%be determined. Note that loading \sty{inputenc} before the |
| 3422 |
%\sty{texosquery} lookup is performed will cause a problem with |
| 3423 |
%non-ASCII characters appearing in the result. |
| 3424 |
% |
| 3425 |
%This option is ignored with \XeLaTeX\ or \LuaLaTeX. |
| 3426 |
% |
| 3427 |
%\item[\pkgopt{datetime}=\meta{value}] This option indicates whether |
| 3428 |
%or not to load the \sty{datetime2} package. The value may be one of: |
| 3429 |
%\begin{itemize} |
| 3430 |
%\item \pkgoptfmt{false}: don't load \sty{datetime2}; |
| 3431 |
%\item \pkgoptfmt{iso}: load \sty{datetime2} with the package option |
| 3432 |
%\pkgoptfmt{useregional=false} and sets the date-time style to \pkgoptfmt{iso}; |
| 3433 |
%\item \pkgoptfmt{text}: load \sty{datetime2} with the package option |
| 3434 |
%\pkgoptfmt{useregional=text}; |
| 3435 |
%\item \pkgoptfmt{num} or \pkgoptfmt{numeric}: load \sty{datetime2} with the |
| 3436 |
%package option \pkgoptfmt{useregional=numeric}; |
| 3437 |
%\item \pkgoptfmt{locale}: don't load \sty{datetime2} and set \ics{today} |
| 3438 |
%to \ics{CurrentLocaleDate}, if available. |
| 3439 |
%\end{itemize} |
| 3440 |
% |
| 3441 |
%\item[\pkgopt{date}=\meta{value}] This option indicates the |
| 3442 |
%preferred date style for \ics{CurrentLocaleDate}. The value may be |
| 3443 |
%one of: \pkgoptfmt{full}, \pkgoptfmt{long}, \pkgoptfmt{medium} |
| 3444 |
%\pkgoptfmt{short}. This option doesn't affect \ics{today} unless you |
| 3445 |
%have used \pkgoptfmt{datetime=locale}. |
| 3446 |
% |
| 3447 |
%\item[\pkgopt{time}=\meta{value}] This option indicates the |
| 3448 |
%preferred time style for \ics{CurrentLocaleTime}. The value may be |
| 3449 |
%one of: \pkgoptfmt{full}, \pkgoptfmt{long}, \pkgoptfmt{medium} |
| 3450 |
%\pkgoptfmt{short}. |
| 3451 |
% |
| 3452 |
%\item[\pkgopt{timedate}=\meta{boolean}] This option indicates |
| 3453 |
%whether or not to support date and time patterns. (See |
| 3454 |
%\sectionref{sec:datetimepat}.) |
| 3455 |
% |
| 3456 |
%\item[\pkgopt{currency}=\meta{value}] This option indicates the |
| 3457 |
%preferred currency style for \ics{CurrentLocaleCurrency}. Available |
| 3458 |
%values: \pkgoptfmt{official} (official identifier), \pkgoptfmt{unofficial} |
| 3459 |
%unofficial identified, \pkgoptfmt{sym} (the symbol, which may include |
| 3460 |
%non-ASCII characters) or \pkgoptfmt{tex} (use the commands provided by |
| 3461 |
%\sty{texosquery}). The default is \pkgoptfmt{currency=sym} for |
| 3462 |
%\XeLaTeX/\LuaLaTeX\ or \pkgoptfmt{currency=tex} otherwise. |
| 3463 |
% |
| 3464 |
%\end{description} |
| 3465 |
% |
| 3466 |
%The \sty{tex-locale} package will use \sty{texosquery} to lookup the |
| 3467 |
%default language tag and encoding, and then attempt to load the |
| 3468 |
%appropriate encoding and language support packages. |
| 3469 |
% |
| 3470 |
%For example, consider the following document: |
| 3471 |
%\begin{verbatim} |
| 3472 |
%\documentclass{article} |
| 3473 |
%\usepackage{tex-locale} |
| 3474 |
%\begin{document} |
| 3475 |
%Currency: \CurrentLocaleCurrency. |
| 3476 |
%\end{document} |
| 3477 |
%\end{verbatim} |
| 3478 |
%My default locale is \texttt{en-GB} with UTF-8 as the default file |
| 3479 |
%encoding, so if I compile this document with \PDFLaTeX, then this is |
| 3480 |
%essentially equivalent to: |
| 3481 |
%\begin{verbatim} |
| 3482 |
%\documentclass{article} |
| 3483 |
%\usepackage[en-GB]{tracklang} |
| 3484 |
%\usepackage[T1]{fontenc} |
| 3485 |
%\usepackage[utf8]{inputenc} |
| 3486 |
%\usepackage[british]{babel} |
| 3487 |
%\usepackage[useregional]{datetime2} |
| 3488 |
%\begin{document} |
| 3489 |
%Currency: \pounds. |
| 3490 |
%\end{document} |
| 3491 |
%\end{verbatim} |
| 3492 |
%(Other dependent packages omitted for clarity.) Whereas if I compile |
| 3493 |
%the document with \XeLaTeX, then this is essentially equivalent to: |
| 3494 |
%\begin{verbatim} |
| 3495 |
%\documentclass{article} |
| 3496 |
%\usepackage[en-GB]{tracklang} |
| 3497 |
%\usepackage{fontspec} |
| 3498 |
%\usepackage{polyglossia} |
| 3499 |
%\setmainlanguage[variant=uk]{english} |
| 3500 |
%\usepackage[useregional]{datetime2} |
| 3501 |
%\begin{document} |
| 3502 |
%Currency: £. |
| 3503 |
%\end{document} |
| 3504 |
%\end{verbatim} |
| 3505 |
%If I still want to use \sty{babel}, then I can enforce this with: |
| 3506 |
%\begin{verbatim} |
| 3507 |
%\usepackage[support=babel]{tex-locale} |
| 3508 |
%\end{verbatim} |
| 3509 |
%Or if I don't want \sty{babel} or \sty{polyglossia}: |
| 3510 |
%\begin{verbatim} |
| 3511 |
%\usepackage[support=none]{tex-locale} |
| 3512 |
%\end{verbatim} |
| 3513 |
% |
| 3514 |
%You can determine which language package was used with: |
| 3515 |
%\begin{definition}[\DescribeMacro\LocaleSupportPackageCase] |
| 3516 |
%\cs{LocaleSupportPackageCase}\marg{babel}\marg{polyglossia}\marg{neither} |
| 3517 |
%\end{definition} |
| 3518 |
%If either package has been loaded \ics{selectlocale}\marg{locale} |
| 3519 |
%should automatically be implemented when the document language |
| 3520 |
%changes, so you can the use the current locale commands described in |
| 3521 |
%\sectionref{sec:currentlocale}. |
| 3522 |
% |
| 3523 |
%Example: |
| 3524 |
%\begin{verbatim} |
| 3525 |
%\usepackage[main={sr-Cyrl-RS},other={en-GB}]{tex-locale} |
| 3526 |
% |
| 3527 |
%\LocaleSupportPackageCase |
| 3528 |
%{\newcommand{\textenglish}[1]{\foreignlanguage{british}{#1}}}% babel |
| 3529 |
%{% polyglossia |
| 3530 |
% \setmainfont{Liberation Serif} |
| 3531 |
% \newfontfamily\cyrillicfont{Liberation Serif} |
| 3532 |
%} |
| 3533 |
%{\newcommand{\textenglish}[1]{#1}}% none |
| 3534 |
%\end{verbatim} |
| 3535 |
% |
| 3536 |
%\StopEventually{% |
| 3537 |
% \printindex[user] |
| 3538 |
% \PrintCodeIndex |
| 3539 |
% \PrintChanges |
| 3540 |
%} |
| 3541 |
% |
| 3542 |
% |
| 3543 |
%\chapter{The Code} |
| 3544 |
%\iffalse |
| 3545 |
% \begin{macrocode} |
| 3546 |
%<*tex-locale.sty> |
| 3547 |
% \end{macrocode} |
| 3548 |
%\fi |
| 3549 |
%\changes{1.0}{2018-08-26}{Initial release} |
| 3550 |
%\section{\LaTeX\ Code (\texttt{tex-locale.sty})} |
| 3551 |
% \begin{macrocode} |
| 3552 |
\NeedsTeXFormat{LaTeX2e} |
| 3553 |
\ProvidesPackage{tex-locale}[2018/08/26 v1.0 (NLCT) localisation support] |
| 3554 |
% \end{macrocode} |
| 3555 |
%Make life easier by using \sty{etoolbox}: |
| 3556 |
% \begin{macrocode} |
| 3557 |
\RequirePackage{etoolbox} |
| 3558 |
% \end{macrocode} |
| 3559 |
% Also need \sty{xfor} to break out of \cs{@for} loop. |
| 3560 |
% \begin{macrocode} |
| 3561 |
\RequirePackage{xfor} |
| 3562 |
% \end{macrocode} |
| 3563 |
%Load \sty{tracklang} using package interface just in case any |
| 3564 |
%languages have been passed through the document class options. |
| 3565 |
%Require at least v1.3.3 since the dialect label mappings are needed |
| 3566 |
%in this file. |
| 3567 |
% \begin{macrocode} |
| 3568 |
\RequirePackage{tracklang}[2016/11/03] |
| 3569 |
% \end{macrocode} |
| 3570 |
%If any languages have been tracked, set the main language to the |
| 3571 |
%first tracked dialect. |
| 3572 |
% \begin{macrocode} |
| 3573 |
\AnyTrackedLanguages |
| 3574 |
{% |
| 3575 |
\ForEachTrackedDialect{\locale@this@dialect} |
| 3576 |
{ |
| 3577 |
\ifx\LocaleMain\undefined |
| 3578 |
\edef\LocaleMain{\GetTrackedLanguageTag{\locale@this@dialect}} |
| 3579 |
\let\@locale@trackedmain\LocaleMain |
| 3580 |
\else |
| 3581 |
\ifx\LocaleOther\undefined |
| 3582 |
\edef\LocaleOther{\GetTrackedLanguageTag{\locale@this@dialect}} |
| 3583 |
\else |
| 3584 |
\edef\LocaleOther{\LocaleOther,\GetTrackedLanguageTag{\locale@this@dialect}} |
| 3585 |
\fi |
| 3586 |
\fi |
| 3587 |
} |
| 3588 |
} |
| 3589 |
{} |
| 3590 |
% \end{macrocode} |
| 3591 |
%Need to determine if we're using \XeLaTeX\ or \LuaLaTeX. |
| 3592 |
% \begin{macrocode} |
| 3593 |
\RequirePackage{ifxetex} |
| 3594 |
\RequirePackage{ifluatex} |
| 3595 |
% \end{macrocode} |
| 3596 |
%\begin{macro}{\@locale@ifxeorlua} |
| 3597 |
%Short cut to check if we're using either: |
| 3598 |
% \begin{macrocode} |
| 3599 |
\ifxetex |
| 3600 |
\newcommand*{\@locale@ifxeorlua}[2]{#1} |
| 3601 |
\else |
| 3602 |
\ifluatex |
| 3603 |
\newcommand*{\@locale@ifxeorlua}[2]{#1} |
| 3604 |
\else |
| 3605 |
\newcommand*{\@locale@ifxeorlua}[2]{#2} |
| 3606 |
\fi |
| 3607 |
\fi |
| 3608 |
% \end{macrocode} |
| 3609 |
%\end{macro} |
| 3610 |
% |
| 3611 |
%Need \sty{xkeyval} for key-value interface: |
| 3612 |
% \begin{macrocode} |
| 3613 |
\RequirePackage{xkeyval} |
| 3614 |
% \end{macrocode} |
| 3615 |
% |
| 3616 |
%Define package options. |
| 3617 |
% |
| 3618 |
% Each \cs{DeclareOptionX} needs a corresponding \cs{DeclareOption} |
| 3619 |
% so that it can be passed as a document class option, so define a |
| 3620 |
% command that will implement both. |
| 3621 |
%\begin{macro}{\@locale@declareoption} |
| 3622 |
% \begin{macrocode} |
| 3623 |
\newcommand*{\@locale@declareoption}[2]{% |
| 3624 |
\DeclareOptionX{#1}{#2}% |
| 3625 |
\DeclareOption{#1}{#2}% |
| 3626 |
} |
| 3627 |
% \end{macrocode} |
| 3628 |
%\end{macro} |
| 3629 |
% |
| 3630 |
%\begin{option}{main} |
| 3631 |
%This option identifies the main locale. This will |
| 3632 |
%default to the operating system's locale if not set. The value |
| 3633 |
%should be the language tag or the keyword \texttt{locale}. |
| 3634 |
% \begin{macrocode} |
| 3635 |
\define@key{tex-locale.sty}{main}{% |
| 3636 |
% \end{macrocode} |
| 3637 |
%If this has already been set in the earlier tracked dialect check, |
| 3638 |
%move the original main to the other list. |
| 3639 |
% \begin{macrocode} |
| 3640 |
\ifx\@locale@trackedmain\undefined |
| 3641 |
\else |
| 3642 |
\ifx\LocaleOther\undefined |
| 3643 |
\let\LocaleOther\@locale@trackedmain |
| 3644 |
\else |
| 3645 |
\edef\LocaleOther{\@locale@trackedmain,\LocaleOther}% |
| 3646 |
\fi |
| 3647 |
\let\@locale@trackedmain\undefined |
| 3648 |
\fi |
| 3649 |
\def\LocaleMain{#1}% |
| 3650 |
} |
| 3651 |
% \end{macrocode} |
| 3652 |
%\end{option} |
| 3653 |
%\begin{option}{other} |
| 3654 |
%This option identifies the other locales. The value |
| 3655 |
%should be a comma-separated list of language tags or the keyword |
| 3656 |
%\texttt{locale}. The value must be grouped to protect any commas |
| 3657 |
%from the key-value parser. Note this option has a cumulative |
| 3658 |
%effect. |
| 3659 |
% \begin{macrocode} |
| 3660 |
\define@key{tex-locale.sty}{other}{% |
| 3661 |
\ifx\LocaleOther\undefined |
| 3662 |
\def\LocaleOther{#1}% |
| 3663 |
\else |
| 3664 |
\edef\LocaleOther{\LocaleOther,#1}% |
| 3665 |
\fi |
| 3666 |
} |
| 3667 |
% \end{macrocode} |
| 3668 |
%\end{option} |
| 3669 |
%\begin{option}{symbols} |
| 3670 |
%This option identifies the symbol package to automatically load. |
| 3671 |
%For example, \sty{textcomp} or \texttt{fontawesome}. If another |
| 3672 |
%package is required, \sty{texosquery}'s currency symbol commands |
| 3673 |
%will need to be redefined as appropriate. The key word \texttt{none} |
| 3674 |
%indicates that no package is required. The default is \texttt{none} |
| 3675 |
%for \XeLaTeX\ or \LuaLaTeX\ and \sty{textcomp} otherwise. |
| 3676 |
%\texttt{textcomp} |
| 3677 |
% \begin{macrocode} |
| 3678 |
\@locale@ifxeorlua{\def\@locale@symbols{none}}{\def\@locale@symbols{textcomp}} |
| 3679 |
\define@key{tex-locale.sty}{symbols}{\def\@locale@symbols{#1}} |
| 3680 |
% \end{macrocode} |
| 3681 |
%\end{option} |
| 3682 |
% |
| 3683 |
%To make it easier to add extra support options, assign a numeric |
| 3684 |
%value to each option so that \cs{ifcase} can be used. Recognised |
| 3685 |
%values: 0 (none), 1 (auto), 2 (babel), 3 (polyglossia), 4 (cjk). |
| 3686 |
%\begin{macro}{\@locale@supportopt} |
| 3687 |
% \begin{macrocode} |
| 3688 |
\newcount\@locale@supportopt |
| 3689 |
% \end{macrocode} |
| 3690 |
% The default value is auto unless a known language package has |
| 3691 |
% already been loaded. |
| 3692 |
% \begin{macrocode} |
| 3693 |
\@ifpackageloaded{polyglossia} |
| 3694 |
{\@locale@supportopt=0\relax} |
| 3695 |
{ |
| 3696 |
\@ifpackageloaded{babel} |
| 3697 |
{\@locale@supportopt=0\relax} |
| 3698 |
{ |
| 3699 |
\@ifpackageloaded{CJK} |
| 3700 |
{\@locale@supportopt=0\relax} |
| 3701 |
{\@locale@supportopt=1\relax} |
| 3702 |
} |
| 3703 |
} |
| 3704 |
% \end{macrocode} |
| 3705 |
%\end{macro} |
| 3706 |
% |
| 3707 |
%\begin{option}{support} |
| 3708 |
%This option identifies the language support package. |
| 3709 |
% \begin{macrocode} |
| 3710 |
\define@choicekey{tex-locale.sty}{support}% |
| 3711 |
[\@locale@support@val\@locale@support@nr]% |
| 3712 |
{none,auto,babel,polyglossia,cjk} |
| 3713 |
{\@locale@supportopt=\@locale@support@nr\relax} |
| 3714 |
% \end{macrocode} |
| 3715 |
%\end{option} |
| 3716 |
%\begin{option}{fontspec} |
| 3717 |
%This option identifies whether or not to load \sty{fontspec} if |
| 3718 |
%\XeLaTeX\ or \LuaLaTeX\ is in use. Defaults to true and is ignored |
| 3719 |
%if neither \XeLaTeX\ nor \LuaLaTeX\ are in use. |
| 3720 |
% \begin{macrocode} |
| 3721 |
\define@boolkey{tex-locale.sty}[@locale@]{fontspec}[true]{} |
| 3722 |
\@locale@ifxeorlua{\@locale@fontspectrue}{\@locale@fontspecfalse} |
| 3723 |
% \end{macrocode} |
| 3724 |
%\end{option} |
| 3725 |
%\begin{option}{fontenc} |
| 3726 |
%This option identifies whether or not to load \sty{fontenc} if |
| 3727 |
%neither \XeLaTeX\ nor \LuaLaTeX\ is in use. The value should be |
| 3728 |
%either \pkgoptfmt{none} (don't load) or \pkgoptfmt{auto} |
| 3729 |
%(determined from the main language or script) or the option to pass to |
| 3730 |
%\sty{fontenc}. If the \pkgoptfmt{auto} option is used but the |
| 3731 |
%appropriate encoding can't be determined, \sty{fontenc} won't be |
| 3732 |
%loaded. The default value is \pkgoptfmt{auto} unless \sty{fontenc} |
| 3733 |
%has already been loaded. This option is ignored if |
| 3734 |
% either \XeLaTeX\ or \LuaLaTeX\ are in use. |
| 3735 |
% \begin{macrocode} |
| 3736 |
\define@key{tex-locale.sty}{fontenc}{% |
| 3737 |
\edef\@locale@fontenc{#1}% |
| 3738 |
\ifdefstring{\@locale@fontenc}{false}{\def\@locale@fontenc{none}}{}% |
| 3739 |
} |
| 3740 |
\@ifpackageloaded{fontenc} |
| 3741 |
{\def\@locale@fontenc{none}} |
| 3742 |
{\def\@locale@fontenc{auto}} |
| 3743 |
% \end{macrocode} |
| 3744 |
%\end{option} |
| 3745 |
%\begin{option}{inputenc} |
| 3746 |
%This option identifies whether or not to load \sty{inputenc} if |
| 3747 |
%neither \XeLaTeX\ nor \LuaLaTeX\ is in use. The value should be |
| 3748 |
%either \pkgoptfmt{none} (don't load) or \pkgoptfmt{auto} |
| 3749 |
%(determined from the locale's default encoding) or the option to pass to |
| 3750 |
%\sty{inputenc}. If the \pkgoptfmt{auto} option is used but the |
| 3751 |
%appropriate encoding can't be determined, \sty{inputenc} won't be |
| 3752 |
%loaded. The default value is \pkgoptfmt{auto}. This option is ignored if |
| 3753 |
% either \XeLaTeX\ or \LuaLaTeX\ are in use. Note that loading |
| 3754 |
% \sty{inputenc} before the query is performed will cause a problem |
| 3755 |
% with non-ASCII characters appearing in the result. |
| 3756 |
% \begin{macrocode} |
| 3757 |
\define@key{tex-locale.sty}{inputenc}{% |
| 3758 |
\edef\@locale@inputenc{#1}% |
| 3759 |
\ifdefstring{\@locale@inputenc}{false}{\def\@locale@inputenc{none}}{}% |
| 3760 |
} |
| 3761 |
\@ifpackageloaded{inputenc} |
| 3762 |
{\def\@locale@inputenc{none}} |
| 3763 |
{\def\@locale@inputenc{auto}} |
| 3764 |
% \end{macrocode} |
| 3765 |
%\end{option} |
| 3766 |
% |
| 3767 |
%\begin{macro}{\@locale@load@dtm} |
| 3768 |
%This command is used to load \sty{datetime2}, if required, and setup the style. |
| 3769 |
% \begin{macrocode} |
| 3770 |
\@ifpackageloaded{datetime2} |
| 3771 |
{ |
| 3772 |
% \end{macrocode} |
| 3773 |
% User has already loaded \sty{datetime2}. Assume they have already |
| 3774 |
% set their preferred style. (They would also need to have loaded |
| 3775 |
% \sty{babel}\slash\sty{polyglossia} before \sty{datetime2}, which |
| 3776 |
% rather reduces the point of the \sty{tex-locale} package.) |
| 3777 |
% \begin{macrocode} |
| 3778 |
\newcommand\@locale@load@dtm{} |
| 3779 |
} |
| 3780 |
{ |
| 3781 |
\newcommand\@locale@load@dtm{% |
| 3782 |
% \end{macrocode} |
| 3783 |
% First check if \sty{datetime2} is installed. If it isn't, then |
| 3784 |
% default to \pkgopt[locale]{datetime2}. |
| 3785 |
% \begin{macrocode} |
| 3786 |
\IfFileExists{datetime2.sty}% |
| 3787 |
{\@locale@load@regional@dtm}% |
| 3788 |
{\@locale@set@today}% |
| 3789 |
}% |
| 3790 |
} |
| 3791 |
% \end{macrocode} |
| 3792 |
%\end{macro} |
| 3793 |
% |
| 3794 |
%\begin{macro}{\@locale@load@regional@dtm} |
| 3795 |
%Load \sty{datetime2} with regional settings. |
| 3796 |
% \begin{macrocode} |
| 3797 |
\newcommand\@locale@load@regional@dtm{% |
| 3798 |
\localedatechoice |
| 3799 |
{%full |
| 3800 |
\PassOptionsToPackage{showdow}{datetime2}% |
| 3801 |
\PassOptionsToPackage{useregional=text}{datetime2}% |
| 3802 |
}% |
| 3803 |
{%long |
| 3804 |
\PassOptionsToPackage{useregional=text}{datetime2}% |
| 3805 |
}% |
| 3806 |
{%medium |
| 3807 |
\PassOptionsToPackage{useregional=text}{datetime2}% |
| 3808 |
}% |
| 3809 |
{%short |
| 3810 |
\PassOptionsToPackage{useregional=numeric}{datetime2}% |
| 3811 |
}% |
| 3812 |
\RequirePackage{datetime2}% |
| 3813 |
\localedatechoice{}{}{\DTMlangsetup*{abbr}}{}% |
| 3814 |
}% |
| 3815 |
% \end{macrocode} |
| 3816 |
%\end{macro} |
| 3817 |
% |
| 3818 |
%\begin{macro}{\@locale@set@today} |
| 3819 |
%Redefine \cs{today}. |
| 3820 |
% \begin{macrocode} |
| 3821 |
\newcommand*{\@locale@set@today}{% |
| 3822 |
% \end{macrocode} |
| 3823 |
% If \cs{CurrentLocaleDate} is empty then the query failed, in which |
| 3824 |
% case don't change \cs{today}. |
| 3825 |
% \begin{macrocode} |
| 3826 |
\ifdefempty\CurrentLocaleDate |
| 3827 |
{}% |
| 3828 |
{% |
| 3829 |
\renewcommand{\today}{\CurrentLocaleDate}% |
| 3830 |
\ForEachTrackedDialect{\locale@this@dialect} |
| 3831 |
{% |
| 3832 |
% \end{macrocode} |
| 3833 |
%Add to \cs{date}\meta{lang} hook. |
| 3834 |
% \begin{macrocode} |
| 3835 |
\SetCurrentTrackedDialect{\locale@this@dialect}% |
| 3836 |
\@TrackLangAddToHook |
| 3837 |
{\renewcommand{\today}{\CurrentLocaleDate}} |
| 3838 |
{date}% |
| 3839 |
}% |
| 3840 |
}% |
| 3841 |
} |
| 3842 |
% \end{macrocode} |
| 3843 |
%\end{macro} |
| 3844 |
% |
| 3845 |
% |
| 3846 |
%\begin{option}{datetime} |
| 3847 |
%Provide an option to adjust the date and time settings. |
| 3848 |
% \begin{macrocode} |
| 3849 |
\define@choicekey{tex-locale.sty}{datetime}% |
| 3850 |
[\@locale@datetime@val\@locale@datetime@nr]% |
| 3851 |
{false,iso,text,num,numeric,locale} |
| 3852 |
{% |
| 3853 |
\ifcase\@locale@datetime@nr |
| 3854 |
\def\@locale@load@dtm{}% |
| 3855 |
\or |
| 3856 |
\def\@locale@load@dtm{% |
| 3857 |
\PassOptionsToPackage{useregional=false}{datetime2}% |
| 3858 |
\RequirePackage{datetime2}% |
| 3859 |
\DTMsetstyle{iso}% |
| 3860 |
}% |
| 3861 |
\or |
| 3862 |
\def\@locale@load@dtm{% |
| 3863 |
\@locale@load@regional@dtm |
| 3864 |
}% |
| 3865 |
\or |
| 3866 |
\def\@locale@load@dtm{% |
| 3867 |
\PassOptionsToPackage{useregional=numeric}{datetime2}% |
| 3868 |
\RequirePackage{datetime2}% |
| 3869 |
}% |
| 3870 |
\or |
| 3871 |
\def\@locale@load@dtm{% |
| 3872 |
\PassOptionsToPackage{useregional=numeric}{datetime2}% |
| 3873 |
\RequirePackage{datetime2}% |
| 3874 |
}% |
| 3875 |
\or |
| 3876 |
\def\@locale@load@dtm{\@locale@set@today}% |
| 3877 |
\fi |
| 3878 |
} |
| 3879 |
% \end{macrocode} |
| 3880 |
%\end{option} |
| 3881 |
% |
| 3882 |
%\begin{option}{iso} |
| 3883 |
%Shortcut for \pkgopt[iso]{datetime2}. |
| 3884 |
% \begin{macrocode} |
| 3885 |
\@locale@declareoption{iso}{% |
| 3886 |
\def\@locale@load@dtm{% |
| 3887 |
\PassOptionsToPackage{useregional=false}{datetime2}% |
| 3888 |
\RequirePackage{datetime2}% |
| 3889 |
\DTMsetstyle{iso}% |
| 3890 |
}% |
| 3891 |
} |
| 3892 |
% \end{macrocode} |
| 3893 |
%\end{option} |
| 3894 |
% |
| 3895 |
%\begin{option}{date} |
| 3896 |
%Preferred date style for \cs{CurrentLocaleDate}. |
| 3897 |
% \begin{macrocode} |
| 3898 |
\define@choicekey{tex-locale.sty}{date}% |
| 3899 |
[\@locale@date@val\@locale@date@nr]{full,long,medium,short} |
| 3900 |
{% |
| 3901 |
\ifcase\@locale@date@nr |
| 3902 |
\def\localedatechoice##1##2##3##4{##1}% |
| 3903 |
\or |
| 3904 |
\def\localedatechoice##1##2##3##4{##2}% |
| 3905 |
\or |
| 3906 |
\def\localedatechoice##1##2##3##4{##3}% |
| 3907 |
\or |
| 3908 |
\def\localedatechoice##1##2##3##4{##4}% |
| 3909 |
\fi |
| 3910 |
} |
| 3911 |
\newcommand*{\localedatechoice}[4]{#2}% |
| 3912 |
% \end{macrocode} |
| 3913 |
%\end{option} |
| 3914 |
% |
| 3915 |
%\begin{option}{time} |
| 3916 |
%Preferred date style for \cs{CurrentLocaleTime}. |
| 3917 |
% \begin{macrocode} |
| 3918 |
\define@choicekey{tex-locale.sty}{time}% |
| 3919 |
[\@locale@time@val\@locale@time@nr]{full,long,medium,short} |
| 3920 |
{% |
| 3921 |
\ifcase\@locale@time@nr |
| 3922 |
\def\localetimechoice##1##2##3##4{##1}% |
| 3923 |
\or |
| 3924 |
\def\localetimechoice##1##2##3##4{##2}% |
| 3925 |
\or |
| 3926 |
\def\localetimechoice##1##2##3##4{##3}% |
| 3927 |
\or |
| 3928 |
\def\localetimechoice##1##2##3##4{##4}% |
| 3929 |
\fi |
| 3930 |
} |
| 3931 |
\newcommand*{\localetimechoice}[4]{#3}% |
| 3932 |
% \end{macrocode} |
| 3933 |
%\end{option} |
| 3934 |
% |
| 3935 |
%\begin{option}{timedata} |
| 3936 |
%Determine whether or not to use \texttt{-M} and \texttt{-Z}. |
| 3937 |
% \begin{macrocode} |
| 3938 |
\define@choicekey{tex-locale.sty}{timedata}% |
| 3939 |
[\@locale@timedata@val\@locale@timedata@nr]{true,false}[true] |
| 3940 |
{% |
| 3941 |
\ifcase\@locale@timedata@nr |
| 3942 |
\def\LocaleIfDateTimePatternsSupported##1##2{##1}% |
| 3943 |
\or |
| 3944 |
\def\LocaleIfDateTimePatternsSupported##1##2{##2}% |
| 3945 |
\fi |
| 3946 |
} |
| 3947 |
% \end{macrocode} |
| 3948 |
%\end{option} |
| 3949 |
% |
| 3950 |
%\begin{option}{currency} |
| 3951 |
%Preferred currency style for \cs{CurrentLocaleCurrency}. |
| 3952 |
% \begin{macrocode} |
| 3953 |
\define@choicekey{tex-locale.sty}{currency}% |
| 3954 |
[\@locale@currency@val\@locale@currency@nr]% |
| 3955 |
{official,unofficial,sym,tex} |
| 3956 |
{% |
| 3957 |
\ifcase\@locale@currency@nr |
| 3958 |
\def\localecurrchoice##1##2##3##4{##1}% |
| 3959 |
\or |
| 3960 |
\def\localecurrchoice##1##2##3##4{##2}% |
| 3961 |
\or |
| 3962 |
\def\localecurrchoice##1##2##3##4{##3}% |
| 3963 |
\or |
| 3964 |
\def\localecurrchoice##1##2##3##4{##4}% |
| 3965 |
\fi |
| 3966 |
} |
| 3967 |
\@locale@ifxeorlua |
| 3968 |
{\newcommand*{\localecurrchoice}[4]{#3}} |
| 3969 |
{\newcommand*{\localecurrchoice}[4]{#4}} |
| 3970 |
% \end{macrocode} |
| 3971 |
%\end{option} |
| 3972 |
% |
| 3973 |
% Process package options. First process any options that have been |
| 3974 |
% passed via the document class. |
| 3975 |
% \begin{macrocode} |
| 3976 |
\@for\CurrentOption:=\@declaredoptions\do{% |
| 3977 |
\ifx\CurrentOption\@empty |
| 3978 |
\else |
| 3979 |
\@expandtwoargs |
| 3980 |
\in@{,\CurrentOption,}{,\@classoptionslist,\@curroptions,}% |
| 3981 |
\ifin@ |
| 3982 |
\@use@ption |
| 3983 |
\expandafter\let\csname ds@\CurrentOption\endcsname\@empty |
| 3984 |
\fi |
| 3985 |
\fi |
| 3986 |
} |
| 3987 |
% \end{macrocode} |
| 3988 |
% Now process options passed to the package: |
| 3989 |
% \begin{macrocode} |
| 3990 |
\ProcessOptionsX |
| 3991 |
% \end{macrocode} |
| 3992 |
% |
| 3993 |
% Check if \sty{babel} or \sty{polyglossia} have already been loaded |
| 3994 |
% (user may have used \pkgopt[babel]{support} or \pkgopt[polyglossia]{support} |
| 3995 |
% without realising it's already been loaded). Since |
| 3996 |
% \sty{polyglossia} pretends \sty{babel} has been loaded, only |
| 3997 |
% \sty{babel} test is required. |
| 3998 |
% \begin{macrocode} |
| 3999 |
\@ifpackageloaded{babel} |
| 4000 |
{% |
| 4001 |
\@locale@supportopt=0\relax |
| 4002 |
} |
| 4003 |
{} |
| 4004 |
% \end{macrocode} |
| 4005 |
% If the main language hasn't been set, define it (needed before |
| 4006 |
% the generic code is input.) |
| 4007 |
% \begin{macrocode} |
| 4008 |
\ifx\LocaleMain\undefined |
| 4009 |
\def\LocaleMain{locale} |
| 4010 |
\fi |
| 4011 |
\ifx\LocaleOther\undefined |
| 4012 |
\def\LocaleOther{} |
| 4013 |
\fi |
| 4014 |
% \end{macrocode} |
| 4015 |
% |
| 4016 |
%\begin{macro}{\@locale@postparse@hook} |
| 4017 |
%Post-parser hook. |
| 4018 |
% \begin{macrocode} |
| 4019 |
\newcommand*{\@locale@postparse@hook}{% |
| 4020 |
\input{tex-locale-support.def}% |
| 4021 |
} |
| 4022 |
% \end{macrocode} |
| 4023 |
%\end{macro} |
| 4024 |
% |
| 4025 |
%If symbol support is required, load the package now: |
| 4026 |
% \begin{macrocode} |
| 4027 |
\ifdefstring{\@locale@symbols}{none} |
| 4028 |
{} |
| 4029 |
{\RequirePackage{\@locale@symbols}} |
| 4030 |
% \end{macrocode} |
| 4031 |
%Load \sty{texosquery} using package interface (needs to be done |
| 4032 |
%after the symbol support is loaded since \texttt{texosquery.tex} |
| 4033 |
%detects some common symbol commands). |
| 4034 |
% \begin{macrocode} |
| 4035 |
\RequirePackage{texosquery} |
| 4036 |
% \end{macrocode} |
| 4037 |
%The encoding needs to be set up before the main query in case there |
| 4038 |
%are any non-ASCII characters returned by the query (for example, |
| 4039 |
%the currency symbol or in month or day names). |
| 4040 |
% |
| 4041 |
% May need to track all the listed dialects before |
| 4042 |
% \texttt{tex-locale.tex} is loaded. |
| 4043 |
%\begin{macro}{\@locale@trackall} |
| 4044 |
% Track the main language if set. |
| 4045 |
% \begin{macrocode} |
| 4046 |
\newcommand\@locale@trackall{% |
| 4047 |
\ifdefstring\LocaleMain{locale}% |
| 4048 |
{% |
| 4049 |
\ifx\LocaleOStag\empty |
| 4050 |
\PackageWarning{tex-locale}{Unable to determine locale |
| 4051 |
(check shell escape)}% |
| 4052 |
\else |
| 4053 |
\TrackLanguageTag{\LocaleOStag}% |
| 4054 |
\fi |
| 4055 |
}% |
| 4056 |
{\TrackLanguageTag{\LocaleMain}}% |
| 4057 |
% \end{macrocode} |
| 4058 |
% Track the other languages. |
| 4059 |
% \begin{macrocode} |
| 4060 |
\@for\locale@this@dialect:=\LocaleOther\do{% |
| 4061 |
\ifdefstring\locale@this@dialect{locale} |
| 4062 |
{% |
| 4063 |
\ifx\LocaleOStag\empty |
| 4064 |
\PackageWarning{tex-locale}{Unable to determine locale |
| 4065 |
(check shell escape)}% |
| 4066 |
\else |
| 4067 |
\TrackLanguageTag{\LocaleOStag}% |
| 4068 |
\fi |
| 4069 |
}% |
| 4070 |
{\TrackLanguageTag{\locale@this@dialect}}% |
| 4071 |
}% |
| 4072 |
\let\@locale@trackall\relax |
| 4073 |
} |
| 4074 |
% \end{macrocode} |
| 4075 |
%\end{macro} |
| 4076 |
% |
| 4077 |
%\begin{macro}{\@locale@loadinputenc} |
| 4078 |
% \begin{macrocode} |
| 4079 |
\newcommand{\@locale@loadinputenc}{} |
| 4080 |
% \end{macrocode} |
| 4081 |
%\end{macro} |
| 4082 |
% |
| 4083 |
%It may be necessary to use texosquery here to determine the |
| 4084 |
%language tag ("-b") and\slash or the codeset ("-C"). It makes more |
| 4085 |
%sense to minimise the number of shell escapes, so try to determine |
| 4086 |
%what extra information we need here. The required parameters are stored in |
| 4087 |
%\cs{@locale@pre@query@params} |
| 4088 |
%\begin{macro}{\@locale@pre@query@params} |
| 4089 |
% \begin{macrocode} |
| 4090 |
\newcommand*\@locale@pre@query@params{}% |
| 4091 |
% \end{macrocode} |
| 4092 |
%\end{macro} |
| 4093 |
%Now we need some commands that will parse the result, depending on |
| 4094 |
%the parameters. |
| 4095 |
%\begin{macro}{\@locale@pre@query@parsetag} |
| 4096 |
%Only the language tag ("-b") is required. The shell escape will |
| 4097 |
%only return a single result. \cs{LocaleOStag} will either be set to |
| 4098 |
%the language tag, if successful, or will be empty, if in dry run |
| 4099 |
%mode. |
| 4100 |
% \begin{macrocode} |
| 4101 |
\newcommand*\@locale@pre@query@parsetag{% |
| 4102 |
\ifx\LocaleStyQueryFile\undefined |
| 4103 |
\TeXOSQuery{\@locale@result}{\@locale@pre@query@params}% |
| 4104 |
\else |
| 4105 |
\ifx\LocaleStyQueryFile\empty |
| 4106 |
\TeXOSQuery{\@locale@result}{\@locale@pre@query@params}% |
| 4107 |
\else |
| 4108 |
\ifx\TeXOSQueryFromFile\undefined |
| 4109 |
\PackageError{locale}{texosquery too old to support |
| 4110 |
\string\LocaleStyQueryFile. At least v1.4 required} |
| 4111 |
{You need to update your version of texosquery} |
| 4112 |
\def\@locale@result{}% |
| 4113 |
\else |
| 4114 |
\PackageInfo{locale}{Fetching query results from `\LocaleStyQueryFile'}% |
| 4115 |
\TeXOSQueryFromFile{\@locale@result}{\LocaleStyQueryFile}% |
| 4116 |
\fi |
| 4117 |
\fi |
| 4118 |
\fi |
| 4119 |
\edef\LocaleOStag{\@locale@result}% |
| 4120 |
}% |
| 4121 |
% \end{macrocode} |
| 4122 |
%\end{macro} |
| 4123 |
%\begin{macro}{\@locale@pre@query@parsecodeset} |
| 4124 |
%Only the codeset ("-C") is required. The shell escape will |
| 4125 |
%only return a single result. \cs{LocaleOScodeset} will either be set to |
| 4126 |
%the codeset, if successful, or will be empty, if in dry run |
| 4127 |
%mode. |
| 4128 |
% \begin{macrocode} |
| 4129 |
\newcommand*\@locale@pre@query@parsecodeset{% |
| 4130 |
\TeXOSQuery{\@locale@result}{\@locale@pre@query@params}% |
| 4131 |
\edef\LocaleOScodeset{\@locale@result}% |
| 4132 |
}% |
| 4133 |
% \end{macrocode} |
| 4134 |
%\end{macro} |
| 4135 |
%\begin{macro}{\@locale@pre@query@parsetagcodeset} |
| 4136 |
%Both the language tag ("-b") and the codeset ("-C") are required. |
| 4137 |
%The shell escape will return two arguments. |
| 4138 |
% \begin{macrocode} |
| 4139 |
\newcommand*\@locale@pre@query@parsetagcodeset{% |
| 4140 |
\def\LocaleOStag{}% |
| 4141 |
\def\LocaleOScodeset{}% |
| 4142 |
\TeXOSQuery{\@locale@result}{\@locale@pre@query@params}% |
| 4143 |
\ifx\@locale@result\@empty |
| 4144 |
\else |
| 4145 |
\edef\LocaleOStag{\expandafter\@firstoftwo\@locale@result}% |
| 4146 |
\edef\LocaleOScodeset{\expandafter\@secondoftwo\@locale@result}% |
| 4147 |
\fi |
| 4148 |
}% |
| 4149 |
% \end{macrocode} |
| 4150 |
%\end{macro} |
| 4151 |
%\begin{macro}{\@locale@pre@query@parse} |
| 4152 |
%This will be set to the appropriate command after determining what |
| 4153 |
%information is actually required. |
| 4154 |
% \begin{macrocode} |
| 4155 |
\let\@locale@pre@query@parse\relax |
| 4156 |
% \end{macrocode} |
| 4157 |
%\end{macro} |
| 4158 |
% |
| 4159 |
%If \XeLaTeX\ or \LuaLaTeX\ is in use and the \pkgopt{fontspec} option |
| 4160 |
%is on, load \sty{fontspec}. |
| 4161 |
% \begin{macrocode} |
| 4162 |
\@locale@ifxeorlua |
| 4163 |
{% |
| 4164 |
\if@locale@fontspec\RequirePackage{fontspec}\fi |
| 4165 |
% \end{macrocode} |
| 4166 |
%The language tag is needed if \pkgopt[auto]{support}. |
| 4167 |
% \begin{macrocode} |
| 4168 |
\ifnum\@locale@supportopt=1\relax |
| 4169 |
\ifdefstring\LocaleMain{locale} |
| 4170 |
{% |
| 4171 |
\def\@locale@pre@query@params{\string-b }% |
| 4172 |
\let\@locale@pre@query@parse\@locale@pre@query@parsetag |
| 4173 |
}% |
| 4174 |
{% |
| 4175 |
\@for\locale@this@dialect:=\LocaleOther\do{% |
| 4176 |
\ifdefstring\locale@this@dialect{locale} |
| 4177 |
{% |
| 4178 |
\def\@locale@pre@query@params{\string-b }% |
| 4179 |
\let\@locale@pre@query@parse\@locale@pre@query@parsetag |
| 4180 |
\@endfortrue |
| 4181 |
}% |
| 4182 |
{}% |
| 4183 |
}% |
| 4184 |
}% |
| 4185 |
% \end{macrocode} |
| 4186 |
%Perform the shell escape if required. |
| 4187 |
% \begin{macrocode} |
| 4188 |
\@locale@pre@query@parse |
| 4189 |
\fi |
| 4190 |
} |
| 4191 |
{% |
| 4192 |
% \end{macrocode} |
| 4193 |
%The language tag is needed if \pkgopt[auto]{fontenc}. |
| 4194 |
% \begin{macrocode} |
| 4195 |
\ifdefstring{\@locale@fontenc}{auto} |
| 4196 |
{% |
| 4197 |
\ifdefstring\LocaleMain{locale} |
| 4198 |
{% |
| 4199 |
\def\@locale@pre@query@params{\string-b }% |
| 4200 |
\let\@locale@pre@query@parse\@locale@pre@query@parsetag |
| 4201 |
}% |
| 4202 |
{% |
| 4203 |
\@for\locale@this@dialect:=\LocaleOther\do{% |
| 4204 |
\ifdefstring\locale@this@dialect{locale} |
| 4205 |
{% |
| 4206 |
\def\@locale@pre@query@params{\string-b }% |
| 4207 |
\let\@locale@pre@query@parse\@locale@pre@query@parsetag |
| 4208 |
\@endfortrue |
| 4209 |
}% |
| 4210 |
{}% |
| 4211 |
}% |
| 4212 |
}% |
| 4213 |
}% |
| 4214 |
{}% |
| 4215 |
% \end{macrocode} |
| 4216 |
%The codeset is needed if \pkgopt[auto]{inputenc}. |
| 4217 |
%The "-C" (\texttt{-{}-codeset-lcs}) switch is used rather |
| 4218 |
%than the "-cs" (\texttt{-{}-codeset}) switch to make it more |
| 4219 |
%compatible with \sty{inputenc}. |
| 4220 |
% \begin{macrocode} |
| 4221 |
\ifdefstring{\@locale@inputenc}{auto} |
| 4222 |
{% |
| 4223 |
\ifx\@locale@pre@query@params\@empty |
| 4224 |
\let\@locale@pre@query@parse\@locale@pre@query@parsecodeset |
| 4225 |
\else |
| 4226 |
\let\@locale@pre@query@parse\@locale@pre@query@parsetagcodeset |
| 4227 |
\fi |
| 4228 |
\edef\@locale@pre@query@params{\@locale@pre@query@params\string-C}% |
| 4229 |
}% |
| 4230 |
{}% |
| 4231 |
% \end{macrocode} |
| 4232 |
%Perform the shell escape if required. |
| 4233 |
% \begin{macrocode} |
| 4234 |
\@locale@pre@query@parse |
| 4235 |
% \end{macrocode} |
| 4236 |
% Do we need to load \sty{fontenc}? |
| 4237 |
% \begin{macrocode} |
| 4238 |
\ifdefstring{\@locale@fontenc}{none} |
| 4239 |
{} |
| 4240 |
{% |
| 4241 |
\ifdefstring{\@locale@fontenc}{auto} |
| 4242 |
{% |
| 4243 |
% \end{macrocode} |
| 4244 |
% If \pkgopt[auto]{fontenc}, set up some script to \sty{fontenc} mappings. |
| 4245 |
% \begin{macrocode} |
| 4246 |
\input{tex-locale-scripts-enc.def}% |
| 4247 |
\@locale@trackall |
| 4248 |
% \end{macrocode} |
| 4249 |
% Iterate through all the dialects. |
| 4250 |
% \begin{macrocode} |
| 4251 |
\ForEachTrackedDialect{\locale@this@dialect}% |
| 4252 |
{ |
| 4253 |
\edef\@locale@lang{\TrackedLanguageFromDialect{\locale@this@dialect}}% |
| 4254 |
\@locale@if@langenc@map{\locale@this@dialect}% |
| 4255 |
{% |
| 4256 |
\edef\@locale@fontenc@opt{% |
| 4257 |
\@locale@get@langenc@map{\locale@this@dialect}}% |
| 4258 |
\expandafter\PassOptionsToPackage\expandafter |
| 4259 |
{\@locale@fontenc@opt}{fontenc}% |
| 4260 |
}% |
| 4261 |
{% |
| 4262 |
\@locale@if@langenc@map{\@locale@lang}% |
| 4263 |
{% |
| 4264 |
\edef\@locale@fontenc@opt{% |
| 4265 |
\@locale@get@langenc@map{\@locale@lang}}% |
| 4266 |
\expandafter\PassOptionsToPackage\expandafter |
| 4267 |
{\@locale@fontenc@opt}{fontenc}% |
| 4268 |
}% |
| 4269 |
{% |
| 4270 |
\edef\@locale@script{\GetTrackedDialectScript{\locale@this@dialect}}% |
| 4271 |
\ifx\@locale@script\empty |
| 4272 |
\edef\@locale@script{\TrackLangGetDefaultScript{\@locale@lang}}% |
| 4273 |
\fi |
| 4274 |
\@locale@if@scriptenc@map{\@locale@script}% |
| 4275 |
{% |
| 4276 |
\edef\@locale@fontenc@opt{% |
| 4277 |
\@locale@get@scriptenc@map{\@locale@script}}% |
| 4278 |
\expandafter\PassOptionsToPackage\expandafter |
| 4279 |
{\@locale@fontenc@opt}{fontenc}% |
| 4280 |
}% |
| 4281 |
{}% |
| 4282 |
}% |
| 4283 |
}% |
| 4284 |
}% |
| 4285 |
\ifx\@locale@fontenc@opt\empty |
| 4286 |
\PackageWarning{tex-locale}{Option `fontenc=auto' failed. |
| 4287 |
Can't determine an appropriate font encoding for dialect(s). |
| 4288 |
(Dialect list: \@tracklang@dialects.) |
| 4289 |
Either set the encoding explicitly or switch to XeLaTeX% |
| 4290 |
}% |
| 4291 |
\else |
| 4292 |
\RequirePackage{fontenc}% |
| 4293 |
\fi |
| 4294 |
} |
| 4295 |
{% |
| 4296 |
\expandafter\PassOptionsToPackage\expandafter{\@locale@fontenc}{fontenc}% |
| 4297 |
\RequirePackage{fontenc}% |
| 4298 |
} |
| 4299 |
} |
| 4300 |
% \end{macrocode} |
| 4301 |
% Do we need to load \sty{inputenc}? This needs to be done before |
| 4302 |
% the main \texttt{tex-locale.tex} shell escape. |
| 4303 |
% \begin{macrocode} |
| 4304 |
\ifdefstring{\@locale@inputenc}{none} |
| 4305 |
{} |
| 4306 |
{% |
| 4307 |
\ifdefstring{\@locale@inputenc}{auto} |
| 4308 |
{% |
| 4309 |
% \end{macrocode} |
| 4310 |
%If the earlier shell escape was successful, \cs{LocaleOScodeset} will be set. |
| 4311 |
% \begin{macrocode} |
| 4312 |
\ifx\LocaleOScodeset\empty |
| 4313 |
% \end{macrocode} |
| 4314 |
%Query failed. |
| 4315 |
% \begin{macrocode} |
| 4316 |
\PackageWarning{tex-locale}{Option `inputenc=auto' failed. |
| 4317 |
(Check shell escape.) Default file encoding unavailable} |
| 4318 |
\else |
| 4319 |
% \end{macrocode} |
| 4320 |
%If the file \cs{LocaleOScodeset}\texttt{.def} exists, then the |
| 4321 |
%codeset should hopefully be valid. |
| 4322 |
% \begin{macrocode} |
| 4323 |
\IfFileExists{\LocaleOScodeset.def}% |
| 4324 |
{% |
| 4325 |
\renewcommand{\@locale@loadinputenc}{% |
| 4326 |
\RequirePackage{inputenc}% |
| 4327 |
\inputencoding{\LocaleOScodeset}% |
| 4328 |
} |
| 4329 |
\let\@locale@inputenc\LocaleOScodeset |
| 4330 |
}% |
| 4331 |
{% |
| 4332 |
% \end{macrocode} |
| 4333 |
%May have a different name. Try known encoding mappings. |
| 4334 |
% \begin{macrocode} |
| 4335 |
\input{tex-locale-encodings.def}% |
| 4336 |
\@locale@ifhasencmap{\LocaleOScodeset} |
| 4337 |
{ |
| 4338 |
\edef\@locale@inputenc{\@locale@getencmap\LocaleOScodeset} |
| 4339 |
\renewcommand{\@locale@loadinputenc}{% |
| 4340 |
\RequirePackage{inputenc}% |
| 4341 |
\inputencoding{\@locale@inputenc}% |
| 4342 |
} |
| 4343 |
} |
| 4344 |
{% |
| 4345 |
\PackageWarning{tex-locale}{Option `inputenc=auto' failed. |
| 4346 |
Don't know how to interpret codeset `\LocaleOScodeset'}% |
| 4347 |
}% |
| 4348 |
} |
| 4349 |
\fi |
| 4350 |
} |
| 4351 |
{% |
| 4352 |
\renewcommand{\@locale@loadinputenc}{% |
| 4353 |
\RequirePackage{inputenc}% |
| 4354 |
\inputencoding{\@locale@inputenc}% |
| 4355 |
} |
| 4356 |
} |
| 4357 |
} |
| 4358 |
} |
| 4359 |
% \end{macrocode} |
| 4360 |
% |
| 4361 |
%\begin{macro}{\@locale@loadscripts} |
| 4362 |
%Only load \sty{tracklang-scripts} if required. |
| 4363 |
% \begin{macrocode} |
| 4364 |
\newcommand{\@locale@loadscripts}{% |
| 4365 |
\RequirePackage{tracklang-scripts}% |
| 4366 |
\let\@locale@loadscripts\relax |
| 4367 |
} |
| 4368 |
% \end{macrocode} |
| 4369 |
%\end{macro} |
| 4370 |
% |
| 4371 |
%The \LaTeX\ kernel provides \cs{@thirdofthree} but not |
| 4372 |
%\cs{@secondofthree}. |
| 4373 |
%\begin{macro}{\@secondofthree} |
| 4374 |
% \begin{macrocode} |
| 4375 |
\providecommand*{\@secondofthree}[3]{#2} |
| 4376 |
% \end{macrocode} |
| 4377 |
%\end{macro} |
| 4378 |
% |
| 4379 |
%\begin{macro}{\@locale@ifsupportbabelorpoly} |
| 4380 |
%\begin{definition} |
| 4381 |
%\cs{@locale@ifsupportbabelorpoly}\marg{neither |
| 4382 |
%case}\marg{babel case}\marg{polyglossia case} |
| 4383 |
%\end{definition} |
| 4384 |
%Should \sty{babel} or \sty{polyglossia} be loaded? Initialise to false. |
| 4385 |
% \begin{macrocode} |
| 4386 |
\newcommand*{\@locale@ifsupportbabelorpoly}[3]{#1} |
| 4387 |
% \end{macrocode} |
| 4388 |
%\end{macro} |
| 4389 |
% |
| 4390 |
%\begin{macro}{\@locale@ifsupportcjk} |
| 4391 |
%Should \sty{CJK} be loaded? Initialise to false. |
| 4392 |
% \begin{macrocode} |
| 4393 |
\newcommand*{\@locale@ifsupportcjk}[2]{#2} |
| 4394 |
% \end{macrocode} |
| 4395 |
%\end{macro} |
| 4396 |
% |
| 4397 |
%\begin{macro}{\@locale@ifsupportpinyin} |
| 4398 |
%Should \sty{pinyin} be loaded? Initialise to false. |
| 4399 |
% \begin{macrocode} |
| 4400 |
\newcommand*{\@locale@ifsupportpinyin}[2]{#2} |
| 4401 |
% \end{macrocode} |
| 4402 |
%\end{macro} |
| 4403 |
% |
| 4404 |
%\begin{macro}{\@locale@cjklist} |
| 4405 |
%List of languages supported by \sty{CJK}. This just makes it easier to test the |
| 4406 |
%language without multiple conditions. |
| 4407 |
% \begin{macrocode} |
| 4408 |
\newcommand*{\@locale@cjklist}{} |
| 4409 |
\listadd{\@locale@cjklist}{chinese} |
| 4410 |
\listadd{\@locale@cjklist}{japanese} |
| 4411 |
\listadd{\@locale@cjklist}{korean} |
| 4412 |
\listadd{\@locale@cjklist}{thai} |
| 4413 |
% \end{macrocode} |
| 4414 |
%\end{macro} |
| 4415 |
% |
| 4416 |
%\begin{macro}{\@locale@ifcjk} |
| 4417 |
%\begin{definition} |
| 4418 |
%\cs{@locale@ifcjk}\marg{language}\marg{true case}\marg{false case} |
| 4419 |
%\end{definition} |
| 4420 |
%Check if given root language is in the CJK list. |
| 4421 |
% \begin{macrocode} |
| 4422 |
\newcommand*{\@locale@ifcjk}[1]{% |
| 4423 |
\xifinlist{#1}{\@locale@cjklist}% |
| 4424 |
} |
| 4425 |
% \end{macrocode} |
| 4426 |
%\end{macro} |
| 4427 |
% |
| 4428 |
%\begin{macro}{\@locale@iflatinscript} |
| 4429 |
%\begin{definition} |
| 4430 |
%\cs{@locale@iflatinscript}\marg{dialect}\marg{true case}\marg{false case} |
| 4431 |
%\end{definition} |
| 4432 |
%Check if given dialect has the script explicitly set to Latn. |
| 4433 |
% \begin{macrocode} |
| 4434 |
\newcommand*{\@locale@iflatinscript}[1]{% |
| 4435 |
\ifcsstring{@tracklang@script@#1}{Latn}% |
| 4436 |
} |
| 4437 |
% \end{macrocode} |
| 4438 |
%\end{macro} |
| 4439 |
% |
| 4440 |
%Should \sty{babel} or \sty{polyglossia} be loaded? |
| 4441 |
% \begin{macrocode} |
| 4442 |
\ifcase\@locale@supportopt |
| 4443 |
% \end{macrocode} |
| 4444 |
% No support required. |
| 4445 |
% \begin{macrocode} |
| 4446 |
\or |
| 4447 |
% \end{macrocode} |
| 4448 |
% \pkgopt{auto} option. |
| 4449 |
% \begin{macrocode} |
| 4450 |
\@locale@trackall |
| 4451 |
\ForEachTrackedDialect{\locale@this@dialect}% |
| 4452 |
{% |
| 4453 |
% \end{macrocode} |
| 4454 |
% Get root language name. |
| 4455 |
% \begin{macrocode} |
| 4456 |
\edef\this@root@lang{\TrackedLanguageFromDialect{\locale@this@dialect}}% |
| 4457 |
% \end{macrocode} |
| 4458 |
% Is this language in the CJK list? |
| 4459 |
% \begin{macrocode} |
| 4460 |
\@locale@ifcjk{\this@root@lang}% |
| 4461 |
{ |
| 4462 |
\let\@locale@ifsupportcjk\@firstoftwo |
| 4463 |
% \end{macrocode} |
| 4464 |
% Is pinyin needed? |
| 4465 |
% \begin{macrocode} |
| 4466 |
\@locale@iflatinscript{\locale@this@dialect}% |
| 4467 |
{\let\@locale@ifsupportpinyin\@firstoftwo}% |
| 4468 |
{} |
| 4469 |
} |
| 4470 |
{} |
| 4471 |
% \end{macrocode} |
| 4472 |
% No point checking for \sty{polyglossia} support if not using |
| 4473 |
% \XeLaTeX\ or \LuaLaTeX. |
| 4474 |
% \begin{macrocode} |
| 4475 |
\@locale@ifxeorlua |
| 4476 |
{ |
| 4477 |
\@locale@ifsupportbabelorpoly |
| 4478 |
{ |
| 4479 |
% \end{macrocode} |
| 4480 |
% Haven't yet determined support for \sty{babel} or \sty{polyglossia}. |
| 4481 |
% Does the file \texttt{gloss-}\meta{language}\texttt{.ldf} exist? |
| 4482 |
% \begin{macrocode} |
| 4483 |
\IfFileExists{gloss-\this@[email protected]} |
| 4484 |
{ |
| 4485 |
\let\@locale@ifsupportbabelorpoly\@thirdofthree |
| 4486 |
} |
| 4487 |
{ |
| 4488 |
% \end{macrocode} |
| 4489 |
% Does the file \meta{language}\texttt{.ldf} exist? |
| 4490 |
% \begin{macrocode} |
| 4491 |
\IfFileExists{\this@[email protected]} |
| 4492 |
{\let\@locale@ifsupportbabelorpoly\@secondofthree} |
| 4493 |
{} |
| 4494 |
} |
| 4495 |
} |
| 4496 |
% \end{macrocode} |
| 4497 |
% Don't bother checking if already determined that \sty{babel} needs |
| 4498 |
% to be used. |
| 4499 |
% \begin{macrocode} |
| 4500 |
{} |
| 4501 |
{ |
| 4502 |
% \end{macrocode} |
| 4503 |
% Already found one language supported by \sty{polyglossia}. Now |
| 4504 |
% check this one. |
| 4505 |
% Does the file \texttt{gloss-}\meta{language}\texttt{.ldf} exist? |
| 4506 |
% \begin{macrocode} |
| 4507 |
\IfFileExists{gloss-\this@[email protected]} |
| 4508 |
{} |
| 4509 |
{ |
| 4510 |
% \end{macrocode} |
| 4511 |
% No support for this language with \sty{polyglossia}. |
| 4512 |
% Does the file \meta{language}\texttt{.ldf} exist? |
| 4513 |
% \begin{macrocode} |
| 4514 |
\IfFileExists{\this@[email protected]} |
| 4515 |
{\let\@locale@ifsupportbabelorpoly\@secondofthree} |
| 4516 |
{} |
| 4517 |
} |
| 4518 |
} |
| 4519 |
} |
| 4520 |
{ |
| 4521 |
% \end{macrocode} |
| 4522 |
% Not using \XeLaTeX\ or \LuaLaTeX\ so no \sty{polyglossia} support. |
| 4523 |
% Does the file \meta{language}\texttt{.ldf} exist? |
| 4524 |
% \begin{macrocode} |
| 4525 |
\IfFileExists{\this@[email protected]} |
| 4526 |
{\let\@locale@ifsupportbabelorpoly\@secondofthree} |
| 4527 |
{} |
| 4528 |
} |
| 4529 |
} |
| 4530 |
\or |
| 4531 |
% \end{macrocode} |
| 4532 |
% \pkgopt{babel} option. |
| 4533 |
% \begin{macrocode} |
| 4534 |
\let\@locale@ifsupportbabelorpoly\@secondofthree |
| 4535 |
\or |
| 4536 |
% \end{macrocode} |
| 4537 |
% \pkgopt{polyglossia} option. |
| 4538 |
% \begin{macrocode} |
| 4539 |
\let\@locale@ifsupportbabelorpoly\@thirdofthree |
| 4540 |
\or |
| 4541 |
% \end{macrocode} |
| 4542 |
% \pkgopt{cjk} option. |
| 4543 |
% \begin{macrocode} |
| 4544 |
\let\@locale@currentiscjk\@secondoftwo |
| 4545 |
% \end{macrocode} |
| 4546 |
% Is pinyin needed? |
| 4547 |
% \begin{macrocode} |
| 4548 |
\ForEachTrackedDialect{\locale@this@dialect}% |
| 4549 |
{% |
| 4550 |
\edef\this@root@lang{\TrackedLanguageFromDialect{\locale@this@dialect}}% |
| 4551 |
\@locale@ifcjk{\this@root@lang}% |
| 4552 |
{ |
| 4553 |
\@locale@iflatinscript{\locale@this@dialect}% |
| 4554 |
{\let\@locale@ifsupportpinyin\@firstoftwo}% |
| 4555 |
{} |
| 4556 |
} |
| 4557 |
{} |
| 4558 |
} |
| 4559 |
% \end{macrocode} |
| 4560 |
%End of case statement |
| 4561 |
% \begin{macrocode} |
| 4562 |
\fi |
| 4563 |
% \end{macrocode} |
| 4564 |
% |
| 4565 |
% Does \sty{CJK} need to be loaded? |
| 4566 |
% \begin{macrocode} |
| 4567 |
\@locale@ifsupportcjk |
| 4568 |
{ |
| 4569 |
% \end{macrocode} |
| 4570 |
% Is UTF-8 support needed? |
| 4571 |
% \begin{macrocode} |
| 4572 |
\@locale@ifxeorlua |
| 4573 |
{ |
| 4574 |
\RequirePackage{xeCJK}% |
| 4575 |
} |
| 4576 |
{ |
| 4577 |
\ifdefstring\@locale@inputenc{utf8}% |
| 4578 |
{% |
| 4579 |
\RequirePackage{CJKutf8}% |
| 4580 |
% \end{macrocode} |
| 4581 |
% \sty{CJKutf8} automatically loads |
| 4582 |
% \sty{inputenc} with the \pkgopt{utf8} option. |
| 4583 |
% \begin{macrocode} |
| 4584 |
\renewcommand{\@locale@loadinputenc}{}% |
| 4585 |
% \end{macrocode} |
| 4586 |
% Need to ensure UTF-8 characters are correctly set up when the |
| 4587 |
% query is made. |
| 4588 |
% \begin{macrocode} |
| 4589 |
\newcommand*{\localeprequery}{\begin{CJK}{UTF8}{}\makeatletter} |
| 4590 |
\newcommand*{\localepostquery}{\end{CJK}} |
| 4591 |
}% |
| 4592 |
{% |
| 4593 |
\RequirePackage{CJK}% |
| 4594 |
% \end{macrocode} |
| 4595 |
% Non-UTF encoding. Not implemented as I'm |
| 4596 |
% not familiar with these encodings. |
| 4597 |
% \begin{macrocode} |
| 4598 |
\PackageWarning{tex-locale}{Unsupported encoding `\@locale@loadinputenc'}% |
| 4599 |
}% |
| 4600 |
} |
| 4601 |
% \end{macrocode} |
| 4602 |
% Load \sty{pinyin} if needed. |
| 4603 |
% \begin{macrocode} |
| 4604 |
\@locale@ifsupportpinyin |
| 4605 |
{\RequirePackage{pinyin}}% |
| 4606 |
{}% |
| 4607 |
} |
| 4608 |
{} |
| 4609 |
% \end{macrocode} |
| 4610 |
|
| 4611 |
% Load \sty{inputenc} if required. |
| 4612 |
% \begin{macrocode} |
| 4613 |
\@locale@loadinputenc |
| 4614 |
% \end{macrocode} |
| 4615 |
% |
| 4616 |
%\begin{macro}{\localenopolypunct} |
| 4617 |
%Just does its argument (scoped) if \sty{polyglossia} hasn't been |
| 4618 |
%loaded. (Made robust if \sty{polyglossia} is loaded.) |
| 4619 |
% \begin{macrocode} |
| 4620 |
\newcommand{\localenopolypunct}[1]{{#1}} |
| 4621 |
% \end{macrocode} |
| 4622 |
%\end{macro} |
| 4623 |
% |
| 4624 |
%\begin{macro}{\@locale@nopolypunct} |
| 4625 |
%Robust form used with \sty{polyglossia}. |
| 4626 |
% \begin{macrocode} |
| 4627 |
\newrobustcmd{\@locale@nopolypunct}[1]{% |
| 4628 |
{% |
| 4629 |
\@tracklang@ifundef{no\languagename @punctuation}{}% |
| 4630 |
{\csname no\languagename @punctuation\endcsname}% |
| 4631 |
#1% |
| 4632 |
}% |
| 4633 |
} |
| 4634 |
% \end{macrocode} |
| 4635 |
%\end{macro} |
| 4636 |
% |
| 4637 |
% |
| 4638 |
%Load the generic code. |
| 4639 |
% \begin{macrocode} |
| 4640 |
\input{tex-locale} |
| 4641 |
% \end{macrocode} |
| 4642 |
%Load \sty{datetime2} if required: |
| 4643 |
% \begin{macrocode} |
| 4644 |
\@locale@load@dtm |
| 4645 |
% \end{macrocode} |
| 4646 |
% |
| 4647 |
%\begin{macro}{\LocaleSupportPackageCase} |
| 4648 |
%\begin{definition} |
| 4649 |
%\cs{LocaleSupportPackageCase}\marg{babel}\marg{polyglossia}\marg{neither} |
| 4650 |
%\end{definition} |
| 4651 |
%Provide a user-level command to determine whether \sty{babel} or |
| 4652 |
%\sty{polyglossia} was used. This doesn't test if \sty{CJK} was |
| 4653 |
%loaded, which may have additionally been loaded. |
| 4654 |
% \begin{macrocode} |
| 4655 |
\@ifpackageloaded{polyglossia} |
| 4656 |
{\newcommand{\LocaleSupportPackageCase}[3]{#2}} |
| 4657 |
{% |
| 4658 |
\@ifpackageloaded{babel} |
| 4659 |
{\newcommand{\LocaleSupportPackageCase}[3]{#1}}% |
| 4660 |
{\newcommand{\LocaleSupportPackageCase}[3]{#3}}% |
| 4661 |
} |
| 4662 |
% \end{macrocode} |
| 4663 |
%\end{macro} |
| 4664 |
%\iffalse |
| 4665 |
% \begin{macrocode} |
| 4666 |
%</tex-locale.sty> |
| 4667 |
% \end{macrocode} |
| 4668 |
%\fi |
| 4669 |
%\iffalse |
| 4670 |
% \begin{macrocode} |
| 4671 |
%<*tex-locale.tex> |
| 4672 |
% \end{macrocode} |
| 4673 |
%\fi |
| 4674 |
%\section{Generic Code (\texttt{tex-locale.tex})} |
| 4675 |
% Does the category code of \verb|@| need changing? |
| 4676 |
%\begin{macro}{\@locale@restore@at} |
| 4677 |
% \begin{macrocode} |
| 4678 |
\ifnum\catcode`\@=11\relax |
| 4679 |
\def\@locale@restore@at{}% |
| 4680 |
\else |
| 4681 |
\expandafter\edef\csname @locale@restore@at\endcsname{% |
| 4682 |
\noexpand\catcode`\noexpand\@=\number\catcode`\@\relax |
| 4683 |
}% |
| 4684 |
\catcode`\@=11\relax |
| 4685 |
\fi |
| 4686 |
% \end{macrocode} |
| 4687 |
%\end{macro} |
| 4688 |
% First check if this file has already been loaded: |
| 4689 |
% \begin{macrocode} |
| 4690 |
\ifx\@locale@parse@query\undefined |
| 4691 |
\else |
| 4692 |
\@locale@restore@at |
| 4693 |
\expandafter\endinput |
| 4694 |
\fi |
| 4695 |
% \end{macrocode} |
| 4696 |
% Version info. |
| 4697 |
% \begin{macrocode} |
| 4698 |
\expandafter\def\csname [email protected]\endcsname{2018/08/26 v1.0 |
| 4699 |
(NLCT) localisation support} |
| 4700 |
% \end{macrocode} |
| 4701 |
% Load \styfmt{tracklang} and \styfmt{texosquery}: |
| 4702 |
% \begin{macrocode} |
| 4703 |
\input tracklang |
| 4704 |
\input texosquery |
| 4705 |
% \end{macrocode} |
| 4706 |
% |
| 4707 |
%\begin{macro}{\@locale@err} |
| 4708 |
% \begin{macrocode} |
| 4709 |
\ifx\PackageError\undefined |
| 4710 |
\def\@locale@err#1#2{% |
| 4711 |
\errhelp{#2}% |
| 4712 |
\errmessage{tex-locale: #1}} |
| 4713 |
\else |
| 4714 |
\def\@locale@err#1#2{\PackageError{tex-locale}{#1}{#2}} |
| 4715 |
\fi |
| 4716 |
% \end{macrocode} |
| 4717 |
%\end{macro} |
| 4718 |
% |
| 4719 |
%\begin{macro}{\@locale@warn} |
| 4720 |
%Use \sty{tracklang}'s warning to allow all warnings to be switched |
| 4721 |
%off at the same time. |
| 4722 |
% \begin{macrocode} |
| 4723 |
\def\@locale@warn{\@tracklang@pkgwarn{tex-locale}} |
| 4724 |
% \end{macrocode} |
| 4725 |
%\end{macro} |
| 4726 |
% |
| 4727 |
%\begin{macro}{\@locale@info} |
| 4728 |
%Information message. |
| 4729 |
% \begin{macrocode} |
| 4730 |
\ifx\PackageInfo\undefined |
| 4731 |
\def\@locale@info#1{% |
| 4732 |
{% |
| 4733 |
\newlinechar=`\^^J |
| 4734 |
\def\MessageBreak{^^J}% |
| 4735 |
\message{^^Jtex-locale Info: #1^^J}% |
| 4736 |
}% |
| 4737 |
} |
| 4738 |
\else |
| 4739 |
\def\@locale@info#1{\PackageInfo{tex-locale}{#1}} |
| 4740 |
\fi |
| 4741 |
% \end{macrocode} |
| 4742 |
%\end{macro} |
| 4743 |
% |
| 4744 |
%Check \sty{tracklang} is at least v1.3.4. |
| 4745 |
% \begin{macrocode} |
| 4746 |
\ifx\@tracklang@pkgwarn\undefined |
| 4747 |
\@locale@err{tracklang version is too old. At least v1.3.4 required} |
| 4748 |
{You need to update tracklang to at least v1.3.4}% |
| 4749 |
\fi |
| 4750 |
% \end{macrocode} |
| 4751 |
% |
| 4752 |
%Check \sty{texosquery} is at least v1.4. |
| 4753 |
% \begin{macrocode} |
| 4754 |
\ifx\@texosquery@argquote\undefined |
| 4755 |
\@locale@err{texosquery version is too old. At least v1.4 required} |
| 4756 |
{You need to update texosquery to at least v1.4}% |
| 4757 |
\fi |
| 4758 |
% \end{macrocode} |
| 4759 |
% |
| 4760 |
%\begin{macro}{\LocaleMain} |
| 4761 |
%If \cs{LocaleMain} hasn't been defined, define it. This macro |
| 4762 |
%stores the language tag of the document's main region or |
| 4763 |
%\texttt{locale} to use the OS locale. The default is |
| 4764 |
%\texttt{locale}. This is a user-level command so it can be set before loading |
| 4765 |
%\file{tex-locale.tex}. |
| 4766 |
% \begin{macrocode} |
| 4767 |
\ifx\LocaleMain\undefined |
| 4768 |
\def\LocaleMain{locale} |
| 4769 |
\fi |
| 4770 |
% \end{macrocode} |
| 4771 |
%Sanitize just in case. |
| 4772 |
% \begin{macrocode} |
| 4773 |
\@tracklang@sanitize\LocaleMain |
| 4774 |
% \end{macrocode} |
| 4775 |
%\end{macro} |
| 4776 |
% |
| 4777 |
%\begin{macro}{\LocaleOther} |
| 4778 |
%If \cs{LocaleOther} hasn't been defined, define it. This macro |
| 4779 |
%stores a comma-separated list of language tags or |
| 4780 |
%\texttt{locale} for additional regions. The default is empty. This |
| 4781 |
%is a user-level command so it can be set before loading |
| 4782 |
%\file{tex-locale.tex}. |
| 4783 |
% \begin{macrocode} |
| 4784 |
\ifx\LocaleOther\undefined |
| 4785 |
\def\LocaleOther{} |
| 4786 |
\else |
| 4787 |
% \end{macrocode} |
| 4788 |
%Sanitize just in case. |
| 4789 |
% \begin{macrocode} |
| 4790 |
\@tracklang@sanitize\LocaleOther |
| 4791 |
\fi |
| 4792 |
% \end{macrocode} |
| 4793 |
%\end{macro} |
| 4794 |
% |
| 4795 |
%\begin{macro}{\@locale@os@tag} |
| 4796 |
%Command to keep track of the OS locale. This is |
| 4797 |
%initialised as empty but will be set if the \sty{texosquery} call |
| 4798 |
%is successful. |
| 4799 |
% \begin{macrocode} |
| 4800 |
\def\@locale@os@tag{} |
| 4801 |
% \end{macrocode} |
| 4802 |
%\end{macro} |
| 4803 |
% |
| 4804 |
%\begin{macro}{\@locale@os@default} |
| 4805 |
%The keyword used to indicate the OS locale. |
| 4806 |
% \begin{macrocode} |
| 4807 |
\def\@locale@os@default{locale} |
| 4808 |
% \end{macrocode} |
| 4809 |
%Sanitize since it needs to be compared with \cs{LocaleMain}. |
| 4810 |
% \begin{macrocode} |
| 4811 |
\@tracklang@sanitize\@locale@os@default |
| 4812 |
% \end{macrocode} |
| 4813 |
%\end{macro} |
| 4814 |
% |
| 4815 |
%\begin{macro}{\@locale@unknown@currency} |
| 4816 |
%Unknown currency designator. |
| 4817 |
% \begin{macrocode} |
| 4818 |
\def\@locale@unknown@currency{XXX} |
| 4819 |
% \end{macrocode} |
| 4820 |
%\end{macro} |
| 4821 |
% |
| 4822 |
%\begin{macro}{\@locale@os@region} |
| 4823 |
%The OS region. Initialised as empty but will be set if the |
| 4824 |
%\sty{texosquery} call is successful. |
| 4825 |
% \begin{macrocode} |
| 4826 |
\def\@locale@os@region{} |
| 4827 |
% \end{macrocode} |
| 4828 |
%\end{macro} |
| 4829 |
% |
| 4830 |
%\begin{macro}{\@locale@os@groupsep} |
| 4831 |
%The OS numeric group sep. Initialised as empty but will be set if the |
| 4832 |
%\sty{texosquery} call is successful. |
| 4833 |
% \begin{macrocode} |
| 4834 |
\def\@locale@os@groupsep{} |
| 4835 |
% \end{macrocode} |
| 4836 |
%\end{macro} |
| 4837 |
% |
| 4838 |
%\begin{macro}{\@locale@os@decsep} |
| 4839 |
%The OS numeric group sep. Initialised as empty but will be set if the |
| 4840 |
%\sty{texosquery} call is successful. |
| 4841 |
% \begin{macrocode} |
| 4842 |
\def\@locale@os@decsep{} |
| 4843 |
% \end{macrocode} |
| 4844 |
%\end{macro} |
| 4845 |
% |
| 4846 |
%\begin{macro}{\@locale@os@cursep} |
| 4847 |
%The OS currency separator. Initialised as empty but will be set if the |
| 4848 |
%\sty{texosquery} call is successful. |
| 4849 |
% \begin{macrocode} |
| 4850 |
\def\@locale@os@cursep{} |
| 4851 |
% \end{macrocode} |
| 4852 |
%\end{macro} |
| 4853 |
% |
| 4854 |
%\begin{macro}{\@locale@os@exp} |
| 4855 |
%The OS exponent symbol. Initialised as empty but will be set if the |
| 4856 |
%\sty{texosquery} call is successful. |
| 4857 |
% \begin{macrocode} |
| 4858 |
\def\@locale@os@exp{} |
| 4859 |
% \end{macrocode} |
| 4860 |
%\end{macro} |
| 4861 |
% |
| 4862 |
%\begin{macro}{\@locale@os@usesgroup} |
| 4863 |
%The OS numeric uses group value. Initialised as empty but will be set if the |
| 4864 |
%\sty{texosquery} call is successful. |
| 4865 |
% \begin{macrocode} |
| 4866 |
\def\@locale@os@usesgroup{} |
| 4867 |
% \end{macrocode} |
| 4868 |
%\end{macro} |
| 4869 |
% |
| 4870 |
%\begin{macro}{\@locale@os@currencycode} |
| 4871 |
%The OS currency code. Initialised as unknown code but will be set if the |
| 4872 |
%\sty{texosquery} call is successful. |
| 4873 |
% \begin{macrocode} |
| 4874 |
\def\@locale@os@currencycode{XXX} |
| 4875 |
% \end{macrocode} |
| 4876 |
%\end{macro} |
| 4877 |
% |
| 4878 |
%\begin{macro}{\@locale@os@regionalcurrencycode} |
| 4879 |
%The OS regional currency code. Initialised as empty but will be set if the |
| 4880 |
%\sty{texosquery} call is successful. |
| 4881 |
% \begin{macrocode} |
| 4882 |
\def\@locale@os@regionalcurrencycode{XXX} |
| 4883 |
% \end{macrocode} |
| 4884 |
%\end{macro} |
| 4885 |
% |
| 4886 |
%\begin{macro}{\@locale@os@currencysym} |
| 4887 |
%The OS currency symbol. Initialised as empty but will be set if the |
| 4888 |
%\sty{texosquery} call is successful. |
| 4889 |
% \begin{macrocode} |
| 4890 |
\def\@locale@os@currencysym{} |
| 4891 |
% \end{macrocode} |
| 4892 |
%\end{macro} |
| 4893 |
% |
| 4894 |
%\begin{macro}{\@locale@os@currencytex} |
| 4895 |
%The OS currency \TeX\ code. Initialised as empty but will be set if the |
| 4896 |
%\sty{texosquery} call is successful. |
| 4897 |
% \begin{macrocode} |
| 4898 |
\def\@locale@os@currencytex{} |
| 4899 |
% \end{macrocode} |
| 4900 |
%\end{macro} |
| 4901 |
% |
| 4902 |
%\begin{macro}{\LocaleMainFile} |
| 4903 |
%The document's main file. (The modification date is queried if not |
| 4904 |
%empty.) If \cs{jobname} includes double-quotes, these need to be |
| 4905 |
%stripped to avoid interfering with the shell-escape (especially in |
| 4906 |
%restricted mode). |
| 4907 |
% \begin{macrocode} |
| 4908 |
\ifx\LocaleMainFile\undefined |
| 4909 |
\edef\LocaleMainFile{\expandafter\texosquerystripquotes{\jobname}.tex} |
| 4910 |
\fi |
| 4911 |
% \end{macrocode} |
| 4912 |
%\end{macro} |
| 4913 |
% |
| 4914 |
%\begin{macro}{\LocaleIfDateTimePatternsSupported} |
| 4915 |
%The \texttt{-M} and \texttt{-Z} lookup is optional. This may be |
| 4916 |
%defined before \file{texosquery.tex} is input. |
| 4917 |
% \begin{macrocode} |
| 4918 |
\ifx\LocaleIfDateTimePatternsSupported\undefined |
| 4919 |
\def\LocaleIfDateTimePatternsSupported#1#2{#2} |
| 4920 |
\fi |
| 4921 |
% \end{macrocode} |
| 4922 |
%\end{macro} |
| 4923 |
% |
| 4924 |
%\begin{macro}{\localedatetimefmt} |
| 4925 |
%Allow the date/time to be wrapped in a formatting command. |
| 4926 |
% \begin{macrocode} |
| 4927 |
\def\localedatetimefmt#1{#1} |
| 4928 |
% \end{macrocode} |
| 4929 |
%\end{macro} |
| 4930 |
% |
| 4931 |
%\subsection{Setting Command Line Switches} |
| 4932 |
% |
| 4933 |
%\begin{macro}{\LocaleQueryCodesetParam} |
| 4934 |
%\app{texosquery} has two different actions for obtaining the |
| 4935 |
%codeset: \texttt{-{}-codeset-lcs} ("-C") and \texttt{-{}-codeset} |
| 4936 |
%(-cs). The second returns the codeset name as recognised by Java. |
| 4937 |
%The first returns a modified version that's closer |
| 4938 |
%to the \sty{inputenc} setting. This macro defaults to using "-C" |
| 4939 |
%but may be defined before this file is loaded to use "-cs" instead. |
| 4940 |
%(This command isn't used by \file{locale.sty} when determining the |
| 4941 |
%input encoding for \sty{inputenc}.) |
| 4942 |
% \begin{macrocode} |
| 4943 |
\ifx\LocaleQueryCodesetParam\undefined |
| 4944 |
\edef\LocaleQueryCodesetParam{\string-C} |
| 4945 |
\fi |
| 4946 |
% \end{macrocode} |
| 4947 |
%\end{macro} |
| 4948 |
% |
| 4949 |
%\begin{macro}{\@locale@query@params} |
| 4950 |
%It's more efficient to have a single \sty{texosquery} call, but the |
| 4951 |
%parameters need to be determined first. (Use short arg with |
| 4952 |
%\cs{string} just in case the hyphen character has a special |
| 4953 |
%meaning.) |
| 4954 |
% \begin{macrocode} |
| 4955 |
\edef\@locale@query@params{% |
| 4956 |
% \end{macrocode} |
| 4957 |
%Since we need to use \sty{texosquery} anyway, may as well look up |
| 4958 |
%the OS information at the same time. |
| 4959 |
% \begin{macrocode} |
| 4960 |
\string-o \string-r \string-a |
| 4961 |
% \end{macrocode} |
| 4962 |
% May as well get the PDF date in case we have a TeX format that |
| 4963 |
% doesn't provide \ics{pdfcreationdate}. |
| 4964 |
% \begin{macrocode} |
| 4965 |
\string-n |
| 4966 |
% \end{macrocode} |
| 4967 |
% Default locale data (requires \sty{texosquery} v1.2): |
| 4968 |
% \begin{macrocode} |
| 4969 |
\string-N |
| 4970 |
% \end{macrocode} |
| 4971 |
% May as well get the default codeset (requires \sty{texosquery} |
| 4972 |
% v1.2). Note that \texttt{locale.sty} may have already found this |
| 4973 |
% if the \sty{inputenc} package was automatically loaded. |
| 4974 |
% \begin{macrocode} |
| 4975 |
\LocaleQueryCodesetParam\space |
| 4976 |
} |
| 4977 |
% \end{macrocode} |
| 4978 |
%The remaining arguments need to be appended programatically. |
| 4979 |
% |
| 4980 |
%If the date-time patterns are needed, get the full date-time |
| 4981 |
%information. |
| 4982 |
% \begin{macrocode} |
| 4983 |
\LocaleIfDateTimePatternsSupported |
| 4984 |
{% |
| 4985 |
\edef\@locale@query@params{\@locale@query@params \string-M } |
| 4986 |
} |
| 4987 |
{} |
| 4988 |
% \end{macrocode} |
| 4989 |
% |
| 4990 |
% May as well get the modification date of the document file since |
| 4991 |
% we need to make a system call anyway, but only if |
| 4992 |
% \cs{LocaleMainFile} isn't empty. |
| 4993 |
% \begin{macrocode} |
| 4994 |
\ifx\LocaleMainFile\empty |
| 4995 |
\else |
| 4996 |
\edef\@locale@query@params{\@locale@query@params |
| 4997 |
\string-d \@texosquery@argquote{\LocaleMainFile} |
| 4998 |
} |
| 4999 |
\fi |
| 5000 |
% \end{macrocode} |
| 5001 |
%The \texttt{-D} switch also requires \sty{texosquery} v1.2. |
| 5002 |
%First deal with the main language. |
| 5003 |
% \begin{macrocode} |
| 5004 |
\ifx\LocaleMain\@locale@os@default |
| 5005 |
\LocaleIfDateTimePatternsSupported |
| 5006 |
{% |
| 5007 |
\edef\@locale@query@params{\@locale@query@params |
| 5008 |
\string-D \string-Z |
| 5009 |
} |
| 5010 |
} |
| 5011 |
{ |
| 5012 |
\edef\@locale@query@params{\@locale@query@params |
| 5013 |
\string-D |
| 5014 |
} |
| 5015 |
} |
| 5016 |
\else |
| 5017 |
\LocaleIfDateTimePatternsSupported |
| 5018 |
{% |
| 5019 |
\edef\@locale@query@params{\@locale@query@params |
| 5020 |
\string-D \LocaleMain\space\string-Z \LocaleMain\space |
| 5021 |
} |
| 5022 |
} |
| 5023 |
{ |
| 5024 |
\edef\@locale@query@params{\@locale@query@params |
| 5025 |
\string-D \LocaleMain\space |
| 5026 |
} |
| 5027 |
} |
| 5028 |
\fi |
| 5029 |
% \end{macrocode} |
| 5030 |
%Iterate through the list of other languages. |
| 5031 |
% \begin{macrocode} |
| 5032 |
\@tracklang@for\@locale@tag:=\LocaleOther\do{% |
| 5033 |
\ifx\@locale@tag\@locale@os@default |
| 5034 |
\LocaleIfDateTimePatternsSupported |
| 5035 |
{% |
| 5036 |
\edef\@locale@query@params{\@locale@query@params |
| 5037 |
\string-D \string-Z |
| 5038 |
} |
| 5039 |
} |
| 5040 |
{% |
| 5041 |
\edef\@locale@query@params{\@locale@query@params |
| 5042 |
\string-D |
| 5043 |
} |
| 5044 |
} |
| 5045 |
\else |
| 5046 |
\LocaleIfDateTimePatternsSupported |
| 5047 |
{% |
| 5048 |
\edef\@locale@query@params{\@locale@query@params |
| 5049 |
\string-D \@locale@tag\space\string-Z \@locale@tag\space |
| 5050 |
} |
| 5051 |
} |
| 5052 |
{% |
| 5053 |
\edef\@locale@query@params{\@locale@query@params |
| 5054 |
\string-D \@locale@tag\space |
| 5055 |
} |
| 5056 |
} |
| 5057 |
\fi |
| 5058 |
} |
| 5059 |
% \end{macrocode} |
| 5060 |
%\end{macro} |
| 5061 |
% |
| 5062 |
%\subsection{System Call} |
| 5063 |
% |
| 5064 |
%\begin{macro}{\localeprequery} |
| 5065 |
%Allow for a hook immediately before the query. |
| 5066 |
% \begin{macrocode} |
| 5067 |
\csname localeprequery\endcsname |
| 5068 |
% \end{macrocode} |
| 5069 |
%\end{macro} |
| 5070 |
% |
| 5071 |
%Now run \sty{texosquery} unless \cs{LocaleQueryFile} has been |
| 5072 |
%defined, in which case use \cs{TeXOSQueryFromFile} |
| 5073 |
% \begin{macrocode} |
| 5074 |
\ifx\LocaleQueryFile\undefined |
| 5075 |
% \end{macrocode} |
| 5076 |
% No file provided. |
| 5077 |
% \begin{macrocode} |
| 5078 |
\TeXOSQuery{\@locale@result}{\@locale@query@params} |
| 5079 |
\else |
| 5080 |
\ifx\LocaleQueryFile\empty |
| 5081 |
\TeXOSQuery{\@locale@result}{\@locale@query@params} |
| 5082 |
\else |
| 5083 |
% \end{macrocode} |
| 5084 |
%\cs{TeXOSQueryFromFile} was added to \sty{texosquery} v1.4, so |
| 5085 |
%check it's available. |
| 5086 |
% \begin{macrocode} |
| 5087 |
\ifx\TeXOSQueryFromFile\undefined |
| 5088 |
\@locale@err{texosquery too old to support |
| 5089 |
\string\LocaleQueryFile. At least v1.4 required} |
| 5090 |
{You need to update your version of texosquery} |
| 5091 |
\def\@locale@result{} |
| 5092 |
\else |
| 5093 |
\@locale@info{Fetching query results from `\LocaleQueryFile'}% |
| 5094 |
\TeXOSQueryFromFile{\@locale@result}{\LocaleQueryFile} |
| 5095 |
\fi |
| 5096 |
\fi |
| 5097 |
\fi |
| 5098 |
% \end{macrocode} |
| 5099 |
%Make the result global in case the pre and post query hooks have |
| 5100 |
%introduced a local scope. |
| 5101 |
% \begin{macrocode} |
| 5102 |
\global\let\@locale@result\@locale@result |
| 5103 |
% \end{macrocode} |
| 5104 |
% |
| 5105 |
%\begin{macro}{\localepostquery} |
| 5106 |
%Allow for a hook immediately after the query. |
| 5107 |
% \begin{macrocode} |
| 5108 |
\csname localepostquery\endcsname |
| 5109 |
% \end{macrocode} |
| 5110 |
%\end{macro} |
| 5111 |
% |
| 5112 |
%If the result is empty then the query failed (\sty{texosquery} not |
| 5113 |
%installed correctly or JRE not installed or shell escape not |
| 5114 |
%permitted or dry run mode on). The result now needs to be parsed, |
| 5115 |
%but first define some convenient commands that can be used by the |
| 5116 |
%parser. |
| 5117 |
% |
| 5118 |
%\subsection{Attributes}\label{sec:code.attributes} |
| 5119 |
%\begin{macro}{\LocaleSetAttribute} |
| 5120 |
%\begin{definition} |
| 5121 |
%\cs{LocaleSetAttribute}\marg{label}\marg{attribute |
| 5122 |
%label}\marg{attribute value} |
| 5123 |
%\end{definition} |
| 5124 |
%Provide convenient way of defining attributes. The label depends on |
| 5125 |
%the attribute type. For example, it could be the dialect label or |
| 5126 |
%the region code. |
| 5127 |
% \begin{macrocode} |
| 5128 |
\def\LocaleSetAttribute#1#2#3{% |
| 5129 |
\expandafter\def\csname locale@#2@#1\endcsname{#3}% |
| 5130 |
} |
| 5131 |
% \end{macrocode} |
| 5132 |
%\end{macro} |
| 5133 |
% |
| 5134 |
%\begin{macro}{\LocaleAppToAttribute} |
| 5135 |
%\begin{definition} |
| 5136 |
%\cs{LocaleAppToAttribute}\marg{label}\marg{attribute |
| 5137 |
%label}\marg{value} |
| 5138 |
%\end{definition} |
| 5139 |
%Append \meta{value} to this attribute value. |
| 5140 |
% \begin{macrocode} |
| 5141 |
\def\LocaleAppToAttribute#1#2#3{% |
| 5142 |
\LocaleIfHasAttribute{#1}{#2}% |
| 5143 |
{% |
| 5144 |
\expandafter\expandafter\expandafter\def |
| 5145 |
\expandafter\expandafter\csname locale@#2@#1\expandafter\endcsname |
| 5146 |
\expandafter\expandafter\expandafter{\csname locale@#2@#1\endcsname#3}% |
| 5147 |
}% |
| 5148 |
{\expandafter\def\csname locale@#2@#1\endcsname{#3}}% |
| 5149 |
} |
| 5150 |
% \end{macrocode} |
| 5151 |
%\end{macro} |
| 5152 |
% |
| 5153 |
%\begin{macro}{\LocaleXpAppToAttribute} |
| 5154 |
%\begin{definition} |
| 5155 |
%\cs{LocaleXpAppToAttribute}\marg{label}\marg{attribute |
| 5156 |
%label}\marg{value} |
| 5157 |
%\end{definition} |
| 5158 |
%As above but expand first token of \meta{value}. |
| 5159 |
% \begin{macrocode} |
| 5160 |
\def\LocaleXpAppToAttribute#1#2#3{% |
| 5161 |
\LocaleIfHasAttribute{#1}{#2}% |
| 5162 |
{% |
| 5163 |
\expandafter\expandafter\expandafter\def |
| 5164 |
\expandafter\expandafter\csname locale@#2@#1\expandafter\endcsname |
| 5165 |
\expandafter\expandafter\expandafter{% |
| 5166 |
\csname locale@#2@#1\expandafter\endcsname#3}% |
| 5167 |
}% |
| 5168 |
{% |
| 5169 |
\expandafter\def\csname locale@#2@#1\expandafter\endcsname\expandafter{#3}% |
| 5170 |
}% |
| 5171 |
} |
| 5172 |
% \end{macrocode} |
| 5173 |
%\end{macro} |
| 5174 |
% |
| 5175 |
%\begin{macro}{\LocaleAddToAttributeList} |
| 5176 |
%\begin{definition} |
| 5177 |
%\cs{LocaleAddToAttributeList}\marg{label}\marg{attribute |
| 5178 |
%label}\marg{value} |
| 5179 |
%\end{definition} |
| 5180 |
%Adds \meta{value} to this attribute's list (without repetition). |
| 5181 |
% \begin{macrocode} |
| 5182 |
\def\LocaleAddToAttributeList#1#2#3{% |
| 5183 |
\LocaleIfHasAttribute{#1}{#2}% |
| 5184 |
{% |
| 5185 |
\LocaleIfInAttributeList{#1}{#2}{#3}% |
| 5186 |
{}% |
| 5187 |
{\LocaleAppToAttribute{#1}{#2}{,#3}}% |
| 5188 |
}% |
| 5189 |
{\LocaleSetAttribute{#1}{#2}{#3}}% |
| 5190 |
} |
| 5191 |
% \end{macrocode} |
| 5192 |
%\end{macro} |
| 5193 |
% |
| 5194 |
%\begin{macro}{\LocaleXpAddToAttributeList} |
| 5195 |
%\begin{definition} |
| 5196 |
%\cs{LocaleXpAddToAttributeList}\marg{label}\marg{attribute |
| 5197 |
%label}\marg{value} |
| 5198 |
%\end{definition} |
| 5199 |
%Adds \meta{value} to this attribute's list (without repetition). |
| 5200 |
% \begin{macrocode} |
| 5201 |
\def\LocaleXpAddToAttributeList#1#2#3{% |
| 5202 |
\LocaleIfHasAttribute{#1}{#2}% |
| 5203 |
{% |
| 5204 |
\LocaleIfXpInAttributeList{#1}{#2}{#3}% |
| 5205 |
{}% |
| 5206 |
{\LocaleXpAppToAttribute{#1}{#2}{\expandafter,#3}}% |
| 5207 |
}% |
| 5208 |
{\expandafter\def\csname locale@#2@#1\expandafter\endcsname\expandafter{#3}}% |
| 5209 |
} |
| 5210 |
% \end{macrocode} |
| 5211 |
%\end{macro} |
| 5212 |
% |
| 5213 |
%\begin{macro}{\localeshowattribute} |
| 5214 |
%Debugging command. |
| 5215 |
% \begin{macrocode} |
| 5216 |
\def\localeshowattribute#1#2{% |
| 5217 |
\LocaleIfHasAttribute{#1}{#2}% |
| 5218 |
{% |
| 5219 |
\expandafter\show\csname locale@#2@#1\endcsname |
| 5220 |
}% |
| 5221 |
{\@locale@err{Attribute `#2' not defined for `#1'}% |
| 5222 |
{\string\localeshowattribute\space was asked to show this |
| 5223 |
attribute for the given attribute type, but the |
| 5224 |
associated command hasn't been defined}}% |
| 5225 |
} |
| 5226 |
% \end{macrocode} |
| 5227 |
%\end{macro} |
| 5228 |
% |
| 5229 |
%\begin{macro}{\LocaleProvideAttribute} |
| 5230 |
%\begin{definition} |
| 5231 |
%\cs{LocaleProvideAttribute}\marg{label}\marg{attribute |
| 5232 |
%label}\marg{attribute value} |
| 5233 |
%\end{definition} |
| 5234 |
%Only set the attribute if it hasn't already been set for this label. |
| 5235 |
% \begin{macrocode} |
| 5236 |
\def\LocaleProvideAttribute#1#2#3{% |
| 5237 |
\LocaleIfHasAttribute{#1}{#2}% |
| 5238 |
{}% |
| 5239 |
{\LocaleSetAttribute{#1}{#2}{#3}}% |
| 5240 |
} |
| 5241 |
% \end{macrocode} |
| 5242 |
%\end{macro} |
| 5243 |
% |
| 5244 |
%\begin{macro}{\LocaleLetAttribute} |
| 5245 |
%\begin{definition} |
| 5246 |
%\cs{LocaleLetAttribute}\marg{label}\marg{attribute |
| 5247 |
%label}\marg{cs} |
| 5248 |
%\end{definition} |
| 5249 |
%Set the attribute value to the definition of the control sequence \meta{cs}. |
| 5250 |
% \begin{macrocode} |
| 5251 |
\def\LocaleLetAttribute#1#2#3{% |
| 5252 |
\expandafter\let\csname locale@#2@#1\endcsname#3% |
| 5253 |
} |
| 5254 |
% \end{macrocode} |
| 5255 |
%\end{macro} |
| 5256 |
% |
| 5257 |
%\begin{macro}{\LocaleGetAttributeOrDefValue} |
| 5258 |
%\begin{definition} |
| 5259 |
%\cs{LocaleGetAttributeOrDefValue}\marg{label}\marg{attribute label}\marg{def |
| 5260 |
%value} |
| 5261 |
%\end{definition} |
| 5262 |
%Gets the attribute or the default value if unset. |
| 5263 |
% \begin{macrocode} |
| 5264 |
\def\LocaleGetAttributeOrDefValue#1#2#3{% |
| 5265 |
\@tracklang@ifundef{locale@#2@#1}% |
| 5266 |
{#3\@locale@undef@action{#1}{#2}}% |
| 5267 |
{\csname locale@#2@#1\endcsname}% |
| 5268 |
} |
| 5269 |
% \end{macrocode} |
| 5270 |
%\end{macro} |
| 5271 |
% |
| 5272 |
%\begin{macro}{\LocaleGetAttribute} |
| 5273 |
%\begin{definition} |
| 5274 |
%\cs{LocaleGetAttribute}\marg{label}\marg{attribute label} |
| 5275 |
%\end{definition} |
| 5276 |
% \begin{macrocode} |
| 5277 |
\def\LocaleGetAttribute#1#2{% |
| 5278 |
\LocaleGetAttributeOrDefValue{#1}{#2}{}% |
| 5279 |
} |
| 5280 |
% \end{macrocode} |
| 5281 |
%\end{macro} |
| 5282 |
% |
| 5283 |
%\begin{macro}{\@locale@undef@action} |
| 5284 |
%Action if an undefined attribute is referenced. |
| 5285 |
%Does nothing by default but may be redefined for debugging |
| 5286 |
%purposes. |
| 5287 |
% \begin{macrocode} |
| 5288 |
\def\@locale@undef@action#1#2{} |
| 5289 |
% \end{macrocode} |
| 5290 |
%\end{macro} |
| 5291 |
% |
| 5292 |
%\begin{macro}{\LocaleIfHasAttribute} |
| 5293 |
%\begin{definition} |
| 5294 |
%\cs{LocaleIfHasAttribute}\marg{label}\marg{attribute |
| 5295 |
%label}\marg{true}\marg{false} |
| 5296 |
%\end{definition} |
| 5297 |
%Tests if the given attribute has been assigned. |
| 5298 |
% \begin{macrocode} |
| 5299 |
\def\LocaleIfHasAttribute#1#2#3#4{% |
| 5300 |
\@tracklang@ifundef{locale@#2@#1}% |
| 5301 |
{#4}% |
| 5302 |
{#3}% |
| 5303 |
} |
| 5304 |
% \end{macrocode} |
| 5305 |
%\end{macro} |
| 5306 |
% |
| 5307 |
%\begin{macro}{\LocaleForEachInAttributeList} |
| 5308 |
%\begin{definition} |
| 5309 |
%\cs{LocaleForEachInAttributeList}\marg{label}\marg{attribute |
| 5310 |
%label}\marg{cs}\marg{body} |
| 5311 |
%\end{definition} |
| 5312 |
%Where an attribute value is a comma-separated list, this iterates |
| 5313 |
%over each item in that list, setting \meta{cs} to that item and |
| 5314 |
%performing \meta{body}. |
| 5315 |
% \begin{macrocode} |
| 5316 |
\def\LocaleForEachInAttributeList#1#2#3#4{% |
| 5317 |
\LocaleIfHasAttribute{#1}{#2}% |
| 5318 |
{% |
| 5319 |
\expandafter\@tracklang@for\expandafter#3\expandafter:\expandafter |
| 5320 |
=\csname locale@#2@#1\endcsname\do{#4}% |
| 5321 |
}% |
| 5322 |
{}% |
| 5323 |
} |
| 5324 |
% \end{macrocode} |
| 5325 |
%\end{macro} |
| 5326 |
% |
| 5327 |
%\begin{macro}{\LocaleIfInAttributeList} |
| 5328 |
%\begin{definition} |
| 5329 |
%\cs{LocaleIfInAttributeList}\marg{label}\marg{attribute |
| 5330 |
%label}\marg{item}\marg{true}\marg{false} |
| 5331 |
%\end{definition} |
| 5332 |
%Where an attribute value is a comma-separated list, this tests if |
| 5333 |
%\meta{item} is in that list. |
| 5334 |
% \begin{macrocode} |
| 5335 |
\def\LocaleIfInAttributeList#1#2#3#4#5{% |
| 5336 |
\LocaleIfHasAttribute{#1}{#2}% |
| 5337 |
{% |
| 5338 |
\expandafter\let\expandafter\@locale@attrlist\csname locale@#2@#1\endcsname |
| 5339 |
\@tracklang@ifinlist{#3}{\@locale@attrlist}{#4}{#5}% |
| 5340 |
}% |
| 5341 |
{#5}% |
| 5342 |
} |
| 5343 |
% \end{macrocode} |
| 5344 |
%\end{macro} |
| 5345 |
% |
| 5346 |
%\begin{macro}{\LocaleIfXpInAttributeList} |
| 5347 |
%\begin{definition} |
| 5348 |
%\cs{LocaleIfXpInAttributeList}\marg{label}\marg{attribute |
| 5349 |
%label}\marg{item}\marg{true}\marg{false} |
| 5350 |
%\end{definition} |
| 5351 |
%As above but expands the first token of \meta{item}. |
| 5352 |
% \begin{macrocode} |
| 5353 |
\def\LocaleIfXpInAttributeList#1#2#3#4#5{% |
| 5354 |
\LocaleIfHasAttribute{#1}{#2}% |
| 5355 |
{% |
| 5356 |
\expandafter\let\expandafter\@locale@attrlist\csname locale@#2@#1\endcsname |
| 5357 |
\expandafter\@tracklang@ifinlist\expandafter{#3}{\@locale@attrlist}{#4}{#5}% |
| 5358 |
}% |
| 5359 |
{#5}% |
| 5360 |
} |
| 5361 |
% \end{macrocode} |
| 5362 |
%\end{macro} |
| 5363 |
% |
| 5364 |
%\begin{macro}{\LocaleIfHasNonEmptyAttribute} |
| 5365 |
%\begin{definition} |
| 5366 |
%\cs{LocaleIfHasNonEmptyAttribute}\marg{label}\marg{attribute |
| 5367 |
%label}\marg{true}\marg{false} |
| 5368 |
%\end{definition} |
| 5369 |
%Tests if the given attribute has been assigned a non-empty value. |
| 5370 |
% \begin{macrocode} |
| 5371 |
\def\LocaleIfHasNonEmptyAttribute#1#2#3#4{% |
| 5372 |
\@tracklang@ifundef{locale@#2@#1}% |
| 5373 |
{#4}% |
| 5374 |
{% |
| 5375 |
\expandafter\ifx\csname locale@#2@#1\endcsname\empty |
| 5376 |
#4% |
| 5377 |
\else |
| 5378 |
#3% |
| 5379 |
\fi |
| 5380 |
}% |
| 5381 |
} |
| 5382 |
% \end{macrocode} |
| 5383 |
%\end{macro} |
| 5384 |
% |
| 5385 |
%\begin{macro}{\LocaleIfAttributeEqCs} |
| 5386 |
%\begin{definition} |
| 5387 |
%\cs{LocaleIfAttributeEqCs}\marg{label}\marg{attribute |
| 5388 |
%label}\marg{cs}\marg{true}\marg{false} |
| 5389 |
%\end{definition} |
| 5390 |
%If the attribute value is the same as the definition of the control |
| 5391 |
%sequence \meta{cs} to \meta{true} otherwise do false. |
| 5392 |
% \begin{macrocode} |
| 5393 |
\def\LocaleIfAttributeEqCs#1#2#3#4#5{% |
| 5394 |
\expandafter\ifx\csname locale@#2@#1\endcsname#3% |
| 5395 |
#4% |
| 5396 |
\else |
| 5397 |
#5% |
| 5398 |
\fi |
| 5399 |
} |
| 5400 |
% \end{macrocode} |
| 5401 |
%\end{macro} |
| 5402 |
% |
| 5403 |
%\begin{macro}{\LocaleIfAttributeEqCsName} |
| 5404 |
%\begin{definition} |
| 5405 |
%\cs{LocaleIfAttributeEqCsName}\marg{label}\marg{attribute |
| 5406 |
%label}\marg{cs name}\marg{true}\marg{false} |
| 5407 |
%\end{definition} |
| 5408 |
%If the attribute value is the same as the definition of the control |
| 5409 |
%sequence name \meta{cs name} to \meta{true} otherwise do false. |
| 5410 |
% \begin{macrocode} |
| 5411 |
\def\LocaleIfAttributeEqCsName#1#2#3#4#5{% |
| 5412 |
\expandafter\ifx |
| 5413 |
\csname locale@#2@#1\expandafter\endcsname |
| 5414 |
\csname #3\endcsname |
| 5415 |
#4% |
| 5416 |
\else |
| 5417 |
#5% |
| 5418 |
\fi |
| 5419 |
} |
| 5420 |
% \end{macrocode} |
| 5421 |
%\end{macro} |
| 5422 |
% |
| 5423 |
%\begin{macro}{\LocaleIfAttributeEqNum} |
| 5424 |
%\begin{definition} |
| 5425 |
%\cs{LocaleIfAttributeEqNum}\marg{label}\marg{attribute |
| 5426 |
%label}\marg{n}\marg{true}\marg{false} |
| 5427 |
%\end{definition} |
| 5428 |
%If the numeric attribute value is equal to \meta{n} do \meta{true} |
| 5429 |
%otherwise do \meta{false}. |
| 5430 |
% \begin{macrocode} |
| 5431 |
\def\LocaleIfAttributeEqNum#1#2#3#4#5{% |
| 5432 |
\LocaleIfHasNonEmptyAttribute{#1}{#2}% |
| 5433 |
{% |
| 5434 |
\expandafter\ifnum\csname locale@#2@#1\endcsname=#3 |
| 5435 |
#4% |
| 5436 |
\else |
| 5437 |
#5% |
| 5438 |
\fi |
| 5439 |
}% |
| 5440 |
{#5}% |
| 5441 |
} |
| 5442 |
% \end{macrocode} |
| 5443 |
%\end{macro} |
| 5444 |
% |
| 5445 |
%\begin{macro}{\LocaleIfSameAttributeValues} |
| 5446 |
%\begin{definition} |
| 5447 |
%\cs{LocaleIfSameAttributeValues}\marg{label}\marg{attribute |
| 5448 |
%1}\marg{attribute 2}\marg{true}\marg{false} |
| 5449 |
%\end{definition} |
| 5450 |
%Tests if two different attributes for the same \meta{label} have |
| 5451 |
%matching values. |
| 5452 |
% \begin{macrocode} |
| 5453 |
\def\LocaleIfSameAttributeValues#1#2#3#4#5{% |
| 5454 |
\expandafter\ifx |
| 5455 |
\csname locale@#2@#1\expandafter\endcsname |
| 5456 |
\csname locale@#3@#1\endcsname |
| 5457 |
#4% |
| 5458 |
\else |
| 5459 |
#5% |
| 5460 |
\fi |
| 5461 |
} |
| 5462 |
% \end{macrocode} |
| 5463 |
%\end{macro} |
| 5464 |
% |
| 5465 |
%\begin{macro}{\localeshowdialectattribute} |
| 5466 |
%Debugging command. |
| 5467 |
% \begin{macrocode} |
| 5468 |
\def\localeshowdialectattribute#1#2{% |
| 5469 |
\localeshowattribute{#1}{dialect@#2}% |
| 5470 |
} |
| 5471 |
% \end{macrocode} |
| 5472 |
%\end{macro} |
| 5473 |
% |
| 5474 |
%\begin{macro}{\LocaleSetDialectAttribute} |
| 5475 |
%\begin{definition} |
| 5476 |
%\cs{LocaleSetDialectAttribute}\marg{dialect label}\marg{attribute |
| 5477 |
%label}\marg{attribute value} |
| 5478 |
%\end{definition} |
| 5479 |
%Sets dialect attribute. |
| 5480 |
% \begin{macrocode} |
| 5481 |
\def\LocaleSetDialectAttribute#1#2#3{% |
| 5482 |
\LocaleSetAttribute{#1}{dialect@#2}{#3}% |
| 5483 |
} |
| 5484 |
% \end{macrocode} |
| 5485 |
%\end{macro} |
| 5486 |
% |
| 5487 |
%\begin{macro}{\LocaleProvideDialectAttribute} |
| 5488 |
%\begin{definition} |
| 5489 |
%\cs{LocaleProvideDialectAttribute}\marg{dialect label}\marg{attribute |
| 5490 |
%label}\marg{attribute value} |
| 5491 |
%\end{definition} |
| 5492 |
%Provides dialect attribute. |
| 5493 |
% \begin{macrocode} |
| 5494 |
\def\LocaleProvideDialectAttribute#1#2#3{% |
| 5495 |
\LocaleProvideAttribute{#1}{dialect@#2}{#3}% |
| 5496 |
} |
| 5497 |
% \end{macrocode} |
| 5498 |
%\end{macro} |
| 5499 |
% |
| 5500 |
%\begin{macro}{\LocaleLetDialectAttribute} |
| 5501 |
%\begin{definition} |
| 5502 |
%\cs{LocaleLetDialectAttribute}\marg{dialect label}\marg{attribute |
| 5503 |
%label}\marg{cs} |
| 5504 |
%\end{definition} |
| 5505 |
%Set the dialect attribute value to the definition of the control sequence \meta{cs}. |
| 5506 |
% \begin{macrocode} |
| 5507 |
\def\LocaleLetDialectAttribute#1#2#3{% |
| 5508 |
\LocaleLetAttribute{#1}{dialect@#2}{#3}% |
| 5509 |
} |
| 5510 |
% \end{macrocode} |
| 5511 |
%\end{macro} |
| 5512 |
% |
| 5513 |
%\begin{macro}{\LocaleAppToDialectAttribute} |
| 5514 |
%\begin{definition} |
| 5515 |
%\cs{LocaleAppToDialectAttribute}\marg{dialect label}\marg{attribute |
| 5516 |
%label}\marg{attribute value} |
| 5517 |
%\end{definition} |
| 5518 |
%Append to dialect attribute value. |
| 5519 |
% \begin{macrocode} |
| 5520 |
\def\LocaleAppToDialectAttribute#1#2#3{% |
| 5521 |
\LocaleAppToAttribute{#1}{dialect@#2}{#3}% |
| 5522 |
} |
| 5523 |
% \end{macrocode} |
| 5524 |
%\end{macro} |
| 5525 |
% |
| 5526 |
%\begin{macro}{\LocaleXpAppToDialectAttribute} |
| 5527 |
%\begin{definition} |
| 5528 |
%\cs{LocaleXpAppToDialectAttribute}\marg{dialect label}\marg{attribute |
| 5529 |
%label}\marg{value} |
| 5530 |
%\end{definition} |
| 5531 |
%Append to dialect attribute value (expand first token of |
| 5532 |
%\meta{value}). |
| 5533 |
% \begin{macrocode} |
| 5534 |
\def\LocaleXpAppToDialectAttribute#1#2#3{% |
| 5535 |
\LocaleXpAppToAttribute{#1}{dialect@#2}{#3}% |
| 5536 |
} |
| 5537 |
% \end{macrocode} |
| 5538 |
%\end{macro} |
| 5539 |
% |
| 5540 |
%\begin{macro}{\LocaleAddToDialectAttributeList} |
| 5541 |
%\begin{definition} |
| 5542 |
%\cs{LocaleAddToDialectAttributeList}\marg{label}\marg{attribute |
| 5543 |
%label}\marg{value} |
| 5544 |
%\end{definition} |
| 5545 |
%Adds \meta{value} to this attribute's list (without repetition). |
| 5546 |
% \begin{macrocode} |
| 5547 |
\def\LocaleAddToDialectAttributeList#1#2{% |
| 5548 |
\LocaleAddToAttributeList{#1}{dialect@#2}% |
| 5549 |
} |
| 5550 |
% \end{macrocode} |
| 5551 |
%\end{macro} |
| 5552 |
% |
| 5553 |
%\begin{macro}{\LocaleXpAddToDialectAttributeList} |
| 5554 |
%\begin{definition} |
| 5555 |
%\cs{LocaleXpAddToDialectAttributeList}\marg{label}\marg{attribute |
| 5556 |
%label}\marg{value} |
| 5557 |
%\end{definition} |
| 5558 |
%Adds \meta{value} to this attribute's list (without repetition). |
| 5559 |
% \begin{macrocode} |
| 5560 |
\def\LocaleXpAddToDialectAttributeList#1#2{% |
| 5561 |
\LocaleXpAddToAttributeList{#1}{dialect@#2}% |
| 5562 |
} |
| 5563 |
% \end{macrocode} |
| 5564 |
%\end{macro} |
| 5565 |
% |
| 5566 |
%\begin{macro}{\LocaleGetDialectAttribute} |
| 5567 |
%\begin{definition} |
| 5568 |
%\cs{LocaleGetDialectAttribute}\marg{dialect label}\marg{attribute |
| 5569 |
%label} |
| 5570 |
%\end{definition} |
| 5571 |
%Gets dialect attribute. |
| 5572 |
% \begin{macrocode} |
| 5573 |
\def\LocaleGetDialectAttribute#1#2{% |
| 5574 |
\LocaleGetAttribute{#1}{dialect@#2}% |
| 5575 |
} |
| 5576 |
% \end{macrocode} |
| 5577 |
%\end{macro} |
| 5578 |
% |
| 5579 |
%\begin{macro}{\LocaleGetDialectAttributeOrDefValue} |
| 5580 |
%\begin{definition} |
| 5581 |
%\cs{LocaleGetDialectAttributeOrDefValue}\marg{dialect label}\marg{attribute |
| 5582 |
%label}\marg{def value} |
| 5583 |
%\end{definition} |
| 5584 |
%Gets attribute for given dialect or \meta{def value} if unset. |
| 5585 |
% \begin{macrocode} |
| 5586 |
\def\LocaleGetDialectAttributeOrDefValue#1#2{% |
| 5587 |
\LocaleGetAttributeOrDefValue{#1}{dialect@#2}% |
| 5588 |
} |
| 5589 |
% \end{macrocode} |
| 5590 |
%\end{macro} |
| 5591 |
% |
| 5592 |
%\begin{macro}{\LocaleIfHasDialectAttribute} |
| 5593 |
%\begin{definition} |
| 5594 |
%\cs{LocaleIfHasDialectAttribute}\marg{dialect label}\marg{attribute |
| 5595 |
%label}\marg{true}\marg{false} |
| 5596 |
%\end{definition} |
| 5597 |
% \begin{macrocode} |
| 5598 |
\def\LocaleIfHasDialectAttribute#1#2{% |
| 5599 |
\LocaleIfHasAttribute{#1}{dialect@#2}% |
| 5600 |
} |
| 5601 |
% \end{macrocode} |
| 5602 |
%\end{macro} |
| 5603 |
% |
| 5604 |
%\begin{macro}{\LocaleForEachInDialectAttributeList} |
| 5605 |
%\begin{definition} |
| 5606 |
%\cs{LocaleForEachInDialectAttributeList}\marg{label}\marg{attribute |
| 5607 |
%label}\marg{cs}\marg{body} |
| 5608 |
%\end{definition} |
| 5609 |
%Where an attribute value is a comma-separated list, this iterates |
| 5610 |
%over each item in that list, setting \meta{cs} to that item and |
| 5611 |
%performing \meta{body}. |
| 5612 |
% \begin{macrocode} |
| 5613 |
\def\LocaleForEachInDialectAttributeList#1#2{% |
| 5614 |
\LocaleForEachInAttributeList{#1}{dialect@#2}% |
| 5615 |
} |
| 5616 |
% \end{macrocode} |
| 5617 |
%\end{macro} |
| 5618 |
% |
| 5619 |
%\begin{macro}{\LocaleIfInDialectAttributeList} |
| 5620 |
%\begin{definition} |
| 5621 |
%\cs{LocaleIfInDialectAttributeList}\marg{label}\marg{attribute |
| 5622 |
%label}\marg{item}\marg{true}\marg{false} |
| 5623 |
%\end{definition} |
| 5624 |
%Where an attribute value is a comma-separated list, this tests if |
| 5625 |
%\meta{item} is in that list. |
| 5626 |
% \begin{macrocode} |
| 5627 |
\def\LocaleIfInDialectAttributeList#1#2{% |
| 5628 |
\LocaleIfInAttributeList{#1}{dialect@#2}% |
| 5629 |
} |
| 5630 |
% \end{macrocode} |
| 5631 |
%\end{macro} |
| 5632 |
% |
| 5633 |
%\begin{macro}{\LocaleIfXpInDialectAttributeList} |
| 5634 |
%\begin{definition} |
| 5635 |
%\cs{LocaleIfXpInDialectAttributeList}\marg{label}\marg{attribute |
| 5636 |
%label}\marg{item}\marg{true}\marg{false} |
| 5637 |
%\end{definition} |
| 5638 |
%As above but expands the first token of \meta{item}. |
| 5639 |
% \begin{macrocode} |
| 5640 |
\def\LocaleIfXpInDialectAttributeList#1#2{% |
| 5641 |
\LocaleIfXpInAttributeList{#1}{dialect@#2}% |
| 5642 |
} |
| 5643 |
% \end{macrocode} |
| 5644 |
%\end{macro} |
| 5645 |
% |
| 5646 |
%\begin{macro}{\LocaleIfHasDialectNonEmptyAttribute} |
| 5647 |
%\begin{definition} |
| 5648 |
%\cs{LocaleIfHasDialectNonEmptyAttribute}\marg{dialect label}\marg{attribute |
| 5649 |
%label}\marg{true}\marg{false} |
| 5650 |
%\end{definition} |
| 5651 |
% \begin{macrocode} |
| 5652 |
\def\LocaleIfHasDialectNonEmptyAttribute#1#2{% |
| 5653 |
\LocaleIfHasNonEmptyAttribute{#1}{dialect@#2}% |
| 5654 |
} |
| 5655 |
% \end{macrocode} |
| 5656 |
%\end{macro} |
| 5657 |
% |
| 5658 |
%\begin{macro}{\LocaleIfDialectAttributeEqCs} |
| 5659 |
%\begin{definition} |
| 5660 |
%\cs{LocaleIfDialectAttributeEqCs}\marg{dialect label}\marg{attribute |
| 5661 |
%label}\marg{cs}\marg{true}\marg{false} |
| 5662 |
%\end{definition} |
| 5663 |
%If the attribute value for the given dialect is the same as the definition of the control |
| 5664 |
%sequence \meta{cs} do \meta{true} otherwise do \meta{false}. |
| 5665 |
% \begin{macrocode} |
| 5666 |
\def\LocaleIfDialectAttributeEqCs#1#2#3{% |
| 5667 |
\LocaleIfAttributeEqCs{#1}{dialect@#2}{#3}% |
| 5668 |
} |
| 5669 |
% \end{macrocode} |
| 5670 |
%\end{macro} |
| 5671 |
% |
| 5672 |
%\begin{macro}{\LocaleIfDialectAttributeEqCsName} |
| 5673 |
%\begin{definition} |
| 5674 |
%\cs{LocaleIfDialectAttributeEqCsName}\marg{dialect label}\marg{attribute |
| 5675 |
%label}\marg{cs name}\marg{true}\marg{false} |
| 5676 |
%\end{definition} |
| 5677 |
%If the attribute value for the given dialect is the same as the definition of the control |
| 5678 |
%sequence name \meta{cs name} do \meta{true} otherwise do \meta{false}. |
| 5679 |
% \begin{macrocode} |
| 5680 |
\def\LocaleIfDialectAttributeEqCsName#1#2#3{% |
| 5681 |
\LocaleIfAttributeEqCsName{#1}{dialect@#2}{#3}% |
| 5682 |
} |
| 5683 |
% \end{macrocode} |
| 5684 |
%\end{macro} |
| 5685 |
% |
| 5686 |
%\begin{macro}{\LocaleIfDialectAttributeEqNum} |
| 5687 |
%\begin{definition} |
| 5688 |
%\cs{LocaleIfDialectAttributeEqNum}\marg{dialect label}\marg{attribute |
| 5689 |
%label}\marg{n}\marg{true}\marg{false} |
| 5690 |
%\end{definition} |
| 5691 |
%If the numeric attribute value for the given dialect is equal to |
| 5692 |
%the number \meta{n} do \meta{true} otherwise do \meta{false}. |
| 5693 |
% \begin{macrocode} |
| 5694 |
\def\LocaleIfDialectAttributeEqNum#1#2#3{% |
| 5695 |
\LocaleIfAttributeEqNum{#1}{dialect@#2}{#3}% |
| 5696 |
} |
| 5697 |
% \end{macrocode} |
| 5698 |
%\end{macro} |
| 5699 |
% |
| 5700 |
%\begin{macro}{\LocaleIfSameDialectAttributeValues} |
| 5701 |
%\begin{definition} |
| 5702 |
%\cs{LocaleIfSameDialectAttributeValues}\marg{dialect label}\marg{attribute |
| 5703 |
%1}\marg{attribute 2}\marg{true}\marg{false} |
| 5704 |
%\end{definition} |
| 5705 |
%Tests if two different dialect attributes for the same |
| 5706 |
%\meta{dialect label} have |
| 5707 |
%matching values. |
| 5708 |
% \begin{macrocode} |
| 5709 |
\def\LocaleIfSameDialectAttributeValues#1#2#3{% |
| 5710 |
\LocaleIfSameAttributeValues{#1}{dialect@#2}{dialect@#3}% |
| 5711 |
} |
| 5712 |
% \end{macrocode} |
| 5713 |
%\end{macro} |
| 5714 |
% |
| 5715 |
%\begin{macro}{\localeshowregionattribute} |
| 5716 |
%Debugging command. |
| 5717 |
% \begin{macrocode} |
| 5718 |
\def\localeshowregionattribute#1#2{% |
| 5719 |
\localeshowattribute{#1}{region@#2}% |
| 5720 |
} |
| 5721 |
% \end{macrocode} |
| 5722 |
%\end{macro} |
| 5723 |
% |
| 5724 |
%\begin{macro}{\LocaleSetRegionAttribute} |
| 5725 |
%\begin{definition} |
| 5726 |
%\cs{LocaleSetRegionAttribute}\marg{region code}\marg{attribute |
| 5727 |
%label}\marg{attribute value} |
| 5728 |
%\end{definition} |
| 5729 |
%Sets region attribute. |
| 5730 |
% \begin{macrocode} |
| 5731 |
\def\LocaleSetRegionAttribute#1#2#3{% |
| 5732 |
\LocaleSetAttribute{#1}{region@#2}{#3}% |
| 5733 |
} |
| 5734 |
% \end{macrocode} |
| 5735 |
%\end{macro} |
| 5736 |
% |
| 5737 |
%\begin{macro}{\LocaleProvideRegionAttribute} |
| 5738 |
%\begin{definition} |
| 5739 |
%\cs{LocaleProvideRegionAttribute}\marg{region code}\marg{attribute |
| 5740 |
%label}\marg{attribute value} |
| 5741 |
%\end{definition} |
| 5742 |
%Provides region attribute. |
| 5743 |
% \begin{macrocode} |
| 5744 |
\def\LocaleProvideRegionAttribute#1#2#3{% |
| 5745 |
\LocaleProvideAttribute{#1}{region@#2}{#3}% |
| 5746 |
} |
| 5747 |
% \end{macrocode} |
| 5748 |
%\end{macro} |
| 5749 |
% |
| 5750 |
%\begin{macro}{\LocaleLetRegionAttribute} |
| 5751 |
%\begin{definition} |
| 5752 |
%\cs{LocaleLetRegionAttribute}\marg{region code}\marg{attribute |
| 5753 |
%label}\marg{cs} |
| 5754 |
%\end{definition} |
| 5755 |
%Set the region attribute value to the definition of the control sequence \meta{cs}. |
| 5756 |
% \begin{macrocode} |
| 5757 |
\def\LocaleLetRegionAttribute#1#2#3{% |
| 5758 |
\LocaleLetAttribute{#1}{region@#2}{#3}% |
| 5759 |
} |
| 5760 |
% \end{macrocode} |
| 5761 |
%\end{macro} |
| 5762 |
% |
| 5763 |
%\begin{macro}{\LocaleAppToRegionAttribute} |
| 5764 |
%\begin{definition} |
| 5765 |
%\cs{LocaleAppToRegionAttribute}\marg{region code}\marg{attribute |
| 5766 |
%label}\marg{value} |
| 5767 |
%\end{definition} |
| 5768 |
%Append to region attribute. |
| 5769 |
% \begin{macrocode} |
| 5770 |
\def\LocaleAppToRegionAttribute#1#2#3{% |
| 5771 |
\LocaleAppToAttribute{#1}{region@#2}{#3}% |
| 5772 |
} |
| 5773 |
% \end{macrocode} |
| 5774 |
%\end{macro} |
| 5775 |
% |
| 5776 |
%\begin{macro}{\LocaleXpAppToRegionAttribute} |
| 5777 |
%\begin{definition} |
| 5778 |
%\cs{LocaleXpAppToRegionAttribute}\marg{region code}\marg{attribute |
| 5779 |
%label}\marg{value} |
| 5780 |
%\end{definition} |
| 5781 |
%Append to region attribute (expand first token of |
| 5782 |
%\meta{value}). |
| 5783 |
% \begin{macrocode} |
| 5784 |
\def\LocaleXpAppToRegionAttribute#1#2#3{% |
| 5785 |
\LocaleXpAppToAttribute{#1}{region@#2}{#3}% |
| 5786 |
} |
| 5787 |
% \end{macrocode} |
| 5788 |
%\end{macro} |
| 5789 |
% |
| 5790 |
%\begin{macro}{\LocaleAddToRegionAttributeList} |
| 5791 |
%\begin{definition} |
| 5792 |
%\cs{LocaleAddToRegionAttributeList}\marg{label}\marg{attribute |
| 5793 |
%label}\marg{value} |
| 5794 |
%\end{definition} |
| 5795 |
%Adds \meta{value} to this attribute's list (without repetition). |
| 5796 |
% \begin{macrocode} |
| 5797 |
\def\LocaleAddToRegionAttributeList#1#2{% |
| 5798 |
\LocaleAddToAttributeList{#1}{region@#2}% |
| 5799 |
} |
| 5800 |
% \end{macrocode} |
| 5801 |
%\end{macro} |
| 5802 |
% |
| 5803 |
%\begin{macro}{\LocaleXpAddToRegionAttributeList} |
| 5804 |
%\begin{definition} |
| 5805 |
%\cs{LocaleXpAddToRegionAttributeList}\marg{label}\marg{attribute |
| 5806 |
%label}\marg{value} |
| 5807 |
%\end{definition} |
| 5808 |
%Adds \meta{value} to this attribute's list (without repetition). |
| 5809 |
% \begin{macrocode} |
| 5810 |
\def\LocaleXpAddToRegionAttributeList#1#2{% |
| 5811 |
\LocaleXpAddToAttributeList{#1}{region@#2}% |
| 5812 |
} |
| 5813 |
% \end{macrocode} |
| 5814 |
%\end{macro} |
| 5815 |
% |
| 5816 |
%\begin{macro}{\LocaleGetRegionAttribute} |
| 5817 |
%\begin{definition} |
| 5818 |
%\cs{LocaleGetRegionAttribute}\marg{region code}\marg{attribute |
| 5819 |
%label} |
| 5820 |
%\end{definition} |
| 5821 |
%Gets region attribute. |
| 5822 |
% \begin{macrocode} |
| 5823 |
\def\LocaleGetRegionAttribute#1#2{% |
| 5824 |
\LocaleGetAttribute{#1}{region@#2}% |
| 5825 |
} |
| 5826 |
% \end{macrocode} |
| 5827 |
%\end{macro} |
| 5828 |
% |
| 5829 |
%\begin{macro}{\LocaleGetRegionAttributeOrDefValue} |
| 5830 |
%\begin{definition} |
| 5831 |
%\cs{LocaleGetRegionAttributeOrDefValue}\marg{region code}\marg{attribute |
| 5832 |
%label}\marg{def value} |
| 5833 |
%\end{definition} |
| 5834 |
%Gets attribute for given region or \meta{def value} if unset. |
| 5835 |
% \begin{macrocode} |
| 5836 |
\def\LocaleGetRegionAttributeOrDefValue#1#2{% |
| 5837 |
\LocaleGetAttributeOrDefValue{#1}{region@#2}% |
| 5838 |
} |
| 5839 |
% \end{macrocode} |
| 5840 |
%\end{macro} |
| 5841 |
% |
| 5842 |
%\begin{macro}{\LocaleIfHasRegionAttribute} |
| 5843 |
%\begin{definition} |
| 5844 |
%\cs{LocaleIfHasRegionAttribute}\marg{region code}\marg{attribute |
| 5845 |
%label}\marg{true}\marg{false} |
| 5846 |
%\end{definition} |
| 5847 |
% \begin{macrocode} |
| 5848 |
\def\LocaleIfHasRegionAttribute#1#2{% |
| 5849 |
\LocaleIfHasAttribute{#1}{region@#2}% |
| 5850 |
} |
| 5851 |
% \end{macrocode} |
| 5852 |
%\end{macro} |
| 5853 |
% |
| 5854 |
%\begin{macro}{\LocaleForEachInRegionAttributeList} |
| 5855 |
%\begin{definition} |
| 5856 |
%\cs{LocaleForEachInRegionAttributeList}\marg{label}\marg{attribute |
| 5857 |
%label}\marg{cs}\marg{body} |
| 5858 |
%\end{definition} |
| 5859 |
%Where an attribute value is a comma-separated list, this iterates |
| 5860 |
%over each item in that list, setting \meta{cs} to that item and |
| 5861 |
%performing \meta{body}. |
| 5862 |
% \begin{macrocode} |
| 5863 |
\def\LocaleForEachInRegionAttributeList#1#2{% |
| 5864 |
\LocaleForEachInAttributeList{#1}{region@#2}% |
| 5865 |
} |
| 5866 |
% \end{macrocode} |
| 5867 |
%\end{macro} |
| 5868 |
% |
| 5869 |
%\begin{macro}{\LocaleIfInRegionAttributeList} |
| 5870 |
%\begin{definition} |
| 5871 |
%\cs{LocaleIfInRegionAttributeList}\marg{label}\marg{attribute |
| 5872 |
%label}\marg{item}\marg{true}\marg{false} |
| 5873 |
%\end{definition} |
| 5874 |
%Where an attribute value is a comma-separated list, this tests if |
| 5875 |
%\meta{item} is in that list. |
| 5876 |
% \begin{macrocode} |
| 5877 |
\def\LocaleIfInRegionAttributeList#1#2{% |
| 5878 |
\LocaleIfInAttributeList{#1}{region@#2}% |
| 5879 |
} |
| 5880 |
% \end{macrocode} |
| 5881 |
%\end{macro} |
| 5882 |
% |
| 5883 |
%\begin{macro}{\LocaleIfXpInRegionAttributeList} |
| 5884 |
%\begin{definition} |
| 5885 |
%\cs{LocaleIfXpInRegionAttributeList}\marg{label}\marg{attribute |
| 5886 |
%label}\marg{item}\marg{true}\marg{false} |
| 5887 |
%\end{definition} |
| 5888 |
%As above but expands the first token of \meta{item}. |
| 5889 |
% \begin{macrocode} |
| 5890 |
\def\LocaleIfXpInRegionAttributeList#1#2{% |
| 5891 |
\LocaleIfXpInAttributeList{#1}{region@#2}% |
| 5892 |
} |
| 5893 |
% \end{macrocode} |
| 5894 |
%\end{macro} |
| 5895 |
% |
| 5896 |
%\begin{macro}{\LocaleIfHasRegionNonEmptyAttribute} |
| 5897 |
%\begin{definition} |
| 5898 |
%\cs{LocaleIfHasRegionNonEmptyAttribute}\marg{region code}\marg{attribute |
| 5899 |
%label}\marg{true}\marg{false} |
| 5900 |
%\end{definition} |
| 5901 |
% \begin{macrocode} |
| 5902 |
\def\LocaleIfHasRegionNonEmptyAttribute#1#2{% |
| 5903 |
\LocaleIfHasNonEmptyAttribute{#1}{region@#2}% |
| 5904 |
} |
| 5905 |
% \end{macrocode} |
| 5906 |
%\end{macro} |
| 5907 |
% |
| 5908 |
%\begin{macro}{\LocaleIfRegionAttributeEqCs} |
| 5909 |
%\begin{definition} |
| 5910 |
%\cs{LocaleIfRegionAttributeEqCs}\marg{region code}\marg{attribute |
| 5911 |
%label}\marg{cs}\marg{true}\marg{false} |
| 5912 |
%\end{definition} |
| 5913 |
%If the attribute value for the given region is the same as the definition of the control |
| 5914 |
%sequence \meta{cs} do \meta{true} otherwise do \meta{false}. |
| 5915 |
% \begin{macrocode} |
| 5916 |
\def\LocaleIfRegionAttributeEqCs#1#2#3{% |
| 5917 |
\LocaleIfAttributeEqCs{#1}{region@#2}{#3}% |
| 5918 |
} |
| 5919 |
% \end{macrocode} |
| 5920 |
%\end{macro} |
| 5921 |
% |
| 5922 |
%\begin{macro}{\LocaleIfRegionAttributeEqCsName} |
| 5923 |
%\begin{definition} |
| 5924 |
%\cs{LocaleIfRegionAttributeEqCsName}\marg{region code}\marg{attribute |
| 5925 |
%label}\marg{cs name}\marg{true}\marg{false} |
| 5926 |
%\end{definition} |
| 5927 |
%If the attribute value for the given region is the same as the definition of the control |
| 5928 |
%sequence name \meta{cs name} do \meta{true} otherwise do \meta{false}. |
| 5929 |
% \begin{macrocode} |
| 5930 |
\def\LocaleIfRegionAttributeEqCsName#1#2#3{% |
| 5931 |
\LocaleIfAttributeEqCsName{#1}{region@#2}{#3}% |
| 5932 |
} |
| 5933 |
% \end{macrocode} |
| 5934 |
%\end{macro} |
| 5935 |
% |
| 5936 |
%\begin{macro}{\LocaleIfRegionAttributeEqNum} |
| 5937 |
%\begin{definition} |
| 5938 |
%\cs{LocaleIfRegionAttributeEqNum}\marg{region label}\marg{attribute |
| 5939 |
%label}\marg{n}\marg{true}\marg{false} |
| 5940 |
%\end{definition} |
| 5941 |
%If the numeric attribute value for the given region is equal to |
| 5942 |
%the number \meta{n} do \meta{true} otherwise do \meta{false}. |
| 5943 |
% \begin{macrocode} |
| 5944 |
\def\LocaleIfRegionAttributeEqNum#1#2#3{% |
| 5945 |
\LocaleIfAttributeEqNum{#1}{region@#2}{#3}% |
| 5946 |
} |
| 5947 |
% \end{macrocode} |
| 5948 |
%\end{macro} |
| 5949 |
% |
| 5950 |
%\begin{macro}{\LocaleIfSameRegionAttributeValues} |
| 5951 |
%\begin{definition} |
| 5952 |
%\cs{LocaleIfSameRegionAttributeValues}\marg{region code}\marg{attribute |
| 5953 |
%1}\marg{attribute 2}\marg{true}\marg{false} |
| 5954 |
%\end{definition} |
| 5955 |
%Tests if two different region attributes for the same |
| 5956 |
%\meta{region code} have matching values. |
| 5957 |
% \begin{macrocode} |
| 5958 |
\def\LocaleIfSameRegionAttributeValues#1#2#3{% |
| 5959 |
\LocaleIfSameAttributeValues{#1}{region@#2}{region@#3}% |
| 5960 |
} |
| 5961 |
% \end{macrocode} |
| 5962 |
%\end{macro} |
| 5963 |
% |
| 5964 |
%\begin{macro}{\localeshowcurrencyattribute} |
| 5965 |
%Debugging command. |
| 5966 |
% \begin{macrocode} |
| 5967 |
\def\localeshowcurrencyattribute#1#2{% |
| 5968 |
\localeshowattribute{#1}{currency@#2}% |
| 5969 |
} |
| 5970 |
% \end{macrocode} |
| 5971 |
%\end{macro} |
| 5972 |
% |
| 5973 |
%\begin{macro}{\LocaleSetCurrencyAttribute} |
| 5974 |
%\begin{definition} |
| 5975 |
%\cs{LocaleSetCurrencyAttribute}\marg{currency code}\marg{attribute |
| 5976 |
%label}\marg{attribute value} |
| 5977 |
%\end{definition} |
| 5978 |
%Sets currency attribute. |
| 5979 |
% \begin{macrocode} |
| 5980 |
\def\LocaleSetCurrencyAttribute#1#2#3{% |
| 5981 |
\LocaleSetAttribute{#1}{currency@#2}{#3}% |
| 5982 |
} |
| 5983 |
% \end{macrocode} |
| 5984 |
%\end{macro} |
| 5985 |
% |
| 5986 |
%\begin{macro}{\LocaleProvideCurrencyAttribute} |
| 5987 |
%\begin{definition} |
| 5988 |
%\cs{LocaleProvideCurrencyAttribute}\marg{currency code}\marg{attribute |
| 5989 |
%label}\marg{attribute value} |
| 5990 |
%\end{definition} |
| 5991 |
%Provides currency attribute. |
| 5992 |
% \begin{macrocode} |
| 5993 |
\def\LocaleProvideCurrencyAttribute#1#2#3{% |
| 5994 |
\LocaleProvideAttribute{#1}{currency@#2}{#3}% |
| 5995 |
} |
| 5996 |
% \end{macrocode} |
| 5997 |
%\end{macro} |
| 5998 |
% |
| 5999 |
%\begin{macro}{\LocaleLetCurrencyAttribute} |
| 6000 |
%\begin{definition} |
| 6001 |
%\cs{LocaleLetCurrencyAttribute}\marg{currency code}\marg{attribute |
| 6002 |
%label}\marg{cs} |
| 6003 |
%\end{definition} |
| 6004 |
%Set the currency attribute value to the definition of the control sequence \meta{cs}. |
| 6005 |
% \begin{macrocode} |
| 6006 |
\def\LocaleLetCurrencyAttribute#1#2#3{% |
| 6007 |
\LocaleLetAttribute{#1}{currency@#2}{#3}% |
| 6008 |
} |
| 6009 |
% \end{macrocode} |
| 6010 |
%\end{macro} |
| 6011 |
% |
| 6012 |
%\begin{macro}{\LocaleAppToCurrencyAttribute} |
| 6013 |
%\begin{definition} |
| 6014 |
%\cs{LocaleAppToCurrencyAttribute}\marg{currency code}\marg{attribute |
| 6015 |
%label}\marg{value} |
| 6016 |
%\end{definition} |
| 6017 |
%Append to currency attribute value. |
| 6018 |
% \begin{macrocode} |
| 6019 |
\def\LocaleAppToCurrencyAttribute#1#2#3{% |
| 6020 |
\LocaleAppToAttribute{#1}{currency@#2}{#3}% |
| 6021 |
} |
| 6022 |
% \end{macrocode} |
| 6023 |
%\end{macro} |
| 6024 |
% |
| 6025 |
%\begin{macro}{\LocaleXpAppToCurrencyAttribute} |
| 6026 |
%\begin{definition} |
| 6027 |
%\cs{LocaleXpAppToCurrencyAttribute}\marg{currency code}\marg{attribute |
| 6028 |
%label}\marg{value} |
| 6029 |
%\end{definition} |
| 6030 |
%Append to currency attribute value (expand first token of |
| 6031 |
%\meta{value}). |
| 6032 |
% \begin{macrocode} |
| 6033 |
\def\LocaleXpAppToCurrencyAttribute#1#2#3{% |
| 6034 |
\LocaleXpAppToAttribute{#1}{currency@#2}{#3}% |
| 6035 |
} |
| 6036 |
% \end{macrocode} |
| 6037 |
%\end{macro} |
| 6038 |
% |
| 6039 |
%\begin{macro}{\LocaleAddToCurrencyAttributeList} |
| 6040 |
%\begin{definition} |
| 6041 |
%\cs{LocaleAddToCurrencyAttributeList}\marg{label}\marg{attribute |
| 6042 |
%label}\marg{value} |
| 6043 |
%\end{definition} |
| 6044 |
%Adds \meta{value} to this attribute's list (without repetition). |
| 6045 |
% \begin{macrocode} |
| 6046 |
\def\LocaleAddToCurrencyAttributeList#1#2{% |
| 6047 |
\LocaleAddToAttributeList{#1}{currency@#2}% |
| 6048 |
} |
| 6049 |
% \end{macrocode} |
| 6050 |
%\end{macro} |
| 6051 |
% |
| 6052 |
%\begin{macro}{\LocaleXpAddToCurrencyAttributeList} |
| 6053 |
%\begin{definition} |
| 6054 |
%\cs{LocaleXpAddToCurrencyAttributeList}\marg{label}\marg{attribute |
| 6055 |
%label}\marg{value} |
| 6056 |
%\end{definition} |
| 6057 |
%Adds \meta{value} to this attribute's list (without repetition). |
| 6058 |
% \begin{macrocode} |
| 6059 |
\def\LocaleXpAddToCurrencyAttributeList#1#2{% |
| 6060 |
\LocaleXpAddToAttributeList{#1}{currency@#2}% |
| 6061 |
} |
| 6062 |
% \end{macrocode} |
| 6063 |
%\end{macro} |
| 6064 |
% |
| 6065 |
%\begin{macro}{\LocaleGetCurrencyAttribute} |
| 6066 |
%\begin{definition} |
| 6067 |
%\cs{LocaleGetCurrencyAttribute}\marg{currency code}\marg{attribute |
| 6068 |
%label} |
| 6069 |
%\end{definition} |
| 6070 |
%Gets currency attribute. |
| 6071 |
% \begin{macrocode} |
| 6072 |
\def\LocaleGetCurrencyAttribute#1#2{% |
| 6073 |
\LocaleGetAttribute{#1}{currency@#2}% |
| 6074 |
} |
| 6075 |
% \end{macrocode} |
| 6076 |
%\end{macro} |
| 6077 |
% |
| 6078 |
%\begin{macro}{\LocaleGetCurrencyAttributeOrDefValue} |
| 6079 |
%\begin{definition} |
| 6080 |
%\cs{LocaleGetCurrencyAttributeOrDefValue}\marg{currency code}\marg{attribute |
| 6081 |
%label}\marg{def value} |
| 6082 |
%\end{definition} |
| 6083 |
%Gets attribute for given currency or \meta{def value} if unset. |
| 6084 |
% \begin{macrocode} |
| 6085 |
\def\LocaleGetCurrencyAttributeOrDefValue#1#2{% |
| 6086 |
\LocaleGetAttributeOrDefValue{#1}{currency@#2}% |
| 6087 |
} |
| 6088 |
% \end{macrocode} |
| 6089 |
%\end{macro} |
| 6090 |
% |
| 6091 |
%\begin{macro}{\LocaleIfHasCurrencyAttribute} |
| 6092 |
%\begin{definition} |
| 6093 |
%\cs{LocaleIfHasCurrencyAttribute}\marg{currency code}\marg{attribute |
| 6094 |
%label}\marg{true}\marg{false} |
| 6095 |
%\end{definition} |
| 6096 |
% \begin{macrocode} |
| 6097 |
\def\LocaleIfHasCurrencyAttribute#1#2{% |
| 6098 |
\LocaleIfHasAttribute{#1}{currency@#2}% |
| 6099 |
} |
| 6100 |
% \end{macrocode} |
| 6101 |
%\end{macro} |
| 6102 |
% |
| 6103 |
%\begin{macro}{\LocaleForEachInCurrencyAttributeList} |
| 6104 |
%\begin{definition} |
| 6105 |
%\cs{LocaleForEachInCurrencyAttributeList}\marg{label}\marg{attribute |
| 6106 |
%label}\marg{cs}\marg{body} |
| 6107 |
%\end{definition} |
| 6108 |
%Where an attribute value is a comma-separated list, this iterates |
| 6109 |
%over each item in that list, setting \meta{cs} to that item and |
| 6110 |
%performing \meta{body}. |
| 6111 |
% \begin{macrocode} |
| 6112 |
\def\LocaleForEachInCurrencyAttributeList#1#2{% |
| 6113 |
\LocaleForEachInAttributeList{#1}{currency@#2}% |
| 6114 |
} |
| 6115 |
% \end{macrocode} |
| 6116 |
%\end{macro} |
| 6117 |
% |
| 6118 |
%\begin{macro}{\LocaleIfInCurrencyAttributeList} |
| 6119 |
%\begin{definition} |
| 6120 |
%\cs{LocaleIfInCurrencyAttributeList}\marg{label}\marg{attribute |
| 6121 |
%label}\marg{item}\marg{true}\marg{false} |
| 6122 |
%\end{definition} |
| 6123 |
%Where an attribute value is a comma-separated list, this tests if |
| 6124 |
%\meta{item} is in that list. |
| 6125 |
% \begin{macrocode} |
| 6126 |
\def\LocaleIfInCurrencyAttributeList#1#2{% |
| 6127 |
\LocaleIfInAttributeList{#1}{currency@#2}% |
| 6128 |
} |
| 6129 |
% \end{macrocode} |
| 6130 |
%\end{macro} |
| 6131 |
% |
| 6132 |
%\begin{macro}{\LocaleIfXpInCurrencyAttributeList} |
| 6133 |
%\begin{definition} |
| 6134 |
%\cs{LocaleIfXpInCurrencyAttributeList}\marg{label}\marg{attribute |
| 6135 |
%label}\marg{item}\marg{true}\marg{false} |
| 6136 |
%\end{definition} |
| 6137 |
%As above but expands the first token of \meta{item}. |
| 6138 |
% \begin{macrocode} |
| 6139 |
\def\LocaleIfXpInCurrencyAttributeList#1#2{% |
| 6140 |
\LocaleIfXpInAttributeList{#1}{currency@#2}% |
| 6141 |
} |
| 6142 |
% \end{macrocode} |
| 6143 |
%\end{macro} |
| 6144 |
% |
| 6145 |
%\begin{macro}{\LocaleIfHasCurrencyNonEmptyAttribute} |
| 6146 |
%\begin{definition} |
| 6147 |
%\cs{LocaleIfHasCurrencyNonEmptyAttribute}\marg{currency code}\marg{attribute |
| 6148 |
%label}\marg{true}\marg{false} |
| 6149 |
%\end{definition} |
| 6150 |
% \begin{macrocode} |
| 6151 |
\def\LocaleIfHasCurrencyNonEmptyAttribute#1#2{% |
| 6152 |
\LocaleIfHasNonEmptyAttribute{#1}{currency@#2}% |
| 6153 |
} |
| 6154 |
% \end{macrocode} |
| 6155 |
%\end{macro} |
| 6156 |
% |
| 6157 |
%\begin{macro}{\LocaleIfCurrencyAttributeEqCs} |
| 6158 |
%\begin{definition} |
| 6159 |
%\cs{LocaleIfCurrencyAttributeEqCs}\marg{currency code}\marg{attribute |
| 6160 |
%label}\marg{cs}\marg{true}\marg{false} |
| 6161 |
%\end{definition} |
| 6162 |
%If the attribute value for the given currency is the same as the definition of the control |
| 6163 |
%sequence \meta{cs} do \meta{true} otherwise do \meta{false}. |
| 6164 |
% \begin{macrocode} |
| 6165 |
\def\LocaleIfCurrencyAttributeEqCs#1#2#3{% |
| 6166 |
\LocaleIfAttributeEqCs{#1}{currency@#2}{#3}% |
| 6167 |
} |
| 6168 |
% \end{macrocode} |
| 6169 |
%\end{macro} |
| 6170 |
% |
| 6171 |
%\begin{macro}{\LocaleIfCurrencyAttributeEqCsName} |
| 6172 |
%\begin{definition} |
| 6173 |
%\cs{LocaleIfCurrencyAttributeEqCsName}\marg{currency code}\marg{attribute |
| 6174 |
%label}\marg{cs name}\marg{true}\marg{false} |
| 6175 |
%\end{definition} |
| 6176 |
%If the attribute value for the given currency is the same as the definition of the control |
| 6177 |
%sequence name \meta{cs name} do \meta{true} otherwise do |
| 6178 |
%\meta{false}. |
| 6179 |
% \begin{macrocode} |
| 6180 |
\def\LocaleIfCurrencyAttributeEqCsName#1#2#3{% |
| 6181 |
\LocaleIfAttributeEqCsName{#1}{currency@#2}{#3}% |
| 6182 |
} |
| 6183 |
% \end{macrocode} |
| 6184 |
%\end{macro} |
| 6185 |
% |
| 6186 |
%\begin{macro}{\LocaleIfCurrencyAttributeEqNum} |
| 6187 |
%\begin{definition} |
| 6188 |
%\cs{LocaleIfCurrencyAttributeEqNum}\marg{currency label}\marg{attribute |
| 6189 |
%label}\marg{n}\marg{true}\marg{false} |
| 6190 |
%\end{definition} |
| 6191 |
%If the numeric attribute value for the given currency is equal to |
| 6192 |
%the number \meta{n} do \meta{true} otherwise do \meta{false}. |
| 6193 |
% \begin{macrocode} |
| 6194 |
\def\LocaleIfCurrencyAttributeEqNum#1#2#3{% |
| 6195 |
\LocaleIfAttributeEqNum{#1}{currency@#2}{#3}% |
| 6196 |
} |
| 6197 |
% \end{macrocode} |
| 6198 |
%\end{macro} |
| 6199 |
% |
| 6200 |
%\begin{macro}{\LocaleIfSameCurrencyAttributeValues} |
| 6201 |
%\begin{definition} |
| 6202 |
%\cs{LocaleIfSameCurrencyAttributeValues}\marg{currency code}\marg{attribute |
| 6203 |
%1}\marg{attribute 2}\marg{true}\marg{false} |
| 6204 |
%\end{definition} |
| 6205 |
%Tests if two different currency attributes for the same |
| 6206 |
%\meta{currency code} have matching values. |
| 6207 |
% \begin{macrocode} |
| 6208 |
\def\LocaleIfSameCurrencyAttributeValues#1#2#3{% |
| 6209 |
\LocaleIfSameAttributeValues{#1}{currency@#2}{currency@#3}% |
| 6210 |
} |
| 6211 |
% \end{macrocode} |
| 6212 |
%\end{macro} |
| 6213 |
% |
| 6214 |
%\subsection{Parser Commands} |
| 6215 |
% |
| 6216 |
%Define commands that are needed to parse the result. |
| 6217 |
%\begin{macro}{\@locale@parse@result} |
| 6218 |
%Start parsing the result. There are more than nine arguments, so do |
| 6219 |
%this in bits. The first six arguments are: OS name, OS version, OS |
| 6220 |
%architecture, PDF date-time, BCP 47 tag for default locale, |
| 6221 |
%the default file encoding. |
| 6222 |
% \begin{macrocode} |
| 6223 |
\def\@locale@parse@result#1#2#3#4#5#6{% |
| 6224 |
\def\LocaleOSname{#1}% |
| 6225 |
\def\LocaleOSversion{#2}% |
| 6226 |
\def\LocaleOSarch{#3}% |
| 6227 |
\def\LocaleNowStamp{#4}% |
| 6228 |
\@locale@parse@default#5% remove outer group |
| 6229 |
\def\LocaleOScodeset{#6}% |
| 6230 |
% \end{macrocode} |
| 6231 |
% Is date-time pattern support required? |
| 6232 |
% \begin{macrocode} |
| 6233 |
\LocaleIfDateTimePatternsSupported |
| 6234 |
{% |
| 6235 |
\let\@locale@next\@locale@parse@datetimeinfo |
| 6236 |
}% |
| 6237 |
{% |
| 6238 |
\def\LocaleDateTimeInfo{}% |
| 6239 |
% \end{macrocode} |
| 6240 |
% Was a file modification date included? |
| 6241 |
% \begin{macrocode} |
| 6242 |
\ifx\LocaleMainFile\empty |
| 6243 |
\def\LocaleFileMod{}% |
| 6244 |
\let\@locale@next\@locale@parse@maindata |
| 6245 |
\else |
| 6246 |
\let\@locale@next\@locale@parse@filemod |
| 6247 |
\fi |
| 6248 |
}% |
| 6249 |
\@locale@next |
| 6250 |
} |
| 6251 |
% \end{macrocode} |
| 6252 |
%\end{macro} |
| 6253 |
% |
| 6254 |
%\begin{macro}{\@locale@parse@datetimeinfo} |
| 6255 |
% \begin{macrocode} |
| 6256 |
\def\@locale@parse@datetimeinfo#1{% |
| 6257 |
\def\LocaleDateTimeInfo{#1}% |
| 6258 |
% \end{macrocode} |
| 6259 |
% Was a file modification date included? |
| 6260 |
% \begin{macrocode} |
| 6261 |
\ifx\LocaleMainFile\empty |
| 6262 |
\def\LocaleFileMod{}% |
| 6263 |
\let\@locale@next\@locale@parse@maindata |
| 6264 |
\else |
| 6265 |
\let\@locale@next\@locale@parse@filemod |
| 6266 |
\fi |
| 6267 |
\@locale@next |
| 6268 |
} |
| 6269 |
% \end{macrocode} |
| 6270 |
%\end{macro} |
| 6271 |
% |
| 6272 |
%\begin{macro}{\@locale@parse@default} |
| 6273 |
%Parse the result of \texttt{-N} |
| 6274 |
% \begin{macrocode} |
| 6275 |
\def\@locale@parse@default#1#2#3#4#5#6#7#8#9{% |
| 6276 |
\def\LocaleOStag{#1}% |
| 6277 |
% \end{macrocode} |
| 6278 |
%Parse (but don't track) tag. |
| 6279 |
% \begin{macrocode} |
| 6280 |
\@tracklang@parselangtag{#1}% |
| 6281 |
% \end{macrocode} |
| 6282 |
%Can now get the region code. |
| 6283 |
% \begin{macrocode} |
| 6284 |
\let\@locale@os@region\@TrackLangEnvTerritory |
| 6285 |
\def\@locale@os@groupsep{#2}% |
| 6286 |
\def\@locale@os@decsep{#3}% |
| 6287 |
\def\@locale@os@exp{#4}% |
| 6288 |
\def\@locale@os@usesgroup{#5}% |
| 6289 |
\def\@locale@os@currencycode{#6}% |
| 6290 |
\def\@locale@os@regionalcurrencycode{#7}% |
| 6291 |
\def\@locale@os@currencysym{#8}% |
| 6292 |
\def\@locale@os@currencytex{#9}% |
| 6293 |
% \end{macrocode} |
| 6294 |
%Provide currency attributes. |
| 6295 |
% \begin{macrocode} |
| 6296 |
\LocaleSetRegionAttribute{\@locale@os@region}{currency}{#7}% |
| 6297 |
\LocaleProvideCurrencyAttribute{#7}{official}{#6}% |
| 6298 |
\LocaleProvideCurrencyAttribute{#7}{sym}{#8}% |
| 6299 |
\LocaleProvideCurrencyAttribute{#7}{tex}{#9}% |
| 6300 |
\@locale@parse@default@cursep |
| 6301 |
} |
| 6302 |
% \end{macrocode} |
| 6303 |
%\end{macro} |
| 6304 |
%\begin{macro}{\@locale@parse@default@cursep} |
| 6305 |
% \begin{macrocode} |
| 6306 |
\def\@locale@parse@default@cursep#1{% |
| 6307 |
\def\@locale@os@cursep{#1}% |
| 6308 |
} |
| 6309 |
% \end{macrocode} |
| 6310 |
%\end{macro} |
| 6311 |
% |
| 6312 |
%\begin{macro}{\@locale@parse@filemod} |
| 6313 |
% \begin{macrocode} |
| 6314 |
\def\@locale@parse@filemod#1{% |
| 6315 |
\def\LocaleFileMod{#1}% |
| 6316 |
\@locale@parse@maindata |
| 6317 |
} |
| 6318 |
% \end{macrocode} |
| 6319 |
%\end{macro} |
| 6320 |
% |
| 6321 |
%\begin{macro}{\@locale@parse@maindata} |
| 6322 |
% \begin{macrocode} |
| 6323 |
\def\@locale@parse@maindata#1{% |
| 6324 |
\@locale@parse@maindatablock#1% remove outer group |
| 6325 |
} |
| 6326 |
% \end{macrocode} |
| 6327 |
%\end{macro} |
| 6328 |
% |
| 6329 |
%\begin{macro}{\@locale@parse@maindatablock} |
| 6330 |
% \begin{macrocode} |
| 6331 |
\def\@locale@parse@maindatablock#1{% |
| 6332 |
\@locale@parse@maindatalocaleblock#1% remove outer group |
| 6333 |
\@locale@parse@dateblock |
| 6334 |
} |
| 6335 |
% \end{macrocode} |
| 6336 |
%\end{macro} |
| 6337 |
% |
| 6338 |
%\begin{macro}{\@locale@parse@maindatalocaleblock} |
| 6339 |
% \begin{macrocode} |
| 6340 |
\def\@locale@parse@maindatalocaleblock#1#2#3#4#5#6#7{% |
| 6341 |
\def\LocaleMain{#1}% |
| 6342 |
\TrackLanguageTag{#1}% |
| 6343 |
\let\LocaleMainDialect\TrackLangLastTrackedDialect |
| 6344 |
\let\@locale@dialect\TrackLangLastTrackedDialect |
| 6345 |
% \end{macrocode} |
| 6346 |
%Get the region code if provided. |
| 6347 |
% \begin{macrocode} |
| 6348 |
\IfTrackedLanguageHasIsoCode{3166-1}{\@locale@dialect}% |
| 6349 |
{% |
| 6350 |
\edef\@locale@region{% |
| 6351 |
\TrackedIsoCodeFromLanguage{3166-1}{\@locale@dialect}}% |
| 6352 |
}% |
| 6353 |
{\def\@locale@region{}}% |
| 6354 |
\let\LocaleMainRegion\@locale@region |
| 6355 |
\ifx\LocaleMainRegion\empty |
| 6356 |
\else |
| 6357 |
\LocaleLetRegionAttribute{\LocaleMainRegion}{dialect}{\@locale@dialect}% |
| 6358 |
\fi |
| 6359 |
% \end{macrocode} |
| 6360 |
%Save language tag. (Provides a convenient mapping from dialect |
| 6361 |
%label to tag.) |
| 6362 |
% \begin{macrocode} |
| 6363 |
\LocaleSetDialectAttribute{\@locale@dialect}{langtag}{#1}% |
| 6364 |
% \end{macrocode} |
| 6365 |
%Provide reverse mapping from tag to dialect label. |
| 6366 |
% \begin{macrocode} |
| 6367 |
\LocaleLetAttribute{#1}{tagtodialect}{\@locale@dialect}% |
| 6368 |
% \end{macrocode} |
| 6369 |
%Save display names. |
| 6370 |
% \begin{macrocode} |
| 6371 |
\LocaleSetDialectAttribute{\@locale@dialect}{langname}{#2}% |
| 6372 |
\LocaleSetDialectAttribute{\@locale@dialect}{nativelangname}{#3}% |
| 6373 |
\LocaleSetDialectAttribute{\@locale@dialect}{regionname}{#4}% |
| 6374 |
\LocaleSetDialectAttribute{\@locale@dialect}{nativeregionname}{#5}% |
| 6375 |
\LocaleSetDialectAttribute{\@locale@dialect}{variantname}{#6}% |
| 6376 |
\LocaleSetDialectAttribute{\@locale@dialect}{nativevariantname}{#7}% |
| 6377 |
} |
| 6378 |
% \end{macrocode} |
| 6379 |
%\end{macro} |
| 6380 |
% |
| 6381 |
%\begin{macro}{\@locale@parse@otherdatalocaleblock} |
| 6382 |
% \begin{macrocode} |
| 6383 |
\def\@locale@parse@otherdatalocaleblock#1#2#3#4#5#6#7{% |
| 6384 |
\TrackLanguageTag{#1}% |
| 6385 |
\let\@locale@dialect\TrackLangLastTrackedDialect |
| 6386 |
% \end{macrocode} |
| 6387 |
%Get the region code if provided. |
| 6388 |
% \begin{macrocode} |
| 6389 |
\IfTrackedLanguageHasIsoCode{3166-1}{\@locale@dialect}% |
| 6390 |
{% |
| 6391 |
\edef\@locale@region{% |
| 6392 |
\TrackedIsoCodeFromLanguage{3166-1}{\@locale@dialect}}% |
| 6393 |
\ifx\@locale@region\empty |
| 6394 |
\else |
| 6395 |
\LocaleXpAddToRegionAttributeList |
| 6396 |
{\@locale@region}{dialect}{\@locale@dialect}% |
| 6397 |
\fi |
| 6398 |
}% |
| 6399 |
{\def\@locale@region{}}% |
| 6400 |
% \end{macrocode} |
| 6401 |
%Save language tag. |
| 6402 |
% \begin{macrocode} |
| 6403 |
\LocaleSetDialectAttribute{\@locale@dialect}{langtag}{#1}% |
| 6404 |
% \end{macrocode} |
| 6405 |
%Provide reverse mapping from tag to dialect label. |
| 6406 |
% \begin{macrocode} |
| 6407 |
\LocaleLetAttribute{#1}{tagtodialect}{\@locale@dialect}% |
| 6408 |
% \end{macrocode} |
| 6409 |
%Save attributes. |
| 6410 |
% \begin{macrocode} |
| 6411 |
\LocaleSetDialectAttribute{\@locale@dialect}{langname}{#2}% |
| 6412 |
\LocaleSetDialectAttribute{\@locale@dialect}{nativelangname}{#3}% |
| 6413 |
\LocaleSetDialectAttribute{\@locale@dialect}{regionname}{#4}% |
| 6414 |
\LocaleSetDialectAttribute{\@locale@dialect}{nativeregionname}{#5}% |
| 6415 |
\LocaleSetDialectAttribute{\@locale@dialect}{variantname}{#6}% |
| 6416 |
\LocaleSetDialectAttribute{\@locale@dialect}{nativevariantname}{#7}% |
| 6417 |
} |
| 6418 |
% \end{macrocode} |
| 6419 |
%\end{macro} |
| 6420 |
% |
| 6421 |
%\begin{macro}{\@locale@parse@dateblock} |
| 6422 |
% \begin{macrocode} |
| 6423 |
\def\@locale@parse@dateblock#1{% |
| 6424 |
\@locale@parse@dates#1% remove outer group |
| 6425 |
\@locale@parse@datefmtblock |
| 6426 |
} |
| 6427 |
% \end{macrocode} |
| 6428 |
%\end{macro} |
| 6429 |
% |
| 6430 |
%\begin{macro}{\@locale@parse@dates} |
| 6431 |
% \begin{macrocode} |
| 6432 |
\def\@locale@parse@dates#1#2#3#4#5{% |
| 6433 |
\LocaleSetDialectAttribute{\@locale@dialect}{fulldate}{#1}% |
| 6434 |
\LocaleSetDialectAttribute{\@locale@dialect}{longdate}{#2}% |
| 6435 |
\LocaleSetDialectAttribute{\@locale@dialect}{meddate}{#3}% |
| 6436 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortdate}{#4}% |
| 6437 |
\LocaleSetDialectAttribute{\@locale@dialect}{firstday}{#5}% |
| 6438 |
} |
| 6439 |
% \end{macrocode} |
| 6440 |
%\end{macro} |
| 6441 |
% |
| 6442 |
%\begin{macro}{\@locale@parse@datefmtblock} |
| 6443 |
% \begin{macrocode} |
| 6444 |
\def\@locale@parse@datefmtblock#1{% |
| 6445 |
\@locale@parse@datefmts#1% remove outer group |
| 6446 |
\@locale@parse@timeblock |
| 6447 |
} |
| 6448 |
% \end{macrocode} |
| 6449 |
%\end{macro} |
| 6450 |
% |
| 6451 |
%\begin{macro}{\@locale@parse@datefmts} |
| 6452 |
% \begin{macrocode} |
| 6453 |
\def\@locale@parse@datefmts#1#2#3#4{% |
| 6454 |
\LocaleSetDialectAttribute{\@locale@dialect}{fulldatefmt}{#1}% |
| 6455 |
\LocaleSetDialectAttribute{\@locale@dialect}{longdatefmt}{#2}% |
| 6456 |
\LocaleSetDialectAttribute{\@locale@dialect}{meddatefmt}{#3}% |
| 6457 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortdatefmt}{#4}% |
| 6458 |
} |
| 6459 |
% \end{macrocode} |
| 6460 |
%\end{macro} |
| 6461 |
% |
| 6462 |
%\begin{macro}{\@locale@parse@timeblock} |
| 6463 |
% \begin{macrocode} |
| 6464 |
\def\@locale@parse@timeblock#1{% |
| 6465 |
\@locale@parse@times#1% remove outer group |
| 6466 |
\@locale@parse@timefmtblock |
| 6467 |
} |
| 6468 |
% \end{macrocode} |
| 6469 |
%\end{macro} |
| 6470 |
% |
| 6471 |
%\begin{macro}{\@locale@parse@times} |
| 6472 |
% \begin{macrocode} |
| 6473 |
\def\@locale@parse@times#1#2#3#4{% |
| 6474 |
\LocaleSetDialectAttribute{\@locale@dialect}{fulltime}{#1}% |
| 6475 |
\LocaleSetDialectAttribute{\@locale@dialect}{longtime}{#2}% |
| 6476 |
\LocaleSetDialectAttribute{\@locale@dialect}{medtime}{#3}% |
| 6477 |
\LocaleSetDialectAttribute{\@locale@dialect}{shorttime}{#4}% |
| 6478 |
} |
| 6479 |
% \end{macrocode} |
| 6480 |
%\end{macro} |
| 6481 |
% |
| 6482 |
%\begin{macro}{\@locale@parse@timefmtblock} |
| 6483 |
% \begin{macrocode} |
| 6484 |
\def\@locale@parse@timefmtblock#1{% |
| 6485 |
\@locale@parse@timefmts#1% remove outer group |
| 6486 |
\@locale@parse@datetimeblock |
| 6487 |
} |
| 6488 |
% \end{macrocode} |
| 6489 |
%\end{macro} |
| 6490 |
% |
| 6491 |
%\begin{macro}{\@locale@parse@timefmts} |
| 6492 |
% \begin{macrocode} |
| 6493 |
\def\@locale@parse@timefmts#1#2#3#4{% |
| 6494 |
\LocaleSetDialectAttribute{\@locale@dialect}{fulltimefmt}{#1}% |
| 6495 |
\LocaleSetDialectAttribute{\@locale@dialect}{longtimefmt}{#2}% |
| 6496 |
\LocaleSetDialectAttribute{\@locale@dialect}{medtimefmt}{#3}% |
| 6497 |
\LocaleSetDialectAttribute{\@locale@dialect}{shorttimefmt}{#3}% |
| 6498 |
} |
| 6499 |
% \end{macrocode} |
| 6500 |
%\end{macro} |
| 6501 |
% |
| 6502 |
%\begin{macro}{\@locale@parse@datetimeblock} |
| 6503 |
% \begin{macrocode} |
| 6504 |
\def\@locale@parse@datetimeblock#1{% |
| 6505 |
\@locale@parse@datetimes#1% remove outer group |
| 6506 |
\@locale@parse@datetimefmtblock |
| 6507 |
} |
| 6508 |
% \end{macrocode} |
| 6509 |
%\end{macro} |
| 6510 |
% |
| 6511 |
%\begin{macro}{\@locale@parse@datetimes} |
| 6512 |
% \begin{macrocode} |
| 6513 |
\def\@locale@parse@datetimes#1#2#3#4{% |
| 6514 |
\LocaleSetDialectAttribute{\@locale@dialect}{fulldatetime}{#1}% |
| 6515 |
\LocaleSetDialectAttribute{\@locale@dialect}{longdatetime}{#2}% |
| 6516 |
\LocaleSetDialectAttribute{\@locale@dialect}{meddatetime}{#3}% |
| 6517 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortdatetime}{#4}% |
| 6518 |
} |
| 6519 |
% \end{macrocode} |
| 6520 |
%\end{macro} |
| 6521 |
% |
| 6522 |
%\begin{macro}{\@locale@parse@datetimefmtblock} |
| 6523 |
% \begin{macrocode} |
| 6524 |
\def\@locale@parse@datetimefmtblock#1{% |
| 6525 |
\@locale@parse@datetimefmts#1% remove outer group |
| 6526 |
\@locale@parse@weekdayblock |
| 6527 |
} |
| 6528 |
% \end{macrocode} |
| 6529 |
%\end{macro} |
| 6530 |
% |
| 6531 |
%\begin{macro}{\@locale@parse@datetimefmts} |
| 6532 |
% \begin{macrocode} |
| 6533 |
\def\@locale@parse@datetimefmts#1#2#3#4{% |
| 6534 |
\LocaleSetDialectAttribute{\@locale@dialect}{fulldatetimefmt}{#1}% |
| 6535 |
\LocaleSetDialectAttribute{\@locale@dialect}{longdatetimefmt}{#2}% |
| 6536 |
\LocaleSetDialectAttribute{\@locale@dialect}{meddatetimefmt}{#3}% |
| 6537 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortdatetimefmt}{#4}% |
| 6538 |
} |
| 6539 |
% \end{macrocode} |
| 6540 |
%\end{macro} |
| 6541 |
% |
| 6542 |
%\begin{macro}{\@locale@parse@weekdayblock} |
| 6543 |
% \begin{macrocode} |
| 6544 |
\def\@locale@parse@weekdayblock#1{% |
| 6545 |
\@locale@parse@weekdays#1% remove outer group |
| 6546 |
\@locale@parse@shortweekdayblock |
| 6547 |
} |
| 6548 |
% \end{macrocode} |
| 6549 |
%\end{macro} |
| 6550 |
% |
| 6551 |
%\begin{macro}{\@locale@parse@weekdays} |
| 6552 |
% \begin{macrocode} |
| 6553 |
\def\@locale@parse@weekdays#1#2#3#4#5#6#7{% |
| 6554 |
\LocaleSetDialectAttribute{\@locale@dialect}{day.0}{#1}% |
| 6555 |
\LocaleSetDialectAttribute{\@locale@dialect}{day.1}{#2}% |
| 6556 |
\LocaleSetDialectAttribute{\@locale@dialect}{day.2}{#3}% |
| 6557 |
\LocaleSetDialectAttribute{\@locale@dialect}{day.3}{#4}% |
| 6558 |
\LocaleSetDialectAttribute{\@locale@dialect}{day.4}{#5}% |
| 6559 |
\LocaleSetDialectAttribute{\@locale@dialect}{day.5}{#6}% |
| 6560 |
\LocaleSetDialectAttribute{\@locale@dialect}{day.6}{#7}% |
| 6561 |
} |
| 6562 |
% \end{macrocode} |
| 6563 |
%\end{macro} |
| 6564 |
% |
| 6565 |
%\begin{macro}{\@locale@parse@shortweekdayblock} |
| 6566 |
% \begin{macrocode} |
| 6567 |
\def\@locale@parse@shortweekdayblock#1{% |
| 6568 |
\@locale@parse@shortweekdays#1% remove outer group |
| 6569 |
\@locale@parse@monthblock |
| 6570 |
} |
| 6571 |
% \end{macrocode} |
| 6572 |
%\end{macro} |
| 6573 |
% |
| 6574 |
%\begin{macro}{\@locale@parse@shortweekdays} |
| 6575 |
% \begin{macrocode} |
| 6576 |
\def\@locale@parse@shortweekdays#1#2#3#4#5#6#7{% |
| 6577 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortday.0}{#1}% |
| 6578 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortday.1}{#2}% |
| 6579 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortday.2}{#3}% |
| 6580 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortday.3}{#4}% |
| 6581 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortday.4}{#5}% |
| 6582 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortday.5}{#6}% |
| 6583 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortday.6}{#7}% |
| 6584 |
} |
| 6585 |
% \end{macrocode} |
| 6586 |
%\end{macro} |
| 6587 |
% |
| 6588 |
%\begin{macro}{\@locale@parse@monthblock} |
| 6589 |
% \begin{macrocode} |
| 6590 |
\def\@locale@parse@monthblock#1{% |
| 6591 |
\@locale@parse@months#1% remove outer group |
| 6592 |
\@locale@parse@shortmonthblock |
| 6593 |
} |
| 6594 |
% \end{macrocode} |
| 6595 |
%\end{macro} |
| 6596 |
% |
| 6597 |
%\begin{macro}{\@locale@parse@months} |
| 6598 |
% \begin{macrocode} |
| 6599 |
\def\@locale@parse@months#1#2#3#4#5#6#7#8#9{% |
| 6600 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.1}{#1}% |
| 6601 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.2}{#2}% |
| 6602 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.3}{#3}% |
| 6603 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.4}{#4}% |
| 6604 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.5}{#5}% |
| 6605 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.6}{#6}% |
| 6606 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.7}{#7}% |
| 6607 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.8}{#8}% |
| 6608 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.9}{#9}% |
| 6609 |
% \end{macrocode} |
| 6610 |
%Grab the remaining three arguments: |
| 6611 |
% \begin{macrocode} |
| 6612 |
\@locale@parse@endmonths |
| 6613 |
} |
| 6614 |
% \end{macrocode} |
| 6615 |
%\end{macro} |
| 6616 |
% |
| 6617 |
%\begin{macro}{\@locale@parse@endmonths} |
| 6618 |
% \begin{macrocode} |
| 6619 |
\def\@locale@parse@endmonths#1#2#3{% |
| 6620 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.10}{#1}% |
| 6621 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.11}{#2}% |
| 6622 |
\LocaleSetDialectAttribute{\@locale@dialect}{month.12}{#3}% |
| 6623 |
} |
| 6624 |
% \end{macrocode} |
| 6625 |
%\end{macro} |
| 6626 |
% |
| 6627 |
%\begin{macro}{\@locale@parse@shortmonthblock} |
| 6628 |
% \begin{macrocode} |
| 6629 |
\def\@locale@parse@shortmonthblock#1{% |
| 6630 |
\@locale@parse@shortmonths#1% remove outer group |
| 6631 |
\@locale@parse@standalone@weekdayblock |
| 6632 |
} |
| 6633 |
% \end{macrocode} |
| 6634 |
%\end{macro} |
| 6635 |
% |
| 6636 |
%\begin{macro}{\@locale@parse@shortmonths} |
| 6637 |
% \begin{macrocode} |
| 6638 |
\def\@locale@parse@shortmonths#1#2#3#4#5#6#7#8#9{% |
| 6639 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.1}{#1}% |
| 6640 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.2}{#2}% |
| 6641 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.3}{#3}% |
| 6642 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.4}{#4}% |
| 6643 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.5}{#5}% |
| 6644 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.6}{#6}% |
| 6645 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.7}{#7}% |
| 6646 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.8}{#8}% |
| 6647 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.9}{#9}% |
| 6648 |
% \end{macrocode} |
| 6649 |
%Grab the remaining three arguments: |
| 6650 |
% \begin{macrocode} |
| 6651 |
\@locale@parse@endshortmonths |
| 6652 |
} |
| 6653 |
% \end{macrocode} |
| 6654 |
%\end{macro} |
| 6655 |
% |
| 6656 |
%\begin{macro}{\@locale@parse@endshortmonths} |
| 6657 |
% \begin{macrocode} |
| 6658 |
\def\@locale@parse@endshortmonths#1#2#3{% |
| 6659 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.10}{#1}% |
| 6660 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.11}{#2}% |
| 6661 |
\LocaleSetDialectAttribute{\@locale@dialect}{shortmonth.12}{#3}% |
| 6662 |
} |
| 6663 |
% \end{macrocode} |
| 6664 |
%\end{macro} |
| 6665 |
% |
| 6666 |
%\begin{macro}{\@locale@parse@standalone@weekdayblock} |
| 6667 |
% \begin{macrocode} |
| 6668 |
\def\@locale@parse@standalone@weekdayblock#1{% |
| 6669 |
\@locale@parse@standalone@weekdays#1% remove outer group |
| 6670 |
\@locale@parse@standalone@shortweekdayblock |
| 6671 |
} |
| 6672 |
% \end{macrocode} |
| 6673 |
%\end{macro} |
| 6674 |
% |
| 6675 |
%\begin{macro}{\@locale@parse@standalone@weekdays} |
| 6676 |
% \begin{macrocode} |
| 6677 |
\def\@locale@parse@standalone@weekdays#1#2#3#4#5#6#7{% |
| 6678 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.0}{#1}% |
| 6679 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.1}{#2}% |
| 6680 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.2}{#3}% |
| 6681 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.3}{#4}% |
| 6682 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.4}{#5}% |
| 6683 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.5}{#6}% |
| 6684 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.day.6}{#7}% |
| 6685 |
} |
| 6686 |
% \end{macrocode} |
| 6687 |
%\end{macro} |
| 6688 |
% |
| 6689 |
%\begin{macro}{\@locale@parse@standalone@shortweekdayblock} |
| 6690 |
% \begin{macrocode} |
| 6691 |
\def\@locale@parse@standalone@shortweekdayblock#1{% |
| 6692 |
\@locale@parse@standalone@shortweekdays#1% remove outer group |
| 6693 |
\@locale@parse@standalone@monthblock |
| 6694 |
} |
| 6695 |
% \end{macrocode} |
| 6696 |
%\end{macro} |
| 6697 |
% |
| 6698 |
%\begin{macro}{\@locale@parse@standalone@shortweekdays} |
| 6699 |
% \begin{macrocode} |
| 6700 |
\def\@locale@parse@standalone@shortweekdays#1#2#3#4#5#6#7{% |
| 6701 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.0}{#1}% |
| 6702 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.1}{#2}% |
| 6703 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.2}{#3}% |
| 6704 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.3}{#4}% |
| 6705 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.4}{#5}% |
| 6706 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.5}{#6}% |
| 6707 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortday.6}{#7}% |
| 6708 |
} |
| 6709 |
% \end{macrocode} |
| 6710 |
%\end{macro} |
| 6711 |
% |
| 6712 |
%\begin{macro}{\@locale@parse@standalone@monthblock} |
| 6713 |
% \begin{macrocode} |
| 6714 |
\def\@locale@parse@standalone@monthblock#1{% |
| 6715 |
\@locale@parse@standalone@months#1% remove outer group |
| 6716 |
\@locale@parse@standalone@shortmonthblock |
| 6717 |
} |
| 6718 |
% \end{macrocode} |
| 6719 |
%\end{macro} |
| 6720 |
% |
| 6721 |
%\begin{macro}{\@locale@parse@standalone@months} |
| 6722 |
% \begin{macrocode} |
| 6723 |
\def\@locale@parse@standalone@months#1#2#3#4#5#6#7#8#9{% |
| 6724 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.1}{#1}% |
| 6725 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.2}{#2}% |
| 6726 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.3}{#3}% |
| 6727 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.4}{#4}% |
| 6728 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.5}{#5}% |
| 6729 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.6}{#6}% |
| 6730 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.7}{#7}% |
| 6731 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.8}{#8}% |
| 6732 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.9}{#9}% |
| 6733 |
% \end{macrocode} |
| 6734 |
%Grab the remaining three arguments: |
| 6735 |
% \begin{macrocode} |
| 6736 |
\@locale@parse@endstandalone@months |
| 6737 |
} |
| 6738 |
% \end{macrocode} |
| 6739 |
%\end{macro} |
| 6740 |
% |
| 6741 |
%\begin{macro}{\@locale@parse@endstandalone@months} |
| 6742 |
% \begin{macrocode} |
| 6743 |
\def\@locale@parse@endstandalone@months#1#2#3{% |
| 6744 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.10}{#1}% |
| 6745 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.11}{#2}% |
| 6746 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.month.12}{#3}% |
| 6747 |
} |
| 6748 |
% \end{macrocode} |
| 6749 |
%\end{macro} |
| 6750 |
% |
| 6751 |
%\begin{macro}{\@locale@parse@standalone@shortmonthblock} |
| 6752 |
% \begin{macrocode} |
| 6753 |
\def\@locale@parse@standalone@shortmonthblock#1{% |
| 6754 |
\@locale@parse@standalone@shortmonths#1% remove outer group |
| 6755 |
\@locale@parse@numericblock |
| 6756 |
} |
| 6757 |
% \end{macrocode} |
| 6758 |
%\end{macro} |
| 6759 |
% |
| 6760 |
%\begin{macro}{\@locale@parse@standalone@shortmonths} |
| 6761 |
% \begin{macrocode} |
| 6762 |
\def\@locale@parse@standalone@shortmonths#1#2#3#4#5#6#7#8#9{% |
| 6763 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.1}{#1}% |
| 6764 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.2}{#2}% |
| 6765 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.3}{#3}% |
| 6766 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.4}{#4}% |
| 6767 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.5}{#5}% |
| 6768 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.6}{#6}% |
| 6769 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.7}{#7}% |
| 6770 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.8}{#8}% |
| 6771 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.9}{#9}% |
| 6772 |
% \end{macrocode} |
| 6773 |
%Grab the remaining three arguments: |
| 6774 |
% \begin{macrocode} |
| 6775 |
\@locale@parse@endstandalone@shortmonths |
| 6776 |
} |
| 6777 |
% \end{macrocode} |
| 6778 |
%\end{macro} |
| 6779 |
% |
| 6780 |
%\begin{macro}{\@locale@parse@endstandalone@shortmonths} |
| 6781 |
% \begin{macrocode} |
| 6782 |
\def\@locale@parse@endstandalone@shortmonths#1#2#3{% |
| 6783 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.10}{#1}% |
| 6784 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.11}{#2}% |
| 6785 |
\LocaleSetDialectAttribute{\@locale@dialect}{standalone.shortmonth.12}{#3}% |
| 6786 |
} |
| 6787 |
% \end{macrocode} |
| 6788 |
%\end{macro} |
| 6789 |
% |
| 6790 |
%\begin{macro}{\@locale@parse@numericblock} |
| 6791 |
% \begin{macrocode} |
| 6792 |
\def\@locale@parse@numericblock#1{% |
| 6793 |
\@locale@parse@numeric#1% remove outer group |
| 6794 |
\@locale@parse@numericfmtblock |
| 6795 |
} |
| 6796 |
% \end{macrocode} |
| 6797 |
%\end{macro} |
| 6798 |
% |
| 6799 |
%\begin{macro}{\@locale@parse@numeric} |
| 6800 |
% \begin{macrocode} |
| 6801 |
\def\@locale@parse@numeric#1#2#3#4#5#6#7#8#9{% |
| 6802 |
\LocaleSetDialectAttribute{\@locale@dialect}{groupsep}{#1}% |
| 6803 |
\LocaleSetDialectAttribute{\@locale@dialect}{decsep}{#2}% |
| 6804 |
\LocaleSetDialectAttribute{\@locale@dialect}{exp}{#3}% |
| 6805 |
\LocaleSetDialectAttribute{\@locale@dialect}{usesgroup}{#4}% |
| 6806 |
\LocaleSetDialectAttribute{\@locale@dialect}{currency}{#5}% |
| 6807 |
\LocaleSetDialectAttribute{\@locale@dialect}{regionalcurrency}{#6}% |
| 6808 |
\LocaleSetDialectAttribute{\@locale@dialect}{currencysym}{#7}% |
| 6809 |
\LocaleSetDialectAttribute{\@locale@dialect}{currencytex}{#8}% |
| 6810 |
\LocaleSetDialectAttribute{\@locale@dialect}{currencysep}{#9}% |
| 6811 |
% \end{macrocode} |
| 6812 |
% Set currency attributes. |
| 6813 |
% \begin{macrocode} |
| 6814 |
\LocaleProvideCurrencyAttribute{#6}{official}{#5}% |
| 6815 |
\LocaleProvideCurrencyAttribute{#6}{sym}{#7}% |
| 6816 |
\LocaleProvideCurrencyAttribute{#6}{tex}{#8}% |
| 6817 |
\LocaleAddToAttributeList{currencies}{official}{#5}% |
| 6818 |
\LocaleAddToAttributeList{currencies}{regional}{#6}% |
| 6819 |
% \end{macrocode} |
| 6820 |
%If this dialect has an associated region, map the region to the |
| 6821 |
%currency code. |
| 6822 |
% \begin{macrocode} |
| 6823 |
\ifx\@locale@region\empty |
| 6824 |
\else |
| 6825 |
\LocaleProvideRegionAttribute{\@locale@region}{currency}{#6}% |
| 6826 |
\LocaleXpAddToCurrencyAttributeList{#5}{region}{\@locale@region}% |
| 6827 |
\LocaleIfSameDialectAttributeValues{\@locale@dialect}% |
| 6828 |
{regionalcurrency}{currency}% |
| 6829 |
{}% |
| 6830 |
{% |
| 6831 |
\LocaleXpAddToCurrencyAttributeList{#6}{region}{\@locale@region}% |
| 6832 |
}% |
| 6833 |
\fi |
| 6834 |
% \end{macrocode} |
| 6835 |
%Grab remaining arguments. |
| 6836 |
% \begin{macrocode} |
| 6837 |
\@locale@parse@persym |
| 6838 |
} |
| 6839 |
% \end{macrocode} |
| 6840 |
%\end{macro} |
| 6841 |
%\begin{macro}{\@locale@parse@persym} |
| 6842 |
% \begin{macrocode} |
| 6843 |
\def\@locale@parse@persym#1#2{% |
| 6844 |
\LocaleSetDialectAttribute{\@locale@dialect}{percent}{#1}% |
| 6845 |
\LocaleSetDialectAttribute{\@locale@dialect}{permill}{#2}% |
| 6846 |
} |
| 6847 |
% \end{macrocode} |
| 6848 |
%\end{macro} |
| 6849 |
% |
| 6850 |
%\begin{macro}{\@locale@parse@numericfmtblock} |
| 6851 |
% \begin{macrocode} |
| 6852 |
\def\@locale@parse@numericfmtblock#1{% |
| 6853 |
\@locale@parse@numericfmt#1% remove outer group |
| 6854 |
\LocaleIfDateTimePatternsSupported |
| 6855 |
{\@locale@parse@timezones}% |
| 6856 |
{\@locale@parse@otherdata}% |
| 6857 |
} |
| 6858 |
% \end{macrocode} |
| 6859 |
%\end{macro} |
| 6860 |
% |
| 6861 |
%\begin{macro}{\@locale@parse@numericfmt} |
| 6862 |
% \begin{macrocode} |
| 6863 |
\def\@locale@parse@numericfmt#1#2#3#4{% |
| 6864 |
\LocaleSetDialectAttribute{\@locale@dialect}{decfmt}{#1}% |
| 6865 |
\LocaleSetDialectAttribute{\@locale@dialect}{intfmt}{#2}% |
| 6866 |
\LocaleSetDialectAttribute{\@locale@dialect}{curfmt}{#3}% |
| 6867 |
\LocaleSetDialectAttribute{\@locale@dialect}{perfmt}{#4}% |
| 6868 |
} |
| 6869 |
% \end{macrocode} |
| 6870 |
%\end{macro} |
| 6871 |
% |
| 6872 |
%\begin{macro}{\@locale@parse@timezones} |
| 6873 |
% \begin{macrocode} |
| 6874 |
\def\@locale@parse@timezones#1{% |
| 6875 |
\@locale@parse@timezonemap#1\relax |
| 6876 |
\@locale@parse@otherdata |
| 6877 |
} |
| 6878 |
% \end{macrocode} |
| 6879 |
%\end{macro} |
| 6880 |
% |
| 6881 |
%\begin{macro}{\@locale@parse@timezonemap} |
| 6882 |
% \begin{macrocode} |
| 6883 |
\def\@locale@parse@timezonemap#1{% |
| 6884 |
\ifx\relax#1\relax |
| 6885 |
\let\@locale@next\relax |
| 6886 |
\else |
| 6887 |
\@locale@save@timezonemap#1% |
| 6888 |
\let\@locale@next\@locale@parse@timezonemap |
| 6889 |
\fi |
| 6890 |
\@locale@next |
| 6891 |
}% |
| 6892 |
% \end{macrocode} |
| 6893 |
%\end{macro} |
| 6894 |
% |
| 6895 |
%\begin{macro}{\@locale@save@timezonemap} |
| 6896 |
% \begin{macrocode} |
| 6897 |
\def\@locale@save@timezonemap#1#2#3#4#5{% |
| 6898 |
\LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.short}{#2}% |
| 6899 |
\LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.long}{#3}% |
| 6900 |
\LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.shortdst}{#4}% |
| 6901 |
\LocaleSetDialectAttribute{\@locale@dialect}{timezone.#1.longdst}{#5}% |
| 6902 |
\LocaleAddToAttributeList{timezone}{id}{#1}% |
| 6903 |
} |
| 6904 |
% \end{macrocode} |
| 6905 |
%\end{macro} |
| 6906 |
% |
| 6907 |
%\begin{macro}{\@locale@parse@otherdata} |
| 6908 |
% \begin{macrocode} |
| 6909 |
\def\@locale@endparse@result{} |
| 6910 |
% \end{macrocode} |
| 6911 |
%\end{macro} |
| 6912 |
%\begin{macro}{\@locale@parse@otherdata} |
| 6913 |
% \begin{macrocode} |
| 6914 |
\def\@locale@parse@otherdata#1{% |
| 6915 |
\ifx\@locale@endparse@result#1\relax |
| 6916 |
% \end{macrocode} |
| 6917 |
%Finished. |
| 6918 |
% \begin{macrocode} |
| 6919 |
\let\@locale@next\relax |
| 6920 |
\else |
| 6921 |
\def\@locale@next{\@locale@parse@otherdata@localeblock#1}% |
| 6922 |
\fi |
| 6923 |
\@locale@next |
| 6924 |
} |
| 6925 |
% \end{macrocode} |
| 6926 |
%\end{macro} |
| 6927 |
% |
| 6928 |
%\begin{macro}{\@locale@parse@otherdata@localeblock} |
| 6929 |
% \begin{macrocode} |
| 6930 |
\def\@locale@parse@otherdata@localeblock#1{% |
| 6931 |
\@locale@parse@otherdatalocaleblock#1% remove outer group |
| 6932 |
\@locale@parse@dateblock |
| 6933 |
} |
| 6934 |
% \end{macrocode} |
| 6935 |
%\end{macro} |
| 6936 |
% |
| 6937 |
% \begin{macrocode} |
| 6938 |
\ifx\@locale@result\empty |
| 6939 |
% \end{macrocode} |
| 6940 |
%Set defaults. |
| 6941 |
% \begin{macrocode} |
| 6942 |
\ifTeXOSQueryDryRun |
| 6943 |
\@locale@warn{Dry run mode on. No data provided by texosquery. Check |
| 6944 |
TeX's shell escape status}% |
| 6945 |
\else |
| 6946 |
\@locale@warn{No data provided by texosquery. Check |
| 6947 |
TeX's shell escape status and texosquery's setup}% |
| 6948 |
\fi |
| 6949 |
\def\LocaleOSname{}% |
| 6950 |
\def\LocaleOSversion{}% |
| 6951 |
\def\LocaleOSarch{}% |
| 6952 |
\def\LocaleNowStamp{}% |
| 6953 |
\def\LocaleOStag{}% |
| 6954 |
\def\LocaleOScodeset{}% |
| 6955 |
\def\LocaleFileMod{}% |
| 6956 |
\def\LocaleMain{}% |
| 6957 |
\def\LocaleMainDialect{}% |
| 6958 |
\def\LocaleMainRegion{}% |
| 6959 |
\def\LocaleDateTimeInfo{}% |
| 6960 |
\else |
| 6961 |
\expandafter\@locale@parse@result\@locale@result\@locale@endparse@result |
| 6962 |
\fi |
| 6963 |
% \end{macrocode} |
| 6964 |
% |
| 6965 |
%\subsection{Locale User Commands} |
| 6966 |
% |
| 6967 |
%\begin{macro}{\LocaleLanguageTag} |
| 6968 |
%\begin{definition} |
| 6969 |
%\cs{LocaleLanguageTag}\marg{dialect} |
| 6970 |
%\end{definition} |
| 6971 |
%Get the language tag of the given dialect. |
| 6972 |
% \begin{macrocode} |
| 6973 |
\def\LocaleLanguageTag#1{% |
| 6974 |
\LocaleGetDialectAttribute{#1}{langtag}% |
| 6975 |
} |
| 6976 |
% \end{macrocode} |
| 6977 |
%\end{macro} |
| 6978 |
%\begin{macro}{\LocaleLanguageName} |
| 6979 |
%\begin{definition} |
| 6980 |
%\cs{LocaleLanguageName}\marg{dialect} |
| 6981 |
%\end{definition} |
| 6982 |
%Get the language name of the given dialect according to the OS |
| 6983 |
%default language. |
| 6984 |
% \begin{macrocode} |
| 6985 |
\def\LocaleLanguageName#1{% |
| 6986 |
\LocaleGetDialectAttribute{#1}{langname}% |
| 6987 |
} |
| 6988 |
% \end{macrocode} |
| 6989 |
%\end{macro} |
| 6990 |
%\begin{macro}{\LocaleLanguageNativeName} |
| 6991 |
%\begin{definition} |
| 6992 |
%\cs{LocaleLanguageNativeName}\marg{dialect} |
| 6993 |
%\end{definition} |
| 6994 |
%Get the language name of the given dialect according to that |
| 6995 |
%dialect. |
| 6996 |
% \begin{macrocode} |
| 6997 |
\def\LocaleLanguageNativeName#1{% |
| 6998 |
\LocaleGetDialectAttribute{#1}{nativelangname}% |
| 6999 |
} |
| 7000 |
% \end{macrocode} |
| 7001 |
%\end{macro} |
| 7002 |
% |
| 7003 |
%\begin{macro}{\LocaleRegionName} |
| 7004 |
%\begin{definition} |
| 7005 |
%\cs{LocaleRegionName}\marg{dialect} |
| 7006 |
%\end{definition} |
| 7007 |
%Get the region name of the given dialect according to the OS |
| 7008 |
%default language. |
| 7009 |
% \begin{macrocode} |
| 7010 |
\def\LocaleRegionName#1{% |
| 7011 |
\LocaleGetDialectAttribute{#1}{regionname}% |
| 7012 |
} |
| 7013 |
% \end{macrocode} |
| 7014 |
%\end{macro} |
| 7015 |
%\begin{macro}{\LocaleRegionNativeName} |
| 7016 |
%\begin{definition} |
| 7017 |
%\cs{LocaleRegionNativeName}\marg{dialect} |
| 7018 |
%\end{definition} |
| 7019 |
%Get the region name of the given dialect according to that |
| 7020 |
%dialect. |
| 7021 |
% \begin{macrocode} |
| 7022 |
\def\LocaleRegionNativeName#1{% |
| 7023 |
\LocaleGetDialectAttribute{#1}{nativeregionname}% |
| 7024 |
} |
| 7025 |
% \end{macrocode} |
| 7026 |
%\end{macro} |
| 7027 |
% |
| 7028 |
%\begin{macro}{\LocaleVariantName} |
| 7029 |
%\begin{definition} |
| 7030 |
%\cs{LocaleVariantName}\marg{dialect} |
| 7031 |
%\end{definition} |
| 7032 |
%Get the variant name of the given dialect according to the OS |
| 7033 |
%default language. |
| 7034 |
% \begin{macrocode} |
| 7035 |
\def\LocaleVariantName#1{% |
| 7036 |
\LocaleGetDialectAttribute{#1}{variantname}% |
| 7037 |
} |
| 7038 |
% \end{macrocode} |
| 7039 |
%\end{macro} |
| 7040 |
%\begin{macro}{\LocaleVariantNativeName} |
| 7041 |
%\begin{definition} |
| 7042 |
%\cs{LocaleVariantNativeName}\marg{dialect} |
| 7043 |
%\end{definition} |
| 7044 |
%Get the variant name of the given dialect according to that |
| 7045 |
%dialect. |
| 7046 |
% \begin{macrocode} |
| 7047 |
\def\LocaleVariantNativeName#1{% |
| 7048 |
\LocaleGetDialectAttribute{#1}{nativevariantname}% |
| 7049 |
} |
| 7050 |
% \end{macrocode} |
| 7051 |
%\end{macro} |
| 7052 |
% |
| 7053 |
%\begin{macro}{\LocaleFullDate} |
| 7054 |
%\begin{definition} |
| 7055 |
%\cs{LocaleFullDate}\marg{dialect} |
| 7056 |
%\end{definition} |
| 7057 |
%Get the full date for the given dialect. |
| 7058 |
% \begin{macrocode} |
| 7059 |
\def\LocaleFullDate#1{% |
| 7060 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{fulldate}}% |
| 7061 |
} |
| 7062 |
% \end{macrocode} |
| 7063 |
%\end{macro} |
| 7064 |
% |
| 7065 |
%\begin{macro}{\LocaleLongDate} |
| 7066 |
%\begin{definition} |
| 7067 |
%\cs{LocaleLongDate}\marg{dialect} |
| 7068 |
%\end{definition} |
| 7069 |
%Get the long date for the given dialect. |
| 7070 |
% \begin{macrocode} |
| 7071 |
\def\LocaleLongDate#1{% |
| 7072 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{longdate}}% |
| 7073 |
} |
| 7074 |
% \end{macrocode} |
| 7075 |
%\end{macro} |
| 7076 |
% |
| 7077 |
%\begin{macro}{\LocaleMediumDate} |
| 7078 |
%\begin{definition} |
| 7079 |
%\cs{LocaleMediumDate}\marg{dialect} |
| 7080 |
%\end{definition} |
| 7081 |
%Get the medium date for the given dialect. |
| 7082 |
% \begin{macrocode} |
| 7083 |
\def\LocaleMediumDate#1{% |
| 7084 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{meddate}}% |
| 7085 |
} |
| 7086 |
% \end{macrocode} |
| 7087 |
%\end{macro} |
| 7088 |
% |
| 7089 |
%\begin{macro}{\LocaleShortDate} |
| 7090 |
%\begin{definition} |
| 7091 |
%\cs{LocaleShortDate}\marg{dialect} |
| 7092 |
%\end{definition} |
| 7093 |
%Get the short date for the given dialect. |
| 7094 |
% \begin{macrocode} |
| 7095 |
\def\LocaleShortDate#1{% |
| 7096 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{shortdate}}% |
| 7097 |
} |
| 7098 |
% \end{macrocode} |
| 7099 |
%\end{macro} |
| 7100 |
% |
| 7101 |
%\begin{macro}{\LocaleFirstDayIndex} |
| 7102 |
%\begin{definition} |
| 7103 |
%\cs{LocaleFirstDayIndex}\marg{dialect} |
| 7104 |
%\end{definition} |
| 7105 |
%Get the index for the first day of the week for the given dialect. |
| 7106 |
%This starts with 0 for Monday to be compatible with |
| 7107 |
%\sty{pgfcalendar} (and \sty{datetime2} which similar does this to |
| 7108 |
%be compatible with \sty{pgfcalendar}). |
| 7109 |
% \begin{macrocode} |
| 7110 |
\def\LocaleFirstDayIndex#1{% |
| 7111 |
\LocaleGetDialectAttributeOrDefValue{#1}{firstday}{-1}% |
| 7112 |
} |
| 7113 |
% \end{macrocode} |
| 7114 |
%\end{macro} |
| 7115 |
% |
| 7116 |
%\begin{macro}{\dtmMondayIndex} |
| 7117 |
% \begin{macrocode} |
| 7118 |
\def\dtmMondayIndex{0} |
| 7119 |
% \end{macrocode} |
| 7120 |
%\end{macro} |
| 7121 |
% |
| 7122 |
%\begin{macro}{\dtmTuesdayIndex} |
| 7123 |
% \begin{macrocode} |
| 7124 |
\def\dtmTuesdayIndex{1} |
| 7125 |
% \end{macrocode} |
| 7126 |
%\end{macro} |
| 7127 |
% |
| 7128 |
%\begin{macro}{\dtmWednesdayIndex} |
| 7129 |
% \begin{macrocode} |
| 7130 |
\def\dtmWednesdayIndex{2} |
| 7131 |
% \end{macrocode} |
| 7132 |
%\end{macro} |
| 7133 |
% |
| 7134 |
%\begin{macro}{\dtmThursdayIndex} |
| 7135 |
% \begin{macrocode} |
| 7136 |
\def\dtmThursdayIndex{3} |
| 7137 |
% \end{macrocode} |
| 7138 |
%\end{macro} |
| 7139 |
% |
| 7140 |
%\begin{macro}{\dtmFridayIndex} |
| 7141 |
% \begin{macrocode} |
| 7142 |
\def\dtmFridayIndex{4} |
| 7143 |
% \end{macrocode} |
| 7144 |
%\end{macro} |
| 7145 |
% |
| 7146 |
%\begin{macro}{\dtmSaturdayIndex} |
| 7147 |
% \begin{macrocode} |
| 7148 |
\def\dtmSaturdayIndex{5} |
| 7149 |
% \end{macrocode} |
| 7150 |
%\end{macro} |
| 7151 |
% |
| 7152 |
%\begin{macro}{\dtmSundayIndex} |
| 7153 |
% \begin{macrocode} |
| 7154 |
\def\dtmSundayIndex{6} |
| 7155 |
% \end{macrocode} |
| 7156 |
%\end{macro} |
| 7157 |
% |
| 7158 |
%The ISO-8601 standard has day of week indexing starting with |
| 7159 |
%1 for Monday. The \sty{datetime} package has day of week indexing |
| 7160 |
%starting with 1 for Sunday, so provide convenient ways to convert |
| 7161 |
%if necessary. |
| 7162 |
%\begin{macro}{\LocaleDayIndexFromZeroMonToOneSun} |
| 7163 |
%Convert from \sty{pgfcalendar}'s Monday=0 indexing to |
| 7164 |
%\sty{datetime}'s Sunday=1 indexing. |
| 7165 |
% \begin{macrocode} |
| 7166 |
\def\LocaleDayIndexFromZeroMonToOneSun#1{% |
| 7167 |
\ifcase#1 |
| 7168 |
2% Monday 0 -> 2 |
| 7169 |
\or |
| 7170 |
3% Tuesday 1 -> 3 |
| 7171 |
\or |
| 7172 |
4% Wednesday 2 -> 4 |
| 7173 |
\or |
| 7174 |
5% Thursday 3 -> 5 |
| 7175 |
\or |
| 7176 |
6% Friday 4 -> 6 |
| 7177 |
\or |
| 7178 |
7% Saturday 5 -> 7 |
| 7179 |
\or |
| 7180 |
1% Sunday 6 -> 1 |
| 7181 |
\else |
| 7182 |
-1% invalid |
| 7183 |
\fi |
| 7184 |
} |
| 7185 |
% \end{macrocode} |
| 7186 |
%\end{macro} |
| 7187 |
% |
| 7188 |
%\begin{macro}{\LocaleDayIndexFromZeroMonToOneMon} |
| 7189 |
%Convert from \sty{pgfcalendar}'s Monday=0 indexing to |
| 7190 |
%ISO-8601's Monday=1 indexing. |
| 7191 |
% \begin{macrocode} |
| 7192 |
\def\LocaleDayIndexFromZeroMonToOneMon#1{% |
| 7193 |
\ifcase#1 |
| 7194 |
1% Monday 0 -> 1 |
| 7195 |
\or |
| 7196 |
2% Tuesday 1 -> 2 |
| 7197 |
\or |
| 7198 |
3% Wednesday 2 -> 3 |
| 7199 |
\or |
| 7200 |
4% Thursday 3 -> 4 |
| 7201 |
\or |
| 7202 |
5% Friday 4 -> 5 |
| 7203 |
\or |
| 7204 |
6% Saturday 5 -> 6 |
| 7205 |
\or |
| 7206 |
7% Sunday 6 -> 7 |
| 7207 |
\else |
| 7208 |
-1% invalid |
| 7209 |
\fi |
| 7210 |
} |
| 7211 |
% \end{macrocode} |
| 7212 |
%\end{macro} |
| 7213 |
% |
| 7214 |
%\begin{macro}{\LocaleDayIndexFromOneSunToZeroMon} |
| 7215 |
%Convert from \sty{datetime}'s Sunday=1 indexing to \sty{pgfcalendar}'s |
| 7216 |
%Monday=0 indexing. |
| 7217 |
% \begin{macrocode} |
| 7218 |
\def\LocaleDayIndexFromOneSunToZeroMon#1{% |
| 7219 |
\ifcase#1 |
| 7220 |
% no 0 |
| 7221 |
\or |
| 7222 |
6% Sunday 1 -> 6 |
| 7223 |
\or |
| 7224 |
0% Monday 2 -> 0 |
| 7225 |
\or |
| 7226 |
1% Tuesday 3 -> 1 |
| 7227 |
\or |
| 7228 |
2% Wednesday 4 -> 2 |
| 7229 |
\or |
| 7230 |
3% Thursday 5 -> 3 |
| 7231 |
\or |
| 7232 |
4% Friday 6 -> 4 |
| 7233 |
\or |
| 7234 |
5% Saturday 7 -> 5 |
| 7235 |
\else |
| 7236 |
-1% invalid |
| 7237 |
\fi |
| 7238 |
} |
| 7239 |
% \end{macrocode} |
| 7240 |
%\end{macro} |
| 7241 |
% |
| 7242 |
%\begin{macro}{\LocaleDayIndexFromOneMonToZeroMon} |
| 7243 |
%Convert from ISO-8601's Monday=1 indexing to \sty{pgfcalendar}'s |
| 7244 |
%Monday=0 indexing. |
| 7245 |
% \begin{macrocode} |
| 7246 |
\def\LocaleDayIndexFromOneMonToZeroMon#1{% |
| 7247 |
\ifcase#1 |
| 7248 |
% no 0 |
| 7249 |
\or |
| 7250 |
0% Monday 1 -> 0 |
| 7251 |
\or |
| 7252 |
1% Tuesday 2 -> 1 |
| 7253 |
\or |
| 7254 |
2% Wednesday 3 -> 2 |
| 7255 |
\or |
| 7256 |
3% Thursday 4 -> 3 |
| 7257 |
\or |
| 7258 |
4% Friday 5 -> 4 |
| 7259 |
\or |
| 7260 |
5% Saturday 6 -> 5 |
| 7261 |
\or |
| 7262 |
6% Sunday 7 -> 6 |
| 7263 |
\else |
| 7264 |
-1% invalid |
| 7265 |
\fi |
| 7266 |
} |
| 7267 |
% \end{macrocode} |
| 7268 |
%\end{macro} |
| 7269 |
% |
| 7270 |
%\begin{macro}{\LocaleDayIndexFromRegion} |
| 7271 |
%Convert from the region's day of the week (starting from 1) |
| 7272 |
%to \sty{pgfcalendar}'s 0=Monday indexing. The first argument is the |
| 7273 |
%dialect label. |
| 7274 |
% \begin{macrocode} |
| 7275 |
\def\LocaleDayIndexFromRegion#1#2{% |
| 7276 |
% \end{macrocode} |
| 7277 |
%Get the region's first day of the week. |
| 7278 |
% \begin{macrocode} |
| 7279 |
\ifcase\LocaleFirstDayIndex{#1} |
| 7280 |
% \end{macrocode} |
| 7281 |
%Monday is the first day of the week. That is, the region's using 1=Monday |
| 7282 |
%indexing. |
| 7283 |
% \begin{macrocode} |
| 7284 |
\LocaleDayIndexFromOneMonToZeroMon{#2}% |
| 7285 |
\or |
| 7286 |
% \end{macrocode} |
| 7287 |
%Tuesday is the first day of the week. That is, the region's using |
| 7288 |
%1=Tuesday indexing. (These mid-week cases are unlikely, but add |
| 7289 |
%them for completeness.) |
| 7290 |
% \begin{macrocode} |
| 7291 |
\ifnum#2=7 % Monday |
| 7292 |
0% |
| 7293 |
\else |
| 7294 |
#2% |
| 7295 |
\fi |
| 7296 |
\or |
| 7297 |
% \end{macrocode} |
| 7298 |
%Wednesday is the first day of the week. That is, the region's using |
| 7299 |
%1=Wednesday indexing. |
| 7300 |
% \begin{macrocode} |
| 7301 |
\ifcase#1 |
| 7302 |
% no 0 |
| 7303 |
\or |
| 7304 |
2% Wednesday 1 -> 2 |
| 7305 |
\or |
| 7306 |
3% Thursday 2 -> 3 |
| 7307 |
\or |
| 7308 |
4% Friday 3 -> 4 |
| 7309 |
\or |
| 7310 |
5% Saturday 4 -> 5 |
| 7311 |
\or |
| 7312 |
6% Sunday 5 -> 6 |
| 7313 |
\or |
| 7314 |
0% Monday 6 -> 0 |
| 7315 |
\or |
| 7316 |
1% Tuesday 7 -> 1 |
| 7317 |
\else |
| 7318 |
-1% invalid |
| 7319 |
\fi |
| 7320 |
\or |
| 7321 |
% \end{macrocode} |
| 7322 |
%Thursday is the first day of the week. That is, the region's using |
| 7323 |
%1=Thursday indexing. |
| 7324 |
% \begin{macrocode} |
| 7325 |
\ifcase#1 |
| 7326 |
% no 0 |
| 7327 |
\or |
| 7328 |
3% Thursday 1 -> 3 |
| 7329 |
\or |
| 7330 |
4% Friday 2 -> 4 |
| 7331 |
\or |
| 7332 |
5% Saturday 3 -> 5 |
| 7333 |
\or |
| 7334 |
6% Sunday 4 -> 6 |
| 7335 |
\or |
| 7336 |
0% Monday 5 -> 0 |
| 7337 |
\or |
| 7338 |
1% Tuesday 6 -> 1 |
| 7339 |
\or |
| 7340 |
2% Wednesday 7 -> 2 |
| 7341 |
\else |
| 7342 |
-1% invalid |
| 7343 |
\fi |
| 7344 |
\or |
| 7345 |
% \end{macrocode} |
| 7346 |
%Friday is the first day of the week. That is, the region's using |
| 7347 |
%1=Friday indexing. |
| 7348 |
% \begin{macrocode} |
| 7349 |
\ifcase#1 |
| 7350 |
% no 0 |
| 7351 |
\or |
| 7352 |
4% Friday 1 -> 4 |
| 7353 |
\or |
| 7354 |
5% Saturday 2 -> 5 |
| 7355 |
\or |
| 7356 |
6% Sunday 3 -> 6 |
| 7357 |
\or |
| 7358 |
0% Monday 4 -> 0 |
| 7359 |
\or |
| 7360 |
1% Tuesday 5 -> 1 |
| 7361 |
\or |
| 7362 |
2% Wednesday 6 -> 2 |
| 7363 |
\or |
| 7364 |
3% Thursday 7 -> 3 |
| 7365 |
\else |
| 7366 |
-1% invalid |
| 7367 |
\fi |
| 7368 |
\or |
| 7369 |
% \end{macrocode} |
| 7370 |
%Saturday is the first day of the week. That is, the region's using |
| 7371 |
%1=Saturday indexing. |
| 7372 |
% \begin{macrocode} |
| 7373 |
\ifcase#1 |
| 7374 |
% no 0 |
| 7375 |
\or |
| 7376 |
5% Saturday 1 -> 5 |
| 7377 |
\or |
| 7378 |
6% Sunday 2 -> 6 |
| 7379 |
\or |
| 7380 |
0% Monday 3 -> 0 |
| 7381 |
\or |
| 7382 |
1% Tuesday 4 -> 1 |
| 7383 |
\or |
| 7384 |
2% Wednesday 5 -> 2 |
| 7385 |
\or |
| 7386 |
3% Thursday 6 -> 3 |
| 7387 |
\or |
| 7388 |
4% Friday 7 -> 4 |
| 7389 |
\else |
| 7390 |
-1% invalid |
| 7391 |
\fi |
| 7392 |
\or |
| 7393 |
% \end{macrocode} |
| 7394 |
%Sunday is the first day of the week. That is, the region's using |
| 7395 |
%1=Sunday indexing. |
| 7396 |
% \begin{macrocode} |
| 7397 |
\LocaleDayIndexFromOneSunToZeroMon{#2}% |
| 7398 |
\else |
| 7399 |
#2% |
| 7400 |
\fi |
| 7401 |
} |
| 7402 |
% \end{macrocode} |
| 7403 |
%\end{macro} |
| 7404 |
% |
| 7405 |
%\begin{macro}{\LocaleDayIndexToRegion} |
| 7406 |
%Convert from \sty{pgfcalendar}'s 0=Monday indexing to the region's |
| 7407 |
%first day of the week (starting from 1). The first argument is the |
| 7408 |
%dialect label. |
| 7409 |
% \begin{macrocode} |
| 7410 |
\def\LocaleDayIndexToRegion#1#2{% |
| 7411 |
% \end{macrocode} |
| 7412 |
%Get the region's first day of the week. |
| 7413 |
% \begin{macrocode} |
| 7414 |
\ifcase\LocaleFirstDayIndex{#1} |
| 7415 |
% \end{macrocode} |
| 7416 |
%Monday is the first day of the week. That is, the region's using 1=Monday |
| 7417 |
%indexing. |
| 7418 |
% \begin{macrocode} |
| 7419 |
\LocaleDayIndexFromZeroMonToOneMon{#2}% |
| 7420 |
\or |
| 7421 |
% \end{macrocode} |
| 7422 |
%Tuesday is the first day of the week. That is, the region's using |
| 7423 |
%1=Tuesday indexing. (These mid-week cases are unlikely, but add |
| 7424 |
%them for completeness.) |
| 7425 |
% \begin{macrocode} |
| 7426 |
\ifnum#2=0 % Monday |
| 7427 |
7% |
| 7428 |
\else |
| 7429 |
#2% |
| 7430 |
\fi |
| 7431 |
\or |
| 7432 |
% \end{macrocode} |
| 7433 |
%Wednesday is the first day of the week. That is, the region's using |
| 7434 |
%1=Wednesday indexing. |
| 7435 |
% \begin{macrocode} |
| 7436 |
\ifcase#1 |
| 7437 |
6% Monday 0 -> 6 |
| 7438 |
\or |
| 7439 |
7% Tuesday 1 -> 7 |
| 7440 |
\or |
| 7441 |
1% Wednesday 2 -> 1 |
| 7442 |
\or |
| 7443 |
2% Thursday 3 -> 2 |
| 7444 |
\or |
| 7445 |
3% Friday 4 -> 3 |
| 7446 |
\or |
| 7447 |
4% Saturday 5 -> 4 |
| 7448 |
\or |
| 7449 |
5% Sunday 6 -> 5 |
| 7450 |
\else |
| 7451 |
-1% invalid |
| 7452 |
\fi |
| 7453 |
\or |
| 7454 |
% \end{macrocode} |
| 7455 |
%Thursday is the first day of the week. That is, the region's using |
| 7456 |
%1=Thursday indexing. |
| 7457 |
% \begin{macrocode} |
| 7458 |
\ifcase#1 |
| 7459 |
5% Monday 0 -> 5 |
| 7460 |
\or |
| 7461 |
6% Tuesday 1 -> 6 |
| 7462 |
\or |
| 7463 |
7% Wednesday 2 -> 7 |
| 7464 |
\or |
| 7465 |
1% Thursday 3 -> 1 |
| 7466 |
\or |
| 7467 |
2% Friday 4 -> 2 |
| 7468 |
\or |
| 7469 |
3% Saturday 5 -> 3 |
| 7470 |
\or |
| 7471 |
4% Sunday 6 -> 4 |
| 7472 |
\else |
| 7473 |
-1% invalid |
| 7474 |
\fi |
| 7475 |
\or |
| 7476 |
% \end{macrocode} |
| 7477 |
%Friday is the first day of the week. That is, the region's using |
| 7478 |
%1=Friday indexing. |
| 7479 |
% \begin{macrocode} |
| 7480 |
\ifcase#1 |
| 7481 |
4% Monday 0 -> 4 |
| 7482 |
\or |
| 7483 |
5% Tuesday 1 -> 5 |
| 7484 |
\or |
| 7485 |
6% Wednesday 2 -> 6 |
| 7486 |
\or |
| 7487 |
7% Thursday 3 -> 7 |
| 7488 |
\or |
| 7489 |
1% Friday 4 -> 1 |
| 7490 |
\or |
| 7491 |
2% Saturday 5 -> 2 |
| 7492 |
\or |
| 7493 |
3% Sunday 6 -> 3 |
| 7494 |
\else |
| 7495 |
-1% invalid |
| 7496 |
\fi |
| 7497 |
\or |
| 7498 |
% \end{macrocode} |
| 7499 |
%Saturday is the first day of the week. That is, the region's using |
| 7500 |
%1=Saturday indexing. |
| 7501 |
% \begin{macrocode} |
| 7502 |
\ifcase#1 |
| 7503 |
3% Monday 0 -> 3 |
| 7504 |
\or |
| 7505 |
4% Tuesday 1 -> 4 |
| 7506 |
\or |
| 7507 |
5% Wednesday 2 -> 5 |
| 7508 |
\or |
| 7509 |
6% Thursday 3 -> 6 |
| 7510 |
\or |
| 7511 |
7% Friday 4 -> 7 |
| 7512 |
\or |
| 7513 |
1% Saturday 5 -> 1 |
| 7514 |
\or |
| 7515 |
2% Sunday 6 -> 2 |
| 7516 |
\else |
| 7517 |
-1% invalid |
| 7518 |
\fi |
| 7519 |
\or |
| 7520 |
% \end{macrocode} |
| 7521 |
%Sunday is the first day of the week. That is, the region's using |
| 7522 |
%1=Sunday indexing. |
| 7523 |
% \begin{macrocode} |
| 7524 |
\LocaleDayIndexFromZeroMonToOneSun{#2}% |
| 7525 |
\else |
| 7526 |
#2% |
| 7527 |
\fi |
| 7528 |
} |
| 7529 |
% \end{macrocode} |
| 7530 |
%\end{macro} |
| 7531 |
% |
| 7532 |
%\begin{macro}{\LocaleFullTime} |
| 7533 |
%\begin{definition} |
| 7534 |
%\cs{LocaleFullTime}\marg{dialect} |
| 7535 |
%\end{definition} |
| 7536 |
%Get the full time for the given dialect. |
| 7537 |
% \begin{macrocode} |
| 7538 |
\def\LocaleFullTime#1{% |
| 7539 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{fulltime}}% |
| 7540 |
} |
| 7541 |
% \end{macrocode} |
| 7542 |
%\end{macro} |
| 7543 |
% |
| 7544 |
%\begin{macro}{\LocaleLongTime} |
| 7545 |
%\begin{definition} |
| 7546 |
%\cs{LocaleLongTime}\marg{dialect} |
| 7547 |
%\end{definition} |
| 7548 |
%Get the long time for the given dialect. |
| 7549 |
% \begin{macrocode} |
| 7550 |
\def\LocaleLongTime#1{% |
| 7551 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{longtime}}% |
| 7552 |
} |
| 7553 |
% \end{macrocode} |
| 7554 |
%\end{macro} |
| 7555 |
% |
| 7556 |
%\begin{macro}{\LocaleMediumTime} |
| 7557 |
%\begin{definition} |
| 7558 |
%\cs{LocaleMediumTime}\marg{dialect} |
| 7559 |
%\end{definition} |
| 7560 |
%Get the medium time for the given dialect. |
| 7561 |
% \begin{macrocode} |
| 7562 |
\def\LocaleMediumTime#1{% |
| 7563 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{medtime}}% |
| 7564 |
} |
| 7565 |
% \end{macrocode} |
| 7566 |
%\end{macro} |
| 7567 |
% |
| 7568 |
%\begin{macro}{\LocaleShortTime} |
| 7569 |
%\begin{definition} |
| 7570 |
%\cs{LocaleShortTime}\marg{dialect} |
| 7571 |
%\end{definition} |
| 7572 |
%Get the short time for the given dialect. |
| 7573 |
% \begin{macrocode} |
| 7574 |
\def\LocaleShortTime#1{% |
| 7575 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{shorttime}}% |
| 7576 |
} |
| 7577 |
% \end{macrocode} |
| 7578 |
%\end{macro} |
| 7579 |
% |
| 7580 |
%\begin{macro}{\LocaleFullDateTime} |
| 7581 |
%\begin{definition} |
| 7582 |
%\cs{LocaleFullDateTime}\marg{dialect} |
| 7583 |
%\end{definition} |
| 7584 |
%Get the full date and time for the given dialect. |
| 7585 |
% \begin{macrocode} |
| 7586 |
\def\LocaleFullDateTime#1{% |
| 7587 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{fulldatetime}}% |
| 7588 |
} |
| 7589 |
% \end{macrocode} |
| 7590 |
%\end{macro} |
| 7591 |
% |
| 7592 |
%\begin{macro}{\LocaleLongDateTime} |
| 7593 |
%\begin{definition} |
| 7594 |
%\cs{LocaleLongDateTime}\marg{dialect} |
| 7595 |
%\end{definition} |
| 7596 |
%Get the long date and time for the given dialect. |
| 7597 |
% \begin{macrocode} |
| 7598 |
\def\LocaleLongDateTime#1{% |
| 7599 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{longdatetime}}% |
| 7600 |
} |
| 7601 |
% \end{macrocode} |
| 7602 |
%\end{macro} |
| 7603 |
% |
| 7604 |
%\begin{macro}{\LocaleMediumDateTime} |
| 7605 |
%\begin{definition} |
| 7606 |
%\cs{LocaleMediumDateTime}\marg{dialect} |
| 7607 |
%\end{definition} |
| 7608 |
%Get the medium date and time for the given dialect. |
| 7609 |
% \begin{macrocode} |
| 7610 |
\def\LocaleMediumDateTime#1{% |
| 7611 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{meddatetime}}% |
| 7612 |
} |
| 7613 |
% \end{macrocode} |
| 7614 |
%\end{macro} |
| 7615 |
% |
| 7616 |
%\begin{macro}{\LocaleShortDateTime} |
| 7617 |
%\begin{definition} |
| 7618 |
%\cs{LocaleShortDateTime}\marg{dialect} |
| 7619 |
%\end{definition} |
| 7620 |
%Get the short date and time for the given dialect. |
| 7621 |
% \begin{macrocode} |
| 7622 |
\def\LocaleShortDateTime#1{% |
| 7623 |
\localedatetimefmt{\LocaleGetDialectAttribute{#1}{shortdatetime}}% |
| 7624 |
} |
| 7625 |
% \end{macrocode} |
| 7626 |
%\end{macro} |
| 7627 |
% |
| 7628 |
%\begin{macro}{\LocaleDayName} |
| 7629 |
%\begin{definition} |
| 7630 |
%\cs{LocaleDayName}\marg{dialect}\marg{n} |
| 7631 |
%\end{definition} |
| 7632 |
%Gets the day of week name identified by the index \meta{n} (0 for |
| 7633 |
%Monday, 1 for Tuesday, etc) in the given dialect. |
| 7634 |
% \begin{macrocode} |
| 7635 |
\def\LocaleDayName#1#2{% |
| 7636 |
\LocaleGetDialectAttribute{#1}{day.\number#2}% |
| 7637 |
} |
| 7638 |
% \end{macrocode} |
| 7639 |
%\end{macro} |
| 7640 |
% |
| 7641 |
%\begin{macro}{\LocaleShortDayName} |
| 7642 |
%\begin{definition} |
| 7643 |
%\cs{LocaleShortDayName}\marg{dialect}\marg{n} |
| 7644 |
%\end{definition} |
| 7645 |
%Gets the abbreviated day of week name identified by the index \meta{n} (0 for |
| 7646 |
%Monday, 1 for Tuesday, etc) in the given dialect. |
| 7647 |
% \begin{macrocode} |
| 7648 |
\def\LocaleShortDayName#1#2{% |
| 7649 |
\LocaleGetDialectAttribute{#1}{shortday.\number#2}% |
| 7650 |
} |
| 7651 |
% \end{macrocode} |
| 7652 |
%\end{macro} |
| 7653 |
% |
| 7654 |
%\begin{macro}{\LocaleMonthName} |
| 7655 |
%\begin{definition} |
| 7656 |
%\cs{LocaleMonthName}\marg{dialect}\marg{n} |
| 7657 |
%\end{definition} |
| 7658 |
%Gets the month name identified by the index \meta{n} (1 for |
| 7659 |
%January, 2 for February, etc) in the given dialect. |
| 7660 |
% \begin{macrocode} |
| 7661 |
\def\LocaleMonthName#1#2{% |
| 7662 |
\LocaleGetDialectAttribute{#1}{month.\number#2}% |
| 7663 |
} |
| 7664 |
% \end{macrocode} |
| 7665 |
%\end{macro} |
| 7666 |
% |
| 7667 |
%\begin{macro}{\LocaleShortMonthName} |
| 7668 |
%\begin{definition} |
| 7669 |
%\cs{LocaleShortMonthName}\marg{dialect}\marg{n} |
| 7670 |
%\end{definition} |
| 7671 |
%Gets the month week name identified by the index \meta{n} (1 for |
| 7672 |
%January, 2 for February, etc) in the given dialect. |
| 7673 |
% \begin{macrocode} |
| 7674 |
\def\LocaleShortMonthName#1#2{% |
| 7675 |
\LocaleGetDialectAttribute{#1}{shortmonth.\number#2}% |
| 7676 |
} |
| 7677 |
% \end{macrocode} |
| 7678 |
%\end{macro} |
| 7679 |
% |
| 7680 |
%Some languages have a different form for month or week day names |
| 7681 |
%used in a standalone context, such as in a column header. These are |
| 7682 |
%provided with the \cs{LocaleStandalone\ldots} commands defined |
| 7683 |
%below. For most languages they will be the same as the above. |
| 7684 |
% |
| 7685 |
%\begin{macro}{\LocaleStandaloneDayName} |
| 7686 |
%\begin{definition} |
| 7687 |
%\cs{LocaleStandaloneDayName}\marg{dialect}\marg{n} |
| 7688 |
%\end{definition} |
| 7689 |
%Gets the day of week name identified by the index \meta{n} (0 for |
| 7690 |
%Monday, 1 for Tuesday, etc) in the given dialect. |
| 7691 |
% \begin{macrocode} |
| 7692 |
\def\LocaleStandaloneDayName#1#2{% |
| 7693 |
\LocaleGetDialectAttribute{#1}{standalone.day.\number#2}% |
| 7694 |
} |
| 7695 |
% \end{macrocode} |
| 7696 |
%\end{macro} |
| 7697 |
% |
| 7698 |
%\begin{macro}{\LocaleStandaloneShortDayName} |
| 7699 |
%\begin{definition} |
| 7700 |
%\cs{LocaleStandaloneShortDayName}\marg{dialect}\marg{n} |
| 7701 |
%\end{definition} |
| 7702 |
%Gets the abbreviated day of week name identified by the index \meta{n} (0 for |
| 7703 |
%Monday, 1 for Tuesday, etc) in the given dialect. |
| 7704 |
% \begin{macrocode} |
| 7705 |
\def\LocaleStandaloneShortDayName#1#2{% |
| 7706 |
\LocaleGetDialectAttribute{#1}{standalone.shortday.\number#2}% |
| 7707 |
} |
| 7708 |
% \end{macrocode} |
| 7709 |
%\end{macro} |
| 7710 |
% |
| 7711 |
%\begin{macro}{\LocaleStandaloneMonthName} |
| 7712 |
%\begin{definition} |
| 7713 |
%\cs{LocaleStandaloneMonthName}\marg{dialect}\marg{n} |
| 7714 |
%\end{definition} |
| 7715 |
%Gets the month week name identified by the index \meta{n} (1 for |
| 7716 |
%January, 2 for February, etc) in the given dialect. |
| 7717 |
% \begin{macrocode} |
| 7718 |
\def\LocaleStandaloneMonthName#1#2{% |
| 7719 |
\LocaleGetDialectAttribute{#1}{standalone.month.\number#2}% |
| 7720 |
} |
| 7721 |
% \end{macrocode} |
| 7722 |
%\end{macro} |
| 7723 |
% |
| 7724 |
%\begin{macro}{\LocaleStandaloneShortMonthName} |
| 7725 |
%\begin{definition} |
| 7726 |
%\cs{LocaleStandaloneShortMonthName}\marg{dialect}\marg{n} |
| 7727 |
%\end{definition} |
| 7728 |
%Gets the month week name identified by the index \meta{n} (1 for |
| 7729 |
%January, 2 for February, etc) in the given dialect. |
| 7730 |
% \begin{macrocode} |
| 7731 |
\def\LocaleStandaloneShortMonthName#1#2{% |
| 7732 |
\LocaleGetDialectAttribute{#1}{standalone.shortmonth.\number#2}% |
| 7733 |
} |
| 7734 |
% \end{macrocode} |
| 7735 |
%\end{macro} |
| 7736 |
% |
| 7737 |
%\begin{macro}{\LocaleNumericGroupSep} |
| 7738 |
%\begin{definition} |
| 7739 |
%\cs{LocaleNumericGroupSep}\marg{dialect} |
| 7740 |
%\end{definition} |
| 7741 |
%Gets the numeric group separator for the given dialect. |
| 7742 |
% \begin{macrocode} |
| 7743 |
\def\LocaleNumericGroupSep#1{% |
| 7744 |
\LocaleGetDialectAttribute{#1}{groupsep}% |
| 7745 |
} |
| 7746 |
% \end{macrocode} |
| 7747 |
%\end{macro} |
| 7748 |
% |
| 7749 |
%\begin{macro}{\LocaleNumericDecimalSep} |
| 7750 |
%\begin{definition} |
| 7751 |
%\cs{LocaleNumericDecimalSep}\marg{dialect} |
| 7752 |
%\end{definition} |
| 7753 |
%Gets the numeric decimal separator for the given dialect. |
| 7754 |
% \begin{macrocode} |
| 7755 |
\def\LocaleNumericDecimalSep#1{% |
| 7756 |
\LocaleGetDialectAttribute{#1}{decsep}% |
| 7757 |
} |
| 7758 |
% \end{macrocode} |
| 7759 |
%\end{macro} |
| 7760 |
% |
| 7761 |
%\begin{macro}{\LocaleNumericMonetarySep} |
| 7762 |
%\begin{definition} |
| 7763 |
%\cs{LocaleNumericMonetarySep}\marg{dialect} |
| 7764 |
%\end{definition} |
| 7765 |
%Gets the numeric monetary separator for the given dialect. |
| 7766 |
% \begin{macrocode} |
| 7767 |
\def\LocaleNumericMonetarySep#1{% |
| 7768 |
\LocaleGetDialectAttribute{#1}{currencysep}% |
| 7769 |
} |
| 7770 |
% \end{macrocode} |
| 7771 |
%\end{macro} |
| 7772 |
% |
| 7773 |
%\begin{macro}{\LocaleNumericExponent} |
| 7774 |
%\begin{definition} |
| 7775 |
%\cs{LocaleNumericExponent}\marg{dialect} |
| 7776 |
%\end{definition} |
| 7777 |
%Gets the exponent symbol for the given dialect. |
| 7778 |
% \begin{macrocode} |
| 7779 |
\def\LocaleNumericExponent#1{% |
| 7780 |
\LocaleGetDialectAttribute{#1}{exp}% |
| 7781 |
} |
| 7782 |
% \end{macrocode} |
| 7783 |
%\end{macro} |
| 7784 |
% |
| 7785 |
%\begin{macro}{\LocaleCurrencyLabel} |
| 7786 |
%\begin{definition} |
| 7787 |
%\cs{LocaleCurrencyLabel}\marg{dialect} |
| 7788 |
%\end{definition} |
| 7789 |
%Gets the currency label for the given dialect. |
| 7790 |
% \begin{macrocode} |
| 7791 |
\def\LocaleCurrencyLabel#1{% |
| 7792 |
\LocaleIfDialectAttributeEqCs{#1}{currency}{\@locale@unknown@currency}% |
| 7793 |
{% |
| 7794 |
% \end{macrocode} |
| 7795 |
%Unknown currency symbol. |
| 7796 |
% \begin{macrocode} |
| 7797 |
\ifx\LocaleMainRegion\empty |
| 7798 |
\@locale@os@currencycode |
| 7799 |
\else |
| 7800 |
\LocaleGetDialectAttributeOrDefValue{\LocaleMainDialect}{currency}% |
| 7801 |
{\@locale@os@currencycode}% |
| 7802 |
\fi |
| 7803 |
}% |
| 7804 |
{\LocaleGetDialectAttribute{#1}{currency}}% |
| 7805 |
} |
| 7806 |
% \end{macrocode} |
| 7807 |
%\end{macro} |
| 7808 |
% |
| 7809 |
%\begin{macro}{\LocaleCurrencyRegionalLabel} |
| 7810 |
%\begin{definition} |
| 7811 |
%\cs{LocaleCurrencyRegionalLabel}\marg{dialect} |
| 7812 |
%\end{definition} |
| 7813 |
%Gets the regional currency label for the given dialect. |
| 7814 |
% \begin{macrocode} |
| 7815 |
\def\LocaleCurrencyRegionalLabel#1{% |
| 7816 |
\LocaleIfDialectAttributeEqCs{#1}{regionalcurrency}% |
| 7817 |
{\@locale@unknown@currency}% |
| 7818 |
{% |
| 7819 |
% \end{macrocode} |
| 7820 |
%Unknown currency symbol. |
| 7821 |
% \begin{macrocode} |
| 7822 |
\ifx\LocaleMainRegion\empty |
| 7823 |
\@locale@os@regionalcurrencycode |
| 7824 |
\else |
| 7825 |
\LocaleGetDialectAttributeOrDefValue{\LocaleMainDialect}{regionalcurrency}% |
| 7826 |
{\@locale@os@regionalcurrencycode}% |
| 7827 |
\fi |
| 7828 |
}% |
| 7829 |
{\LocaleGetDialectAttribute{#1}{regionalcurrency}}% |
| 7830 |
} |
| 7831 |
% \end{macrocode} |
| 7832 |
%\end{macro} |
| 7833 |
% |
| 7834 |
%\begin{macro}{\LocaleCurrencySymbol} |
| 7835 |
%\begin{definition} |
| 7836 |
%\cs{LocaleCurrencySymbol}\marg{dialect} |
| 7837 |
%\end{definition} |
| 7838 |
%Gets the currency symbol for the given dialect. (May have non-ASCII |
| 7839 |
%characters.) |
| 7840 |
% \begin{macrocode} |
| 7841 |
\def\LocaleCurrencySymbol#1{% |
| 7842 |
\LocaleIfDialectAttributeEqCs{#1}{currency}{\@locale@unknown@currency}% |
| 7843 |
{% |
| 7844 |
% \end{macrocode} |
| 7845 |
%Unknown currency code. Does the main locale have a region? |
| 7846 |
% \begin{macrocode} |
| 7847 |
\ifx\LocaleMainRegion\empty |
| 7848 |
% \end{macrocode} |
| 7849 |
%No main region, try the default OS currency. |
| 7850 |
% \begin{macrocode} |
| 7851 |
\ifx\@locale@os@currencysym\empty |
| 7852 |
\LocaleGetDialectAttribute{#1}{currencysym}% |
| 7853 |
\else |
| 7854 |
\@locale@os@currencysym |
| 7855 |
\fi |
| 7856 |
\else |
| 7857 |
% \end{macrocode} |
| 7858 |
%Try the main dialect attribute. |
| 7859 |
% \begin{macrocode} |
| 7860 |
\LocaleGetDialectAttributeOrDefValue{\LocaleMainDialect}{currencysym}% |
| 7861 |
{\LocaleGetDialectAttribute{#1}{currencysym}}% |
| 7862 |
\fi |
| 7863 |
}% |
| 7864 |
{% |
| 7865 |
\LocaleIfSameDialectAttributeValues{#1}% |
| 7866 |
{currency}{currencysym}% |
| 7867 |
{% |
| 7868 |
\LocaleGetCurrencyAttributeOrDefValue |
| 7869 |
{\LocaleGetDialectAttribute{#1}{currency}}{sym}% |
| 7870 |
{\LocaleGetDialectAttribute{#1}{currencysym}}% |
| 7871 |
}% |
| 7872 |
{% |
| 7873 |
\LocaleGetDialectAttribute{#1}{currencysym}% |
| 7874 |
}% |
| 7875 |
}% |
| 7876 |
} |
| 7877 |
% \end{macrocode} |
| 7878 |
%\end{macro} |
| 7879 |
% |
| 7880 |
%\begin{macro}{\LocaleCurrencyTeXSymbol} |
| 7881 |
%\begin{definition} |
| 7882 |
%\cs{LocaleCurrencyTeXSymbol}\marg{dialect} |
| 7883 |
%\end{definition} |
| 7884 |
%Gets the currency symbol for the given dialect. (May include |
| 7885 |
%\sty{texosquery} currency control symbols.) |
| 7886 |
% \begin{macrocode} |
| 7887 |
\def\LocaleCurrencyTeXSymbol#1{% |
| 7888 |
\LocaleIfDialectAttributeEqCs{#1}{currency}{\@locale@unknown@currency}% |
| 7889 |
{% |
| 7890 |
% \end{macrocode} |
| 7891 |
%Unknown currency code. Does the main locale have a region? |
| 7892 |
% \begin{macrocode} |
| 7893 |
\ifx\LocaleMainRegion\empty |
| 7894 |
\ifx\@locale@os@currencytex\empty |
| 7895 |
\LocaleGetDialectAttribute{#1}{currencytex}% |
| 7896 |
\else |
| 7897 |
\@locale@os@currencytex |
| 7898 |
\fi |
| 7899 |
\fi |
| 7900 |
}% |
| 7901 |
{% |
| 7902 |
\LocaleIfSameDialectAttributeValues{#1}% |
| 7903 |
{currency}{currencytex}% |
| 7904 |
{% |
| 7905 |
\LocaleGetCurrencyAttributeOrDefValue |
| 7906 |
{\LocaleGetDialectAttribute{#1}{currency}}{tex}% |
| 7907 |
{\LocaleGetDialectAttribute{#1}{currencytex}}% |
| 7908 |
}% |
| 7909 |
{% |
| 7910 |
\LocaleGetDialectAttribute{#1}{currencytex}% |
| 7911 |
}% |
| 7912 |
}% |
| 7913 |
} |
| 7914 |
% \end{macrocode} |
| 7915 |
%\end{macro} |
| 7916 |
% |
| 7917 |
%\begin{macro}{\LocaleNumericPercent} |
| 7918 |
%\begin{definition} |
| 7919 |
%\cs{LocaleNumericPercent}\marg{dialect} |
| 7920 |
%\end{definition} |
| 7921 |
%Gets the percent symbol for this dialect. |
| 7922 |
% \begin{macrocode} |
| 7923 |
\def\LocaleNumericPercent#1{% |
| 7924 |
\LocaleGetDialectAttribute{#1}{percent}% |
| 7925 |
} |
| 7926 |
% \end{macrocode} |
| 7927 |
%\end{macro} |
| 7928 |
% |
| 7929 |
%\begin{macro}{\LocaleNumericPermill} |
| 7930 |
%\begin{definition} |
| 7931 |
%\cs{LocaleNumericPermill}\marg{dialect} |
| 7932 |
%\end{definition} |
| 7933 |
%Gets the permill symbol for this dialect. |
| 7934 |
% \begin{macrocode} |
| 7935 |
\def\LocaleNumericPermill#1{% |
| 7936 |
\LocaleGetDialectAttribute{#1}{permill}% |
| 7937 |
} |
| 7938 |
% \end{macrocode} |
| 7939 |
%\end{macro} |
| 7940 |
% |
| 7941 |
%\subsection{Patterns} |
| 7942 |
% |
| 7943 |
%\begin{macro}{\LocaleApplyDateTimePattern} |
| 7944 |
%\begin{definition} |
| 7945 |
%\cs{LocaleApplyDateTimePattern}\marg{dialect}\marg{attribute}\marg{date-time data} |
| 7946 |
%\end{definition} |
| 7947 |
% \begin{macrocode} |
| 7948 |
\def\LocaleApplyDateTimePattern#1#2#3{% |
| 7949 |
\LocaleIfHasDialectNonEmptyAttribute{#1}{#2}% |
| 7950 |
{% |
| 7951 |
% \end{macrocode} |
| 7952 |
%The data might be provided with the control sequence |
| 7953 |
%\cs{LocaleDateTimeInfo}, which may be empty and will need expanding. |
| 7954 |
% \begin{macrocode} |
| 7955 |
\ifx\empty#3\empty |
| 7956 |
\@locale@warn{No date-time data for pattern |
| 7957 |
(attribute `#2', dialect `#1')}% |
| 7958 |
\else |
| 7959 |
\localedatetimefmt |
| 7960 |
{\expandafter\texosqueryfmtdatetime |
| 7961 |
\csname locale@dialect@#2@#1\expandafter\endcsname#3}% |
| 7962 |
\fi |
| 7963 |
}% |
| 7964 |
{% |
| 7965 |
\@locale@warn{No date-time pattern attribute `#2' for dialect `#1'}% |
| 7966 |
}% |
| 7967 |
} |
| 7968 |
% \end{macrocode} |
| 7969 |
%\end{macro} |
| 7970 |
% |
| 7971 |
%If the date-time patterns are required, the name commands such as |
| 7972 |
%\cs{texosqueryfmtpatMMM} need defining |
| 7973 |
% \begin{macrocode} |
| 7974 |
\LocaleIfDateTimePatternsSupported |
| 7975 |
{% |
| 7976 |
% \end{macrocode} |
| 7977 |
%\begin{macro}{\texosqueryfmtpatMMM} |
| 7978 |
%Short month name. |
| 7979 |
% \begin{macrocode} |
| 7980 |
\def\texosqueryfmtpatMMM#1{% |
| 7981 |
\CurrentLocaleShortMonthName{#1}% |
| 7982 |
} |
| 7983 |
% \end{macrocode} |
| 7984 |
%\end{macro} |
| 7985 |
% |
| 7986 |
%\begin{macro}{\texosqueryfmtpatMMMM} |
| 7987 |
%Full month name. |
| 7988 |
% \begin{macrocode} |
| 7989 |
\def\texosqueryfmtpatMMMM#1{% |
| 7990 |
\CurrentLocaleMonthName{#1}% |
| 7991 |
} |
| 7992 |
% \end{macrocode} |
| 7993 |
%\end{macro} |
| 7994 |
% |
| 7995 |
%\begin{macro}{\texosqueryfmtpatLLL} |
| 7996 |
%Short standalone month name. |
| 7997 |
% \begin{macrocode} |
| 7998 |
\def\texosqueryfmtpatLLL#1{% |
| 7999 |
\CurrentLocaleStandaloneShortMonthName{#1}% |
| 8000 |
} |
| 8001 |
% \end{macrocode} |
| 8002 |
%\end{macro} |
| 8003 |
% |
| 8004 |
%\begin{macro}{\texosqueryfmtpatLLLL} |
| 8005 |
%Full standalone month name. |
| 8006 |
% \begin{macrocode} |
| 8007 |
\def\texosqueryfmtpatLLLL#1{% |
| 8008 |
\CurrentLocaleStandaloneMonthName{#1}% |
| 8009 |
} |
| 8010 |
% \end{macrocode} |
| 8011 |
%\end{macro} |
| 8012 |
% |
| 8013 |
%\begin{macro}{\texosqueryfmtpatEEE} |
| 8014 |
%Short day of week name. |
| 8015 |
% \begin{macrocode} |
| 8016 |
\def\texosqueryfmtpatEEE#1{% |
| 8017 |
\CurrentLocaleShortDayName{\LocaleDayIndexFromOneMonToZeroMon{#1}}% |
| 8018 |
} |
| 8019 |
% \end{macrocode} |
| 8020 |
%\end{macro} |
| 8021 |
% |
| 8022 |
%\begin{macro}{\texosqueryfmtpatEEEE} |
| 8023 |
%Full day of week name. |
| 8024 |
% \begin{macrocode} |
| 8025 |
\def\texosqueryfmtpatEEEE#1{% |
| 8026 |
\CurrentLocaleDayName{\LocaleDayIndexFromOneMonToZeroMon{#1}}% |
| 8027 |
} |
| 8028 |
% \end{macrocode} |
| 8029 |
%\end{macro} |
| 8030 |
% |
| 8031 |
%\begin{macro}{\texosquerytimezonefmt} |
| 8032 |
%Allow the time zone name to be wrapped in a formatting command. |
| 8033 |
% \begin{macrocode} |
| 8034 |
\def\texosquerytimezonefmt#1{#1} |
| 8035 |
% \end{macrocode} |
| 8036 |
%\end{macro} |
| 8037 |
% |
| 8038 |
%\begin{macro}{\texosqueryshorttimezone} |
| 8039 |
% \begin{macrocode} |
| 8040 |
\def\texosqueryshorttimezone#1{% |
| 8041 |
\texosquerytimezonefmt |
| 8042 |
{\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.short}}% |
| 8043 |
} |
| 8044 |
% \end{macrocode} |
| 8045 |
%\end{macro} |
| 8046 |
% |
| 8047 |
%\begin{macro}{\texosqueryshortdstzone} |
| 8048 |
% \begin{macrocode} |
| 8049 |
\def\texosqueryshortdstzone#1{% |
| 8050 |
\texosquerytimezonefmt |
| 8051 |
{\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.shortdst}}% |
| 8052 |
} |
| 8053 |
% \end{macrocode} |
| 8054 |
%\end{macro} |
| 8055 |
% |
| 8056 |
%\begin{macro}{\texosquerylongtimezone} |
| 8057 |
% \begin{macrocode} |
| 8058 |
\def\texosquerylongtimezone#1{% |
| 8059 |
\texosquerytimezonefmt |
| 8060 |
{\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.long}}% |
| 8061 |
} |
| 8062 |
% \end{macrocode} |
| 8063 |
%\end{macro} |
| 8064 |
% |
| 8065 |
%\begin{macro}{\texosquerylongdstzone} |
| 8066 |
% \begin{macrocode} |
| 8067 |
\def\texosquerylongdstzone#1{% |
| 8068 |
\texosquerytimezonefmt |
| 8069 |
{\LocaleGetDialectAttribute{\CurrentTrackedDialect}{timezone.#1.longdst}}% |
| 8070 |
} |
| 8071 |
% \end{macrocode} |
| 8072 |
%\end{macro} |
| 8073 |
%End of first argument of \cs{LocaleIfDateTimePatternsSupported}. |
| 8074 |
%(Do nothing if date-time patterns not required.) |
| 8075 |
% \begin{macrocode} |
| 8076 |
} |
| 8077 |
{} |
| 8078 |
% \end{macrocode} |
| 8079 |
% |
| 8080 |
%Set up the \sty{texosquery} numbering commands to use the current |
| 8081 |
%locale symbols. |
| 8082 |
%\begin{macro}{\texosquerypatfmtgroupsep} |
| 8083 |
% \begin{macrocode} |
| 8084 |
\def\texosquerypatfmtgroupsep{\CurrentLocaleNumericGroupSep} |
| 8085 |
% \end{macrocode} |
| 8086 |
%\end{macro} |
| 8087 |
% |
| 8088 |
%\begin{macro}{\texosquerypatfmtdecsep} |
| 8089 |
% \begin{macrocode} |
| 8090 |
\def\texosquerypatfmtdecsep{\CurrentLocaleDecimalSep} |
| 8091 |
% \end{macrocode} |
| 8092 |
%\end{macro} |
| 8093 |
% |
| 8094 |
%\begin{macro}{\texosquerypatfmtcurdecsep} |
| 8095 |
% \begin{macrocode} |
| 8096 |
\def\texosquerypatfmtcurdecsep{\CurrentLocaleMonetarySep} |
| 8097 |
% \end{macrocode} |
| 8098 |
%\end{macro} |
| 8099 |
% |
| 8100 |
%\begin{macro}{\texosquerypatfmtexp} |
| 8101 |
% \begin{macrocode} |
| 8102 |
\def\texosquerypatfmtexp{\CurrentLocaleExponent} |
| 8103 |
% \end{macrocode} |
| 8104 |
%\end{macro} |
| 8105 |
% |
| 8106 |
%\begin{macro}{\texosquerypatfmtcurrencysign} |
| 8107 |
% \begin{macrocode} |
| 8108 |
\def\texosquerypatfmtcurrencysign{\CurrentLocaleCurrency} |
| 8109 |
% \end{macrocode} |
| 8110 |
%\end{macro} |
| 8111 |
% |
| 8112 |
%\begin{macro}{\texosquerypatfmtpercentsign} |
| 8113 |
% \begin{macrocode} |
| 8114 |
\def\texosquerypatfmtpercentsign{\CurrentLocalePercent} |
| 8115 |
% \end{macrocode} |
| 8116 |
%\end{macro} |
| 8117 |
% |
| 8118 |
%\begin{macro}{\texosquerypatfmtpermillsign} |
| 8119 |
% \begin{macrocode} |
| 8120 |
\def\texosquerypatfmtpermillsign{\CurrentLocalePermill} |
| 8121 |
% \end{macrocode} |
| 8122 |
%\end{macro} |
| 8123 |
% |
| 8124 |
%\subsection{Conditionals} |
| 8125 |
%\begin{macro}{\LocaleIfNumericUsesGroup} |
| 8126 |
%\begin{definition} |
| 8127 |
%\cs{LocaleIfNumericUsesGroup}\marg{dialect}\marg{true}\marg{false} |
| 8128 |
%\end{definition} |
| 8129 |
%Determines if the locale uses numerical group separator. The |
| 8130 |
%\texttt{usesgroup} attribute will be 1 for true and 0 for false, so |
| 8131 |
%we need a numerical comparison. |
| 8132 |
% \begin{macrocode} |
| 8133 |
\def\LocaleIfNumericUsesGroup#1{% |
| 8134 |
\LocaleIfDialectAttributeEqNum{#1}{usesgroup}{1}% |
| 8135 |
} |
| 8136 |
% \end{macrocode} |
| 8137 |
%\end{macro} |
| 8138 |
% |
| 8139 |
%\begin{macro}{\LocaleIfHasLanguageName} |
| 8140 |
%\begin{definition} |
| 8141 |
%\cs{LocaleIfHasLanguageName}\marg{dialect}\marg{true}\marg{false} |
| 8142 |
%\end{definition} |
| 8143 |
%Determines if the given dialect has a language name. |
| 8144 |
% \begin{macrocode} |
| 8145 |
\def\LocaleIfHasLanguageName#1{% |
| 8146 |
\LocaleIfHasDialectNonEmptyAttribute{#1}{langname}% |
| 8147 |
} |
| 8148 |
% \end{macrocode} |
| 8149 |
%\end{macro} |
| 8150 |
%No need for a separate check for the native version. If it has |
| 8151 |
%one, then it will have the other. |
| 8152 |
% |
| 8153 |
%\begin{macro}{\LocaleIfHasRegionName} |
| 8154 |
%\begin{definition} |
| 8155 |
%\cs{LocaleIfHasRegionName}\marg{dialect}\marg{true}\marg{false} |
| 8156 |
%\end{definition} |
| 8157 |
%Determines if the given dialect has a region name. |
| 8158 |
% \begin{macrocode} |
| 8159 |
\def\LocaleIfHasRegionName#1{% |
| 8160 |
\LocaleIfHasDialectNonEmptyAttribute{#1}{regionname}% |
| 8161 |
} |
| 8162 |
% \end{macrocode} |
| 8163 |
%\end{macro} |
| 8164 |
% |
| 8165 |
%\begin{macro}{\LocaleIfHasVariantName} |
| 8166 |
%\begin{definition} |
| 8167 |
%\cs{LocaleIfHasVariantName}\marg{dialect}\marg{true}\marg{false} |
| 8168 |
%\end{definition} |
| 8169 |
%Determines if the given dialect has a variant name. |
| 8170 |
% \begin{macrocode} |
| 8171 |
\def\LocaleIfHasVariantName#1{% |
| 8172 |
\LocaleIfHasDialectNonEmptyAttribute{#1}{variantname}% |
| 8173 |
} |
| 8174 |
% \end{macrocode} |
| 8175 |
%\end{macro} |
| 8176 |
% |
| 8177 |
%\subsection{Post-Parsing} |
| 8178 |
%If this hook has been defined, use it. |
| 8179 |
% \begin{macrocode} |
| 8180 |
\ifx\@locale@postparse@hook\undefined |
| 8181 |
\else |
| 8182 |
\@locale@postparse@hook |
| 8183 |
\fi |
| 8184 |
% \end{macrocode} |
| 8185 |
% |
| 8186 |
%\subsection{Initialising Current Locale Commands} |
| 8187 |
%These commands are all initialised to do nothing (except for |
| 8188 |
%indexes which are initialised to \texttt{-1}), in the event that |
| 8189 |
%the dry run mode is on. |
| 8190 |
% \begin{macrocode} |
| 8191 |
\def\CurrentLocaleLanguageName{}% |
| 8192 |
\def\CurrentLocaleLanguageNativeName{}% |
| 8193 |
\def\CurrentLocaleRegionName{}% |
| 8194 |
\def\CurrentLocaleRegionNativeName{}% |
| 8195 |
\def\CurrentLocaleVariantName{}% |
| 8196 |
\def\CurrentLocaleVariantNativeName{}% |
| 8197 |
\def\CurrentLocaleFirstDayIndex{-1}% |
| 8198 |
\def\CurrentLocaleDayIndexFromRegion{-1}% |
| 8199 |
\def\CurrentLocaleDayName{}% |
| 8200 |
\def\CurrentLocaleShortDayName{}% |
| 8201 |
\def\CurrentLocaleStandaloneDayName{}% |
| 8202 |
\def\CurrentLocaleStandaloneShortDayName{}% |
| 8203 |
\def\CurrentLocaleMonthName{}% |
| 8204 |
\def\CurrentLocaleShortMonthName{}% |
| 8205 |
\def\CurrentLocaleStandaloneMonthName{}% |
| 8206 |
\def\CurrentLocaleStandaloneShortMonthName{}% |
| 8207 |
\def\CurrentLocaleFullDate{}% |
| 8208 |
\def\CurrentLocaleLongDate{}% |
| 8209 |
\def\CurrentLocaleMediumDate{}% |
| 8210 |
\def\CurrentLocaleShortDate{}% |
| 8211 |
\def\CurrentLocaleFullTime{}% |
| 8212 |
\def\CurrentLocaleLongTime{}% |
| 8213 |
\def\CurrentLocaleMediumTime{}% |
| 8214 |
\def\CurrentLocaleShortTime{}% |
| 8215 |
\def\CurrentLocaleFullDateTime{}% |
| 8216 |
\def\CurrentLocaleLongDateTime{}% |
| 8217 |
\def\CurrentLocaleMediumDateTime{}% |
| 8218 |
\def\CurrentLocaleShortDateTime{}% |
| 8219 |
\def\CurrentLocaleDate{}% |
| 8220 |
\def\CurrentLocaleTime{}% |
| 8221 |
\def\CurrentLocaleCurrency{}% |
| 8222 |
\def\CurrentLocaleNumericGroupSep{}% |
| 8223 |
\def\CurrentLocaleIfNumericUsesGroup{}% |
| 8224 |
\def\CurrentLocaleDecimalSep{}% |
| 8225 |
\def\CurrentLocaleMonetarySep{}% |
| 8226 |
\def\CurrentLocaleExponent{}% |
| 8227 |
\def\CurrentLocalePercent{}% |
| 8228 |
\def\CurrentLocalePermill{}% |
| 8229 |
\def\CurrentLocaleIntegerPattern{}% |
| 8230 |
\def\CurrentLocaleDecimalPattern{}% |
| 8231 |
\def\CurrentLocaleCurrencyPattern{}% |
| 8232 |
\def\CurrentLocalePercentPattern{}% |
| 8233 |
\def\CurrentLocaleApplyDateTimePattern{}% |
| 8234 |
\def\CurrentTrackedDialect{}% |
| 8235 |
% \end{macrocode} |
| 8236 |
% |
| 8237 |
%\subsection{Switching Locale} |
| 8238 |
%\begin{macro}{\@locale@select} |
| 8239 |
%Used when a language is changed. The argument is the dialect label. |
| 8240 |
% \begin{macrocode} |
| 8241 |
\def\@locale@select#1{% |
| 8242 |
\SetCurrentTrackedDialect{#1}% |
| 8243 |
\def\CurrentLocaleLanguageName{\LocaleLanguageName{#1}}% |
| 8244 |
\def\CurrentLocaleLanguageNativeName{\LocaleLanguageNativeName{#1}}% |
| 8245 |
\def\CurrentLocaleRegionName{\LocaleRegionName{#1}}% |
| 8246 |
\def\CurrentLocaleRegionNativeName{\LocaleRegionNativeName{#1}}% |
| 8247 |
\def\CurrentLocaleVariantName{\LocaleVariantName{#1}}% |
| 8248 |
\def\CurrentLocaleVariantNativeName{\LocaleVariantNativeName{#1}}% |
| 8249 |
\def\CurrentLocaleFirstDayIndex{\LocaleFirstDayIndex{#1}}% |
| 8250 |
\def\CurrentLocaleDayIndexFromRegion{\LocaleDayIndexFromRegion{#1}}% |
| 8251 |
\def\CurrentLocaleDayName{\LocaleDayName{#1}}% |
| 8252 |
\def\CurrentLocaleShortDayName{\LocaleShortDayName{#1}}% |
| 8253 |
\def\CurrentLocaleStandaloneDayName{% |
| 8254 |
\LocaleStandaloneDayName{#1}}% |
| 8255 |
\def\CurrentLocaleStandaloneShortDayName{% |
| 8256 |
\LocaleStandaloneShortDayName{#1}}% |
| 8257 |
\def\CurrentLocaleMonthName{\LocaleMonthName{#1}}% |
| 8258 |
\def\CurrentLocaleShortMonthName{\LocaleShortMonthName{#1}}% |
| 8259 |
\def\CurrentLocaleStandaloneMonthName{% |
| 8260 |
\LocaleStandaloneMonthName{#1}}% |
| 8261 |
\def\CurrentLocaleStandaloneShortMonthName{% |
| 8262 |
\LocaleStandaloneShortMonthName{#1}}% |
| 8263 |
\def\CurrentLocaleFullDate{\LocaleFullDate{#1}}% |
| 8264 |
\def\CurrentLocaleLongDate{\LocaleLongDate{#1}}% |
| 8265 |
\def\CurrentLocaleMediumDate{\LocaleMediumDate{#1}}% |
| 8266 |
\def\CurrentLocaleShortDate{\LocaleShortDate{#1}}% |
| 8267 |
\def\CurrentLocaleFullTime{\LocaleFullTime{#1}}% |
| 8268 |
\def\CurrentLocaleLongTime{\LocaleLongTime{#1}}% |
| 8269 |
\def\CurrentLocaleMediumTime{\LocaleMediumTime{#1}}% |
| 8270 |
\def\CurrentLocaleShortTime{\LocaleShortTime{#1}}% |
| 8271 |
\def\CurrentLocaleFullDateTime{\LocaleFullDateTime{#1}}% |
| 8272 |
\def\CurrentLocaleLongDateTime{\LocaleLongDateTime{#1}}% |
| 8273 |
\def\CurrentLocaleMediumDateTime{\LocaleMediumDateTime{#1}}% |
| 8274 |
\def\CurrentLocaleShortDateTime{\LocaleShortDateTime{#1}}% |
| 8275 |
\def\CurrentLocaleDate{% |
| 8276 |
\localedatechoice |
| 8277 |
{\LocaleFullDate{#1}}% |
| 8278 |
{\LocaleLongDate{#1}}% |
| 8279 |
{\LocaleMediumDate{#1}}% |
| 8280 |
{\LocaleShortDate{#1}}% |
| 8281 |
}% |
| 8282 |
\def\CurrentLocaleTime{% |
| 8283 |
\localetimechoice |
| 8284 |
{\LocaleFullTime{#1}}% |
| 8285 |
{\LocaleLongTime{#1}}% |
| 8286 |
{\LocaleMediumTime{#1}}% |
| 8287 |
{\LocaleShortTime{#1}}% |
| 8288 |
}% |
| 8289 |
\def\CurrentLocaleCurrency{% |
| 8290 |
\localecurrchoice |
| 8291 |
{\LocaleCurrencyLabel{#1}}% |
| 8292 |
{\LocaleCurrencyRegionalLabel{#1}}% |
| 8293 |
{\LocaleCurrencySymbol{#1}}% |
| 8294 |
{\LocaleCurrencyTeXSymbol{#1}}% |
| 8295 |
}% |
| 8296 |
\def\CurrentLocaleNumericGroupSep{% |
| 8297 |
\LocaleNumericGroupSep{#1}% |
| 8298 |
}% |
| 8299 |
\def\CurrentLocaleIfNumericUsesGroup{% |
| 8300 |
\LocaleIfNumericUsesGroup{#1}% |
| 8301 |
}% |
| 8302 |
\def\CurrentLocaleDecimalSep{% |
| 8303 |
\LocaleNumericDecimalSep{#1}% |
| 8304 |
}% |
| 8305 |
\def\CurrentLocaleMonetarySep{% |
| 8306 |
\LocaleNumericMonetarySep{#1}% |
| 8307 |
}% |
| 8308 |
\def\CurrentLocaleExponent{% |
| 8309 |
\LocaleNumericExponent{#1}% |
| 8310 |
}% |
| 8311 |
\def\CurrentLocalePercent{% |
| 8312 |
\LocaleNumericPercent{#1}% |
| 8313 |
}% |
| 8314 |
\def\CurrentLocalePermill{% |
| 8315 |
\LocaleNumericPermill{#1}% |
| 8316 |
}% |
| 8317 |
\def\CurrentLocaleIntegerPattern{% |
| 8318 |
\LocaleGetDialectAttribute{#1}{intfmt}% |
| 8319 |
}% |
| 8320 |
\def\CurrentLocaleDecimalPattern{% |
| 8321 |
\LocaleGetDialectAttribute{#1}{decfmt}% |
| 8322 |
}% |
| 8323 |
\def\CurrentLocaleCurrencyPattern{% |
| 8324 |
\LocaleGetDialectAttribute{#1}{curfmt}% |
| 8325 |
}% |
| 8326 |
\def\CurrentLocalePercentPattern{% |
| 8327 |
\LocaleGetDialectAttribute{#1}{perfmt}% |
| 8328 |
}% |
| 8329 |
\def\CurrentLocaleApplyDateTimePattern{% |
| 8330 |
\LocaleApplyDateTimePattern{#1}% |
| 8331 |
}% |
| 8332 |
} |
| 8333 |
% \end{macrocode} |
| 8334 |
%\end{macro} |
| 8335 |
% |
| 8336 |
%Provide the choice commands: |
| 8337 |
%\begin{macro}{\localedatechoice} |
| 8338 |
% \begin{macrocode} |
| 8339 |
\ifx\localedatechoice\undefined |
| 8340 |
\def\localedatechoice#1#2#3#4{#2} |
| 8341 |
\fi |
| 8342 |
% \end{macrocode} |
| 8343 |
%\end{macro} |
| 8344 |
% |
| 8345 |
%\begin{macro}{\localetimechoice} |
| 8346 |
% \begin{macrocode} |
| 8347 |
\ifx\localetimechoice\undefined |
| 8348 |
\def\localetimechoice#1#2#3#4{#3} |
| 8349 |
\fi |
| 8350 |
% \end{macrocode} |
| 8351 |
%\end{macro} |
| 8352 |
% |
| 8353 |
%\begin{macro}{\localecurrchoice} |
| 8354 |
% \begin{macrocode} |
| 8355 |
\ifx\localecurrchoice\undefined |
| 8356 |
\def\localecurrchoice#1#2#3#4{#2} |
| 8357 |
\fi |
| 8358 |
% \end{macrocode} |
| 8359 |
%\end{macro} |
| 8360 |
% |
| 8361 |
%\begin{macro}{\CurrentLocaleDateTime} |
| 8362 |
%Shortcut for date and time. |
| 8363 |
% \begin{macrocode} |
| 8364 |
\def\CurrentLocaleDateTime{\CurrentLocaleDate\space\CurrentLocaleTime} |
| 8365 |
% \end{macrocode} |
| 8366 |
%\end{macro} |
| 8367 |
% |
| 8368 |
%Provide convenient shortcut commands for formatting numbers. |
| 8369 |
%These need a bit of help to split the argument on "." |
| 8370 |
%and on "E". First provide a general purpose command. |
| 8371 |
% |
| 8372 |
%\begin{macro}{\localenumfmt} |
| 8373 |
%The first argument is the pattern. The second argument is the |
| 8374 |
%value. |
| 8375 |
% \begin{macrocode} |
| 8376 |
\def\localenumfmt#1#2{% |
| 8377 |
\@locale@decfmt#2\empty.0E0\relax |
| 8378 |
\ifnum\@locale@decfmt@int<0 |
| 8379 |
\let\@localenum@fmt\localenumfmtneg |
| 8380 |
\else |
| 8381 |
\ifnum\@locale@decfmt@int=0 |
| 8382 |
\ifnum\@locale@decfmt@frac=0 |
| 8383 |
\ifnum\@locale@decfmt@exp=0 |
| 8384 |
\let\@localenum@fmt\localenumfmtzero |
| 8385 |
\else |
| 8386 |
\let\@localenum@fmt\localenumfmtpos |
| 8387 |
\fi |
| 8388 |
\else |
| 8389 |
\let\@localenum@fmt\localenumfmtpos |
| 8390 |
\fi |
| 8391 |
\else |
| 8392 |
\let\@localenum@fmt\localenumfmtpos |
| 8393 |
\fi |
| 8394 |
\fi |
| 8395 |
\@localenum@fmt |
| 8396 |
{% |
| 8397 |
\texosqueryfmtnumber{#1}% |
| 8398 |
{\@locale@decfmt@int}% |
| 8399 |
{\@locale@decfmt@frac}% |
| 8400 |
{\@locale@decfmt@exp}% |
| 8401 |
}% |
| 8402 |
} |
| 8403 |
% \end{macrocode} |
| 8404 |
%\end{macro} |
| 8405 |
% |
| 8406 |
%\begin{macro}{\localenumfmtpos} |
| 8407 |
%Wrapper for positive values. |
| 8408 |
% \begin{macrocode} |
| 8409 |
\def\localenumfmtpos#1{#1} |
| 8410 |
% \end{macrocode} |
| 8411 |
%\end{macro} |
| 8412 |
% |
| 8413 |
%\begin{macro}{\localenumfmtneg} |
| 8414 |
%Wrapper for negative values. |
| 8415 |
% \begin{macrocode} |
| 8416 |
\def\localenumfmtneg#1{#1} |
| 8417 |
% \end{macrocode} |
| 8418 |
%\end{macro} |
| 8419 |
% |
| 8420 |
%\begin{macro}{\localenumfmtzero} |
| 8421 |
%Wrapper for zero values. |
| 8422 |
% \begin{macrocode} |
| 8423 |
\def\localenumfmtzero#1{#1} |
| 8424 |
% \end{macrocode} |
| 8425 |
%\end{macro} |
| 8426 |
% |
| 8427 |
%\begin{macro}{\localeint} |
| 8428 |
% \begin{macrocode} |
| 8429 |
\def\localeint#1{% |
| 8430 |
\localenumfmt{\CurrentLocaleIntegerPattern}{#1}% |
| 8431 |
} |
| 8432 |
% \end{macrocode} |
| 8433 |
%\end{macro} |
| 8434 |
% |
| 8435 |
% |
| 8436 |
%\begin{macro}{\localedec} |
| 8437 |
% \begin{macrocode} |
| 8438 |
\def\localedec#1{% |
| 8439 |
\localenumfmt{\CurrentLocaleDecimalPattern}{#1}% |
| 8440 |
} |
| 8441 |
% \end{macrocode} |
| 8442 |
%\end{macro} |
| 8443 |
% |
| 8444 |
%\begin{macro}{\localecur} |
| 8445 |
% \begin{macrocode} |
| 8446 |
\def\localecur#1{% |
| 8447 |
\localenumfmt{\CurrentLocaleCurrencyPattern}{#1}% |
| 8448 |
} |
| 8449 |
% \end{macrocode} |
| 8450 |
%\end{macro} |
| 8451 |
% |
| 8452 |
%\begin{macro}{\localeper} |
| 8453 |
% \begin{macrocode} |
| 8454 |
\def\localeper#1{% |
| 8455 |
\localenumfmt{\CurrentLocalePercentPattern}{#1}% |
| 8456 |
} |
| 8457 |
% \end{macrocode} |
| 8458 |
%\end{macro} |
| 8459 |
% |
| 8460 |
%\begin{macro}{\@locale@decfmt} |
| 8461 |
% \begin{macrocode} |
| 8462 |
\def\@locale@decfmt#1.#2E#3\relax{% |
| 8463 |
% \end{macrocode} |
| 8464 |
%Allow for mantissa present but missing fractional part. |
| 8465 |
% \begin{macrocode} |
| 8466 |
\@locale@decfmt@split#1E\empty\relax |
| 8467 |
\ifx\@locale@decfmt@exp\empty |
| 8468 |
\edef\@locale@decfmt@frac{\@locale@gobbleemptytorelax#2\empty\relax}% |
| 8469 |
\edef\@locale@decfmt@exp{\@locale@gobbleemptytorelax#3\empty\relax}% |
| 8470 |
\else |
| 8471 |
\def\@locale@decfmt@frac{0}% |
| 8472 |
\fi |
| 8473 |
} |
| 8474 |
% \end{macrocode} |
| 8475 |
%\end{macro} |
| 8476 |
% |
| 8477 |
%\begin{macro}{\@locale@gobbleemptytorelax} |
| 8478 |
%Strip everything between \cs{empty} and \cs{relax} |
| 8479 |
% \begin{macrocode} |
| 8480 |
\def\@locale@gobbleemptytorelax#1\empty#2\relax{#1} |
| 8481 |
% \end{macrocode} |
| 8482 |
%\end{macro} |
| 8483 |
% |
| 8484 |
%\begin{macro}{\@locale@decfmt@split} |
| 8485 |
%Split on "E". (In case "E" but no "." supplied.) |
| 8486 |
% \begin{macrocode} |
| 8487 |
\def\@locale@decfmt@split#1E#2\empty#3\relax{% |
| 8488 |
\edef\@locale@decfmt@int{\@locale@gobbleemptytorelax#1\empty\relax}% |
| 8489 |
\edef\@locale@decfmt@exp{\@locale@gobbleemptytorelax#2\empty\relax}% |
| 8490 |
} |
| 8491 |
% \end{macrocode} |
| 8492 |
%\end{macro} |
| 8493 |
% |
| 8494 |
%Iterate through all languages and add to caption hook. |
| 8495 |
% \begin{macrocode} |
| 8496 |
\ForEachTrackedDialect{\locale@this@dialect}{% |
| 8497 |
\SetCurrentTrackedDialect{\locale@this@dialect}% |
| 8498 |
\expandafter\@TrackLangAddToHook\expandafter |
| 8499 |
{\expandafter\@locale@select\expandafter{\locale@this@dialect}} |
| 8500 |
{captions}% |
| 8501 |
} |
| 8502 |
% \end{macrocode} |
| 8503 |
% |
| 8504 |
%Provide a command to select a language using the \sty{tracklang} |
| 8505 |
%dialect label or the language tag. |
| 8506 |
%\begin{macro}{\selectlocale} |
| 8507 |
% \begin{macrocode} |
| 8508 |
\def\selectlocale#1{% |
| 8509 |
\ifx\selectlanguage\undefined |
| 8510 |
\IfTrackedDialect{#1}% |
| 8511 |
{\@locale@select{#1}}% |
| 8512 |
{% |
| 8513 |
\LocaleIfHasAttribute{#1}{tagtodialect} |
| 8514 |
{% |
| 8515 |
\edef\@locale@dialect{\LocaleGetAttribute{#1}{tagtodialect}}% |
| 8516 |
\expandafter\@locale@select\expandafter{\@locale@dialect}% |
| 8517 |
}% |
| 8518 |
{% |
| 8519 |
\ifTeXOSQueryDryRun |
| 8520 |
\@locale@warn{Unknown locale `#1'}% |
| 8521 |
\else |
| 8522 |
\@locale@err{Unknown locale `#1'}% |
| 8523 |
{The argument to \string\selectlocale\space must be either a |
| 8524 |
tracklang dialect label or a tracked dialect language tag}% |
| 8525 |
\fi |
| 8526 |
}% |
| 8527 |
}% |
| 8528 |
\else |
| 8529 |
% \end{macrocode} |
| 8530 |
% Need to find the correct label to use in \cs{selectlanguage} |
| 8531 |
% \begin{macrocode} |
| 8532 |
\IfTrackedDialect{#1}% |
| 8533 |
{% |
| 8534 |
\@locale@select@dialect{#1}% |
| 8535 |
}% |
| 8536 |
{% |
| 8537 |
\LocaleIfHasAttribute{#1}{tagtodialect} |
| 8538 |
{\@locale@select@dialect{\LocaleGetAttribute{#1}{tagtodialect}}}% |
| 8539 |
{% |
| 8540 |
\ifTeXOSQueryDryRun |
| 8541 |
\@locale@warn{Unknown locale `#1'}% |
| 8542 |
\else |
| 8543 |
\@locale@err{Unknown locale `#1'}% |
| 8544 |
{The argument to \string\selectlocale\space must be either a |
| 8545 |
tracklang dialect label or a tracked dialect language tag}% |
| 8546 |
\fi |
| 8547 |
}% |
| 8548 |
}% |
| 8549 |
\fi |
| 8550 |
} |
| 8551 |
% \end{macrocode} |
| 8552 |
%\end{macro} |
| 8553 |
% |
| 8554 |
%\begin{macro}{\@locale@select@dialect} |
| 8555 |
%Select language from \sty{tracklang} dialect label. |
| 8556 |
% \begin{macrocode} |
| 8557 |
\def\@locale@select@dialect#1{% |
| 8558 |
\IfTrackedDialectHasMapping{#1}% |
| 8559 |
{\edef\@locale@dialect{\GetTrackedDialectToMapping{#1}}}% |
| 8560 |
{\edef\@locale@dialect{#1}}% |
| 8561 |
% \end{macrocode} |
| 8562 |
% Is there a date hook available? (Match the check used by |
| 8563 |
% \cs{selectlanguage}.) |
| 8564 |
% \begin{macrocode} |
| 8565 |
\@tracklang@ifundef{date\@locale@dialect}% |
| 8566 |
{% |
| 8567 |
% \end{macrocode} |
| 8568 |
% Try the root language. |
| 8569 |
% \begin{macrocode} |
| 8570 |
\edef\@locale@dialect{\TrackedLanguageFromDialect{#1}}% |
| 8571 |
% \end{macrocode} |
| 8572 |
% Is there a date hook available? |
| 8573 |
% \begin{macrocode} |
| 8574 |
\@tracklang@ifundef{date\@locale@dialect}% |
| 8575 |
{% |
| 8576 |
\@locale@warn{Can't determine correct label for |
| 8577 |
\string\selectlanguage\space from tracklang dialect `#1'}% |
| 8578 |
\SetCurrentTrackedDialect{#1}% |
| 8579 |
}% |
| 8580 |
{\expandafter\selectlanguage\expandafter{\@locale@dialect}}% |
| 8581 |
}% |
| 8582 |
{\expandafter\selectlanguage\expandafter{\@locale@dialect}}% |
| 8583 |
} |
| 8584 |
% \end{macrocode} |
| 8585 |
%\end{macro} |
| 8586 |
% |
| 8587 |
%Select the main locale (but don't try any language change |
| 8588 |
%as this might upset \sty{polyglossia} if the fonts haven't been set |
| 8589 |
%yet), so use the internal |
| 8590 |
%\cs{@locale@select}. |
| 8591 |
% \begin{macrocode} |
| 8592 |
\ifx\LocaleMainDialect\empty |
| 8593 |
\else |
| 8594 |
\expandafter\@locale@select\expandafter{\LocaleMainDialect} |
| 8595 |
\fi |
| 8596 |
% \end{macrocode} |
| 8597 |
% |
| 8598 |
%Restore category code for \texttt{@} if necessary. |
| 8599 |
% \begin{macrocode} |
| 8600 |
\@locale@restore@at |
| 8601 |
% \end{macrocode} |
| 8602 |
|
| 8603 |
%\iffalse |
| 8604 |
% \begin{macrocode} |
| 8605 |
%</tex-locale.tex> |
| 8606 |
% \end{macrocode} |
| 8607 |
%\fi |
| 8608 |
%\iffalse |
| 8609 |
% \begin{macrocode} |
| 8610 |
%<*tex-locale-scripts-enc.def> |
| 8611 |
% \end{macrocode} |
| 8612 |
%\fi |
| 8613 |
%\section{Scripts to \styfmt{fontenc} mappings |
| 8614 |
%(\texttt{tex-locale-scripts-enc.def})} |
| 8615 |
%\label{sec:locale-scripts-enc.def} |
| 8616 |
%Provides mappings from scripts to font encodings. Not all |
| 8617 |
%supported. This file is only loaded if the \pkgopt[auto]{fontenc} |
| 8618 |
%option is used. The \texttt{@} character is assumed to have |
| 8619 |
%category code when this file is input. |
| 8620 |
%\begin{macro}{\@locale@scriptenc@map} |
| 8621 |
%Maps ISO 15924 script label to \LaTeX\ font encoding name. |
| 8622 |
% \begin{macrocode} |
| 8623 |
\def\@locale@scriptenc@map#1#2{% |
| 8624 |
\@tracklang@namedef{@locale@scriptenc@map@#1}{#2}% |
| 8625 |
} |
| 8626 |
% \end{macrocode} |
| 8627 |
%\end{macro} |
| 8628 |
%\begin{macro}{\@locale@get@scriptenc@map} |
| 8629 |
%Get the mapping. |
| 8630 |
% \begin{macrocode} |
| 8631 |
\def\@locale@get@scriptenc@map#1{% |
| 8632 |
\@tracklang@ifundef{@locale@scriptenc@map@#1}% |
| 8633 |
{}% |
| 8634 |
{\csname @locale@scriptenc@map@#1\endcsname}% |
| 8635 |
} |
| 8636 |
% \end{macrocode} |
| 8637 |
%\end{macro} |
| 8638 |
%\begin{macro}{\@locale@if@scriptenc@map} |
| 8639 |
%Test if there's a script mapping. |
| 8640 |
% \begin{macrocode} |
| 8641 |
\def\@locale@if@scriptenc@map#1#2#3{% |
| 8642 |
\@tracklang@ifundef{@locale@scriptenc@map@#1}% |
| 8643 |
{#3}% false |
| 8644 |
{#2}% true |
| 8645 |
} |
| 8646 |
% \end{macrocode} |
| 8647 |
%\end{macro} |
| 8648 |
% |
| 8649 |
%\begin{macro}{\@locale@langenc@map} |
| 8650 |
%Maps tracklang language or dialect labels to \LaTeX\ font encoding name. |
| 8651 |
% \begin{macrocode} |
| 8652 |
\def\@locale@langenc@map#1#2{% |
| 8653 |
\@tracklang@namedef{@locale@langenc@map@#1}{#2}% |
| 8654 |
} |
| 8655 |
% \end{macrocode} |
| 8656 |
%\end{macro} |
| 8657 |
% |
| 8658 |
%\begin{macro}{\@locale@if@langenc@map} |
| 8659 |
%Test if there's a lang mapping. |
| 8660 |
% \begin{macrocode} |
| 8661 |
\def\@locale@if@langenc@map#1#2#3{% |
| 8662 |
\@tracklang@ifundef{@locale@langenc@map@#1}% |
| 8663 |
{#3}% false |
| 8664 |
{#2}% true |
| 8665 |
} |
| 8666 |
% \end{macrocode} |
| 8667 |
%\end{macro} |
| 8668 |
% |
| 8669 |
%\begin{macro}{\@locale@get@langenc@map} |
| 8670 |
%Get the mapping. |
| 8671 |
% \begin{macrocode} |
| 8672 |
\def\@locale@get@langenc@map#1{% |
| 8673 |
\@tracklang@ifundef{@locale@langenc@map@#1}% |
| 8674 |
{}% |
| 8675 |
{\csname @locale@langenc@map@#1\endcsname}% |
| 8676 |
} |
| 8677 |
% \end{macrocode} |
| 8678 |
%\end{macro} |
| 8679 |
% |
| 8680 |
%Define mappings. Only a few currently supported. It's better to use |
| 8681 |
%\sty{fontspec} instead of \sty{fontenc} for non-Latin scripts. |
| 8682 |
% |
| 8683 |
% Scripts first. |
| 8684 |
% \begin{macrocode} |
| 8685 |
\@locale@scriptenc@map{Latn}{T1} |
| 8686 |
\@locale@scriptenc@map{Latf}{T1} |
| 8687 |
\@locale@scriptenc@map{Latg}{T1} |
| 8688 |
\@locale@scriptenc@map{Cyrl}{T2A,T2B,T2C} |
| 8689 |
% \end{macrocode} |
| 8690 |
%Now languages or dialect labels: |
| 8691 |
% \begin{macrocode} |
| 8692 |
\@locale@langenc@map{vietnamese}{T5} |
| 8693 |
\@locale@langenc@map{polish}{OT4} |
| 8694 |
\@locale@langenc@map{armenian}{OT6} |
| 8695 |
\@locale@langenc@map{greek}{LGR} |
| 8696 |
% \end{macrocode} |
| 8697 |
%\iffalse |
| 8698 |
% \begin{macrocode} |
| 8699 |
%</tex-locale-scripts-enc.def> |
| 8700 |
% \end{macrocode} |
| 8701 |
%\fi |
| 8702 |
%\iffalse |
| 8703 |
% \begin{macrocode} |
| 8704 |
%<*tex-locale-encodings.def> |
| 8705 |
% \end{macrocode} |
| 8706 |
%\fi |
| 8707 |
%\section{texosquery to \styfmt{inputenc} mappings |
| 8708 |
%(\texttt{tex-locale-encodings.def})} |
| 8709 |
%Encoding mappings. |
| 8710 |
%\begin{macro}{\@locale@newencmap} |
| 8711 |
% \begin{macrocode} |
| 8712 |
\def\@locale@newencmap#1#2{% |
| 8713 |
\@tracklang@namedef{@locale@encmap@#1}{#2}} |
| 8714 |
% \end{macrocode} |
| 8715 |
%\end{macro} |
| 8716 |
%\begin{macro}{\@locale@ifhasencmap} |
| 8717 |
% \begin{macrocode} |
| 8718 |
\def\@locale@ifhasencmap#1#2#3{% |
| 8719 |
\@tracklang@ifundef{@locale@encmap@#1}{#3}{#2}} |
| 8720 |
% \end{macrocode} |
| 8721 |
%\end{macro} |
| 8722 |
%\begin{macro}{\@locale@getencmap} |
| 8723 |
% \begin{macrocode} |
| 8724 |
\def\@locale@getencmap#1{% |
| 8725 |
\@tracklang@nameuse{@locale@encmap@#1}} |
| 8726 |
% \end{macrocode} |
| 8727 |
%\end{macro} |
| 8728 |
% \begin{macrocode} |
| 8729 |
\@locale@newencmap{iso88591}{latin1} |
| 8730 |
\@locale@newencmap{iso88592}{latin2} |
| 8731 |
\@locale@newencmap{iso88593}{latin3} |
| 8732 |
\@locale@newencmap{iso88594}{latin4} |
| 8733 |
\@locale@newencmap{iso88595}{latin5} |
| 8734 |
\@locale@newencmap{iso88599}{latin9} |
| 8735 |
\@locale@newencmap{windows1250}{cp1250} |
| 8736 |
\@locale@newencmap{windows1252}{cp1252} |
| 8737 |
\@locale@newencmap{windows1257}{cp1257} |
| 8738 |
\@locale@newencmap{ibm850}{cp850} |
| 8739 |
\@locale@newencmap{ibm852}{cp852} |
| 8740 |
\@locale@newencmap{ibm437}{cp437} |
| 8741 |
\@locale@newencmap{ibm865}{cp865} |
| 8742 |
\@locale@newencmap{usascii}{ascii} |
| 8743 |
\@locale@newencmap{xmaccentraleurope}{macce} |
| 8744 |
% \end{macrocode} |
| 8745 |
%\iffalse |
| 8746 |
% \begin{macrocode} |
| 8747 |
%</tex-locale-encodings.def> |
| 8748 |
% \end{macrocode} |
| 8749 |
%\fi |
| 8750 |
%\iffalse |
| 8751 |
% \begin{macrocode} |
| 8752 |
%<*tex-locale-support.def> |
| 8753 |
% \end{macrocode} |
| 8754 |
%\fi |
| 8755 |
%\section{Language Support Setup} |
| 8756 |
%The language support setup performed in \cs{@locale@postparse@hook}. |
| 8757 |
%Load \sty{babel} or \sty{polyglossia}. |
| 8758 |
% \begin{macrocode} |
| 8759 |
\@locale@ifsupportbabelorpoly |
| 8760 |
{} |
| 8761 |
{% |
| 8762 |
% \end{macrocode} |
| 8763 |
%(\sty{babel} support.) |
| 8764 |
%Set up some extra mappings that aren't in \sty{tracklang} version |
| 8765 |
%1.3. There's no intuitive way of testing if a dialect label is |
| 8766 |
%provided by \sty{babel}. There's only a test for the root language |
| 8767 |
%by checking for the existence of the ldf file, so these are known |
| 8768 |
%\sty{babel} options. This means that if there isn't a mapping, the |
| 8769 |
%root language will be used instead. |
| 8770 |
% \begin{macrocode} |
| 8771 |
\def\@locale@providemap#1#2{% |
| 8772 |
\IfTrackedDialectHasMapping{#1}% |
| 8773 |
{}% |
| 8774 |
{\SetTrackedDialectLabelMap{#1}{#2}}% |
| 8775 |
}% |
| 8776 |
\@locale@providemap{bahasa}{bahasa}% |
| 8777 |
\@locale@providemap{indonesian}{indonesian}% |
| 8778 |
\@locale@providemap{indon}{indon}% |
| 8779 |
\@locale@providemap{bahasam}{bahasam}% |
| 8780 |
\@locale@providemap{malay}{malay}% |
| 8781 |
\@locale@providemap{melayu}{melayu}% |
| 8782 |
\@locale@providemap{USenglish}{USenglish}% |
| 8783 |
\@locale@providemap{american}{american}% |
| 8784 |
\@locale@providemap{UKenglish}{UKenglish}% |
| 8785 |
\@locale@providemap{british}{british}% |
| 8786 |
\@locale@providemap{canadian}{canadian}% |
| 8787 |
\@locale@providemap{australian}{australian}% |
| 8788 |
\@locale@providemap{newzealand}{newzealand}% |
| 8789 |
\@locale@providemap{francais}{francais}% |
| 8790 |
\@locale@providemap{canadien}{canadien}% |
| 8791 |
\@locale@providemap{acadian}{acadian}% |
| 8792 |
\@locale@providemap{austrian}{austrian}% |
| 8793 |
\@locale@providemap{germanb}{germanb}% |
| 8794 |
\@locale@providemap{ngerman}{ngerman}% |
| 8795 |
\@locale@providemap{naustrian}{naustrian}% |
| 8796 |
\@locale@providemap{nswissgerman}{nswissgerman}% |
| 8797 |
\@locale@providemap{swissgerman}{swissgerman}% |
| 8798 |
\@locale@providemap{polutonikogreek}{greek}% |
| 8799 |
\@locale@providemap{nynorsk}{nynorsk}% |
| 8800 |
\@locale@providemap{portuguese}{portuguese}% |
| 8801 |
\@locale@providemap{brazilian}{brazilian}% |
| 8802 |
\@locale@providemap{brazil}{brazil}% |
| 8803 |
% \end{macrocode} |
| 8804 |
%Work out how to pass the options since we may need to convert a |
| 8805 |
%\sty{tracklang} dialect label to a recognised \sty{babel} label. |
| 8806 |
% \begin{macrocode} |
| 8807 |
\def\@locale@bbl@options{}% |
| 8808 |
\ForEachTrackedDialect{\this@dialect}% |
| 8809 |
{% |
| 8810 |
\edef\this@root@lang{% |
| 8811 |
\TrackedLanguageFromDialect{\this@dialect}}% |
| 8812 |
% \end{macrocode} |
| 8813 |
%Is there a language file? |
| 8814 |
% \begin{macrocode} |
| 8815 |
\IfFileExists{\this@[email protected]} |
| 8816 |
{% |
| 8817 |
% \end{macrocode} |
| 8818 |
%Check for Serbian, since we need to know the script. |
| 8819 |
% \begin{macrocode} |
| 8820 |
\ifdefstring{\this@root@lang}{serbian}% |
| 8821 |
{% |
| 8822 |
\@locale@loadscripts |
| 8823 |
\IfTrackedDialectIsScriptCs{\this@dialect}% |
| 8824 |
{\TrackLangScriptLatn}% |
| 8825 |
{\def\locale@bbl@dialect{serbian}}% |
| 8826 |
{\def\locale@bbl@dialect{serbianc}}% |
| 8827 |
}% |
| 8828 |
{% |
| 8829 |
\IfFileExists{\[email protected]}% |
| 8830 |
{% |
| 8831 |
\let\locale@bbl@dialect\this@dialect |
| 8832 |
}% |
| 8833 |
{% |
| 8834 |
% \end{macrocode} |
| 8835 |
%Do we have a mapping for this dialect label? |
| 8836 |
% \begin{macrocode} |
| 8837 |
\IfTrackedDialectHasMapping{\this@dialect}% |
| 8838 |
{% |
| 8839 |
\edef\locale@bbl@dialect{% |
| 8840 |
\GetTrackedDialectToMapping{\this@dialect}}% |
| 8841 |
}% |
| 8842 |
{% |
| 8843 |
\let\locale@bbl@dialect\this@root@lang |
| 8844 |
}% |
| 8845 |
}% |
| 8846 |
}% |
| 8847 |
\SetTrackedDialectLabelMap{\this@dialect}{\locale@bbl@dialect}% |
| 8848 |
\ifx\this@dialect\LocaleMainDialect |
| 8849 |
\ifx\@locale@bbl@options\empty |
| 8850 |
\edef\@locale@bbl@options{main=\locale@bbl@dialect}% |
| 8851 |
\else |
| 8852 |
\edef\@locale@bbl@options{\@locale@bbl@options,% |
| 8853 |
main=\locale@bbl@dialect}% |
| 8854 |
\fi |
| 8855 |
\else |
| 8856 |
\ifx\@locale@bbl@options\empty |
| 8857 |
\edef\@locale@bbl@options{\locale@bbl@dialect}% |
| 8858 |
\else |
| 8859 |
\edef\@locale@bbl@options{\@locale@bbl@options,% |
| 8860 |
\locale@bbl@dialect}% |
| 8861 |
\fi |
| 8862 |
\fi |
| 8863 |
}% |
| 8864 |
{}% |
| 8865 |
}% |
| 8866 |
\ifx\@locale@bbl@options\@empty |
| 8867 |
\ifTeXOSQueryDryRun |
| 8868 |
\@locale@err{Can't determine `babel' package |
| 8869 |
options\MessageBreak (texosquery's dry run mode is on)}{} |
| 8870 |
\else |
| 8871 |
\@locale@err{Can't determine `babel' package |
| 8872 |
options (perhaps the shell escape failed, check |
| 8873 |
`\jobname.log')}{} |
| 8874 |
\fi |
| 8875 |
\else |
| 8876 |
\expandafter\PassOptionsToPackage\expandafter |
| 8877 |
{\@locale@bbl@options}{babel} |
| 8878 |
\RequirePackage{babel}% |
| 8879 |
\fi |
| 8880 |
}% |
| 8881 |
{% |
| 8882 |
% \end{macrocode} |
| 8883 |
% (\sty{polyglossia} support). |
| 8884 |
% \begin{macrocode} |
| 8885 |
% \end{macrocode} |
| 8886 |
% Need a way of mapping scripts, regions and variants to known |
| 8887 |
% \sty{polyglossia} keys. A lot of these variants aren't official |
| 8888 |
% BCP 47 tags. |
| 8889 |
% \begin{macrocode} |
| 8890 |
\def\@set@locale@poly@map@script#1#2#3{% |
| 8891 |
\@tracklang@namedef{@local@poly@map@script@#1@#2}{#3}% |
| 8892 |
} |
| 8893 |
\def\@if@locale@poly@map@script#1#2#3#4{% |
| 8894 |
\@tracklang@ifundef{@local@poly@map@script@#1@#2}{#4}{#3}% |
| 8895 |
} |
| 8896 |
\def\@get@locale@poly@map@script#1#2{% |
| 8897 |
\@tracklang@nameuse{@local@poly@map@script@#1@#2}% |
| 8898 |
} |
| 8899 |
\def\@set@locale@poly@map@region#1#2#3{% |
| 8900 |
\@tracklang@namedef{@local@poly@map@region@#1@#2}{#3}% |
| 8901 |
} |
| 8902 |
\def\@if@locale@poly@map@region#1#2#3#4{% |
| 8903 |
\@tracklang@ifundef{@local@poly@map@region@#1@#2}{#4}{#3}% |
| 8904 |
} |
| 8905 |
\def\@get@locale@poly@map@region#1#2{% |
| 8906 |
\@tracklang@nameuse{@local@poly@map@region@#1@#2}% |
| 8907 |
} |
| 8908 |
\def\@set@locale@poly@map@variant#1#2#3{% |
| 8909 |
\@tracklang@namedef{@local@poly@map@variant@#1@#2}{#3}% |
| 8910 |
} |
| 8911 |
\def\@if@locale@poly@map@variant#1#2#3#4{% |
| 8912 |
\@tracklang@ifundef{@local@poly@map@variant@#1@#2}{#4}{#3}% |
| 8913 |
} |
| 8914 |
\def\@get@locale@poly@map@variant#1#2{% |
| 8915 |
\@tracklang@nameuse{@local@poly@map@variant@#1@#2}% |
| 8916 |
} |
| 8917 |
\def\@set@locale@poly@map@sublang#1#2#3{% |
| 8918 |
\@tracklang@namedef{@local@poly@map@sublang@#1@#2}{#3}% |
| 8919 |
} |
| 8920 |
\def\@if@locale@poly@map@sublang#1#2#3#4{% |
| 8921 |
\@tracklang@ifundef{@local@poly@map@sublang@#1@#2}{#4}{#3}% |
| 8922 |
} |
| 8923 |
\def\@get@locale@poly@map@sublang#1#2{% |
| 8924 |
\@tracklang@nameuse{@local@poly@map@sublang@#1@#2}% |
| 8925 |
} |
| 8926 |
\@set@locale@poly@map@region{arabic}{IQ}{locale=mashriq} |
| 8927 |
\@set@locale@poly@map@region{arabic}{SY}{locale=mashriq} |
| 8928 |
\@set@locale@poly@map@region{arabic}{JO}{locale=mashriq} |
| 8929 |
\@set@locale@poly@map@region{arabic}{LB}{locale=mashriq} |
| 8930 |
\@set@locale@poly@map@region{arabic}{PS}{locale=mashriq} |
| 8931 |
\@set@locale@poly@map@region{arabic}{LY}{locale=libya} |
| 8932 |
\@set@locale@poly@map@region{arabic}{DZ}{locale=algeria} |
| 8933 |
\@set@locale@poly@map@region{arabic}{TN}{locale=tunisia} |
| 8934 |
\@set@locale@poly@map@region{arabic}{MA}{locale=morocco} |
| 8935 |
\@set@locale@poly@map@region{arabic}{MR}{locale=mauritania} |
| 8936 |
\@set@locale@poly@map@variant{arabic}{islamic}{calendar=islamic} |
| 8937 |
\@set@locale@poly@map@variant{arabic}{maghrib}{numerals=maghrib} |
| 8938 |
\@set@locale@poly@map@variant{arabic}{abjad}{abjadjimnotail} |
| 8939 |
\@set@locale@poly@map@variant{bengali}{western}{numerals=Western} |
| 8940 |
\@set@locale@poly@map@variant{bengali}{devanagari}{numerals=Devanagari} |
| 8941 |
\@set@locale@poly@map@variant{bengali}{bengali}{numerals=Bengali} |
| 8942 |
\@set@locale@poly@map@region{english}{US}{variant=us} |
| 8943 |
\@set@locale@poly@map@region{english}{GB}{variant=uk} |
| 8944 |
\@set@locale@poly@map@region{english}{AU}{variant=australian} |
| 8945 |
\@set@locale@poly@map@region{english}{NZ}{variant=newzealand} |
| 8946 |
\@set@locale@poly@map@variant{farsi}{western}{numerals=western} |
| 8947 |
\@set@locale@poly@map@variant{farsi}{eastern}{numerals=eastern} |
| 8948 |
\@set@locale@poly@map@region{german}{DE}{variant=german} |
| 8949 |
\@set@locale@poly@map@region{german}{AU}{variant=austrian} |
| 8950 |
\@set@locale@poly@map@region{german}{CH}{variant=swiss} |
| 8951 |
\@set@locale@poly@map@variant{german}{1996}{spelling=new} |
| 8952 |
\@set@locale@poly@map@variant{german}{1901}{spelling=old} |
| 8953 |
\@set@locale@poly@map@script{german}{Latf}{script=fraktur} |
| 8954 |
\@set@locale@poly@map@variant{greek}{monoton}{variant=monotonic} |
| 8955 |
\@set@locale@poly@map@variant{greek}{polyton}{variant=polytonic} |
| 8956 |
\@set@locale@poly@map@variant{greek}{ancient}{variant=ancient} |
| 8957 |
\@set@locale@poly@map@variant{greek}{arabic}{numerals=arabic} |
| 8958 |
\@set@locale@poly@map@variant{hebrew}{arabic}{numerals=arabic} |
| 8959 |
\@set@locale@poly@map@variant{hebrew}{gregorian}{calendar=gregorian} |
| 8960 |
\@set@locale@poly@map@variant{hindi}{western}{numerals=Western} |
| 8961 |
\@set@locale@poly@map@variant{hindi}{devanagari}{numerals=Devanagari} |
| 8962 |
\@set@locale@poly@map@variant{latin}{classic}{variant=classic} |
| 8963 |
\@set@locale@poly@map@variant{latin}{modern}{variant=modern} |
| 8964 |
\@set@locale@poly@map@variant{latin}{medieval}{variant=medieval} |
| 8965 |
\@set@locale@poly@map@sublang{russian}{orv}{spelling=old} |
| 8966 |
\@set@locale@poly@map@variant{russian}{luna1918}{spelling=new} |
| 8967 |
\@set@locale@poly@map@script{serbian}{Latn}{script=Latin} |
| 8968 |
\@set@locale@poly@map@script{serbian}{Cyrl}{script=Cyrillic} |
| 8969 |
\@set@locale@poly@map@variant{syriac}{western}{numerals=western} |
| 8970 |
\@set@locale@poly@map@variant{syriac}{eastern}{numerals=eastern} |
| 8971 |
% \end{macrocode} |
| 8972 |
% Load polyglossia. |
| 8973 |
% \begin{macrocode} |
| 8974 |
\RequirePackage{polyglossia} |
| 8975 |
\ForEachTrackedDialect{\this@dialect}% |
| 8976 |
{% |
| 8977 |
\edef\this@root@lang{% |
| 8978 |
\TrackedLanguageFromDialect{\this@dialect}}% |
| 8979 |
\edef\this@sublang{% |
| 8980 |
\GetTrackedDialectSubLang{\this@dialect}}% |
| 8981 |
\edef\this@region{% |
| 8982 |
\TrackedIsoCodeFromLanguage{3166-1}{\this@dialect}}% |
| 8983 |
\edef\this@script{% |
| 8984 |
\GetTrackedDialectScript{\this@dialect}}% |
| 8985 |
\edef\this@variant{% |
| 8986 |
\GetTrackedDialectVariant{\this@dialect}}% |
| 8987 |
% \end{macrocode} |
| 8988 |
% Try to determine the options. Check the script mappings. |
| 8989 |
% \begin{macrocode} |
| 8990 |
\def\@locale@poly@options{}% |
| 8991 |
\ifx\this@script\empty |
| 8992 |
\else |
| 8993 |
\@if@locale@poly@map@script{\this@root@lang}{\this@script}% |
| 8994 |
{% |
| 8995 |
\edef\@locale@poly@options{% |
| 8996 |
\@get@locale@poly@map@script |
| 8997 |
{\this@root@lang}{\this@script}}% |
| 8998 |
}% |
| 8999 |
{}% |
| 9000 |
\fi |
| 9001 |
% \end{macrocode} |
| 9002 |
% Check the region mappings. |
| 9003 |
% \begin{macrocode} |
| 9004 |
\ifx\this@region\empty |
| 9005 |
\else |
| 9006 |
\@if@locale@poly@map@region{\this@root@lang}{\this@region}% |
| 9007 |
{% |
| 9008 |
\ifx\@locale@poly@options\empty |
| 9009 |
\edef\@locale@poly@options{% |
| 9010 |
\@get@locale@poly@map@region{\this@root@lang}{\this@region}}% |
| 9011 |
\else |
| 9012 |
\edef\@locale@poly@options{\@locale@poly@options,% |
| 9013 |
\@get@locale@poly@map@region{\this@root@lang}{\this@region}}% |
| 9014 |
\fi |
| 9015 |
}% |
| 9016 |
{}% |
| 9017 |
\fi |
| 9018 |
% \end{macrocode} |
| 9019 |
% Check the sub-language mappings. |
| 9020 |
% \begin{macrocode} |
| 9021 |
\ifx\this@sublang\empty |
| 9022 |
\else |
| 9023 |
\@if@locale@poly@map@sublang{\this@root@lang}{\this@sublang}% |
| 9024 |
{% |
| 9025 |
\ifx\@locale@poly@options\empty |
| 9026 |
\edef\@locale@poly@options{% |
| 9027 |
\@get@locale@poly@map@sublang |
| 9028 |
{\this@root@lang}{\this@sublang}}% |
| 9029 |
\else |
| 9030 |
\edef\@locale@poly@options{\@locale@poly@options,% |
| 9031 |
\@get@locale@poly@map@sublang |
| 9032 |
{\this@root@lang}{\this@sublang}}% |
| 9033 |
\fi |
| 9034 |
}% |
| 9035 |
{}% |
| 9036 |
\fi |
| 9037 |
% \end{macrocode} |
| 9038 |
% Check the variant mappings. |
| 9039 |
% \begin{macrocode} |
| 9040 |
\ifx\this@subvariant\empty |
| 9041 |
\else |
| 9042 |
\@if@locale@poly@map@variant{\this@root@lang}{\this@variant}% |
| 9043 |
{% |
| 9044 |
\ifx\@locale@poly@options\empty |
| 9045 |
\edef\@locale@poly@options{% |
| 9046 |
\@get@locale@poly@map@variant |
| 9047 |
{\this@root@lang}{\this@variant}}% |
| 9048 |
\else |
| 9049 |
\edef\@locale@poly@options{\@locale@poly@options,% |
| 9050 |
\@get@locale@poly@map@variant |
| 9051 |
{\this@root@lang}{\this@variant}}% |
| 9052 |
\fi |
| 9053 |
}% |
| 9054 |
{}% |
| 9055 |
\fi |
| 9056 |
% \end{macrocode} |
| 9057 |
% Set the language using either \cs{setmainlanguage} or |
| 9058 |
% \cs{setotherlanguage}. |
| 9059 |
% \begin{macrocode} |
| 9060 |
\ifx\this@dialect\LocaleMainDialect |
| 9061 |
\edef\@locale@tmp{\noexpand\setmainlanguage |
| 9062 |
[\@locale@poly@options]{\this@root@lang}}% |
| 9063 |
\else |
| 9064 |
\edef\@locale@tmp{\noexpand\setotherlanguage |
| 9065 |
[\@locale@poly@options]{\this@root@lang}}% |
| 9066 |
\fi |
| 9067 |
\@locale@tmp |
| 9068 |
}% |
| 9069 |
% \end{macrocode} |
| 9070 |
%Redefine command to temporarily switch off punctuation |
| 9071 |
%adjustments. For example, when formatting the date or time. |
| 9072 |
% \begin{macrocode} |
| 9073 |
\def\localenopolypunct{\@locale@nopolypunct}% |
| 9074 |
} |
| 9075 |
% \end{macrocode} |
| 9076 |
%\iffalse |
| 9077 |
% \begin{macrocode} |
| 9078 |
%</tex-locale-support.def> |
| 9079 |
% \end{macrocode} |
| 9080 |
%\fi |
| 9081 |
%\Finale |
| 9082 |
\endinput |