%%
%% Locale for some float labels and articleinfo/bookinfo stuff
%%

\long\def\dolangsetup#1#2{%
  \expandafter\def\csname setup@lang@#1\endcsname{#2}%
}

\def\dosetuplang#1{%
  \csname setup@lang@#1\endcsname%
}

%% Internal interface
\long\def\langsetupdbk#1#2{ \dolangsetup{dbk@#1}{#2} }
\def\setuplocale#1{ \dosetuplang{dbk@#1} }

%% User Babel setup hooks
\long\def\babelsetup#1#2{ \dolangsetup{bab@#1}{#2} }
\def\setupbabel#1{ \globalbabelsetup\dosetuplang{bab@#1} }

%% Setup common to all babel languages
\def\globalbabelsetup{
  % Cannot remove those messy "x shorthands for every language (e.g. not in
  % french)
  % \AtBeginDocument{\shorthandoff{"}}
}

%% Define the locale setups in docbook
\langsetupdbk{de}{
  \def\refname{Referenzen}%
  \def\abstractname{Zusammenfassung}%
  \def\bibname{Bibliographie}%
  \def\prefacename{Vorwort}%
  \def\chaptername{Kapitel}%
  \def\appendixname{Anhang}%
  \def\contentsname{Inhaltsverzeichnis}%
  \def\listfigurename{Abbildungsverzeichnis}%
  \def\listtablename{Tabellenverzeichnis}%
  \def\indexname{Index}%
  \def\figurename{{\scshape Abbildung }}%
  \def\tablename{{\scshape Tabelle }}%
   
  \def\dbequationname{Gleichung}
  \def\examplename{Beispiel}
  \def\ondate{am}
  \renewcommand{\DBKreleaseinfo}{Arbeitspapier}
  \def\writtenby{VERFASST DURCH}
  \def\projname{PROJEKT}
  \def\titlename{TITEL}
  \def\DBKrefname{REFERENZ}
  \def\DBKindname{NAME}
  \def\DBKindtitle{MITWIRKENDE}
  \def\DBKrevtitle{VERSIONSGESCHICHTE}
  \def\DBKrevdesc{BESCHREIBUNG}
  \def\DBKrevnumber{NUMMER}
  \def\DBKrevname{NAME}
  \def\DBKrevdate{DATUM}
  \def\DBKcontrib{AKTION}
  \def\DBKsignature{UNTERSCHRIFT}
}
\langsetupdbk{fr}{
  \def\refname{R\'ef\'erences}%
  \def\abstractname{R\'esum\'e}%
  \def\bibname{Bibliographie}%
  \def\prefacename{Pr\'eface}%
  \def\chaptername{Chapitre}%
  \def\appendixname{Annexe}%
  \def\contentsname{Table des mati\`eres}%
  \def\listfigurename{Liste des figures}%
  \def\listtablename{Liste des tableaux}%
  \def\indexname{Index}%
  \def\figurename{{\scshape Figure }}%
  \def\tablename{{\scshape Tableau }}%

  \def\dbequationname{\'Equation}
  \def\examplename{Exemple}
  \def\ondate{le}
  \renewcommand{\DBKreleaseinfo}{Document de Travail}
  \def\projname{PROJET}
  \def\titlename{TITRE}
  \def\writtenby{R\'EDIG\'E PAR}
  \def\DBKrefname{R\'EFERENCE}
  \def\DBKindname{NOM}
  \def\DBKindtitle{INDEXATION DU DOCUMENT}
  \def\DBKrevtitle{SUIVI DU DOCUMENT}
  \def\DBKrevdesc{MODIFICATIONS}
  \def\DBKrevnumber{INDICE}
  \def\DBKrevname{NOM}
  \def\DBKrevdate{DATE}
  \def\DBKcontrib{ACTION}
  \def\DBKsignature{SIGNATURE}
}
\langsetupdbk{nb}{
  \def\dbequationname{Ligning}%
  \def\examplename{Eksempel}%
  \def\titlename{Tittel}%
  \def\writtenby{Skrevet av}
  \def\DBKindname{Navn}%
  \def\DBKindtitle{Bidragsliste}%
  \def\DBKrevtitle{Revisjoner}%
  \def\DBKrevdesc{Beskrivelse}%
  \def\DBKrevnumber{Versjon}%
  \def\DBKrevname{Navn}%
  \def\DBKrevdate{Dato}%
  \def\DBKcontrib{Bidrag}%
  \def\DBKsignature{Signatur}%
}
\langsetupdbk{nn}{
  \def\dbequationname{Likning}%
  \def\examplename{D\o{}me}%
  \def\titlename{Tittel}%
  \def\writtenby{Skrevet av}%
  \def\DBKindname{Namn}%
  \def\DBKindtitle{Bidragsliste}%
  \def\DBKrevtitle{Revisjonar}%
  \def\DBKrevdesc{Beskrivelse}%
  \def\DBKrevnumber{Versjon}%
  \def\DBKrevname{Namn}%
  \def\DBKrevdate{Dato}%
  \def\DBKcontrib{Bidrag}%
  \def\DBKsignature{Signatur}%
}
\langsetupdbk{nl}{
  \def\refname{Referenties}%
  \def\abstractname{Samenvatting}%
  \def\bibname{Bibliografie}%
  \def\prefacename{Voorwoord}%
  \def\chaptername{Hoofdstuk}%
  \def\appendixname{Appendix}%
  \def\contentsname{Inhoudstafel}%
  \def\listfigurename{Lijst van figuren}%
  \def\listtablename{Lijst van tabellen}%
  \def\indexname{Index}%
  \def\figurename{{\scshape Figuur }}%
  \def\tablename{{\scshape Tabel }}%

  \def\dbequationname{Vergelijking}
  \def\examplename{Voorbeeld}
  \def\ondate{}
  \renewcommand{\DBKreleaseinfo}{Werkdocument}
  \def\writtenby{GESCHREVEN DOOR}
  \def\projname{PROJECT}
  \def\titlename{TITEL}
  \def\DBKindname{NAAM}
  \def\DBKindtitle{MEDEWERKERS}
  \def\DBKrevtitle{HERZIENINGEN}
  \def\DBKrevdesc{BESCHRIJVING}
  \def\DBKrevnumber{NUMMER}
  \def\DBKrevname{NAAM}
  \def\DBKrevdate{DATUM}
  \def\DBKcontrib{ACTIE}
  \def\DBKsignature{Handtekening}
}
\langsetupdbk{es}{
  \def\refname{Referencia}%
  \def\abstractname{Resumen}%
  \def\bibname{Bibliograf\'ia}%
  \def\prefacename{Prefacio}%
  \def\chaptername{Cap\'itulo}%
  \def\appendixname{Ap\'endice}%
  \def\contentsname{\'Indice de contenido}%
  \def\listfigurename{\'Indice de ilustraciones}%
  \def\listtablename{\'Indice de tablas}%
  \def\indexname{\'Indice de palabras clave}%
  \def\figurename{{\scshape Ilustraci\'on }}%
  \def\tablename{{\scshape Tabla }}%
   
  \def\dbequationname{Ecuaci\'on}
  \def\examplename{Ejemplo}
  \def\ondate{}
  \renewcommand{\DBKreleaseinfo}{Documento de trabajo}
  \def\writtenby{ESCRITO POR}
  \def\projname{PROYECTO}
  \def\titlename{T\'ITULO}
  \def\DBKindname{NOMBRE}
  \def\DBKindtitle{COLABORADORES}
  \def\DBKrevtitle{HISTORIAL DE REVISIONES}
  \def\DBKrevdesc{MODIFICACIONES}
  \def\DBKrevnumber{N\'UMERO}
  \def\DBKrevname{NOMBRE}
  \def\DBKrevdate{FECHA}
  \def\DBKcontrib{ACCI\'ON}
  \def\DBKsignature{FIRMA}
}
% Last-Translator: Giuseppe Sacco <eppesuig@debian.org>
% Translation-Team: Italian translation project <tp@lists.linux.it>
% Translation-Date: 2007-07-25
\langsetupdbk{it}{
  \def\refname{Nome}%
  \def\abstractname{Introduzione}%
  \def\bibname{Bibliografia}%
  \def\prefacename{Prefazione}%
  \def\chaptername{Capitolo}%
  \def\appendixname{Appendice}%
  \def\contentsname{Sommario}%
  \def\listfigurename{Indice delle figure}%
  \def\listtablename{Indice delle tavole}%
  \def\indexname{Indice}%
  \def\figurename{{\scshape Figura }}%
  \def\tablename{{\scshape Tavola }}%
 
  \def\dbequationname{Equazione}
  \def\examplename{Esempio}
  \def\ondate{l\`i}
  \renewcommand{\DBKreleaseinfo}{Documento di lavoro}
  \def\writtenby{A CURA DI}
  \def\projname{PROGETTO}
  \def\titlename{TITOLO}
  \def\DBKindname{NOME}
  \def\DBKindtitle{COLLABORATORI}
  \def\DBKrevtitle{CRONOLOGIA DELLE REVISIONI}
  \def\DBKrevdesc{DESCRIZIONE}
  \def\DBKrevnumber{POSIZIONE}
  \def\DBKrevname{NOME}
  \def\DBKrevdate{DATA}
  \def\DBKcontrib{AZIONE}
  \def\DBKsignature{FIRMA}
}
\langsetupdbk{en}{
  \def\examplename{Example}
  \def\dbequationname{Equation}
  \def\ondate{on}
  \renewcommand{\DBKreleaseinfo}{Working Paper}
  \def\writtenby{WRITTEN BY}
  \def\projname{PROJECT}
  \def\titlename{TITLE}
  \def\DBKrefname{REFERENCE}
  \def\DBKindname{NAME}
  \def\DBKindtitle{COLLABORATORS}
  \def\DBKrevtitle{REVISION HISTORY}
  \def\DBKrevdesc{DESCRIPTION}
  \def\DBKrevnumber{NUMBER}
  \def\DBKrevname{NAME}
  \def\DBKrevdate{DATE}
  \def\DBKcontrib{ACTION}
  \def\DBKsignature{SIGNATURE}
}
\langsetupdbk{ko}{
%  \usepackage{hfont}
  \ifxetex
  \newenvironment{CJK}[3][]{}{}
  \else
  \hypersetup{unicode}
  \usepackage{CJKutf8}
  \fi
}
\langsetupdbk{se}{
  \def\chaptername{Kapihttal}%
  \def\abstractname{Čoahkkáigeassu}%
  \def\partname{Oassi}%
  \def\bibname{Bibliografiija}%
  \def\appendixname{Lasáhus}%
  \def\contentsname{Sisdoallu}%
  \def\listfigurename{Govvosat}%
  \def\listtablename{Tabeallat}%
  \def\dbequationname{Ovttamađodat}%
  \def\examplename{Ovdamearka}%
  \def\figurename{{\scshape Govus }}%
  \def\tablename{{\scshape Tabealla }}%

  \def\titlename{Namahus}%
  \def\writtenby{Čálli(t)}
  \def\DBKindname{Namma}%
  \def\DBKindtitle{Mielbargu}%
  \def\DBKrevtitle{Rievdadeamit}%
  \def\DBKrevdesc{Válddahus}%
  \def\DBKrevnumber{Veršuvdna}%
  \def\DBKrevname{Namma}%
  \def\DBKrevdate{Dáhton}%
  \def\DBKcontrib{Bargu}%
  \def\DBKsignature{Vuolláičála}%
  \def\indexname{Registtar}%
}
\langsetupdbk{zh}{
  \ifxetex
  \newenvironment{CJK}[3][]{}{}
  \else
  \hypersetup{unicode}
  \usepackage{CJKutf8}
  \usepackage{pinyin}
  \fi
}
\langsetupdbk{ja}{
  \ifxetex
  \newenvironment{CJK}[3][]{}{}
  \else
  \hypersetup{unicode}
  \usepackage{CJKutf8}
  \fi
}

%% Define the babel setups in docbook
\babelsetup{cs}{%
  % Shorthand breaks longtable stops
  \AtBeginDocument{\shorthandoff{-}}
}

\babelsetup{fr}{%
  \ifxetex
  % \NoAutoSpaceBeforeFDP does not seem to work when used with XeTeX
  % Take into account the frenchb version in the setup (< v2.5)
  \AtBeginDocument{\@ifundefined{NoAutoSpacing}{%
    \shorthandoff{:;!?}}{\NoAutoSpacing}}
  \fi
  \NoAutoSpaceBeforeFDP
  % Avoid mess between enumitem and french redefinition
  \@ifundefined{ifFrenchItemizeSpacing}{}{\FrenchItemizeSpacingfalse}
  % The same, for recent frenchb release (v2.3)
  \@ifundefined{frenchbsetup}{}{\frenchbsetup{CompactItemize=false}}
}

\babelsetup{es}{%
  % Avoid enumitem to crash with spanish babel
  \let\savees@listquot\es@listquot
  \def\es@listquot{\protect\savees@listquot}

  % Remove those horrible and messy "x shorthands
  \renewcommand\shorthandsspanish{}
}

\babelsetup{de}{%
  % Remove those messy "x shorthands
  % \languageshorthands{none} does not work for lot/lof files
  \AtBeginDocument{\shorthandoff{"}}
}

\babelsetup{ru}{%
  % XeTeX works with russian babel only if xecyr is provided
  \ifxetex\usepackage{xecyr}\fi
  \AtBeginDocument{\shorthandoff{"}}
}

\babelsetup{sk}{%
  % Shorthand breaks longtable stops
  \AtBeginDocument{\shorthandoff{-}}
}

\babelsetup{uk}{%
  % XeTeX works with ukrainian babel only if xecyr is provided
  \ifxetex\usepackage{xecyr}\fi
}

\babelsetup{nn}{\AtBeginDocument{\shorthandoff{"}}}
\babelsetup{nb}{\AtBeginDocument{\shorthandoff{"}}}
\babelsetup{pt}{\AtBeginDocument{\shorthandoff{"}}}
\babelsetup{pt_br}{\AtBeginDocument{\shorthandoff{"}}}

%% Apply default locale setup
\setuplocale{en}

