Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation only works correctly if the language is specified as a class option #839

Open
user227621 opened this issue Mar 6, 2023 · 2 comments

Comments

@user227621
Copy link

If a language is specified as a package option for babel, some words are correctly translated while others are not:

\documentclass{beamer}
\usepackage[ngerman]{babel}


\begin{document}


\section{Erster Abschnitt}


\begin{frame}
\sectionpage
\end{frame}


\begin{frame}
\begin{theorem}
Text
\end{theorem}

\begin{proof}
Text
\end{proof}

\begin{example}
Text
\end{example}
\end{frame}


\begin{frame}
\begin{figure}
\framebox(80,50){}
\caption{Eine Abbildung}
\end{figure}
\end{frame}


\end{document}

beamer-translate2

(The correctly translated words are probably handled by babel's translation mechanism, while the other words are handled by the translator package.)

However, if a language is specified as a class option for beamer, all translations are applied correctly:

\documentclass[ngerman]{beamer}
\usepackage{babel}


\begin{document}


\section{Erster Abschnitt}


\begin{frame}
\sectionpage
\end{frame}


\begin{frame}
\begin{theorem}
Text
\end{theorem}

\begin{proof}
Text
\end{proof}

\begin{example}
Text
\end{example}
\end{frame}


\begin{frame}
\begin{figure}
\framebox(80,50){}
\caption{Eine Abbildung}
\end{figure}
\end{frame}


\end{document}

beamer-translate

From a user's point of view, this is surprising because the beamer user guide does not mention that you have to specify the language as a class option to get correct translations. With other classes you don't have to do this either.

Apparently the translator package does not check whether a language is set e. g. by the babel package, but needs a language option itself. Is this a bug or is this by design? If this is not a bug, I would suggest adding an explanation in the beamer user guide on how to specify a language correctly to get all translations.

On the other hand, the translator user guide states

The translator package is loaded "in stages":

  1. First, some package or the document author requests the translator package
    is loaded.
  2. The translator package allows options like ngerman to be given. These op-
    tions cause the necessary aliases and the correct translator languages to be
    requested.
  3. During the preamble, packages and the document author request creating
    dictionary kinds and certain languages to be used. There requests are stored
    for loading later.
  4. At the beginning of the document the requested dictionary-language pairs
    are loaded.

This sounds as if translator could in principle apply its translations even if the language is only specified as a babel option by looking at the language at the beginning of the document.

@samcarter
Copy link
Collaborator

@user227621 You don't necessarily need to specify the language as class option, you could also pass it to the translator package:

\PassOptionsToPackage{ngerman}{translator}
\documentclass{beamer}
\usepackage[ngerman]{babel}
....

@user227621
Copy link
Author

@samcarter That also works, but is not intuitive either. If the beamer class does not support enabling translations by specifying a language option for the babel package (this is how it works with most other classes), I think there should be an explanation in the beamer user guide on how to specify a language correctly to get all translations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants