How internationalization is done in MapOSMatic

If you want to help translating MapOSMatic, see the page on how to translate MapOSMatic in your language.

If you have any question, send an email to contact@maposmatic.org (only MapOSMatic core team) or dev@maposmatic.org (public mailing list, archived)

Translation of the web site

The web site is translated using Django's internationalization framework. The list of strings to translate is available in this file: django.pot and are edited through maposmatic resource on Transifex.

Language specific code in ocitysmap

Add code for your language in: http://git.savannah.gnu.org/cgit/maposmatic/ocitysmap.git/tree/ocitysmap/i18n.py

The three methods to code are:

  • language_code(): returns the language code of the specific language supported, e.g. fr_FR.UTF-8;
  • user_readable_street(name): transforms a street name into a suitable form for the map index, e.g. Paris (Rue de) for French;
  • first_letter_equal(a, b): returns True if the letters a and b are equal in the map index;
  • isrtl(): returns True if the language is written Right to Left (RTL).

Then add a construction of this object in the hash-table language_map at the end of i18n.py.

Language specific code in maposmatic

To add a new language for a map index in maposmatic, one should:

  1. Add the new language code and the way it will be displayed on the main page in www/settings.py: http://git.savannah.gnu.org/cgit/maposmatic.git/tree/www/settings.py#n111
  2. Check that this language code is supported by ocitysmap (otherwise add it, see above): http://git.savannah.gnu.org/cgit/maposmatic/ocitysmap.git/tree/ocitysmap/i18n.py#n742

Things to do on the server

You shoud recompile .po files for ocitysmap (see I18N doc file) and maposmatic.

You should configure needed locales on your maposmatic server.

  • On Debian: dpkg-reconfigure locales
    1. Check which locales are supported:
      less /usr/share/i18n/SUPPORTED
    2. Add the locales you want (for example fr) :
      locale-gen fr_FR.UTF-8
      locale-gen fr_FR
      locale-gen fr_FR@euro
  • Here is what has been done on the main server:
    for code in en es fr de it ar ru nb sl sv et da cs ca hr sk fi el hu is lt pl ro tr eo ; do
      locale-gen --lang $code
    done
    locale-gen fr_FR@euro
    locale-gen fr_BE@euro
    locale-gen fr_LU@euro

References

dev/i18n/i18n_support.txt · Last modified: 2013/04/11 20:26 by Hakan Tandogan
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki