Skip to content

Commit

Permalink
v1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
cgnieder committed Jun 2, 2016
1 parent 1157c60 commit c03f002
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------
the TRANSLATIONS package v1.3 - 2016/04/19
the TRANSLATIONS package v1.4 - 2016/06/02
internationalization of LaTeX2e packages

--------------------------------------------------------------------------
Expand Down
65 changes: 44 additions & 21 deletions translations.sty
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
\def\@trnslt@date{2016/04/19}
\def\@trnslt@version{v1.3}
\def\@trnslt@info{internationalization of LaTeX2e packages}
\newcommand*\@trnslt@date{2016/06/02}
\newcommand*\@trnslt@version{v1.4}
\newcommand*\@trnslt@info{internationalization of LaTeX2e packages}

\ProvidesPackage{translations}[%
\@trnslt@date\space
Expand All @@ -38,7 +38,7 @@
% --------------------------------------------------------------------------
% message handling
% generic help message:
\def\@trnslt@error@message{%
\newcommand*\@trnslt@error@message{%
For details have a look at the `translations' manual.%
}

Expand Down Expand Up @@ -277,31 +277,50 @@
% #1: language
% #2: word
% #3: replacement
\newrobustcmd*\DeclareTranslation[3]{%
\newrobustcmd*\declaretranslation[3]{%
\@trnslt@declare@translation{#2}{#1}{#3}%
}
\@onlypreamble\DeclareTranslation

\newrobustcmd*\DeclareTranslationFallback[2]{%
\@trnslt@declare@translation{#1}{fallback}{#2}%
}
\@onlypreamble\DeclareTranslationFallback

\newrobustcmd*\NewTranslation[3]{%
\newrobustcmd*\newtranslation[3]{%
\@trnslt@new@translation{#2}{#1}{#3}%
}
\@onlypreamble\NewTranslation

\newrobustcmd*\RenewTranslation[3]{%
\newrobustcmd*\renewtranslation[3]{%
\@trnslt@renew@translation{#2}{#1}{#3}%
}
\@onlypreamble\RenewTranslation

\newrobustcmd*\ProvideTranslation[3]{%
\newrobustcmd*\providetranslation[3]{%
\@trnslt@provide@translation{#2}{#1}{#3}%
}

\let\DeclareTranslation\declaretranslation
\@onlypreamble\DeclareTranslation
\let\NewTranslation\newtranslation
\@onlypreamble\NewTranslation
\let\RenewTranslation\renewtranslation
\@onlypreamble\RenewTranslation
\let\ProvideTranslation\providetranslation
\@onlypreamble\ProvideTranslation

\newrobustcmd*\declaretranslationfallback{%
\declaretranslation{fallback}%
}
\newrobustcmd*\newtranslationfallback{%
\newtranslation{fallback}%
}
\newrobustcmd*\renewtranslationfallback{%
\renewtranslation{fallback}%
}
\newrobustcmd*\providetranslationfallback{%
\providetranslation{fallback}%
}

\let\DeclareTranslationFallback\declaretranslationfallback
\@onlypreamble\DeclareTranslationFallback
\let\NewTranslationFallback\newtranslationfallback
\@onlypreamble\NewTranslationFallback
\let\RenewTranslationFallback\renewtranslationfallback
\@onlypreamble\RenewTranslationFallback
\let\ProvideTranslationFallback\providetranslationfallback
\@onlypreamble\ProvideTranslationFallback

% #1: word
% #2: language
% #3: replacement
Expand Down Expand Up @@ -700,7 +719,7 @@
\newcommand*\@trnslt@print@dictionary@entry@aux[5]{#1#4#2#5#3}

% ==========================================================================
% Now that the package is finished let's us the above commands to provide a
% Now that the package is finished let's use the above commands to provide a
% basis for usage; we need all languages known to `babel' and `polyglossia'
% as well as aliases to allow different spellings/names; we also need dialects
% where it makes sense (e.g. British as a dialect of English)
Expand Down Expand Up @@ -1105,10 +1124,14 @@
2015/11/07 v1.2e - Some fixes to the French translations in the basic
dictionary, thanks to Denis Bitouz\'e
- add Macedonian language
2016/01/20 v1.3 - \LoadDictionary first checks if a dictionary for the
2016/04/19 v1.3 - \LoadDictionary first checks if a dictionary for the
dialect exists and loads it if it does; else it looks
for a dictionary of the base language and loads that
instead
- New command \LoadDictionaryForDialect which only loads
the dictionary for a specified dialect – this doesn't
check if a dictionary for a baselanguage exists
2016/06/02 v1.4 - new commands \declaretranslation, \newtranslation,
\renewtranslation and \providetranslation which can be
used after begin document
- fallback versions for each definition command
Binary file modified translations_en.pdf
Binary file not shown.
67 changes: 56 additions & 11 deletions translations_en.tex
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,28 @@
DeclareLanguageAlias,
DeclareLanguageDialect,
DeclareTranslation,
declaretranslation,
DeclareTranslationFallback,
declaretranslationfallback,
GetTranslation,
GetTranslationFor,
IfTranslation,
LoadDictionary,
LoadDictionaryFor,
NewTranslation,
newtranslation,
NewTranslationFallback,
newtranslationfallback,
ProvideDictionaryFor,
ProvideDictTranslation,
ProvideTranslation,
providetranslation,
ProvideTranslationFallback,
providetranslationfallback,
RenewTranslation,
renewtranslation,
RenewTranslationFallback,
renewtranslationfallback,
SaveTranslation,
SaveTranslationFor
} ,
Expand Down Expand Up @@ -249,26 +261,59 @@ \subsection{Available Commands}\label{ssec:commands}
\translations.
\command{NewTranslation}[\marg{lang}\marg{key}\marg{translation}]
Defines a translation of key \meta{key} for the language \meta{lang}.
An error will be raised if a translation of \meta{key} already exists.
This command can only be used in the preamble.
An error will be raised if a translation of \meta{key} in language
\marg{lang} already exists. This command can only be used in the
preamble.
\command{NewTranslationFallback}[\marg{key}\marg{translation}]
\sinceversion{1.4}Defines a fallback translation of key \meta{key} for the
language \meta{lang}. An error will be raised if a fallback translation of
\meta{key} already exists. This command can only be used in the preamble.
\command{RenewTranslation}[\marg{lang}\marg{key}\marg{translation}]
Redefines a translation of key \meta{key} for the language \meta{lang}.
An error will be raised if no translation of \meta{key} exists.
This command can only be used in the preamble.
An error will be raised if no translation of \meta{key} in language
\meta{lang} exists. This command can only be used in the preamble.
\command{RenewTranslationFallback}[\marg{key}\marg{translation}]
\sinceversion{1.4}Renews a fallback translation. This command can only be
used in the preamble.
\command{ProvideTranslation}[\marg{lang}\marg{key}\marg{translation}]
\sinceversion{1.2}Provides a translation of key \meta{key} for the
language \meta{lang}. If a translation of \meta{key} already exists it
won't be overwritten and no error will be raised. This command can only
language \meta{lang}. If a translation of \meta{key} in language
\meta{lang} already exists it won't be overwritten and no error will be
raised. This command can only be used in the preamble.
\command{ProvideTranslationFallback}[\marg{key}\marg{translation}]
\sinceversion{1.4}Provides a fallback translation. This command can only
be used in the preamble.
\command{DeclareTranslation}[\marg{lang}\marg{key}\marg{translation}]
Defines a translation of key \meta{key} for the language \meta{lang}.
No error will be raised if a translation of \meta{key} already exists.
This command can only be used in the preamble.
\command{DeclareTranslationFallback}[\marg{key}\marg{fallback}]
Defines a fallback translation for key \meta{key} that is used in case no
translation of \meta{key} for the currently active language has been
provided. No error will be raised if a fallback for \meta{key} already
exists. This command can only be used in the preamble.
Declares a fallback translation. This command can only be used in the
preamble.
\command{newtranslation}[\marg{lang}\marg{key}\marg{translation}]
\sinceversion{1.4}A version of \cs{NewTranslation} that \emph{can} be used
after begin document.
\command{newtranslationfallback}[\marg{key}\marg{translation}]
\sinceversion{1.4}A version of \cs{NewTranslationFallback} that \emph{can}
be used after begin document.
\command{renewtranslation}[\marg{lang}\marg{key}\marg{translation}]
\sinceversion{1.4}A version of \cs{RenewTranslation} that \emph{can} be
used after begin document.
\command{renewtranslationfallback}[\marg{key}\marg{translation}]
\sinceversion{1.4}A version of \cs{RenewTranslationFallback} that
\emph{can} be used after begin document.
\command{providetranslation}[\marg{lang}\marg{key}\marg{translation}]
\sinceversion{1.4}A version of \cs{ProvideTranslation} that \emph{can} be
used after begin document.
\command{providetranslationfallback}[\marg{key}\marg{translation}]
\sinceversion{1.4}A version of \cs{ProvideTranslationFallback} that
\emph{can} be used after begin document.
\command{declaretranslation}[\marg{lang}\marg{key}\marg{translation}]
\sinceversion{1.4}A version of \cs{DeclareTranslation} that \emph{can} be
used after begin document.
\command{declaretranslationfallback}[\marg{key}\marg{translation}]
\sinceversion{1.4}A version of \cs{DeclareTranslationFallback} that
\emph{can} be used after begin document.
\expandable\command{IfTranslation}[\marg{lang}\marg{key}\marg{true}\marg{false}]
Checks\sinceversion{1.2d} if a translation for \meta{key} in language
\meta{lang} is defined or not and either leaves \meta{true} or
Expand Down Expand Up @@ -609,7 +654,7 @@ \subsection{Base Languages}\label{ssec:languages:base}
explanation what's wrong and why.

\newcounter{column}
\gdef\seplang{%
\def\seplang{%
\stepcounter{column}%
\ifnumless{\value{column}}{5}
{&}
Expand Down

0 comments on commit c03f002

Please sign in to comment.