How to change languages before \begin{document} command

In the definition of command \makecvhead (responsible to print the title with the email address) you have to change one line to:

        \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\protect\am\emaillink{\@email}\protect\gr}% <============

See that I added \protect\am and \protect\gr to get the email in english language.

So with the complete code

\documentclass[11pt,a4paper]{moderncv} 

\moderncvstyle{classic} % head 1 body 1 foot 
\moderncvcolor{blue} 
\usepackage[american,greek]{babel}
\usepackage{enumerate}
\usepackage[scale=0.75]{geometry} 
\usepackage[utf8]{inputenc}

\setlength{\hintscolumnwidth}{22mm} 
\setlength{\makecvheadnamewidth}{100mm} 

\newcommand{\gr}{\selectlanguage{greek}}
\newcommand{\am}{\selectlanguage{american}}

\makeatletter
\renewcommand*{\makecvhead}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputecvlengths%
  % optional detailed information (pre-rendering)
  \@initializebox{\makecvheaddetailsbox}%
  \if@details%
    \def\phonesdetails{}%
    \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
      \protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
    \def\socialsdetails{}%
    \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
      \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
    \savebox{\makecvheaddetailsbox}{%
      \addressfont\color{color2}%
      \if@left\begin{tabular}[b]{@{}r@{}}\fi%
      \if@right\begin{tabular}[b]{@{}l@{}}\fi%
        \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
          \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
          \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
        \phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
        \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\protect\am\emaillink{\@email}\protect\gr}% <============
        \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
        \socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
        \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
      \end{tabular}
    }\fi%
  % optional photo (pre-rendering)
  \@initializebox{\makecvheadpicturebox}%
  \savebox{\makecvheadpicturebox}{%
    \ifthenelse{\isundefined{\@photo}}%
      {}%
      {%
        \if@left%
          \hspace*{\separatorcolumnwidth}\fi%
        \color{color1}%
        \setlength{\fboxrule}{\@photoframewidth}%
        \ifdim\@photoframewidth=0pt%
          \setlength{\fboxsep}{0pt}\fi%
        \framebox{\includegraphics[width=\@photowidth]{\@photo}}}%
        \if@right%
          \hspace*{\separatorcolumnwidth}\fi}%
  % name and title (pre-rendering)
  \@initializelength{\makecvheaddetailswidth}\settowidth{\makecvheaddetailswidth}{\usebox{\makecvheaddetailsbox}}%
  \@initializelength{\makecvheadpicturewidth}\settowidth{\makecvheadpicturewidth}{\usebox{\makecvheadpicturebox}}%
  \ifthenelse{\lengthtest{\makecvheadnamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvheadnamewidth=0pt)
    {\setlength{\makecvheadnamewidth}{\textwidth-\makecvheaddetailswidth-\makecvheadpicturewidth}}%
    {}%
  \@initializebox{\makecvheadnamebox}%
  \savebox{\makecvheadnamebox}{%
    \begin{minipage}[b]{\makecvheadnamewidth}%
      \if@left\raggedright\fi%
      \if@right\raggedleft\fi%
      \namestyle{\@firstname\ \@lastname}%
      \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
    \end{minipage}}%
  % rendering
  \if@left%
    \usebox{\makecvheadnamebox}%
    \hfill%
    \llap{\usebox{\makecvheaddetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
    \usebox{\makecvheadpicturebox}\fi%
  \if@right%
    \usebox{\makecvheadpicturebox}%
    \rlap{\usebox{\makecvheaddetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
    \hfill%
    \usebox{\makecvheadnamebox}\fi%
  \\[2.5em]%
  % optional quote
  \ifthenelse{\isundefined{\@quote}}%
    {}%
    {{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
  \par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvhead
\makeatother

%---------------------------------------------------------------------------
%   NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------

\firstname{ΟΝΟΜΑ} % Your first name
\familyname{ΕΠΩΝΥΜΟ} % Your last name

\title{Βιογραφικό Σημείωμα}
\address{Αθήνα, Ελλάδα}
\mobile{(+30) 999999999}
\email{[email protected]}
%\email{\am [email protected] \gr} 
\photo[100pt][0pt]{example-image} 


%-------------------------------------------------------------------------

\begin{document}

\makecvtitle % Print the CV title

%---------------------------------------------------------------------------
%   EDUCATION SECTION
%---------------------------------------------------------------------------

\section{Εκπαίδευση}

whatever..

\end{document}

you get the wished result:

enter image description here


The \emaillink macro used internally by moderncv accepts an optional argument, but \email doesn't.

Here's a way to make \email accept the optional argument, so separating the aspects; this way, we can add typesetting instructions to the “printed” address, while stating an ASCII email address.

\documentclass[11pt,a4paper]{moderncv} 

\moderncvstyle{classic}
\moderncvcolor{blue} 
\usepackage[american,greek]{babel}
\usepackage{enumerate}
\usepackage[scale=0.75]{geometry} 
\usepackage[utf8]{inputenc}
\usepackage{letltxmacro,xpatch}

\setlength{\hintscolumnwidth}{22mm} 
\setlength{\makecvheadnamewidth}{100mm} 

\newcommand{\gr}{\selectlanguage{greek}}
\newcommand{\am}{\selectlanguage{american}}

\makeatletter
\LetLtxMacro\mcvemaillink\emaillink
\renewcommand\email[2][]{%
  \if\relax\detokenize{#1}\relax
    \edef\@email{[\unexpanded{#2}]{\detokenize{#2}}}%
  \else
    \edef\@email{[\unexpanded{#2}]{\detokenize{#1}}}%
  \fi
}
\renewcommand{\emaillink}[1]{\expandafter\mcvemaillink#1}
\makeatother

%---------------------------------------------------------------------------
%   NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------

\firstname{ΟΝΟΜΑ} % Your first name
\familyname{ΕΠΩΝΥΜΟ} % Your last name

\title{Βιογραφικό Σημείωμα}
\address{Αθήνα, Ελλάδα}
\mobile{(+30) 999999999}
\email[[email protected]]{\textlatin{email\_in\[email protected]}}
\photo[100pt][0pt]{example-image} 

%-------------------------------------------------------------------------

\begin{document}

\makecvtitle % Print the CV title

%---------------------------------------------------------------------------
%   EDUCATION SECTION
%---------------------------------------------------------------------------

\section{Εκπαίδευση}

whatever..

\end{document}

enter image description here

Tags:

Moderncv