diff --git a/README b/README index 4f93dfa..e9a9f01 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the TRANSLATIONS package v1.8b - 2020/04/28 +the TRANSLATIONS package v1.9 - 2020/11/08 internationalization of LaTeX2e packages -------------------------------------------------------------------------- @@ -10,12 +10,12 @@ E-Mail: contact@mychemistry.eu Copyright 2012--2020 Clemens Niederberger This work may be distributed and/or modified under the -conditions of the LaTeX Project Public License, either version 1.3 +conditions of the LaTeX Project Public License, either version 1.3c 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 -version 2005/12/01 or later. +and version 1.3c or later is part of all distributions of LaTeX +version 2008/05/04 or later. This work has the LPPL maintenance status `maintained'. @@ -23,6 +23,7 @@ The Current Maintainer of this work is Clemens Niederberger. -------------------------------------------------------------------------- The translations package consists of the files - translations.sty, translations_en.tex, translations_en.pdf, + translations-basic-dictionary-brazil.trsl, translations-basic-dictionary-catalan.trsl, translations-basic-dictionary-english.trsl, translations-basic-dictionary-dutch.trsl, diff --git a/translations.sty b/translations.sty index 1749329..49418ec 100644 --- a/translations.sty +++ b/translations.sty @@ -25,8 +25,8 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -\newcommand*\@trnslt@date{2020/04/28} -\newcommand*\@trnslt@version{v1.8b} +\newcommand*\@trnslt@date{2020/11/08} +\newcommand*\@trnslt@version{v1.9} \newcommand*\@trnslt@packageinfo{internationalization of LaTeX2e packages} \ProvidesPackage{translations}[% @@ -86,14 +86,18 @@ % -------------------------------------------------------------------------- % test string equality, expandably: -\newcommand\@trnslt@ifstrequal[2]{% - \ifnum\pdf@strcmp{\unexpanded{#1}}{\unexpanded{#2}}=\z@ +\newcommand\@trnslt@ifstrequalTF[2]{% + \@trnslt@ifstrequal{#1}{#2}% \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi } +\newcommand\@trnslt@ifstrequal[2]{% + \ifnum\pdf@strcmp{\unexpanded{#1}}{\unexpanded{#2}}=\z@ +} + \long\def\@trnslt@getnext@braced#1#2#3{#2\@trnslt@firstofone{#3{#1}}} \long\def\@trnslt@firstofone#1{#1} \long\def\@trnslt@braced@expanded@fully#1\@trnslt@firstofone#2#3{% @@ -258,6 +262,15 @@ % #1: language % #2: true % #3: false +\newcommand*\@trnslt@iflanguageTF[1]{% + \@trnslt@braced@expanded@fully + \@trnslt@braced@expanded@fully + \@trnslt@firstofone + \@trnslt@ifstrequalTF + {\@trnslt@language{#1}} + {\@trnslt@language{\languagename}}% +} + \newcommand*\@trnslt@iflanguage[1]{% \@trnslt@braced@expanded@fully \@trnslt@braced@expanded@fully @@ -268,6 +281,19 @@ } % check the current /base/ language, expandably: +\newcommand*\@trnslt@ifbaselanguageTF[1]{% + \@trnslt@if@dialect{\languagename} + {% + \@trnslt@braced@expanded@fully + \@trnslt@braced@expanded@fully + \@trnslt@firstofone + \@trnslt@ifstrequalTF + {\@trnslt@language{\@trnslt@dialect@of{\languagename}}} + {\@trnslt@language{#1}}% + } + {\@trnslt@iflanguageTF{#1}}% +} + \newcommand*\@trnslt@ifbaselanguage[1]{% \@trnslt@if@dialect{\languagename} {% @@ -283,9 +309,16 @@ % user commands for the above: \newcommand*\ifcurrentlanguage[1]{% - \@trnslt@iflanguage{#1}% + \@trnslt@iflanguageTF{#1}% } \newcommand*\ifcurrentbaselanguage[1]{% + \@trnslt@ifbaselanguageTF{#1}% +} + +\newcommand*\ifcurrentlang[1]{% + \@trnslt@iflanguage{#1}% +} +\newcommand*\ifcurrentbaselang[1]{% \@trnslt@ifbaselanguage{#1}% } @@ -1196,3 +1229,8 @@ available) 2020/04/26 v1.8a - fix problem with loading of dictionaries in some circumstances +2020/04/28 v1.8b - fix issue #9 +2020/11/08 v1.9 - add \ifcurrentlang{} ... \else ... \fi + - add \ifcurrentbaselang{} ... \else ... \fi + - add Brazilian basic dictionary + diff --git a/translations_en.pdf b/translations_en.pdf index 427707c..fea9e5c 100644 Binary files a/translations_en.pdf and b/translations_en.pdf differ diff --git a/translations_en.tex b/translations_en.tex index 340eaaf..7118e67 100644 --- a/translations_en.tex +++ b/translations_en.tex @@ -1,7 +1,7 @@ -% arara: pdflatex: { shell: on, interaction: nonstopmode } +% !arara: pdflatex: { shell: on, interaction: nonstopmode } % !arara: biber -% !arara: pdflatex -% !arara: pdflatex +% arara: pdflatex +% arara: pdflatex % -------------------------------------------------------------------------- % the TRANSLATIONS package % @@ -30,7 +30,7 @@ % feel free to contact me. % -------------------------------------------------------------------------- \documentclass[load-preamble]{cnltx-doc} -\usepackage[french,spanish,ngerman,english]{babel} +\usepackage[french,brazil,spanish,ngerman,english]{babel} % ---------------------------------------------------------------------------- \usepackage{imakeidx} % document layout and typographic features @@ -52,6 +52,8 @@ declaretranslationfallback, GetTranslation, GetTranslationFor, + ifcurrentbaselang, + ifcurrentlang, IfTranslation, LoadDictionary, LoadDictionaryFor, @@ -98,7 +100,8 @@ % ---------------------------------------------------------------------------- % other packages, bibliography, index \usepackage{array,longtable,booktabs} -\AfterPackage!{hyperref}{\usepackage[sort]{cleveref}} +\usepackage{hyperref} +\usepackage[sort]{cleveref} % ---------------------------------------------------------------------------- % example definitions that have to be done in the preamble: @@ -115,6 +118,8 @@ \newrobustcmd\fnote[1]{\textsuperscript{#1}} +\tracingmacros=1 + \begin{document} \section{Motivation} @@ -423,12 +428,18 @@ \subsection{Available Commands}\label{ssec:commands} \sinceversion{1.2}Places \meta{true} in the input stream if the current language is \meta{lang}. Note: a dialect counts as a language of it's own here. \cs{ifcurrentlanguage}\Marg{English} will for example be - \meta{false} if the current \pkg{babel} language is \code{american}. + \meta{false} if the current \pkg{babel} language is \code{american}. + \expandable\command{ifcurrentlang}[\marg{lang}] + \sinceversion{1.9}The same as \cs{ifcurrentlanguage} but uses the + \dots\cs{else}\dots\cs*{fi} syntax. \expandable\command{ifcurrentbaselanguage}[\marg{lang}\marg{true}\marg{false}] \sinceversion{1.2}Places \meta{true} in the input stream if the current language is \meta{lang}. Note: a dialect does not count as a language of it's own here. If the current \pkg{babel} language is \code{american} then \cs{ifcurrentbaselanguage}\Marg{English} will be \meta{true}. + \expandable\command{ifcurrentbaselang}[\marg{lang}] + \sinceversion{1.9}The same as \cs{ifcurrentbaselanguage} but uses the + \dots\cs{else}\dots\cs*{fi} syntax. \end{commands} \subsection{A Small Example} @@ -617,6 +628,7 @@ \subsubsection{Own Dictionaries}\label{sec:own-dictionaries} \subsubsection{\translations' Basic Dictionaries}\label{sec:transl-basic-dict} \translations\ already provides a basic dictionary for the languages \begin{itemize} + \item Brazilian, \item Catalan, \item English, \item Dutch,