1 <h1 id=
"translations">Translations
</h1>
2 <p>To update the language files you just need to know a bit of GIT. This page should help
3 with the structure of language files.
</p>
4 <h2 id=
"where-are-the-language-files-">Where are the language files?
</h2>
5 <p>There are two places where language override files are stored. The LANG_CODE is the two
6 letter code for that language. Eg: en, fr, de
</p>
7 <h3 id=
"strings">Strings
</h3>
8 <p><code>src/lang/_strings/LANG_CODE.po
</code></p>
10 <li>This is strings used throughout the application. In general, only update
<code>msgstr
</code>.
</li>
11 <li>If there is no
<code>msgstr
</code> for the string, then copy from en.po and update, Eg de.po.
<pre><code>msgctxt
<span class=
"hljs-string">""</span>
12 msgid
<span class=
"hljs-string">"Select a filter"</span>
13 msgstr
<span class=
"hljs-string">"Filter wählen"</span>
16 <h3 id=
"pages">Pages
</h3>
17 <p><code>src/lang/LANG_CODE/PAGE.md
</code></p>
19 <li>These are full pages that can be overridden with a different language.
</li>
20 <li>The pages are in
<a href=
"https://en.wikipedia.org/wiki/Markdown">markdown
</a>.
</li>
21 <li>If there is no
<em>PAGE
</em>.md for yor language then copy from the en folder and edit.
</li>
22 <li>Only create a
<em>PAGE
</em>.md for a full translation
</li>
24 <h2 id=
"adding-a-new-language">Adding a new language
</h2>
25 <p><strong>Example:
</strong> If your new language is
<code>French
</code> it would have a
<em>LANG_KEY
</em> of
<code>fr
</code>.
</p>
26 <h3 id=
"tell-the-app-about-it">Tell the app about it
</h3>
27 <p>You also need to tell the application to have it as an option. So you edit this file:
28 <code>/src/js/helpers/translate.js.coffee
</code> and add
<code>fr:
"French
"</code> to the languages in
<code>getLanguages
</code></p>
29 <h3 id=
"duplicate-the-folder-file-structure-of-en">Duplicate the folder/file structure of en
</h3>
30 <p>Copy the files you want to override with the new language:
</p>
32 <li><strong>Strings:
</strong> copy
<code>/src/_strings/en.po
</code> to
<code>/src/_strings/fr.po
</code></li>
33 <li><strong>Pages:
</strong> copy
<code>/src/en/readme.md
</code> to
<code>/src/fr/readme.md
</code></li>
35 <h2 id=
"testing">Testing
</h2>
36 <p>To test you need to do a build, however if you follow the existing structure you shouldn
't need to.
</p>
37 <p>If
<strong>do
</strong> you want to test your language in the app with a build, you can:
</p>
39 <li>Ensure
<code>nodejs
</code>,
<code>npm
</code> are installed
</li>
40 <li><code>cd /chorus/folder
</code></li>
41 <li><code>npm install
</code> (only the first time)
</li>
42 <li><code>grunt lang
</code> (this will rebuild only the languages in the
<code>dist/lang
</code> folder)
</li>
43 <li>Refresh Chorus
</li>
45 <h2 id=
"fallback">Fallback
</h2>
46 <p>Translations should fallback to English unless the
<code>msgid
</code> is set in a
<code>LANG_CODE.po
</code> file.
47 Or if a page
<code>LANG_CODE/PAGE.md
</code> exists.
</p>
48 <h2 id=
"submitting-an-update">Submitting an update
</h2>
49 <p>Send a pull request through
<a href=
"https://github.com/jez500/chorus2">GitHub
</a> on a new branch is the best way.
50 Would consider updates via other methods.
</p>