\documentclass[DIV=13,%
               BCOR=0mm,%
               headinclude=false,%
               footinclude=false,open=any,%
               fontsize=10pt,%
               oneside,%
               paper=a5]%
               {scrbook}






\usepackage[noautomatic]{imakeidx}



\usepackage{microtype}
\usepackage{graphicx}
\usepackage{alltt}
\usepackage{verbatim}
\usepackage[shortlabels]{enumitem}
\usepackage{tabularx}
\usepackage[normalem]{ulem}
\def\hsout{\bgroup \ULdepth=-.55ex \ULset}
% https://tex.stackexchange.com/questions/22410/strikethrough-in-section-title
% Unclear if \protect \hsout is needed. Doesn't looks so
\DeclareRobustCommand{\sout}[1]{\texorpdfstring{\hsout{#1}}{#1}}
\usepackage{wrapfig}

% avoid breakage on multiple <br><br> and avoid the next [] to be eaten
\newcommand*{\forcelinebreak}{\strut\\*{}}

\newcommand*{\hairline}{%
  \bigskip%
  \noindent \hrulefill%
  \bigskip%
}

% reverse indentation for biblio and play

\newenvironment*{amusebiblio}{
  \leftskip=\parindent
  \parindent=-\parindent
  \smallskip
  \indent
}{\smallskip}

\newenvironment*{amuseplay}{
  \leftskip=\parindent
  \parindent=-\parindent
  \smallskip
  \indent
}{\smallskip}

\newcommand*{\Slash}{\slash\hspace{0pt}}


% http://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url
\PassOptionsToPackage{hyphens}{url}\usepackage[hyperfootnotes=false,hidelinks,breaklinks=true]{hyperref}
\usepackage{bookmark}

\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setmainfont{texgyrepagella-regular.otf}[Script=Latin,%
 Ligatures=TeX,%
 Path=/usr/share/texmf/fonts/opentype/public/tex-gyre/,%
 BoldFont=texgyrepagella-bold.otf,%
 BoldItalicFont=texgyrepagella-bolditalic.otf,%
 ItalicFont=texgyrepagella-italic.otf]
\setmonofont{cmuntt.ttf}[Script=Latin,%
 Ligatures=TeX,%
 Scale=MatchLowercase,%
 Path=/usr/share/fonts/truetype/cmu/,%
 BoldFont=cmuntb.ttf,%
 BoldItalicFont=cmuntx.ttf,%
 ItalicFont=cmunit.ttf]
\setsansfont{cmunss.ttf}[Script=Latin,%
 Ligatures=TeX,%
 Scale=MatchLowercase,%
 Path=/usr/share/fonts/truetype/cmu/,%
 BoldFont=cmunsx.ttf,%
 BoldItalicFont=cmunso.ttf,%
 ItalicFont=cmunsi.ttf]
\newfontfamily\englishfont{texgyrepagella-regular.otf}[Script=Latin,%
 Ligatures=TeX,%
 Path=/usr/share/texmf/fonts/opentype/public/tex-gyre/,%
 BoldFont=texgyrepagella-bold.otf,%
 BoldItalicFont=texgyrepagella-bolditalic.otf,%
 ItalicFont=texgyrepagella-italic.otf]



\renewcommand*{\partpagestyle}{empty}


% global style

\pagestyle{plain}




\usepackage{indentfirst}

% remove the numbering
\setcounter{secnumdepth}{-2}

% remove labels from the captions
\renewcommand*{\captionformat}{}
\renewcommand*{\figureformat}{}
\renewcommand*{\tableformat}{}
\KOMAoption{captions}{belowfigure,nooneline}
\addtokomafont{caption}{\centering}







\deffootnote[3em]{0em}{4em}{\textsuperscript{\thefootnotemark}~}


\addtokomafont{disposition}{\rmfamily}
\addtokomafont{descriptionlabel}{\rmfamily}


\frenchspacing
% avoid vertical glue
\raggedbottom

% this will generate overfull boxes, so we need to set a tolerance
% \pretolerance=1000
% pretolerance is what is accepted for a paragraph without
% hyphenation, so it makes sense to be strict here and let the user
% accept tweak the tolerance instead.
\tolerance=200
% Additional tolerance for bad paragraphs only
\setlength{\emergencystretch}{30pt}

% (try to) forbid widows/orphans
\clubpenalty=10000
\widowpenalty=10000





% given that we said footinclude=false, this should be safe
\setlength{\footskip}{2\baselineskip}

\title{Localization}
\date{}
\author{}
\subtitle{}






% https://groups.google.com/d/topic/comp.text.tex/6fYmcVMbSbQ/discussion
\hypersetup{%
pdfencoding=auto,
pdftitle={Localization},%
pdfauthor={},%
pdfsubject={},%
pdfkeywords={doc; howto}%
}


\begin{document}






  \begin{titlepage}


  \strut\vskip 2em
  \begin{center}

  {\usekomafont{title}{\huge Localization\par}}%
  \vskip 1em
  
  \vskip 2em
  
  \vskip 1.5em



   
   \vfill



  
    \strut\par
  


  \end{center}


     \end{titlepage}
     
     \cleardoublepage



\tableofcontents
% start a new right-handed page

\cleardoublepage




If you need to update the translations in the UI, you have two ways to
do that, globally or locally for a single site.

\section{Global}


GNU gettext message catalogues (.po files) are located at
\texttt{lib/AmuseWikiFarm/I18N/xx.po}, where xx is the language code. Changes
done here shouldn't be site specific and if you improve the
translations, please send the updated .po file to me
(melmothx@gmail.com) or fork the amusewiki repo and do a pull request,
making sure you're aligned to the latest master branch.

\section{Local \texttt{PO} files}


You can override the UI translations and provide them for the
categories as well (if your site is multilingual or if you use codes
instead of strings) storing the relevant po files into the
\texttt{site\_files/locales} directory in the site repository (e.g.
\texttt{repo/amw/site\_files/locales/hr.po}).

\section{\texttt{lexicon.json}}


Before version 1.8, the only way to override the translation was using
a JSON file in the \texttt{site\_files/lexicon.json} file.


Internally, the application will see only the PO files. However,
depending on your needs and preferences, you may find less complicated
to continue to use this file instead of the po files.


On application restart, these files are read and PO file produced (or
when you call amusewiki-upgrade-lexicon against the repo directory.


So, you have two alternative ways:


\begin{itemize}
\item\relax 
leave the po files uncommitted in the git repo, and continue as
before (keeping in mind that you need to manually restart the app
or call \texttt{amusewiki-upgrade-lexicon} to produce the po files when you
update it).



\item\relax 
commit the po files in the git and remove \texttt{lexicon.json}, banishing
it.




\end{itemize}

Mixing the two approaches will just lead to confusion, git conflicts,
and so on.


The format is as follows (plain JSON):


\begin{alltt}
\{
   "term" : \{
      "hr" : "Term in croatian",
      "en" : "Term in english",
      "it" : "Term in italian"
   \},
   "another term [\_1]" : \{
      "hr" : "Another term in croatian with an argument [\_1]",
      "en" : "Another term in english with an argument [\_1]",
      "it" : "Another term in italian with an argumetn [\_1]"
   \}
\}
\end{alltt}


The JSON must be correct, otherwise you will not get any translation
out of that. You can use arguments for translations with the \texttt{[\_1]},
\texttt{[\_2]} syntax or the gettext syntax (\texttt{\%1}, \texttt{\%2}, etc.).


Strings are expected to be unescaped (HTML-wise).


To validate the lexicon file prior to upload, use this (somehow
longish) one-liner:


\begin{alltt}
perl -MJSON -MData::Dumper \textbackslash{}
     -e 'open (my \$fh, "<:encoding(UTF-8)", "site\_files/lexicon.json");
         \$/ = undef; my \$json = <\$fh>;
            print Data::Dumper::Dumper(JSON::from\_json(\$json));'

\end{alltt}


You can create the po files out of those files with the script
\texttt{amusewiki-upgrade-lexicon}. E.g.


\begin{alltt}
script/amusewiki-upgrade-lexicon repo/*
\end{alltt}


Which will parse the lexicon.json files and dump the po files, merging
them if already existing. No git operation is performed.

\section{Adding a new language (developer-only)}


Go to lib\Slash{}AmuseWikiFarm\Slash{}I18N and run (for example to add swedish)


\begin{alltt}
msginit --input=messages.pot --output=sv.po --locale=sv
\end{alltt}


Add the language code and the language string to the
\texttt{AmuseWikiFarm::Utils::Amuse::known\_langs} method.


Add the datatable alias for i18n at \texttt{AmuseWikiFarm::Controller::API}


Add the language code to the \texttt{script/upgrade\_i18n} script.


Add the babel name to \texttt{Text::Amuse::Utils} if missing.


Run \texttt{make manifest}







% begin final page

\clearpage



% new page for the colophon

\thispagestyle{empty}

\begin{center}





\bigskip
\includegraphics[width=0.25\textwidth]{logo-amw.pdf}
\bigskip

\end{center}

\strut

\vfill

\begin{center}




Localization






\bigskip



   

       

       

       

       

       
   



\bigskip
\textbf{amusewiki.org}


\end{center}

% end final page with colophon


\end{document}


% No format ID passed.



