Please consider the following MWE:

```
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{etoolbox}

\newcommand*{\convertlang}[1]{%
\ifstrequal{#1}{es}{spanish}{%
  \ifstrequal{#1}{lat}{latin}{%
    \ifstrequal{#1}{eng}{english}{%
      \ifstrequal{#1}{deu}{german}{%
        \ifstrequal{#1}{enm}{spanish}{% else
          % use English as foreign default
          english}}}}}}%

\newcommand*{\langtest}[1]{%
    \def\temp{\convertlang{#1}}%
    \ifstrequal{\temp}{spanish}{True}{False}%
}

\begin{document}

Testing: \convertlang{es} % yields: spanish

\langtest{es} % should yield: True

\end{document}

```

The command `\convertlang` takes an ISO 8859 language code (`es`, `eng`, etc.) and converts it into a babel language name (`spanish`, `english`, etc.). This works fine.

The problem is with `\langtest`, which compares a string (`spanish`) with the result of transforming its argument (`#1`) using `\convertlang`.

There must be a problem in the expansion of `\convertlang` and/or of `#1` there, buy I don't understand the fundamentals of TeX macro expansion.

I tried doing this:

```
\newcommand*{\langtest}[1]{%
    \edef\temp{\convertlang{#1}}%
    \ifstrequal{\temp}{spanish}{True}{False}%
}

```

expecting that `\temp` gets the expanded value of its argument. But this doesn't work either.

How can I fix this?