Commits

Joseph Wright committed 22f1e50

Fix \iftranslationdefined test (fixes #84)

The test here was defective as it did not watch the impact of repeated
tests. This version should be OK, and does not pollute the name table:
of course, ideally we'd require e-TeX and use \ifcsname!

  • Participants
  • Parent commits 1443917

Comments (0)

Files changed (1)

File base/translator/translator.sty

 \newcommand\iftranslationdefined[4][]{%
   \def\trans@to{\trans@defaultto}%
   \setkeys{translator}{#1}%
-  \expandafter\ifx\csname tr@@@\trans@to @#2\endcsname\@undefined%
+  \begingroup\expandafter\expandafter\expandafter\endgroup
+  \expandafter\ifx\csname tr@@@\trans@to @#2\endcsname\relax%
+    \let\trans@next=\@secondoftwo%
+  \else%
     \let\trans@next=\@firstoftwo%
-  \else%
-    \let\trans@next=\@secondoftwo%
   \fi%
   \trans@next{#3}{#4}%
 }
 
 \newcommand\newtranslation[3][]{%
   \iftranslationdefined[#1]{#2}{%
-    \PackageError{translator}{Translation of ``#2'' already defined.}{}%
+    \PackageError{translator}{Translation of '#2' already defined}{}%
   }%
   {%
     \deftranslation[#1]{#2}{#3}%
     \deftranslation[#1]{#2}{#3}%
   }%
   {%
-    \PackageError{translator}{Translation of ``#2'' not defined.}{}%
+    \PackageError{translator}{Translation of '#2' not defined}{}%
   }%
 }