-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
108 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
-------------------------------------------------------------------------- | ||
the TRANSLATIONS package v1.2e - 2015/11/07 | ||
the TRANSLATIONS package v1.3 - 2016/04/19 | ||
internationalization of LaTeX2e packages | ||
|
||
-------------------------------------------------------------------------- | ||
Clemens Niederberger | ||
Web: http://www.mychemistry.eu/forums/forum/translations | ||
E-Mail: [email protected] | ||
-------------------------------------------------------------------------- | ||
Copyright 2012-2015 Clemens Niederberger | ||
Copyright 2012-2016 Clemens Niederberger | ||
|
||
This work may be distributed and/or modified under the | ||
conditions of the LaTeX Project Public License, either version 1.3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
% Web: http://www.mychemistry.eu/forums/forum/translations | ||
% E-Mail: [email protected] | ||
% -------------------------------------------------------------------------- | ||
% Copyright 2012-2015 Clemens Niederberger | ||
% Copyright 2012-2016 Clemens Niederberger | ||
% | ||
% This work may be distributed and/or modified under the | ||
% conditions of the LaTeX Project Public License, either version 1.3 | ||
|
@@ -25,8 +25,8 @@ | |
% If you have any ideas, questions, suggestions or bugs to report, please | ||
% feel free to contact me. | ||
% -------------------------------------------------------------------------- | ||
\def\@trnslt@date{2015/11/07} | ||
\def\@trnslt@version{v1.2e} | ||
\def\@trnslt@date{2016/04/19} | ||
\def\@trnslt@version{v1.3} | ||
\def\@trnslt@info{internationalization of LaTeX2e packages} | ||
|
||
\ProvidesPackage{translations}[% | ||
|
@@ -511,23 +511,65 @@ | |
\@trnslt@load@dictionary@for{#2}{#1}} | ||
\@onlypreamble\LoadDictionaryFor | ||
|
||
\newrobustcmd*\LoadDictionaryForDialect[2]{% | ||
\@trnslt@load@dictionary@for@dialect{#2}{#1}} | ||
\@onlypreamble\LoadDictionaryFor | ||
|
||
% #1: name | ||
% #2: lang | ||
\newrobustcmd*\@trnslt@load@dictionary@for[2]{% | ||
% #3: false | ||
\newrobustcmd*\@trnslt@input@if@dictionary@exists[3]{% | ||
\AtBeginDocument{% | ||
\InputIfFileExists{#1-\@trnslt@language{#2}.trsl} | ||
{\@trnslt@check@dictionary{#1}{#2}} | ||
{% | ||
\@trnslt@warning{dictionary file `#1-\@trnslt@language{#2}.trsl' not | ||
found.}% | ||
}% | ||
{#3}% | ||
}% | ||
} | ||
|
||
% #1: name | ||
% #2: lang | ||
% #3: false | ||
\newrobustcmd*\@trnslt@load@dictionary@for@F[3]{% | ||
\@trnslt@input@if@dictionary@exists{#1}{#2}{#3}% | ||
} | ||
|
||
% #1: name | ||
% #2: lang | ||
\newrobustcmd*\@trnslt@load@dictionary@for@dialect[2]{% | ||
\@trnslt@load@dictionary@for@F{#1}{#2} | ||
{% | ||
\@trnslt@warning{dictionary file `#1-\@trnslt@language{#2}.trsl' not | ||
found.}% | ||
}% | ||
} | ||
|
||
% #1: name | ||
% #2: lang | ||
\newrobustcmd*\@trnslt@load@dictionary@for[2]{% | ||
\@trnslt@load@dictionary@for@F{#1}{#2} | ||
{% | ||
\@trnslt@load@dictionary@for@F{#1}{\baselanguage{#2}} | ||
{% | ||
\@trnslt@warning{neither dictionary file | ||
`#1-\@trnslt@language{#2}.trsl' nor `#1-\baselanguage{#2}.trsl' | ||
found.}% | ||
}% | ||
}% | ||
} | ||
|
||
\newrobustcmd*\@trnslt@load@dictionary@silent@for[2]{% | ||
\@trnslt@load@dictionary@for@F{#1}{#2}{% | ||
\@trnslt@load@dictionary@for@F{#1}{\baselanguage{#2}}{}% | ||
}% | ||
} | ||
|
||
% #1: name | ||
% #2: lang | ||
\newrobustcmd*\@trnslt@check@dictionary[2]{% | ||
\AfterFile{#1-\@trnslt@language{#2}.trsl} | ||
{% | ||
\ifcsdef{@trnslt@dictionary@#1@\@trnslt@language{#2}} | ||
\edef\@trnslt@tmpa{\@trnslt@language{#2}}% | ||
\ifcsdef{@trnslt@dictionary@#1@\@trnslt@tmpa} | ||
{\@trnslt@info{loading dictionary `#1' for `#2'.}} | ||
{% | ||
\@trnslt@warning{file `#1-\@trnslt@language{#2}.trsl' does not | ||
|
@@ -536,16 +578,18 @@ | |
}% | ||
} | ||
|
||
\newcommand*\@trnslt@if@dictionary[2]{\IfFileExists{#1-#2.trsl}} | ||
|
||
\newcommand*\@trnslt@load@dictionary@silent@for[2]{\InputIfFileExists{#1-#2.trsl}{}{}} | ||
% \newcommand*\@trnslt@if@dictionary[2]{\IfFileExists{#1-#2.trsl}} | ||
|
||
% -------------------------------------------------------------------------- | ||
% the contents of a dictionary; let's declare that is one. | ||
% #1: lang | ||
% #2: name | ||
\newrobustcmd*\ProvideDictionaryFor[2]{% | ||
\@trnslt@provide@dictionary@for{#1}{#2}} | ||
\@onlypreamble\ProvideDictionaryFor | ||
|
||
% #1: lang | ||
% #2: name | ||
\newrobustcmd*\@trnslt@provide@dictionary@for[2]{% | ||
\def\@trnslt@dictionary@name{#2}% | ||
\edef\@trnslt@dictionary@lang{\@trnslt@language{#1}}% | ||
|
@@ -968,27 +1012,30 @@ | |
% -------------------------------------------------------------------------- | ||
% load basic dictionary if available | ||
\AtBeginDocument{% | ||
\@trnslt@if@dialect{\@trnslt@current@language} | ||
{% | ||
\@trnslt@if@dictionary | ||
{translations-basic-dictionary} | ||
{\@trnslt@language{\@trnslt@current@language}}% | ||
{% | ||
\@trnslt@load@dictionary@silent@for | ||
{translations-basic-dictionary} | ||
{\@trnslt@language{\@trnslt@current@language}}% | ||
}% | ||
{% | ||
\@trnslt@load@dictionary@silent@for | ||
{translations-basic-dictionary} | ||
{\@trnslt@dialect@of{\@trnslt@current@language}}% | ||
} | ||
} | ||
{% | ||
\@trnslt@load@dictionary@silent@for | ||
{translations-basic-dictionary} | ||
{\@trnslt@language{\@trnslt@current@language}}% | ||
}% | ||
% \@trnslt@if@dialect{\@trnslt@current@language} | ||
% {% | ||
% \@trnslt@if@dictionary | ||
% {translations-basic-dictionary} | ||
% {\@trnslt@language{\@trnslt@current@language}}% | ||
% {% | ||
% \@trnslt@load@dictionary@silent@for | ||
% {translations-basic-dictionary} | ||
% {\@trnslt@language{\@trnslt@current@language}}% | ||
% }% | ||
% {% | ||
% \@trnslt@load@dictionary@silent@for | ||
% {translations-basic-dictionary} | ||
% {\@trnslt@dialect@of{\@trnslt@current@language}}% | ||
% } | ||
% } | ||
% {% | ||
% \@trnslt@load@dictionary@silent@for | ||
% {translations-basic-dictionary} | ||
% {\@trnslt@language{\@trnslt@current@language}}% | ||
% }% | ||
\@trnslt@load@dictionary@silent@for | ||
{translations-basic-dictionary} | ||
\@trnslt@current@language | ||
} | ||
|
||
\endinput | ||
|
@@ -1058,3 +1105,10 @@ | |
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 | ||
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 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
% Web: http://www.mychemistry.eu/forums/forum/translations | ||
% E-Mail: [email protected] | ||
% -------------------------------------------------------------------------- | ||
% Copyright 2012-2015 Clemens Niederberger | ||
% Copyright 2012-2016 Clemens Niederberger | ||
% | ||
% This work may be distributed and/or modified under the | ||
% conditions of the LaTeX Project Public License, either version 1.3 | ||
|
@@ -424,7 +424,7 @@ \subsubsection{Basic Structure} | |
\DeclareTranslation{French}{mypackage-title}{Beau Titre} | ||
\DeclareTranslation{German}{mypackage-title}{Sch\"{o}ner Titel} | ||
... | ||
\def\mypackage@title{\GetTranslation{mypackage-title}} | ||
\newcommand*\mypackage@title{\GetTranslation{mypackage-title}} | ||
\end{sourcecode} | ||
|
||
That is, a package defines some unique key for an expression and at least | ||
|
@@ -484,11 +484,24 @@ \subsubsection{Background} | |
\begin{commands} | ||
\command{LoadDictionary}[\marg{name}] | ||
Loads a file named \code{\meta{name}-\meta{lang}.trsl} where \meta{lang} | ||
corresponds to the lowercase name of the current language as defined with | ||
\cs{DeclareLanguage}. This file should contain the translations for the | ||
specified language. | ||
corresponds to the lowercase name of the current language or base language | ||
as defined with \cs{DeclareLanguage}. This file should contain the | ||
translations for the specified language. This means if \meta{lang} is a | ||
dialect and a dictionary exists the dictionary is used. If it doesn't | ||
exist but there is a dictionary for the base language that one is used. | ||
\command{LoadDictionaryFor}[\marg{lang}\marg{name}] | ||
Loads a file named \code{\meta{name}-\meta{lang}.trsl}. | ||
Loads a file named \code{\meta{name}-\meta{lang}.trsl} where \meta{lang} | ||
corresponds to the lowercase name of the current language or base language | ||
as defined with \cs{DeclareLanguage}. This file should contain the | ||
translations for the specified language. This means if \meta{lang} is a | ||
dialect and a dictionary exists the dictionary is used. If it doesn't | ||
exist but there is a dictionary for the base language that one is used. | ||
\command{LoadDictionaryForDialect}[\marg{lang}\marg{name}] | ||
\sinceversion{1.3}Loads a file named \code{\meta{name}-\meta{lang}.trsl} | ||
where \meta{lang} corresponds to the lowercase name of the current | ||
language as defined with \cs{DeclareLanguage}. This file should contain | ||
the translations for the specified language. This command \emph{does not | ||
look} for a base language dictionary. | ||
\end{commands} | ||
|
||
A package could provide dictionary files for its language dependent settings | ||
|