b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Advanced Topics
  3. Translations (i18n/l10n)
  4. Localizing / Translating b2evolution

Localizing / Translating b2evolution

So you want to localize (mainly translate) b2evolution to your own language? Here’s how to do it with minimum effort by using the gettext system provided by b2evo.

If this is the first time you are dealing with localization and/or gettext, you may want to read this background information first:

  • Introducing i18n and l10n
  • Introducing gettext and .PO files

Important : Language vs. Locale

When you translate, you don’t translate to your language. You translate to your Locale. A locale is identified by a language code followed by a country code. For example en_US and en_GB are different, though similar, locales.

Quick start with Transifex

Transifex is the collaborative translation platform we use. It allows several people to translate to the same locale. They can even translate at the same time, if necessary.

In order to get started translating b2evolution to your own locale, all you need to do is this:

  1. Go to Transifex and create an account if you don’t have one already. It is 100% Free for translators (and also for Open Source projects in general).
  2. On the b2evolution project page, select you language / locale. If it doesn’t exist yet, click on "+ Create Language". (Note: If you are going to create a locale similar to another (for example pt_BR vs pt_PT), you can also open an existing locale and click on "Clone to new language".)
  3. On your language page, select a resource. You can always start with messages.po which is the main and most important resource to translate.
  4. Click on "Translate now" and off you go. Every string you translate and save will be contributed to the project!

Note: if you already have a local version of the messages.po file (from an old language pack or previous work), instead of "Translate now", you can click on ‘Upload file". Note: your file must be encoded in UTF-8 before you can upload it to Transifex. (You can change the encoding in PO Edit, if needed.)

You don’t really need to go deeper into this page until, say, your language/locale has at least 10% to 15% translated.

Important: only use Transifex for translating the latest public release. Do not use it for translating old versions of b2evolution. The text strings may differ.

Optional/Alternative: PO Edit

If you are an experimented software translator, you could export and download the messages.po from Transifex, edit it locally on your computer, and then reupload it to Transifex. If you do this, you can use a tool like messages.po for easy editing of the .PO file.

This method is more complicated than editing directly on Transifex. However it allows a more direct access to the source code during translation, which may be useful in some cases. PO Edit will open the sources and highlight the occurrences for you. This way, you can really make sure what a string is used for when you’re not sure about how to translate it!

Creating/Updating a Language Pack

