[Tex/LaTex] how to change language within the .cls file

babelgreeklanguages

The problem is this: I want to use in the custom class file (named thesis.cls), a different language than English, Greek to be specific. In the .tex file I loaded the babel package with the command

\usepackage[greek,english]{babel}

that is, English as my main language. Also to change language in the .tex file I use

\newcommand{\gr}{\selectlanguage{greek}}
\newcommand{\en}{\selectlanguage{english}}

Now inside the .cls file I want to create the text below for the .tex file.

%%%%%%%%%%%%%%%%%%
\newcommand\Declaration[1]{
\btypeout{Declaration of Authorship}
\addtotoc{Declaration of Authorship}
\thispagestyle{plain}
\null\vfil
%\vskip 60\p@
\begin{center}{\huge\bf{\gr{Δήλωση Προστασίας Πνευματικών Δικαιωμάτων}}\par}\end{center}
%\vskip 60\p@
{\normalsize #1}
\vfil\vfil\null
%\cleardoublepage
}
%%%%%%%%%%%%%%%%%%%

My problem is that the Greek sentence

<<Δήλωση Προστασίας Πνευματικών Δικαιωμάτων>>

is output in a machine-like language. How can I write it in Greek?

%%%%%%%%%%
%thesis.cls (excerpt)
%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
              [2007/22/02 v1.0
   LaTeX document class]

% declaration of options
\newif\ifdext@languagechosen

\DeclareOption{greek}{%
  \PassOptionsToPackage{greek}{babel}
  \dext@languagechosentrue
}
\DeclareOption{english}{%
  \PassOptionsToPackage{english}{babel}
  \dext@languagechosentrue
}

\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
  \edef\@curroptions{\@ptionlist{\@currname.\@currext}}
  \@tempswafalse
  \@tfor\@this:=#2\do{
    \@expandtwoargs\in@{,\@this,}{,\@curroptions,}
    \ifin@ \@tempswatrue \@break@tfor \fi}
  \let\@this\@empty
  \if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\LoadClass{\baseclass}
\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}

\newcommand\Declaration[1]{
\btypeout{Declaration of Authorship}
\addtotoc{Declaration of Authorship}
\thispagestyle{plain}
\null\vfil
%\vskip 60\p@
\begin{center}{\huge\bf{\tg{Δήλωση Προστασίας Πνευματικών Δικαιωμάτων}}\par}\end{center}
%\vskip 60\p@
{\normalsize #1}
\vfil\vfil\null
%\cleardoublepage
}

Here is my LaTeX file

%%%%%%%%%%%%%%%%%%%%%%%%%%%
.tex file
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[11pt, a4paper, oneside]{Thesis} % Paper size, default font size and one-sided paper
\usepackage{kmath,kerkis} % The order of the packages matters; kmath changes the default text font
\usepackage[greek,english]{babel}
\usepackage[utf8x]{inputenx}

Best Answer

Don't modify the class. I think to have downloaded the one you refer to. I took the Thesis.tex file and changed the first line (with \documentclass) into

\documentclass[a4paper, 11pt, oneside]{Thesis}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[greek,english]{babel}
\makeatletter
\renewcommand\Declaration[1]{%
  \btypeout{Declaration of Authorship}
  \addtotoc{Declaration of Authorship}
  \thispagestyle{plain}
  \null\vfil
  \vskip 60\p@
  \begin{center}\huge\bfseries
    \textgreek{Δήλωση Προστασίας Πνευματικών Δικαιωμάτων}
  \end{center}
  \vskip 60\p@
  {\normalsize #1}
  \vfil\vfil\null
  \cleardoublepage
}
\makeatother

and the Declaration page became like so

enter image description here

I just had to fix the encoding of the Chapters/Chapter1.tex file and the compilation ran smoothly with a TeX Live 2012 and also with the 2013 release. I suggest you to update your TeX distribution, and to change the utf8x option into utf8.