This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

To read this how-to french click click here

concrete5 is proposing more and more packages on marketplace but most of these are in English.

It could be useful to have the GUI in your language, mainly if some editors of your web site do not speak English.

You may translate a concrete5 package:

  1. By terminal (for those who are comfortable with the command line)
  2. With a GUI translation program like poEdit.

Prerequisites

Softwares

First we have to install, if it's not done, the utilities we'll use. Here we will need the translation management librairy gettext and of the PoEdit software.

Terminology and method of operation

Operation:

concrete5 let include the translation management by the t() function to manage strings to be translated on screen.

To do it the core engine is calling the messages.mo files placed in a group of folders arranged lik this :

{root}/languages/fr_FR/LC_MESSAGES/

We admit here that {root} is the root of the package to translate, example:

{root} is /packages/easy_news for the easy_news package.

concrete5 having an overlaodable core, you just have to upload the folders and their content in the root of the package to be automaticly translate.

notes: Sometimes you have to clean cache to apply the translations.

Naming catalogs:

The file must absolutely be named messages. Instead the system don't take them in charge. Three extensions will be necessary.

messages.po is the uncompressed file, then writable, of translation management. (portable document)

messages.pot is the reference catalog of translations. For example if you develop your own package this file let the others to translate in their language, and to update their catalogue from this one.

messages.mo is the compiled file of translations readable by the concrete5's engine. This file is created automatically depending your PoEdit settings, or when you generate it with the software.

Conventions:

To start from somewhere, we'll take the easy_news package for working base. This for two reasons: This package is free, and it have several lines to translate.

Keyword: t() is the used function used by concrete5 the keyword to search will simply be t.

{root} is your package root like explained above.

Path: It's your local path to the package you want to translate.

Project name and version: It's your package name and release version. For example easy_news 1.1 for the release 1.1 of easy news.

Team: The translator's or team's name, i.e Concrete5 FR for the french team of concrete5.

Language: i.e. for french speakers it's French. It's the part corresponding to the fr part of fr_FR, the laguage part of code ISO639.

Country: i.e. for France it's FRANCE. It's the part corresponding to the FR part of the fr_FR, the laguage part of code ISO3166.

Charset: It's the encoding mode to compile the .mo file. You to set it to utf-8 to be consistent on one hand, and to don't create special characters because C5 use utf-8 (see below).

Source code charset: It's the encoding tyype used in the concrete5 files, packages and themes. Then we'll set it to utf-8.

Plural forms: It's the used code to define the plurals in the text. Fench and english sepaking use nplurals=2; plural=n>1; (check the doc for others). The 1rst mean that 2 is a plural, the second that all is superior to 1 is plural.

Build the catalog:

Method one by the terminal:

The terminal method is simple, but sometimes gettext report some errors you'll don't have with the following graphical one.

First will install Gettext on the workstation:

On .deb based GNU/Linux (as root or with sudo)

apt-get install gettext

you can use aptitude if your prefer.

with yum

yum search gettext

select the one corresponding to your system and

yum install gettext.x86_64

or

yum install gettext.i386

for other os check here http://www.gnu.org/software/gettext/manual/gettext.html

Now we will create our .po file at the {root} replace {root} by your local path !

Tested in bash and shell only, you have to check for kornshell and others.

cd {root} && touch messages.po

Fill the catalog automaticly:

cd {root}

find ./ -iname '*.php' -exec xgettext --default-domain=messages --from-code=utf-8 --keyword=t --language=PHP -p ./ -j {} \;

Now your messages.po is ready to be used.

Install PoEdit ( http://www.poedit.net/download.php )

apt-get install poedit

you're ready, then open the .po file with poedit and fill the catalog configuration like it's explain below. you have to enter all the configurations inside. read the beginning of the graphical method to know how to.

To keep you file up to date it's easer to do it graphicly that with a terminal with msginit and so on.


Graphical methode:

We assume that you have installed the required software on your workstation is that they are functional. We have to say that the file .mo must be in /languages/fr_FR/LC_MESSAGES but our work space have to be on the package root.

We also admit that you have downloaded and uncompressed the package on your work station.

Let's create the catalog:

Launch the PoEdit software

Click on the menu file → new catalog

You'll have a window like this one:

Empty catalog

We have to fill the fields depending the conventions saw above.

You have to remplace the mail by your one, also for your name or team's name by your one, and project name and version by your package's one.

Finally you should have something like that:

filled catalog config

Do not confirm !

Click on the Path tab and on the button button to add path

Enter the local path to the package's root you want to translate. i.e.: /home/cali/Bureau/packages/easy_news (for me on GNU/Linux)

To have your path, if you don't know it, do a right click on the folder and check properties.

You should have a result like:

local path entered

Note: The path is ending by a /

Do not confirm too !

Click on the keyword tab and after on the button button to add keyword

Enter the used keyword by Concrete5 in the field, so a simple t

You should obtain:

keyword entered

Now you can confirm your configuration :)

PoEdit will immediatly ask you to save your file.

Navigate into your package's folder, don't forget to name your file messages.po, and save it.

path where to save

Once de confirmation launched, PoEdit will recursively analyze the folders and files at the root and automatically fill the catalog.

After you should have something like:

analyse results

If all is allright, the fields are correctly filled and the package properly coded, you should not have any errors.

Then you can confirm the output and obtain something like:

catalog ready

Be carrefull it's not done, but almost !

You have to save your file at the package's root.

You can remove the .mo if your settings create it automaticly. Now copy the messages.po file named this copy messages.pot

This copy will serve as reference later, so it must remain empty of anything translated.

Finally create your folders /languages/fr_FR/LC_MESSAGES/ and copy again your .po inside.

You should have something like that:

files repository after saving

Your working file become the messages.po file located in LC_MESSAGES.

We keep the two others (.po and .pot) as reference.

Update process

The advantages of previous copies, namely the relocation of the working file, are that's simple to keep your translations up to date and the sharing possibility.

The operation is very simple.

Conventions

We admit that the files .po and .pot on {root} remain empty of any translations.

Method

First you have to replace the package sources by the new. This in order to keep the same local path (if not don't forget to change your path in catalog config). Like that we don't move our references.

After you must open your reference .po file (at the package's root), infact the direct update of the .pot should have some issues when saving.

And click on the button to update the catalog from sources.

A similar output to the creation should appear, now summarizing both the new channels and those that are obsolete.

And save your messages.po file

Spread

To update your .pot file, you just have to remove the old one, and make a new copy of your .po one renamed .pot

We now have our references updated.

To finish, and update our working file, we'll open the .po file located in LC_MESSAGES and click on the menu Catalog → Update from a POT file

Now select you .pot file at path the root newly created and confirm the action.

A new list of strings to translate will apear at the top of the catalog.

Cleaning

If some strings becom obsolete the menu Catalog → Purge the inactive translations will become activ, that let you to clean the catalog.

Conclusion

Like you see, or will see soon, it's longer to read this tutorial as to create a ew catalog to translate.

What takes time is the translation, depending the packages.

If you have some questions or comment don't hesitate !

Good translation at all :)

Loading Conversation