Chemmacros scheme translation

One issue is here an error in the manual.

You have to use the following definitions

\DeclareChemTranslation{scheme}{spanish}{esquema} % <===================
\DeclareChemTranslation{Scheme}{spanish}{Esquema} % <===================

to get no error message. Please see that the order of parameters has changed! First key, then language and then translation. In the manual this is simply wrong (see red arrow with flash), but the second command works as described ...

snippet of manual

Perhaps because l3kernel has changed it seems that the definitions above do not find their way into the document. Please see the following code

\documentclass[spanish]{article} % <====================================

\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\usepackage{chemmacros}
\chemsetup{modules={scheme}}
%\chemsetup{language={spanish}}
\DeclareChemTranslation{scheme}{spanish}{esquema} % <===================
\DeclareChemTranslation{Scheme}{spanish}{Esquema} % <===================
%\DeclareChemTranslations{scheme}{spanish=esquema} % <==================
%\DeclareChemTranslations{Scheme}{spanish=Esquema} % <==================


\begin{document}

    \begin{scheme}
        \caption{Lorem ipsum}
    \end{scheme}

\end{document}

and its result (compiled with MIKTeX version pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7050 64-bit)):

resulting pdf

As you can see the language for scheme has not changed!

Now adding

\renewcommand{\schemename}{Esquema}

after \begin{document} gives you the following result:

resulting pdf

while adding the same line before \begin{documents} results in an error because command \schemename is only known after document has started ...

I did not investigated now the code (I did not learn using l3kernel until now) what is the reason that the new defined translation for scheme in spanish is not printed in the document.

I suggest you make a bug report for the maintainer of that package to get the manual corrected and to get an working translation ...


As @Mensch already mentioned, the manual is wrong and the language should come second. Moreover, the list of translation keys in the manual is also a bit confusing. The list mentions both scheme and scheme-name, but only scheme-name works. This can be traced in the source code of the scheme module around line 250, where schema-name is used for the predefined translation to German - but again somewhat confusingly in a \ChemCompatibilityTo{5.6} block, so it might be an old version of the syntax - but at least it works.

An issue on the Github page certainly looks like a good idea, to update the manual and/or the code to make the behavior more intuitive.

MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\usepackage{chemmacros}
\chemsetup{modules={scheme}}
\DeclareChemTranslation{scheme-name}{spanish}{Esquema}

\begin{document}

    \begin{scheme}
        \caption{Lorem ipsum}
    \end{scheme}

\end{document}

Result:

enter image description here