From 55be422dc01e60cfae781a9a4a310a96c9e99256 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 13 May 2018 21:53:50 +0000 Subject: tracklang (13may18) git-svn-id: svn://tug.org/texlive/trunk@47704 c570f23f-e606-0410-a88d-b1316a301751 --- .../generic/tracklang/tracklang-region-codes.tex | 2 +- .../tex/generic/tracklang/tracklang-scripts.tex | 2 +- .../texmf-dist/tex/generic/tracklang/tracklang.tex | 71 ++++++++++++++-------- 3 files changed, 48 insertions(+), 27 deletions(-) (limited to 'Master/texmf-dist/tex/generic') diff --git a/Master/texmf-dist/tex/generic/tracklang/tracklang-region-codes.tex b/Master/texmf-dist/tex/generic/tracklang/tracklang-region-codes.tex index e48f468e588..135b3a00f10 100644 --- a/Master/texmf-dist/tex/generic/tracklang/tracklang-region-codes.tex +++ b/Master/texmf-dist/tex/generic/tracklang/tracklang-region-codes.tex @@ -64,7 +64,7 @@ \expandafter\endinput \fi \expandafter\def\csname ver@tracklang-region-codes.tex\endcsname{% - 2018/02/21 v1.3.5 (NLCT) Track Languages Regions}% + 2018/05/13 v1.3.6 (NLCT) Track Languages Regions}% \def\TrackLangRegionMap#1#2#3{% \@tracklang@enamedef{@tracklang@region@numtoalphaii@#1}{#2}% \@tracklang@enamedef{@tracklang@region@numtoalphaiii@#1}{#3}% diff --git a/Master/texmf-dist/tex/generic/tracklang/tracklang-scripts.tex b/Master/texmf-dist/tex/generic/tracklang/tracklang-scripts.tex index 47e4aa43caa..fcb8bcaba32 100644 --- a/Master/texmf-dist/tex/generic/tracklang/tracklang-scripts.tex +++ b/Master/texmf-dist/tex/generic/tracklang/tracklang-scripts.tex @@ -64,7 +64,7 @@ \expandafter\endinput \fi \expandafter\def\csname ver@tracklang-scripts.tex\endcsname{% - 2018/02/21 v1.3.5 (NLCT) Track Languages Scripts (Generic)}% + 2018/05/13 v1.3.6 (NLCT) Track Languages Scripts (Generic)}% \def\TrackLangScriptMap#1#2#3#4#5{% \@tracklang@enamedef{TrackLangScript#1}{#1}% \@tracklang@enamedef{@tracklang@script@numtoalpha@#2}{#1}% diff --git a/Master/texmf-dist/tex/generic/tracklang/tracklang.tex b/Master/texmf-dist/tex/generic/tracklang/tracklang.tex index 58ec8f19946..9abdf6aec50 100644 --- a/Master/texmf-dist/tex/generic/tracklang/tracklang.tex +++ b/Master/texmf-dist/tex/generic/tracklang/tracklang.tex @@ -64,7 +64,7 @@ \expandafter\endinput \fi \expandafter\def\csname ver@tracklang.tex\endcsname{% - 2018/02/21 v1.3.5 (NLCT) Track Languages Generic Code} + 2018/05/13 v1.3.6 (NLCT) Track Languages Generic Code} \long\def\@tracklang@ifundef#1#2#3{% \ifcsname#1\endcsname \expandafter\ifx\csname #1\endcsname\relax @@ -1334,6 +1334,7 @@ }% \def\GetTrackedDialectFromLanguageTag#1#2{% \def#2{}% + \def\TrackedDialectClosestSubMatch{}% \@tracklang@parselangtag{#1}% \edef\@tracklang@dialect{% \@TrackLangEnvLang @@ -1342,41 +1343,61 @@ \@TrackLangEnvTerritory \@TrackLangEnvModifier \@TrackLangEnvVariant}% - \IfTrackedDialect{\@tracklang@dialect}% - {% + \IfTrackedDialect{\@tracklang@dialect}% + {% \let#2\@tracklang@dialect - }% - {% + }% + {% \edef\@tracklang@lang{\TrackLangGetKnownLangFromIso\@TrackLangEnvLang}% \edef\@tracklang@defscript{\TrackLangGetDefaultScript\@tracklang@lang}% + \def\@tracklang@bestmatch{0}% \edef\@tracklang@dialects{\TrackedDialectsFromLanguage\@tracklang@lang}% \@tracklang@for\@tracklang@dialect:=\@tracklang@dialects\do{% + \def\@tracklang@currentmatch{0}% + \edef\@tracklang@tmp{% + \GetTrackedDialectScript{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvScript + \def\@tracklang@currentmatch{1}% + \else + \ifx\@TrackLangEnvScript\empty + \ifx\@tracklang@tmp\@tracklang@defscript + \def\@tracklang@currentmatch{1}% + \fi + \fi + \fi + \edef\@tracklang@tmp{% + \GetTrackedDialectSubLang{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvSubLang + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 1}% + \else + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 0}% + \fi + \edef\@tracklang@tmp{% + \GetTrackedDialectVariant{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvVariant + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 1}% + \else + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 0}% + \fi \edef\@tracklang@tmp{% \TrackedIsoCodeFromLanguage{3166-1}{\@tracklang@dialect}}% \ifx\@tracklang@tmp\@TrackLangEnvTerritory - \edef\@tracklang@tmp{% - \GetTrackedDialectSubLang{\@tracklang@dialect}}% - \ifx\@tracklang@tmp\@TrackLangEnvSubLang - \edef\@tracklang@tmp{% - \GetTrackedDialectVariant{\@tracklang@dialect}}% - \ifx\@tracklang@tmp\@TrackLangEnvVariant - \edef\@tracklang@tmp{% - \GetTrackedDialectScript{\@tracklang@dialect}}% - \ifx\@tracklang@tmp\@TrackLangEnvScript - \let#2\@tracklang@dialect - \else - \ifx\@TrackLangEnvScript\empty - \ifx\@tracklang@tmp\@tracklang@defscript - \let#2\@tracklang@dialect - \fi - \fi - \fi - \fi + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 1}% + \else + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 0}% + \fi + \ifx\@tracklang@currentmatch\@tracklang@fullmatch + \let#2\@tracklang@dialect + \else + \ifnum\@tracklang@currentmatch>\@tracklang@bestmatch\relax + \let\TrackedDialectClosestSubMatch\@tracklang@dialect + \let\@tracklang@bestmatch\@tracklang@currentmatch \fi \fi - }% - }% + }% + }% } +\def\@tracklang@fullmatch{1111} \def\TrackLangFromEnv{% \def\TrackLangEnvLang{}% \def\TrackLangEnvTerritory{}% -- cgit v1.2.3