diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/translations/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/translations/translations_en.pdf | bin | 552265 -> 554471 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/translations/translations_en.tex | 25 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/translations/translations.sty | 120 |
4 files changed, 108 insertions, 41 deletions
diff --git a/Master/texmf-dist/doc/latex/translations/README b/Master/texmf-dist/doc/latex/translations/README index 046ab90ef03..bd11fe68be6 100644 --- a/Master/texmf-dist/doc/latex/translations/README +++ b/Master/texmf-dist/doc/latex/translations/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the TRANSLATIONS package v1.2e - 2015/11/07 +the TRANSLATIONS package v1.3 - 2016/04/19 internationalization of LaTeX2e packages -------------------------------------------------------------------------- @@ -7,7 +7,7 @@ Clemens Niederberger Web: http://www.mychemistry.eu/forums/forum/translations E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- -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 diff --git a/Master/texmf-dist/doc/latex/translations/translations_en.pdf b/Master/texmf-dist/doc/latex/translations/translations_en.pdf Binary files differindex e18b6b0702c..8d8c6863079 100644 --- a/Master/texmf-dist/doc/latex/translations/translations_en.pdf +++ b/Master/texmf-dist/doc/latex/translations/translations_en.pdf diff --git a/Master/texmf-dist/doc/latex/translations/translations_en.tex b/Master/texmf-dist/doc/latex/translations/translations_en.tex index 5ce6fa4ddc4..ceff08981a6 100644 --- a/Master/texmf-dist/doc/latex/translations/translations_en.tex +++ b/Master/texmf-dist/doc/latex/translations/translations_en.tex @@ -12,7 +12,7 @@ % Web: http://www.mychemistry.eu/forums/forum/translations % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% 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 @@ A typical usage in a package would look as follows: \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 @@ active language with \cs{LoadDictionary} or for a specific language with \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 diff --git a/Master/texmf-dist/tex/latex/translations/translations.sty b/Master/texmf-dist/tex/latex/translations/translations.sty index 2a59d323f04..23228043c97 100644 --- a/Master/texmf-dist/tex/latex/translations/translations.sty +++ b/Master/texmf-dist/tex/latex/translations/translations.sty @@ -8,7 +8,7 @@ % Web: http://www.mychemistry.eu/forums/forum/translations % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% 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 |