From bec19ad7aea6f3d69d967f735ebc501d4097155d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 21 Feb 2018 23:32:28 +0000 Subject: tracklang (21feb18) git-svn-id: svn://tug.org/texlive/trunk@46703 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/tracklang/tracklang.dtx | 101 +++++++++++++++------ .../source/latex/tracklang/tracklang.ins | 6 +- 2 files changed, 78 insertions(+), 29 deletions(-) (limited to 'Master/texmf-dist/source/latex') diff --git a/Master/texmf-dist/source/latex/tracklang/tracklang.dtx b/Master/texmf-dist/source/latex/tracklang/tracklang.dtx index 11945726532..b63bb9e3dec 100644 --- a/Master/texmf-dist/source/latex/tracklang/tracklang.dtx +++ b/Master/texmf-dist/source/latex/tracklang/tracklang.dtx @@ -1,5 +1,5 @@ %\iffalse -% tracklang.dtx generated using makedtx version 1.1 (c) Nicola Talbot +% tracklang.dtx generated using makedtx version 1.2 (c) Nicola Talbot % Command line args: % -section "chapter" % -doc "tracklang-manual.tex" @@ -10,7 +10,7 @@ % -src "tracklang-scripts.sty\Z=>tracklang-scripts.sty" % -src "tracklang-scripts.tex\Z=>tracklang-scripts.tex" % tracklang -% Created on 2017/3/25 20:20 +% Created on 2018/2/21 13:08 %\fi %\iffalse %<*package> @@ -33,7 +33,7 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2017 Nicola Talbot, all rights reserved. +% Copyright (C) 2018 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> @@ -59,7 +59,7 @@ pdfauthor={Nicola L.C. Talbot}, pdftitle={tracklang: tracking language options}]{hyperref} -\CheckSum{3897} +\CheckSum{3914} \appto\MacroFont{\scriptsize} \renewcommand*{\usage}[1]{\textit{\hyperpage{#1}}} @@ -278,11 +278,11 @@ and~\ref{tab:nonisoopts}} % %\MakeShortVerb{"} % -%\title{tracklang v1.3.4: +%\title{tracklang v1.3.5: %tracking language options} %\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}} % -%\date{2017-03-25} +%\date{2018-02-21} %\maketitle % %\begin{abstract} @@ -300,15 +300,19 @@ and~\ref{tab:nonisoopts}} %or \envvar{LANG} environment variable (see %\sectionref{sec:langsty}). Windows users, who don't have the locale %stored in environment variables, can use \app{texosquery} -%in combination with \styfmt{tracklang}. +%in combination with \styfmt{tracklang}. (Similarly if \envvar{LC\_ALL} +%or \envvar{LANG} don't contain sufficient information.) In order to +%use \app{texosquery} through the restricted shell escape, you must +%have at least Java~8 and set up \texttt{texosquery.cfg} +%appropriately. (See the \app{texosquery} manual for further details.) %\end{abstract} % %The fundamental aim of this generic package is to be able to %effectively say: %\begin{quote} %The user (that is, the \emph{document} author) wants to use -%dialects \texttt{xx-XX}, \texttt{yy-YY-Scrp}, etc in this -%document. Any packages used by this document that provide +%dialects \texttt{xx-XX}, \texttt{yy-YY-Scrp}, etc in their +%document. Any packages used by their document that provide %multilingual or region-dependent support should do whatever is %required to activate the settings for those languages and regions %(or warn the user that there's no support). @@ -319,6 +323,10 @@ and~\ref{tab:nonisoopts}} %for packages to detect the required language and region. The aim of %\styfmt{tracklang} is to provide that method. % +%Related article: \qt{Localisation of \TeX\ documents: +%\styfmt{tracklang}.} TUGBoat, Volume~37 (2016), No.~3 +%(\url{http://www.tug.org/TUGboat/tb37-3/tb117talbot.pdf}). +% %\clearpage %\tableofcontents %\clearpage\phantomsection @@ -366,9 +374,13 @@ and~\ref{tab:nonisoopts}} %\qt{british}, which can result in some redundancy. % %Unfortunately I can't work out how to pick up the language variant -%or script -%from \sty{polyglossia}, so only the root languages are detected, +%or script from \sty{polyglossia}, so only the root languages are detected, %which is suboptimal but at least provides some information. +%(\sty{polyglossia} now provides \cs{xpg@loaded}, which +%\sty{tracklang} uses to track the root languages, but the language variant +%command \cs{xpg@vloaded} only seems to be set when the language +%changes, which doesn't occur until the start of the \env{document} +%environment.) % %If the \sty{ngerman} package has been loaded, \styfmt{tracklang} %effectively does @@ -1373,16 +1385,29 @@ and~\ref{tab:nonisoopts}} %\begin{definition}[\DescribeMacro\ForEachTrackedDialect] %\cs{ForEachTrackedDialect}\marg{cs}\marg{code} %\end{definition} -%At the start of each iteration, this sets \meta{cs} to the -%tracked dialect and does \meta{code}. +%At the start of each iteration, this sets the control sequence +%\meta{cs} to the tracked dialect and does \meta{code}. % %You can iterate through each tracked language using: %\begin{definition}[\DescribeMacro\ForEachTrackedLanguage] %\cs{ForEachTrackedLanguage}\marg{cs}\marg{code} %\end{definition} -%At the start of each iteration, this sets \meta{cs} to the +%At the start of each iteration, this sets the control sequence \meta{cs} to the %tracked language and does \meta{code}. % +%The above for-loops use the same internal mechanism as \LaTeX's +%\cs{@for} loop. The provided control sequence \meta{cs} is updated at the +%start of each iteration to the current element. The loop is +%terminated when this control sequence is set to \cs{@nil}. This +%special control sequence should never been used as it's just a +%marker and isn't actually defined. If you get an error message +%stating that \cs{@nil} is undefined, then it's most likely due to a +%loop control sequence being used outside the loop. This can occur if +%the loop contains code that isn't expanded until later. For example, +%if the loop code includes \cs{AtBeginDocument}, you need to ensure +%that the loop control sequence is expanded before being added to the +%hook. +% %You can test if a root language has been detected using: %\begin{definition}[\DescribeMacro\IfTrackedLanguage] %\cs{IfTrackedLanguage}\marg{label}\marg{true part}\marg{false part} @@ -3189,7 +3214,7 @@ and~\ref{tab:nonisoopts}} % packages such as \styfmt{etoolbox}. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tracklang}[2017/03/25 v1.3.4 (NLCT) Track Languages] +\ProvidesPackage{tracklang}[2018/02/21 v1.3.5 (NLCT) Track Languages] % \end{macrocode} %\begin{macro}{\@tracklang@declareoption} % Set up package options. @@ -3276,12 +3301,36 @@ and~\ref{tab:nonisoopts}} % \styfmt{tracklang}.) Script names seem to be stored in % \cs{xpg:scripttag@\meta{language}} but again this doesn't seem to be set % for the main language until the start of the document. +% New versions of \sty{polyglossia} store the list of loaded +% languages in \cs{xpg@loaded}, so check if this is defined. %\changes{1.3}{2016-10-07}{removed hard-coded polyglossia language list} +%\changes{1.3.5}{2018-02-21}{check for \cs{xpg@loaded}} +% \begin{macrocode} + \@ifundefined{xpg@loaded}% + {% +% \end{macrocode} +%\cs{xpg@loaded} isn't defined, so iterate over known options and +%check if the language has been loaded. % \begin{macrocode} - \@for\this@language:=\@tracklang@declaredoptions\do{% - \@ifundefined{\this@language @loaded}% - {}% - {\@nameuse{@tracklang@add@\this@language}}% + \PackageInfo{tracklang}{polyglossia loaded but + \string\xpg@loaded\space not defined. Will attempt + to track known languages.}% + \@for\this@language:=\@tracklang@declaredoptions\do{% + \@ifundefined{\this@language @loaded}% + {}% + {\@nameuse{@tracklang@add@\this@language}}% + }% + }% + {% + \@for\this@language:=\xpg@loaded\do{% + \@ifundefined{@tracklang@add@\this@language}% + {% + \PackageWarning{tracklang}% + {Adding unknown polyglossia language `\this@language'}% + \AddTrackedLangage{\this@language}% + }% + {\@nameuse{@tracklang@add@\this@language}}% + }% }% }% {% @@ -3442,8 +3491,8 @@ and~\ref{tab:nonisoopts}} % \end{macrocode} % Version info. % \begin{macrocode} -\expandafter\def\csname ver@tracklang.tex\endcsname{2017/03/25 v1.3.4 -(NLCT) Track Languages Generic Code} +\expandafter\def\csname ver@tracklang.tex\endcsname{% + 2018/02/21 v1.3.5 (NLCT) Track Languages Generic Code} % \end{macrocode} % Define a long command for determining the existence of a control % sequence by its name. (\cs{relax} is considered undefined.) @@ -9906,8 +9955,8 @@ and~\ref{tab:nonisoopts}} % \end{macrocode} % Version info. % \begin{macrocode} -\expandafter\def\csname ver@tracklang-region-codes.tex\endcsname{2016/11/03 v1.3.3 -(NLCT) Track Languages Regions}% +\expandafter\def\csname ver@tracklang-region-codes.tex\endcsname{% + 2018/02/21 v1.3.5 (NLCT) Track Languages Regions}% % \end{macrocode} % %\begin{macro}{\TrackLangRegionMap} @@ -10296,7 +10345,7 @@ and~\ref{tab:nonisoopts}} %\changes{1.3}{2016-10-07}{added tracklang-scripts.sty} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tracklang-scripts}[2016/11/03 v1.3.3 (NLCT) Track +\ProvidesPackage{tracklang-scripts}[2018/02/21 v1.3.5 (NLCT) Track Language Scripts (LaTeX)] \RequirePackage{tracklang} \input{tracklang-scripts} @@ -10337,8 +10386,8 @@ Language Scripts (LaTeX)] % \end{macrocode} % Version info. % \begin{macrocode} -\expandafter\def\csname ver@tracklang-scripts.tex\endcsname{2016/11/03 v1.3.3 -(NLCT) Track Languages Scripts (Generic)}% +\expandafter\def\csname ver@tracklang-scripts.tex\endcsname{% + 2018/02/21 v1.3.5 (NLCT) Track Languages Scripts (Generic)}% % \end{macrocode} % %\begin{macro}{\TrackLangScriptsMap} diff --git a/Master/texmf-dist/source/latex/tracklang/tracklang.ins b/Master/texmf-dist/source/latex/tracklang/tracklang.ins index b69d7e269f9..e2937f28d02 100644 --- a/Master/texmf-dist/source/latex/tracklang/tracklang.ins +++ b/Master/texmf-dist/source/latex/tracklang/tracklang.ins @@ -1,14 +1,14 @@ -% tracklang.ins generated using makedtx version 1.1 2017/3/25 20:20 +% tracklang.ins generated using makedtx version 1.2 2018/2/21 13:08 \input docstrip \preamble tracklang.dtx - Copyright 2017 Nicola Talbot + Copyright 2018 Nicola Talbot This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 - of this license of (at your option) any later version. + of this license or (at your option) any later version. The latest version of this license is in http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all distributions of LaTeX -- cgit v1.2.3