ti18n.html - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       ti18n.html (10975B)
       ---
            1 <?xml version="1.0" encoding="UTF-8"?>
            2 
            3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
            4  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
            5 
            6 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
            7 
            8 <head>
            9 <title>Internationalization</title>
           10 <meta charset="utf-8"/>
           11 </head>
           12 
           13 <body>
           14 <h1>Internationalization</h1>
           15 
           16 <p>dopewars uses the <a href="http://www.gnu.org/manual/gettext/">GNU
           17 gettext</a> utilities for internationalization (i18n) support. This allows the
           18 software to be translated into the local language at runtime - run dopewars in
           19 the UK and it'll talk to you in English, but run it in Germany and it'll talk
           20 to you in German. This relies on translators to translate the program's output
           21 into each language beforehand, of course, and so native language speakers to
           22 carry out this task are always needed!</p>
           23 
           24 <ul>
           25 <li><a href="#running">Running dopewars with i18n support</a></li>
           26 <li><a href="#adding">Adding a new translation</a></li>
           27 <li><a href="#dopespec">dopewars specifics</a></li>
           28 <li><a href="#updating">Updating a translation for a new dopewars
           29 version</a></li>
           30 <li><a href="#current">Currently available translations</a></li>
           31 </ul>
           32 
           33 <h2><a id="running">Running dopewars with i18n support</a></h2>
           34 <p>i18n is only included in versions of dopewars later than 1.4.8. By default,
           35 "Native Language Support" is compiled in; binary installations should be
           36 already set up for i18n. When compiling dopewars from source code, the
           37 <tt>configure</tt> script should detect whether your system can support
           38 GNU gettext. To disable i18n,
           39 pass the <tt>--disable-nls</tt> option to the <tt>configure</tt> script.</p>
           40 
           41 <p>When you run your installed copy of dopewars, it should detect your "locale"
           42 automatically and talk to you in your native language. If this does not happen,
           43 the following are some possible explanations:-</p>
           44 <ul>
           45 <li>dopewars cannot find the locale-specific language file - by default, stored
           46 under /usr/local/share/locale/</li>
           47 <li>Your language is not yet supported - why not add it yourself?</li>
           48 <li>Your system does not have locale support.</li>
           49 <li>On a Windows system, you need to select the language from the relevant
           50 section of Control Panel (or set the LANG environment variable, below). i18n
           51 under Windows is only supported by version 1.5.3 and later.</li>
           52 <li>You haven't set an environment variable to specify your locale (usually
           53 this is done automatically). For example, if you're using the <tt>bash</tt>
           54 shell and want a German translation, the command "<tt>export LANG=de_DE</tt>"
           55 should ensure that dopewars (and all other i18n-aware programs launched from
           56 this shell) will use the German language.</li>
           57 </ul>
           58 
           59 <h2><a id="adding">Adding a new translation</a></h2>
           60 <p>Translation files are kept in the subdirectory <tt>po/</tt> of the dopewars
           61 source code distribution. They are named by
           62 <a href="http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_639.html">
           63 2-letter language codes</a> followed by the <tt>.po</tt> extension - for
           64 example, the German translation is stored in the file <tt>po/de.po</tt>.
           65 They are simple text files, consisting of lists of the original English string
           66 (labelled by "msgid") followed by the translated string (labelled by
           67 "msgstr").</p>
           68 
           69 <p>To add a new translation, first
           70 <a href="installation.html">install dopewars from source code</a>. This will
           71 generate the reference file <tt>dopewars.pot</tt> in the <tt>po</tt>
           72 subdirectory. Then, copy <tt>dopewars.pot</tt> to your language-specific
           73 <tt>.po</tt> file in the
           74 <tt>po/</tt> directory, and fill in the "msgstr" entries. Once this is done,
           75 edit the <tt>configure.ac</tt> file in the top dopewars directory to add your
           76 language code to the <tt>ALL_LINGUAS</tt> variable. Then run <tt>autoconf</tt>
           77 to rebuild the <tt>configure</tt> script, before making and installing dopewars
           78 as usual. The new translation should now be available. Once this is complete,
           79 please <a href="https://github.com/benmwebb/dopewars/pulls">open a pull
           80 request</a> to have the translation included in the next dopewars version.</p>
           81 
           82 <p>Please note that some strings are <b>format strings</b> containing the %
           83 character. These are used in the program code for substituting numbers and
           84 other pieces of text into the string - these substitutions are are performed
           85 using variables which are specified in the <b>same order</b> as the %
           86 characters in the format string. For example, the following format string
           87 substitutes in a string (%s) and an integer number (%d):-<br />
           88 <tt>"String '%s' has %d characters"</tt><br />
           89 The string and number are specified in order in the code. This is problematic
           90 if your translation changes the order - for example, a valid German translation
           91 of the string would be<br />
           92 <tt>"%d Zeichen lang ist die Zeichenkette '%s'"</tt><br />
           93 Now the number and string are specified in the wrong order, and this will
           94 probably crash the program on running! To fix this, use the special notation<br />
           95 <tt>"%2$d Zeichen lang ist die Zeichenkette '%1$s'"</tt><br />
           96 (i.e. replace <b>%x</b> with <b>%n$x</b> where <b>n</b> is the index that the
           97 format specifier "should" have, starting from 1.)</p>
           98 
           99 <h2><a id="dopespec">dopewars specifics</a></h2>
          100 <ul>
          101 <li>When questions are asked in the curses (text mode) client, the keys that
          102 you are allowed to press in reply are stored in a string. This should be
          103 translated to suitable keys in your language, in the <b>same</b> order as 
          104 the original - e.g. "<tt>YN</tt>" (for Yes/No) could be translated in German
          105 to "<tt>JN</tt>" (for Ja/Nein).<p /></li>
          106 
          107 <li>When a dopewars server asks a client a question, the valid replies are
          108 sent at the start of the message, followed by a "<tt>^</tt>" character. These
          109 replies define the dopewars protocol, and so should <b>not</b> be
          110 translated - they will prevent clients and servers from talking to each other
          111 properly. So for example, the string "<tt>YN^Would you like to visit %s?</tt>"
          112 should be translated as you wish, but with the "<tt>YN^</tt>" at the start
          113 left unchanged.<p /></li>
          114 
          115 <li>The <tt>%txx</tt> notation is used for "translated strings". This notation
          116 is exactly equivalent to the standard C "<tt>%s</tt>" notation for a string,
          117 and does essentially the same thing, except that the two-letter code which
          118 follows the <tt>%t</tt> is used to select an "alternative form" of the word
          119 - for example, your language may have different words for "bitch" depending
          120 on whether the word is the subject or the object of the sentence. You are
          121 free to translate <tt>%txx</tt> to use the most appropriate form of the word.
          122 If you wish to capitalise the first letter of the word (as used in English for
          123 titles, etc.) then use "<tt>%T</tt>" rather than "<tt>%t</tt>".<p />
          124 
          125 <p>Obviously dopewars cannot guess what your "alternative forms" are; you must
          126 specify them yourself. Essentially, when setting a string in a dopewars
          127 configuration file (or the defaults, which are set in dopewars.c) alternative
          128 forms can be added by alternating two-letter codes and alternative forms after
          129 the original word, separating them by _ (underline) symbols. For example,<br />
          130 <tt>Names.Bitch = "bitch_no_bitcho_ac_bitche"</tt><br />
          131 specifies two alternative forms for "bitch", identified by the "<tt>no</tt>"
          132 and "<tt>ac</tt>" codes. You can then use "bitcho" anywhere that "bitch" is
          133 normally used by translating the relevant string as "<tt>%tno</tt>" (and to
          134 get "bitche" use "<tt>%tac</tt>"). If you specify a two letter code
          135 in the translation that you haven't given an alternative form for, the
          136 default word ("bitch") will be used. In the original English, "<tt>%tde</tt>"
          137 is used for this purpose, but there is nothing special about the "<tt>de</tt>"
          138 code - you can use it yourself if you like, and you can use as many
          139 different two-letter codes as you want to.</p>
          140 
          141 <p>For a good working example of the "<tt>%tde</tt>" notation, see the
          142 Norwegian Nynorsk translation (<tt>nn.po</tt>).</p>
          143 
          144 <p>Additionally, prices in dopewars are automatically formatted into strings by
          145 means of the %P notation, and comments can be introduced into format strings
          146 by means of the %/.../ notation. Everything between the two / characters is
          147 not printed. This is used to "qualify" some strings for translation, and the
          148 %/.../ can be left out of the translated string if desired (the comment does
          149 not need to be translated).</p>
          150 </li>
          151 
          152 </ul>
          153 
          154 <h2><a id="updating">Updating a translation for a new dopewars
          155 version</a></h2>
          156 
          157 <p>New versions of dopewars will often change what is printed to the user, and
          158 so may may require changes to the translation. To update an existing
          159 translation, change into the <tt>po</tt> subdirectory of the dopewars
          160 source code, and do a "<tt>make dopewars.pot</tt>". This creates the
          161 <tt>dopewars.pot</tt> file, which lists the strings that need translating.
          162 Next, create a new translation file from your "old" translation file (we'll
          163 assume it's called <tt>de.po</tt>) and <tt>dopewars.pot</tt> with the
          164 <tt>msgmerge</tt> command:-<br />
          165 <tt>msgmerge -o newfile de.po dopewars.pot</tt><br />
          166 Examine this new file <tt>newfile</tt> for translations that need updating
          167 (a search for "fuzzy" should find most of them) and then overwrite your old
          168 translation with the new one:<br />
          169 <tt>mv newfile de.po</tt><br />
          170 Rebuild and reinstall dopewars, and the new translations should become
          171 available. Again, it is deeply appreciated if such updated files are
          172 contributed to the main dopewars distribution!</p>
          173 
          174 <h2><a id="current">Currently available translations</a></h2>
          175 
          176 <ul>
          177 <li>French (<tt>fr.po</tt>)
          178    <ul>
          179    <li>Maintained by: leonard</li>
          180    <li>Version required: <b>1.5.2</b> or later</li>
          181    </ul>
          182 </li>
          183 
          184 <li>French (Canada) (<tt>fr_CA.po</tt>)
          185    <ul>
          186    <li>Maintained by: François Marier</li>
          187    <li>Version required: <b>1.5.11</b> or later</li>
          188    </ul>
          189 </li>
          190 
          191 <li>German (<tt>de.po</tt>)
          192    <ul>
          193    <li>Maintained by: Benjamin Karaca, Eric Steiner, Tobias Mathes</li>
          194    <li>Version required: <b>1.5.0</b> or later</li>
          195    </ul>
          196 </li>
          197 
          198 <li>English (Britain) (<tt>en_GB.po</tt>)
          199    <ul>
          200    <li>Maintained by: Ben Webb</li>
          201    <li>Version required: <b>1.6.1</b> or later</li>
          202    </ul>
          203 </li>
          204 
          205 <li>Polish (<tt>pl.po</tt>)
          206    <ul>
          207    <li>Maintained by: Slawomir Molenda</li>
          208    <li>Version required: <b>1.5.0</b> or later</li>
          209    </ul>
          210 </li>
          211 
          212 <li>Portuguese (Brazil) (<tt>pt_BR.po</tt>)
          213    <ul>
          214    <li>Maintained by: Hugo Cisneiros, Bruno Lopes</li>
          215    <li>Version required: <b>1.5.0</b> or later</li>
          216    </ul>
          217 </li>
          218 
          219 <li>Norwegian Nynorsk (<tt>nn.po</tt>)
          220    <ul>
          221    <li>Maintained by: &Aring;smund Skj&aelig;veland</li>
          222    <li>Version required: <b>1.5.7</b> or later</li>
          223    </ul>
          224 </li>
          225 
          226 <li>Spanish (<tt>es.po</tt> or <tt>es_ES.po</tt>)
          227    <ul>
          228    <li>Maintained by: Quique</li>
          229    <li>Version required: <b>1.5.8</b> or later</li>
          230    </ul>
          231 </li>
          232 </ul>
          233 
          234 <hr />
          235 <ul>
          236 <li><a href="index.html">Main index</a></li>
          237 </ul>
          238 <p>
          239   Last update: <b>09-12-2020</b><br />
          240   Valid <a href="http://validator.w3.org/check/referer">XHTML 1.1</a>
          241 </p>
          242 
          243 </body>
          244 </html>