Is there an option so you can choose ON your website which language you want? So the visitors can choose
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:
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:
- 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).
- 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".)
- On your language page, select a resource. You can always start with
messages.powhich is the main and most important resource to translate.
- 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.
- 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.
- Go to the directory
/localesand 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_DEfor 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.
LC_MESSAGES. Yes, this is a little funky, but it’s a gettext convention.
messages.pofile. Note that this file will always be encoded in UTF-8. Put this file in the
fr-FR.localeto reflect your new locale, for example
de-CH.localefor Swiss German.
'utf-8'. Here is an example:
Compiling the Language Pack
.po format is not very efficient. So we need to compile it the
.php. We’ll use b2evolution’s embedded tool for doing that.
- Open the file
/conf/_locales.phpand at the end of the file set
- At this time, if you go to the regional settings screen and click "Restore Default Locales", you will see your locale appear.
- Since you have set
$allow_po_extraction = 1, you can, click "Show translation info’.
- 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.phpin your locale folder.)
- Your translations should now be active
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.
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.
Last edit by In order to get this working, after this Permission denied error while extracting @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.
Comment from: Valerio Falcao
the translation file, do:
touch _global.php )
chmod a+rwx _global.php )
Form is loading...
In order to get this working, after this Permission denied error while extracting
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.