Skip to content

Commit

Permalink
v1.1 CTAN ready
Browse files Browse the repository at this point in the history
  • Loading branch information
cgnieder committed Aug 5, 2013
1 parent 673c6c0 commit 79b9040
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 111 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.1 - 2013/07/26
the TRANSLATIONS package v1.1 - 2013/08/05
a simple translator

--------------------------------------------------------------------------
Expand Down
20 changes: 0 additions & 20 deletions dicts/translations-basic-dictionary-english.trsl
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@
\DeclareDictTranslation{Saturday}{Saturday}
\DeclareDictTranslation{Sunday}{Sunday}

\DeclareDictTranslation{Monday (lowercase)}{Monday}
\DeclareDictTranslation{Tuesday (lowercase)}{Tuesday}
\DeclareDictTranslation{Wednesday (lowercase)}{Wednesday}
\DeclareDictTranslation{Thursday (lowercase)}{Thursday}
\DeclareDictTranslation{Friday (lowercase)}{Friday}
\DeclareDictTranslation{Saturday (lowercase)}{Saturday}
\DeclareDictTranslation{Sunday (lowercase)}{Sunday}

\DeclareDictTranslation{January}{January}
\DeclareDictTranslation{February}{February}
\DeclareDictTranslation{March}{March}
Expand All @@ -115,15 +107,3 @@
\DeclareDictTranslation{November}{November}
\DeclareDictTranslation{December}{December}

\DeclareDictTranslation{January (lowercase)}{January}
\DeclareDictTranslation{February (lowercase)}{February}
\DeclareDictTranslation{March (lowercase)}{March}
\DeclareDictTranslation{April (lowercase)}{April}
\DeclareDictTranslation{May (lowercase)}{May}
\DeclareDictTranslation{June (lowercase)}{June}
\DeclareDictTranslation{July (lowercase)}{July}
\DeclareDictTranslation{August (lowercase)}{August}
\DeclareDictTranslation{September (lowercase)}{September}
\DeclareDictTranslation{October (lowercase)}{October}
\DeclareDictTranslation{November (lowercase)}{November}
\DeclareDictTranslation{December (lowercase)}{December}
20 changes: 0 additions & 20 deletions dicts/translations-basic-dictionary-french.trsl
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@
\DeclareDictTranslation{Saturday}{Samedi}
\DeclareDictTranslation{Sunday}{Dimanche}

\DeclareDictTranslation{Monday (lowercase)}{lundi}
\DeclareDictTranslation{Tuesday (lowercase)}{mardi}
\DeclareDictTranslation{Wednesday (lowercase)}{mercredi}
\DeclareDictTranslation{Thursday (lowercase)}{jeudi}
\DeclareDictTranslation{Friday (lowercase)}{vendredi}
\DeclareDictTranslation{Saturday (lowercase)}{samedi}
\DeclareDictTranslation{Sunday (lowercase)}{dimanche}