Once your translation is complete, you need to package it into a language pack so that b2evolution can use it.

  1. Check if your locale is already available for download in the Language packs area or if it has been posted to the forums by someone. It may be a good starting point.
  2. Go to the directory /locales and duplicate the folder of an existing locale like fr_FR (or unzip your old/existing language pack there). Name the new folder to reflect the locale of your new language pack, for example de_DE for a Swiss German language pack.
    • The first two letters must be your ISO 639 language code.
    • The next two letters must be your ISO 3166 country code.
    • You may add a 3rd part the the folder name to specify the charset of your locale, but all new locales should use UTF-8 now, so you should typically skip this, even if you see older locales with a specific charset.
  • your locale folder, you should find a subfolder named LC_MESSAGES. Yes, this is a little funky, but it’s a gettext convention.
  • In Transifex, click on "Download for use" to download the latest messages.po file. Note that this file will always be encoded in UTF-8. Put this file in the LC_MESSAGES folder.
  • Rename an existing locale definition file like fr-FR.locale to reflect your new locale, for example de-CH.locale for Swiss German.
  • Inside that file, change the name of the locale as well as the date format and other variables, if need be. Make sure the charset is set to 'utf-8'. Here is an example:
  • <?php
    $locale_defs['fr-FR'] = array(
    		'name' => NT_('French (FR) utf-8'),
    		'messages' => 'fr_FR',
    		'charset' => 'utf-8',
    		'datefmt' => 'd.m.y',
    		'timefmt' => 'H:i:s',
    		'startofweek' => 1,
    		'transliteration_map' => array(),
    	);
    ?>

    Compiling the Language Pack

    The .po format is not very efficient. So we need to compile it the .php. We’ll use b2evolution’s embedded tool for doing that.

    1. Open the file /conf/_locales.php and change the value of
    2. $allow_po_extraction = 0; 
      to
      $allow_po_extraction = 1; 
    3. At this time, if you go to the regional settings screen and click "Restore Default Locales", you will see your locale appear.
    4. Since you have set $allow_po_extraction = 1, you can, click "Show translation info’.
    5. You will now see a link named [extract] for each locale. Click to extract the strings for your own locale. (This will create or update a file named _globals.php in your locale folder.)
    6. Your translations should now be active

    Notes

    At this point, your locale is active. However, note that blogs on the public pages will be displayed in the language that has been set for them in the blogs configuration forms. So you may need to change the locale setting of each blog you want to appear translated.

    Please contribute your translation to the language packs by following the instructions on that page.

    Static pages

    There is a second resource in Transifex called static.po. It contains the strings of the html help pages that are displayed in the b2evolution package before the installation.

    For this file you are also kindly invited to provide translations on Transifex.

    There are no language packs to compile for this file. These are the welcome messages of the b2evolution package. The translations will go directly into the b2evolution release packages.

    Created by fplanque • Last edit by fplanque on 2020-07-28 23:54 • •

    3 comments

    Comment from: Sjoerd

    Sjoerd

    Is there an option so you can choose ON your website which language you want? So the visitors can choose

    2005-05-02 @ 06:11

    Comment from: Valerio Falcao

    Valerio Falcao

    In order to get this working, after this Permission denied error while extracting
    the translation file, do:

    1. go to your locales/{lang}_{country} dir
    2. create a brand new _global.php ( touch _global.php )
    3. change its permissions to 777 ( chmod a+rwx _global.php )
    4. extract the language files again.
    2006-06-12 @ 00:01

    Comment from: ralfh

    @alexdd wrote:

    In German you can translate into two "words". One that is more familar (German "du") and one that is more formal (German "Sie"). What sould be used in the translation? Or should it be difference for logged users and for guests?

    my suggestion is to use the more formal 'Sie' in German translation.

    In German you can translate the English 'you' very formal as 'Sie' or informal as 'Du'. The formal 'Sie' is used in more official context, the 'du' is used in informal colleagial style of the language.

    My intention is to work on a complete draft version of the German language elements, that can be optimized later. So I suggest to translate first missing strings. My experience is that lots of German users critize a incomplete translation more than a translation that is not consistant everywhere.

    2014-01-05 @ 22:10

    On this page

    • Important : Language vs. Locale
    • Quick start with Transifex
    • Optional/Alternative: PO Edit
    • Creating/Updating a Language Pack
    • Compiling the Language Pack
    • Notes
    • Static pages

    Search the Manual

    Content Hierarchy

    • b2evolution CMS User Manual
    • User's Guide
    • Installation / Upgrade
    • Front-office Reference
    • Back-office Reference
    • Developer Reference
    • Operations Reference
    • Advanced Topics
      • Using Desktop Blogging Tools
      • Using Blogging Apps
      • Blogging by email
      • Using the APIs
      • Contributing
      • Translations (i18n/l10n)
        • How to install a language pack
        • Translating b2evolution
        • Formal vs Casual l10n
        • How to create your own flag / locale
        • Localizing Plugins
        • Localization FAQ
        • Command Line Tools for localization
        • Internationalization (i18n) Guidelines
        • Translation Guidelines
      • Monetizing
      • How to...
      • Podcasting
    • Glossary
    • Archives
    Community software

    This online manual is powered by b2evolution CMS – A complete engine for your website.

    About b2evolution

    • What is it?
    • Features
    • Getting Started
    • Screenshots
    • Online demo
    • Testimonials
    • Design philosophy
    • Free & open source
    • Terms of service

    Downloads

    • Latest releases
    • Skins
    • Plugins
    • Language packs

    About us

    • About us
    • Contact

    Webhosting Guide

    • Web hosting blog
    • Best web hosting
    • Cheap web hosting
    • Green web hosting
    • Hosting with SSH
    • VPS hosting
    • Dedicated servers
    • Reseller hosting
    • Int'l: UK / France

    Docs & Support

    • Online manual
    • Forums
    • Hire a pro !

    Other

    • Adsense
    • Press room
    • Privacy policy

    Stay in touch

    • GitHub
    • Twitter
    • Facebook
    • LinkedIn
    • News blog
    • RSS feed
    • Atom feed

    Founded & Maintained by François Planque