This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Best Practice: Translating

Best Practice: Translating

Best Practice: Translating

Saturday 10 January 2009 5:58:56 pm - 6 replies

I am developing a local based community site for a german audience. We have a lot of students in here from abroad. So i want to translate my Site to english language and maybe more in the future (turkish and french is planned).

The Problem what i have is, which language i should use as base in the templates which will the be translated thru the .ts files. In one Forum thread (i cannot find now) i ve read that i must use english as the base. Thats a Problem for me because its not my native language and sometime i translate content wrong. This will then be a Problem, when i use the same translating on different templates and pages. If i want to make changes, i have to do it on all templates. The risk is also high that i forget a page and the Page stays on false translation.

Is it true that i have to use english in the templates, or is it also safe to use german as bae and make an english folder for translating content?

Where are the problems in this case?

Thursday 05 April 2012 11:08:23 am

Hi John,

I've your same problem and I'm wondering how to use the Italian language as a starting locale. Did you find a solution or a workaround?

Thanks in advance.

Friday 13 April 2012 12:27:02 pm

Hi Simone,

The default eZ Publish templates use English as the base for translatable text, via the i18n() operator.

However, you can set your site to use a different language, and any NEW translatable text can be in any language you like.   So you just pass your Italian text (and context) to the i18n operator, and create translation files for any additional languages (e.g, translating to German) - I recommend doing this in an extension, so you aren't messing with the core UI/template translations under /share. 



Sunday 15 April 2012 9:08:07 pm

There is basically one and only one reason that the "default" language for the translation system is english, and it is: when using the eng-uk locale, the translation system will not translate anything, however you set up the configuration - it will just assume that strings in your templates or php code are in the good language.

So, for your own code:

- for generic extensions: always use english as language for strings in tpl+php, and provide translation files to your native language

- for code that is specific to a website: you should do the same, but cutting corners and putting the language strings directly is your language is not a capital sin

Do not forget that to have another language as base and to able to translate it to english, you will have to use english-american or any other english locale except eng-uk

Modified on Sunday 15 April 2012 9:10:02 pm by Gaetano Giunta

Tuesday 24 April 2012 3:33:59 pm

Thanks to all for replies, these helped me a lot.


I read the documentation and found the reason why eZ use eng-GB as default language.

I'm agree with you when you say "for code that is specific to a website: you should do the same" but, usually, while I'm developing the website I don't know the English version of strings that I need to include into tpl files. Obviously I'm using the i18n operator with all strings in my tpl files but if I'm developing a multilanguage website this operation causes a waste of time because, when the client send us the correct strings, I need to change them in tpl and ts files.

If I was able to set Italian as a starting language, the corrections were only into ts files. This is the only reason.


@Geoff Bentley

How can I set up a different language? I tried by setting ita-IT into site.ini and by using ts files for eng-US and esl-ES but, honestly, I can't figure out what is the correct configuration. Anyway I'm using an extension for the whole project (templates, overrides, translations, custom operators, etc.) so I'm able to collect all project files within one place.

Tuesday 24 April 2012 10:02:46 pm

Nevermind trying to do the "right" thing. Here's another take on what you should to:

- put whatever translation strings you want in your template/php code

- use the command-line tool to generate the untranslated xml file

- create a .ts file for every language of your site (copying the untranslated one)

- when you get the translation strings for language X, add them to the corresponding .ts file

- never touch anymore your php and tpl sources

- for the english version of the site, use english-american language, which switches translation on (and provide of course a .ts file for it)

this way you can treat the source strings as pure "tokens" that you don't really care that much about.

Caveat: if your contents are already english-uk, in site ini you have to set properly content language to eng-uk and tpl language as eng-us

Tuesday 24 April 2012 10:55:57 pm

Hi Simone,

I'm building a site with multiple languages and multiple locales currently, all in an extension.  I've set it up in this way:

1. Siteaccesses per locale



2. /extension/mysite/settings/site.ini.append.php


3. /extension/mysite/settings/siteaccess/us/site.ini.append.php (US)


4. /settings/override/site.ini.append.php

TranslationSA[uk]=United Kingdom
TranslationSA[us]=United States
TranslationSA[ca-en]=Canada (English) 

5. Translation files with my custom strings


6. Override default eZ Publish strings


(with the US siteaccess site.ini > RegionalSettings > Locale set to "eng-US@override"blunk.gif Emoticon

Hope this helps.



You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from