From db4d41b67e25a02c4a3478b1eae4434d98313837 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sat, 4 Jun 2016 13:35:47 +0200 Subject: [PATCH] Implement proper multi-language support. That is, actually translate "Slide" and provide German and English dictionaries usable both with beamer's translator package and polyglossia. Make English the main language of the example. --- Makefile | 2 +- beamerthemetokkee.sty | 3 ++ example.tex | 49 ++++++++++++------- ...lator-tokkeebeamer-dictionary-English.dict | 31 ++++++++++++ ...slator-tokkeebeamer-dictionary-German.dict | 31 ++++++++++++ 5 files changed, 98 insertions(+), 18 deletions(-) create mode 100644 translator-tokkeebeamer-dictionary-English.dict create mode 100644 translator-tokkeebeamer-dictionary-German.dict diff --git a/Makefile b/Makefile index 12df52e..b509107 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ TEXMFHOME := $(shell kpsewhich -expand-var \$$TEXMFHOME) all: example.pdf -example.pdf: example.tex beamerthemetokkee.sty beamercolorthemetokkee.sty tokkee_logo.* Makefile +example.pdf: example.tex *.sty *.dict tokkee_logo.* Makefile # the default titlegraphic requires the presentation to be compiled twice xelatex example.tex xelatex example.tex diff --git a/beamerthemetokkee.sty b/beamerthemetokkee.sty index 467ecc9..2a9b7a1 100644 --- a/beamerthemetokkee.sty +++ b/beamerthemetokkee.sty @@ -30,6 +30,9 @@ \usecolortheme{tokkee} +\usepackage{translator} +\usedictionary{translator-tokkeebeamer-dictionary} + \usepackage{tikz} \usetikzlibrary{positioning} diff --git a/example.tex b/example.tex index b346ac2..5306ef6 100644 --- a/example.tex +++ b/example.tex @@ -24,20 +24,24 @@ % ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. % \documentclass{beamer} +\uselanguage{German} + \usetheme{tokkee} \usepackage{fontspec,xunicode,polyglossia} +\setdefaultlanguage{english} +\setotherlanguage[spelling=new]{german} \usepackage{xeCJK} \renewcommand\CJKfamilydefault{\CJKsfdefault} \setCJKsansfont{WenQuanYi Zen Hei} -\title[Beamer-Vorlage]{Meine tolle Beamer-Vorlage} -\subtitle{\LaTeX{} beamer für tokkee.net} +\title[Beamer Template]{tokkee's \LaTeX{} Beamer Template} +\subtitle{\LaTeX{} beamer for tokkee.net} \date{\today} \institute{tokkee.net} \author{Sebastian Harl\\ $<$sh@tokkee.org$>$} -\copyrightinfo{\copyright{} 2013 Sebastian `tokkee' Harl, All rights reserved.} +\copyrightinfo{\copyright{} 2013-2016 Sebastian `tokkee' Harl, All rights reserved.} \AtBeginSection[] { @@ -52,32 +56,43 @@ \begin{document} \frame[plain]{\titlepage} -\begin{frame}{Hallo 世界} - Dies ist ein Beispiel für tokkee's Beamer-Vorlage.\\[5mm] +\begin{frame}{Hello 世界} + This is an example slide deck using tokkee's beamer templates.\\[5mm] - {\Large Hallo 世界} + {\Large Hello 世界} \end{frame} -\section{Beispiel} +\section{Example} -\begin{frame}{Beispiel} +\begin{frame}{Example} Text: \begin{itemize} - \item Stichpunkt + \item Bullet point \begin{itemize} - \item Unterpunkt + \item sub item \end{itemize} - \item Noch ein Stichpunkt + \item More bullet points + \item ... \end{itemize} \end{frame} -\begin{frame}{Noch ein {\ttfamily frame}}{... mit Subtitel} - Mehr Text: +\selectlanguage{german} +\begin{frame}{Mehrere Sprachen} + Mehr Text (jetzt in Deutsch mit Umlauten und Sonderzeichen): + + \begin{quote} + Franz jagt im komplett verwahrlosten Taxi quer durch Bayern. Stanleys + Expeditionszug quer durch Afrika wird von jedermann bewundert. Prall + vom Whisky flog Quax den Jet zu Bruch. Vogel Quax zwickt Johnys Pferd + Bim. Sylvia wagt quick den Jux bei Pforzheim.\\[2mm] + + Vogt Nyx: »Büß du ja zwölf Qirsch, Kämpe!« + \end{quote} +\end{frame} - Franz jagt im komplett verwahrlosten Taxi quer durch Bayern. Stanleys - Expeditionszug quer durch Afrika wird von jedermann bewundert. Prall vom - Whisky flog Quax den Jet zu Bruch. Vogel Quax zwickt Johnys Pferd Bim. - Sylvia wagt quick den Jux bei Pforzheim. +\selectlanguage{english} +\begin{frame}{Back to English} + Note how the slide numbering switched between ``Slide'' and ``Folie''. \end{frame} \end{document} diff --git a/translator-tokkeebeamer-dictionary-English.dict b/translator-tokkeebeamer-dictionary-English.dict new file mode 100644 index 0000000..17fe137 --- /dev/null +++ b/translator-tokkeebeamer-dictionary-English.dict @@ -0,0 +1,31 @@ +% +% Copyright (C) 2013-2016 Sebastian 'tokkee' Harl +% All rights reserved. +% +% Redistribution and use in source and binary forms, with or without +% modification, are permitted provided that the following conditions +% are met: +% 1. Redistributions of source code must retain the above copyright +% notice, this list of conditions and the following disclaimer. +% 2. Redistributions in binary form must reproduce the above copyright +% notice, this list of conditions and the following disclaimer in the +% documentation and/or other materials provided with the distribution. +% +% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +% ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +% TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +% PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR +% CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +% EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +% PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +% OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +% WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +% OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +% ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +% +\ProvidesDictionary{translator-tokkeebeamer-dictionary}{English}% + [2016/06/04 v0.02 tokkee's utilities/add-ons for LaTeX beamer] + +\languagealias{english}{English} + +\providetranslation{Slide}{Slide} diff --git a/translator-tokkeebeamer-dictionary-German.dict b/translator-tokkeebeamer-dictionary-German.dict new file mode 100644 index 0000000..da04bd3 --- /dev/null +++ b/translator-tokkeebeamer-dictionary-German.dict @@ -0,0 +1,31 @@ +% +% Copyright (C) 2013-2016 Sebastian 'tokkee' Harl +% All rights reserved. +% +% Redistribution and use in source and binary forms, with or without +% modification, are permitted provided that the following conditions +% are met: +% 1. Redistributions of source code must retain the above copyright +% notice, this list of conditions and the following disclaimer. +% 2. Redistributions in binary form must reproduce the above copyright +% notice, this list of conditions and the following disclaimer in the +% documentation and/or other materials provided with the distribution. +% +% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +% ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +% TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +% PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR +% CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +% EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +% PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +% OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +% WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +% OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +% ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +% +\ProvidesDictionary{translator-tokkeebeamer-dictionary}{German}% + [2016/06/04 v0.02 tokkee's utilities/add-ons for LaTeX beamer] + +\languagealias{german}{German} + +\providetranslation{Slide}{Folie} -- 2.30.2