[Tex/LaTex] Beamer newtheorem translation

beamertheorems

Consider the following MWE:

\documentclass{beamer}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\uselanguage{Spanish}
\languagepath{Spanish}

\deftranslation[to=Spanish]{Proposition}{Proposición}
\newtheorem{proposition}[theorem]{Proposition}

\begin{document}
\begin{frame}
  \begin{proposition}
    Foo
  \end{proposition}
\end{frame}
\end{document}

This will print the Proposition environment as Proposition and I want it printed as Proposición. I know I can define the new environment as \newtheorem{proposition}[theorem]{Proposición} but I was wondering if the translation can be done automatically i.e if the language of the document is spanish and a new theorem environment is defined as \newtheorem{proposition}[theorem]{Proposition} then print the word Proposition in spanish.

Best Answer

The following likely won't work in the real world so you'll have to try it and see. However, it does at least produce the right result for the MWE.

\documentclass{beamer}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\uselanguage{Spanish}
\languagepath{Spanish}

\newtheorem{proposition}[theorem]{\translate{Proposition}}

\begin{document}
\begin{frame}
  \begin{proposition}
    Foo
  \end{proposition}
\end{frame}
\end{document}

A Spanish proposition