XeLaTeX + \ifthenelse:

I use XelaTeX to produce my CV.

Currently, I want to update it and have both Slovak and English CV within one document.

I want to have all strings of one language grouped in the preamble, same for the other. (That is, I don’t want to have the string after \begin{document}).

I want to create \cvlang using \def \cvlang {sk} % Options: en | sk. This way I can switch between languages quite easily.

Now, I have no idea, how to check what is the current value of the \cvlang. I want to create something like this (if syntax borrowed from Javascript; incorporated some TeX commands):

if (\cvlang == "sk"){
\def \lgdatebirthplace {Dátum a miesto\\ narodenia}
\def \lgphone {Telefón}
\def \lgemail {Email}
}else if{
\def \lgdatebirthplace {Date and place of birth}
\def \lgphone {Phone}
\def \lgemail {Email}
}


I don’t care about the package/command/syntax—it can be anything.

I tried to use ifthen package, but I’ve some errors at PDF compilation:

\usepackage{ifthen}
\ifthenelse{\equal{\lang}{sk}}{
\def \lgdatebirthplace {Dátum a miesto\\ narodenia}
\def \lgphone {Telefón}
\def \lgemail {Email}
}{
\def \lgdatebirthplace {Date and place of birth}
\def \lgphone {Phone}
\def \lgemail {Email}
}%


I tried to use pdftexcmds package, however, this does not work either:

% \usepackage{pdftexcmds}
% \ifnum\pdf@strcmp{\cvlang}{sk}{
\def \lgdatebirthplace {Dátum a miesto\\ narodenia}
\def \lgphone {Telefón}
\def \lgemail {Email}
\else
\def \lgdatebirthplace {Date and place of birth}
\def \lgphone {Phone}
\def \lgemail {Email}
\fi


Questions and answers I checked and tried to implement: - On testing two fully expanded character strings for equality

PS—I am quite new to TeX and I have never used any conditionals in it.

There is no need for ifthen here. Add your definitions to the babel interface:

\documentclass{book}
\usepackage[english]{babel}
%\usepackage[slovak]{babel}

• This works as expected, however, I use some of these ‘variables’ (i.e. command definitions that outputs a string) with hyperref packages, concreately with hypersetup, which now throughs errors (Undefined control sequence. <argument> \pdfauthor). It looks like this: \hypersetup{ pdfauthor={\pdfauthor}, pdftitle={\pdftitle}, pdfsubject={\pdfsubtitle}, pdfkeywords={\pdfkeywords}, pdfsubject={\pdfsubject} }. – tukusejssirs Mar 11 '19 at 18:58