<h1>Internationalization<aclass="headerlink"href="#internationalization"title="Permalink to this headline">¶</a></h1>
<p><em>Internationalization</em> (often abbreviated <em>i18n</em> since there are 18 characters between the first “i”
and the last “n” in that word) allows Evennia’s core server to return texts in other languages than
English - without anyone having to edit the source code. Take a look at the <codeclass="docutils literal notranslate"><spanclass="pre">locale</span></code> directory of
the Evennia installation, there you will find which languages are currently supported.</p>
<divclass="section"id="changing-server-language">
<h2>Changing server language<aclass="headerlink"href="#changing-server-language"title="Permalink to this headline">¶</a></h2>
<p>Change language by adding the following to your <codeclass="docutils literal notranslate"><spanclass="pre">mygame/server/conf/settings.py</span></code> file:</p>
<p>Here <codeclass="docutils literal notranslate"><spanclass="pre">'en'</span></code> should be changed to the abbreviation for one of the supported languages found in <codeclass="docutils literal notranslate"><spanclass="pre">locale/</span></code>. Restart the server to activate i18n. The two-character international language codes are found <aclass="reference external"href="http://www.science.co.il/Language/Codes.asp">here</a>.</p>
<blockquote>
<div><p>Windows Note: If you get errors concerning <codeclass="docutils literal notranslate"><spanclass="pre">gettext</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">xgettext</span></code> on Windows, see the <aclass="reference external"href="https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#gettext-on-windows">Django documentation</a>. A self-installing and up-to-date version of gettext for Windows (32/64-bit) is available on <aclass="reference external"href="https://github.com/mlocati/gettext-iconv-windows">Github</a>.</p>
</div></blockquote>
</div>
<divclass="section"id="translating-evennia">
<h2>Translating Evennia<aclass="headerlink"href="#translating-evennia"title="Permalink to this headline">¶</a></h2>
<blockquote>
<div><p><strong>Important Note:</strong> Evennia offers translations of hard-coded strings in the server, things like “Connection closed” or “Server restarted”, strings that end users will see and which game devs are not supposed to change on their own. Text you see in the log file or on the command line (like error messages) are generally <em>not</em> translated (this is a part of Python).</p>
</div></blockquote>
<blockquote>
<div><p>In addition, text in default Commands and in default Typeclasses will <em>not</em> be translated by switching <em>i18n</em> language. To translate Commands and Typeclass hooks you must overload them in your game directory and translate their returns to the language you want. This is because from Evennia’s perspective, adding <em>i18n</em> code to commands tend to add complexity to code that is <em>meant</em> to be changed anyway. One of the goals of Evennia is to keep the user-changeable code as clean and easy-to-read as possible.</p>
</div></blockquote>
<p>If you cannot find your language in <codeclass="docutils literal notranslate"><spanclass="pre">evennia/locale/</span></code> it’s because noone has translated it yet. Alternatively you might have the language but find the translation bad … You are welcome to help improve the situation!</p>
<p>To start a new translation you need to first have cloned the Evennia repositry with GIT and activated a python virtualenv as described on the <aclass="reference internal"href="Getting-Started.html"><spanclass="doc">Getting Started</span></a> page. You now need to <codeclass="docutils literal notranslate"><spanclass="pre">cd</span></code> to the <codeclass="docutils literal notranslate"><spanclass="pre">evennia/</span></code> directory. This is <em>not</em> your created game folder but the main Evennia library folder. If you see a folder <codeclass="docutils literal notranslate"><spanclass="pre">locale/</span></code> then you are in the right place. From here you run:</p>
<p>where <codeclass="docutils literal notranslate"><spanclass="pre"><language-code></span></code> is the <aclass="reference external"href="http://www.science.co.il/Language/Codes.asp">two-letter locale code</a> for the language you want, like ‘sv’ for Swedish or ‘es’ for Spanish. After a moment it will tell you the language has been processed. For instance:</p>
<p>If you started a new language a new folder for that language will have emerged in the <codeclass="docutils literal notranslate"><spanclass="pre">locale/</span></code> folder. Otherwise the system will just have updated the existing translation with eventual new strings found in the server. Running this command will not overwrite any existing strings so you can run it as much as you want.</p>
<blockquote>
<div><p>Note: in Django, the <codeclass="docutils literal notranslate"><spanclass="pre">makemessages</span></code> command prefixes the locale name by the <codeclass="docutils literal notranslate"><spanclass="pre">-l</span></code> option (<codeclass="docutils literal notranslate"><spanclass="pre">...</span><spanclass="pre">makemessages</span><spanclass="pre">-l</span><spanclass="pre">sv</span></code> for instance). This syntax is not allowed in Evennia, due to the fact that <codeclass="docutils literal notranslate"><spanclass="pre">-l</span></code> is the option to tail log files. Hence, <codeclass="docutils literal notranslate"><spanclass="pre">makemessages</span></code> doesn’t use the <codeclass="docutils literal notranslate"><spanclass="pre">-l</span></code> flag.</p>
</div></blockquote>
<p>Next head to <codeclass="docutils literal notranslate"><spanclass="pre">locale/<language-code>/LC_MESSAGES</span></code> and edit the <codeclass="docutils literal notranslate"><spanclass="pre">**.po</span></code> file you find there. You can edit this with a normal text editor but it is easiest if you use a special po-file editor from the web (search the web for “po editor” for many free alternatives).</p>
<p>The concept of translating is simple, it’s just a matter of taking the english strings you find in
the <codeclass="docutils literal notranslate"><spanclass="pre">**.po</span></code> file and add your language’s translation best you can. The <codeclass="docutils literal notranslate"><spanclass="pre">**.po</span></code> format (and many
supporting editors) allow you to mark translations as “fuzzy”. This tells the system (and future
translators) that you are unsure about the translation, or that you couldn’t find a translation that
exactly matched the intention of the original text. Other translators will see this and might be
able to improve it later.
Finally, you need to compile your translation into a more efficient form. Do so from the <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span></code> folder
<p>This will go through all languages and create/update compiled files (<codeclass="docutils literal notranslate"><spanclass="pre">**.mo</span></code>) for them. This needs to be done whenever a <codeclass="docutils literal notranslate"><spanclass="pre">**.po</span></code> file is updated.</p>
<p>When you are done, send the <codeclass="docutils literal notranslate"><spanclass="pre">**.po</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">*.mo</span></code> file to the Evennia developer list (or push it into your own repository clone) so we can integrate your translation into Evennia!</p>