% variables

\def\authorname{BENINCA}
\def\authorshort{M. \authorname}
\def\authorlong{Marc \authorname}

\def\dateshort{2021}
\def\datelong{\ml{Month DD, \dateshort}{JJ Mois \dateshort}}

\def\instituteshort{CNAM}
\def\institutelong{Conservatoire National des Arts et Métiers}

% set languages
\usepackage{polyglossia}
% recommended
\usepackage{csquotes}
\setmainlanguage{\mainlanguage}
\setotherlanguages{\otherlanguages}

% handle multiple languages

\newcommand{\ifstreq}[4]{\expandafter\ifstrequal\expandafter{#1}{#2}{#3}{#4}}

\def\todo{TODO}

\newcommand{\ml}[2]{%
\ifstreq{\mainlanguage}{english}{\ifstrempty{#1}{\todo}{#1}}{%
\ifstreq{\mainlanguage}{french}{\ifstrempty{#2}{\todo}{#2}}{%
ERROR%
}}%
}

\newcommand{\en}[1]{\textenglish{#1}}

\newcommand{\fr}[1]{\textfrench{#1}}

% variables

\def\titleshort{\ml{Incremental Live OS}{SE autonomes incrémentaux}}
\ml
{\def\titlelong{Incremental Live Operating Systems}
\def\titlesub{a reversal of conventional approaches}}
{\def\titlelong{Systèmes d’Exploitation autonomes incrémentaux}
\def\titlesub{une inversion des approches conventionnelles}}

\ml
{\def\typeshort{Thesis}}
{\def\typeshort{Mémoire}}
\ml
{\def\typelong{\instituteshort\ Master's \typeshort}}
{\def\typelong{\typeshort\ d’Ingénieur \instituteshort}}

% set key words

\def\kwaen{one, two, three, four}
\def\kwafr{un, deux, trois, quatre}

\def\kwben{five, six, seven, eight}
\def\kwbfr{cinq, six, sept, huit}

\newcommand{\kwa}[1]{%
\ifstreq{#1}{english}{\kwaen}{}%
\ifstreq{#1}{french}{\kwafr}{}%
}
\newcommand{\kwb}[1]{%
\ifstreq{#1}{english}{\kwben}{}%
\ifstreq{#1}{french}{\kwbfr}{}%
}

\ml
{\def\kw{\kwaen, \kwben}}
{\def\kw{\kwafr, \kwbfr}}

% links and pdf metadata

\usepackage{hyperref}
\hypersetup{
pdfinfo={
Subject={\typelong},
Keywords={\kw},
},
}

% imports

\input{settings}

% begin document

\begin{document}