\DeclareDictTranslation{January}{Janvier}
\DeclareDictTranslation{February}{F\'evrier}
\DeclareDictTranslation{March}{Mars}
Expand All @@ -115,15 +107,3 @@
\DeclareDictTranslation{November}{Novembre}
\DeclareDictTranslation{December}{D\'ecembre}

\DeclareDictTranslation{January (lowercase)}{janvier}
\DeclareDictTranslation{February (lowercase)}{f\'evrier}
\DeclareDictTranslation{March (lowercase)}{mars}
\DeclareDictTranslation{April (lowercase)}{avril}
\DeclareDictTranslation{May (lowercase)}{mai}
\DeclareDictTranslation{June (lowercase)}{juin}
\DeclareDictTranslation{July (lowercase)}{juillet}
\DeclareDictTranslation{August (lowercase)}{ao\^{u}t}
\DeclareDictTranslation{September (lowercase)}{septembre}
\DeclareDictTranslation{October (lowercase)}{octobre}
\DeclareDictTranslation{November (lowercase)}{novembre}
\DeclareDictTranslation{December (lowercase)}{d\'ecembre}
20 changes: 0 additions & 20 deletions dicts/translations-basic-dictionary-german.trsl
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@
\DeclareDictTranslation{Saturday}{Samstag}
\DeclareDictTranslation{Sunday}{Sonntag}

\DeclareDictTranslation{Monday (lowercase)}{Montag}
\DeclareDictTranslation{Tuesday (lowercase)}{Dienstag}
\DeclareDictTranslation{Wednesday (lowercase)}{Mittwoch}
\DeclareDictTranslation{Thursday (lowercase)}{Donnerstag}
\DeclareDictTranslation{Friday (lowercase)}{Freitag}
\DeclareDictTranslation{Saturday (lowercase)}{Samstag}
\DeclareDictTranslation{Sunday (lowercase)}{Sonntag}

\DeclareDictTranslation{January}{Januar}
\DeclareDictTranslation{February}{Februar}
\DeclareDictTranslation{March}{M\"arz}
Expand All @@ -115,15 +107,3 @@
\DeclareDictTranslation{November}{November}
\DeclareDictTranslation{December}{Dezember}

\DeclareDictTranslation{January (lowercase)}{Januar}
\DeclareDictTranslation{February (lowercase)}{Februar}
\DeclareDictTranslation{March (lowercase)}{M\"arz}
\DeclareDictTranslation{April (lowercase)}{April}
\DeclareDictTranslation{May (lowercase)}{Mai}
\DeclareDictTranslation{June (lowercase)}{Juni}
\DeclareDictTranslation{July (lowercase)}{Juli}
\DeclareDictTranslation{August (lowercase)}{August}
\DeclareDictTranslation{September (lowercase)}{September}
\DeclareDictTranslation{October (lowercase)}{Oktober}
\DeclareDictTranslation{November (lowercase)}{November}
\DeclareDictTranslation{December (lowercase)}{Dezember}
20 changes: 0 additions & 20 deletions dicts/translations-basic-dictionary-spanish.trsl
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@
\DeclareDictTranslation{Saturday}{S\'{a}bado}
\DeclareDictTranslation{Sunday}{Domingo}

\DeclareDictTranslation{Monday (lowercase)}{lunes}
\DeclareDictTranslation{Tuesday (lowercase)}{martes}
\DeclareDictTranslation{Wednesday (lowercase)}{mi\'{e}rcoles}
\DeclareDictTranslation{Thursday (lowercase)}{jueves}
\DeclareDictTranslation{Friday (lowercase)}{viernes}
\DeclareDictTranslation{Saturday (lowercase)}{s\'{a}bado}
\DeclareDictTranslation{Sunday (lowercase)}{domingo}

\DeclareDictTranslation{January}{Enero}
\DeclareDictTranslation{February}{Febrero}
\DeclareDictTranslation{March}{Marzo}
Expand All @@ -115,15 +107,3 @@
\DeclareDictTranslation{November}{Noviembre}
\DeclareDictTranslation{December}{Diciembre}

\DeclareDictTranslation{January (lowercase)}{enero}
\DeclareDictTranslation{February (lowercase)}{febrero}
\DeclareDictTranslation{March (lowercase)}{marzo}
\DeclareDictTranslation{April (lowercase)}{abril}
\DeclareDictTranslation{May (lowercase)}{mayo}
\DeclareDictTranslation{June (lowercase)}{junio}
\DeclareDictTranslation{July (lowercase)}{julio}
\DeclareDictTranslation{August (lowercase)}{agosto}
\DeclareDictTranslation{September (lowercase)}{septiembre}
\DeclareDictTranslation{October (lowercase)}{octubre}
\DeclareDictTranslation{November (lowercase)}{noviembre}
\DeclareDictTranslation{December (lowercase)}{diciembre}
118 changes: 106 additions & 12 deletions translations.sty
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
\def\@trnslt@date{2013/07/26}
\def\@trnslt@date{2013/08/05}
\def\@trnslt@version{v1.1}
\def\@trnslt@info{internationalization of LaTeX2e packages}

Expand Down Expand Up @@ -63,6 +63,31 @@
\def\@trnslt@err@not@defined#1#2{%
\@trnslt@error{The \@trnslt@language{#2} translation for `#1' is not defined yet.}}

% --------------------------------------------------------------------------
% catcode stuff:
\DeclareListParser*{\@trnslt@map@tokenlist}{}

\def\@trnslt@save@catcodes#1{%
\@trnslt@map@tokenlist\@trnslt@save@catcode{#1}%
}
\def\@trnslt@save@catcode#1{%
\csedef{@trnslt@catcode@#1}{\the\catcode`#1}%
}

\def\@trnslt@restore@catcodes#1{%
\@trnslt@map@tokenlist\@trnslt@restore@catcode{#1}%
}
\protected\def\@trnslt@restore@catcode#1{%
\catcode`#1=\csname @trnslt@catcode@#1\endcsname
}

\def\@trnslt@set@catcodes#1#2{%
\@trnslt@map@tokenlist{\@trnslt@set@catcode{#2}}{#1}%
}
\def\@trnslt@set@catcode#1#2{%
\catcode`#2=#1\relax
}

% --------------------------------------------------------------------------
% check if babel or polyglossia is used
\AtEndPreamble{
Expand Down Expand Up @@ -92,7 +117,7 @@
% \relax behind and check for \@trnslt@<name>@#1. These conditionals should
% also be expandable in an \edef-like context. Thanks to e-TeX there's
% \ifcsname:
\def\@trnslt@newif#1{%
\def\@trnslt@new@check#1{%
\csdef{@trnslt@if@#1}##1{%
\ifcsname @trnslt@#1@##1\endcsname
\expandafter\@firstoftwo
Expand All @@ -102,6 +127,11 @@
}%
}

% --------------------------------------------------------------------------
\long\def\@trnslt@get@lowercase#1{%
\lowercase\expandafter{\romannumeral-`\Q#1}%
}

% --------------------------------------------------------------------------
% \DeclareLanguage
% #1: language
Expand All @@ -120,9 +150,11 @@
\def\@trnslt@language#1{%
\csuse{@trnslt@language@#1}}

\newcommand*\babellanguage[1]{\@trnslt@language{#1}}
\newcommand*\baselanguage[1]{\@trnslt@language{#1}}

\@trnslt@newif{language}
% define \@trnslt@if@language{#1}{}{} that actually checks the existence of
% \@trnslt@language@#1:
\@trnslt@new@check{language}

% --------------------------------------------------------------------------
% \DeclareLanguageDialect
Expand Down Expand Up @@ -171,7 +203,9 @@
}{}%
}

\@trnslt@newif{dialect}
% define \@trnslt@if@dialect{#1}{}{} that actually checks the existence of
% \@trnslt@dialect@#1:
\@trnslt@new@check{dialect}

% --------------------------------------------------------------------------
% \DeclareLanguageAlias
Expand Down Expand Up @@ -202,7 +236,9 @@
\def\@trnslt@alias#1{%
\csuse{@trnslt@alias@#1}}

\@trnslt@newif{alias}
% define \@trnslt@if@alias{#1}{}{} that actually checks the existence of
% \@trnslt@alias@#1:
\@trnslt@new@check{alias}

% --------------------------------------------------------------------------
% dummy language: `fallback':
Expand Down Expand Up @@ -299,6 +335,16 @@
\newcommand*\GetTranslation[1]{%
\@trnslt@checkandget@translation@for{#1}{\@trnslt@current@language}}

\newcommand*\GetLCTranslationFor[2]{%
\@trnslt@get@lowercase{\@trnslt@checkandget@translation@for{#2}{#1}}%
}

\newcommand*\GetLCTranslation[1]{%
\@trnslt@get@lowercase{%
\@trnslt@checkandget@translation@for{#1}{\@trnslt@current@language}%
}%
}

% unexpandable version of the commands that raise a warning if no translation
% is available:
\newcommand*\GetTranslationForWarn[2]{%
Expand All @@ -307,6 +353,12 @@
\newcommand*\GetTranslationWarn[1]{%
\@trnslt@getandwarn@translation@for{#1}{\@trnslt@current@language}}

\newcommand*\GetLCTranslationForWarn[2]{%
\@trnslt@getandwarn@lctranslation@for{#2}{#1}}

\newcommand*\GetLCTranslationWarn[1]{%
\@trnslt@getandwarn@lctranslation@for{#1}{\@trnslt@current@language}}

% #1: word #2: language
\def\@trnslt@get@translation@for#1#2{%
\@trnslt@if@dialect{#2}
Expand Down Expand Up @@ -344,6 +396,22 @@
}%
}

% lowercase version for translation with warnings:
\protected\def\@trnslt@getandwarn@lctranslation@for#1#2{%
\@trnslt@if@translation{#1}{#2}
{\@trnslt@get@lowercase{\@trnslt@get@translation@for{#1}{#2}}}
{%
\@trnslt@warning{Translation for `#1' in #2 unknown. You may try to use
\string\DeclareTranslation{#2}{#1}{ ... } in your preamble.}%
\@trnslt@if@translation{#1}{fallback}
{%
\@trnslt@info{Using fallback translation for `#1'}%
\@trnslt@get@lowercase{\csuse{@trnslt@word@#1@fallback}}%
}
{\@trnslt@get@lowercase{\csuse{@trnslt@word@#1@literal}}}%
}%
}

% --------------------------------------------------------------------------
% \SaveTranslationFor and \SaveTranslation
\newrobustcmd*\SaveTranslationFor[3]{%
Expand Down Expand Up @@ -391,8 +459,11 @@
}%
}

\def\@trnslt@if@dictionary#1#2{%
\IfFileExists{#1-#2.trsl}}

\def\@trnslt@load@dictionary@silent@for#1#2{%
\AtBeginDocument{\InputIfFileExists{#1-\@trnslt@language{#2}.trsl}{}{}}}
\InputIfFileExists{#1-#2.trsl}{}{}}

\newrobustcmd*\ProvideDictionaryFor[2]{%
\@trnslt@provide@dictionary@for{#1}{#2}}
Expand Down Expand Up @@ -739,9 +810,27 @@
% --------------------------------------------------------------------------
% load basic dictionary if available
\AtBeginDocument{%
\@trnslt@load@dictionary@silent@for
{translations-basic-dictionary}
{\@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}}%
}%
}

\endinput
Expand Down Expand Up @@ -778,10 +867,15 @@
- new command \PrintDictionaryFor
- redefined conditionals; they still seemed to make
trouble in some cases
2013/07/26 v1.1 - added /loads/ of languages, noe the list of babel and
2013/08/05 v1.1 - added /loads/ of languages, noe the list of babel and
polyglossia languages hopefully is complete
- a few languages had falsely been declared as dialect
instead of an alias
- added weekday names and month names to basic dictionary
- new command \babellanguage
- new command \baselanguage
- new commands \GetLCTranslation, \GetLCTranslationFor,
\GetLCTranslationWarn and \GetLCTranslationForWarn
- load basic dictionary also for dialects and if it
doesn't exist load it for the corresponding base
language instead

Binary file modified translations_en.pdf
Binary file not shown.
Loading

0 comments on commit 79b9040

Please sign in to comment.