Skip to content

Commit

Permalink
v1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
cgnieder committed Nov 8, 2020
1 parent 5e7b8f9 commit b58f1f9
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 15 deletions.
9 changes: 5 additions & 4 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------
the TRANSLATIONS package v1.8b - 2020/04/28
the TRANSLATIONS package v1.9 - 2020/11/08
internationalization of LaTeX2e packages

--------------------------------------------------------------------------
Expand All @@ -10,19 +10,20 @@ E-Mail: [email protected]
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'.

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,
Expand Down
48 changes: 43 additions & 5 deletions translations.sty
Original file line number Diff line number Diff line change
Expand Up @@ -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}[%
Expand Down Expand Up @@ -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{%
Expand Down Expand Up @@ -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
Expand All @@ -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}
{%
Expand All @@ -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}%
}

Expand Down Expand Up @@ -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{<lang>} ... \else ... \fi
- add \ifcurrentbaselang{<lang>} ... \else ... \fi
- add Brazilian basic dictionary

Binary file modified translations_en.pdf
Binary file not shown.
24 changes: 18 additions & 6 deletions translations_en.tex
Original file line number Diff line number Diff line change
@@ -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
%
Expand Down Expand Up @@ -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
Expand All @@ -52,6 +52,8 @@
declaretranslationfallback,
GetTranslation,
GetTranslationFor,
ifcurrentbaselang,
ifcurrentlang,
IfTranslation,
LoadDictionary,
LoadDictionaryFor,
Expand Down Expand Up @@ -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:
Expand All @@ -115,6 +118,8 @@

\newrobustcmd\fnote[1]{\textsuperscript{#1}}

\tracingmacros=1

\begin{document}

\section{Motivation}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b58f1f9

Please sign in to comment.