Store and restore the previous language [WIP]

This commit is contained in:
finga 2025-02-28 12:20:32 +01:00
parent 01849f4046
commit eae5254bfe

View file

@ -13,6 +13,11 @@
\PassOptionsToPackage{\@dictionary@primary,\@dictionary@secondary}{babel} \PassOptionsToPackage{\@dictionary@primary,\@dictionary@secondary}{babel}
\newcommand{\previouslang}{\languagename}
%% \newcommand{\selectpreviouslang}{\selectlanguage{\languagename}}
\newcommand{\debugDictionary}{primary: \@dictionary@primary, secondary: \@dictionary@secondary, previous: \previouslang}
\newcommand{\entry}[2]{% \newcommand{\entry}[2]{%
\DTLnewrow{dictionary}% \DTLnewrow{dictionary}%
\DTLnewdbentry{dictionary}{word}{#1}% \DTLnewdbentry{dictionary}{word}{#1}%
@ -22,9 +27,14 @@
\newenvironment{dictionary}{% \newenvironment{dictionary}{%
\DTLifdbexists{dictionary}{\DTLcleardb{dictionary}}{\DTLnewdb{dictionary}}% \DTLifdbexists{dictionary}{\DTLcleardb{dictionary}}{\DTLnewdb{dictionary}}%
}{% }{%
\renewcommand{\previouslang}{\languagename}
%% \renewcommand{\selectpreviouslang}{\selectlanguage{\languagename}}
\DTLsort{word}{dictionary}% \DTLsort{word}{dictionary}%
\scriptsize% \scriptsize%
\DTLforeach*{dictionary}{\word=word,\translation=translation}{% \DTLforeach*{dictionary}{\word=word,\translation=translation}{%
\selectlanguage{\@dictionary@primary}\textbf{\word:} \selectlanguage{\@dictionary@secondary}\translation\\}% \selectlanguage{\@dictionary@primary}\textbf{\word:} \selectlanguage{\@dictionary@secondary}\translation\\}%
\selectlanguage{\@dictionary@primary}% %% \selectlanguage{vietnamese}\textbf{\word:} \selectlanguage{naustrian}\translation\\}%
\selectlanguage{\@dictionary@primary}%
%% \selectlanguage{\previouslang}%
%% \selectpreviouslang
} }