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

eZ Community » Forums » Setup & design » Multilingual static texts: how to...
expandshrink

Multilingual static texts: how to reuse and customise ?

Multilingual static texts: how to reuse and customise ?

Thursday 13 July 2006 8:33:50 am - 2 replies

Hi,

Since the 3.8 version provides a much more usable multiligual content managemeny system, I'm trying to use the native ez functions for that.

I want to have one design for all the languages, and I obvioulsy have some static content in it (eg. a button "home page"blunk.gif Emoticon.

I'm wondering if I can use the already translated texts.

I could find some (eg design/admin/content/search contains "search"blunk.gif Emoticon, but I haven't been able to find most (eg "home page"blunk.gif Emoticon.

How do you do ? Are you re-using existing translations or do everything ?

Moreover, I'd like to create my own .ts, but don't know where to put it so it's taken into account. I couldn't find anything about creating your own translation without having to create an extension (and even so, that's more by looking at the existing code). Is there a doc you could refer me too ?

Thanks in advance,

X+

Friday 14 July 2006 9:03:57 am

Salut!

There are 3 approches if you can't find already translated text in the exisiting translations:

1. Add missing translation to existing files under share/translation. This is less flexible since you need to take care about future updates, but of course the fastest way to add missing untranslated labels.

2. Create translation extension:

Extension structure:

extension
	|
	| - - mytranslationext
			|
			| - - settings
			|	| - - site.ini.append.php
			|
			| - - translations
				|
				| - - pol-PL
				|	| - - translation.ts
				|
				| - - fre-FR
				|	| - - translation.ts
				|
				| - - untranslated
					| - - translation.ts
						

Source: extension/mytranslationext/settings/site.ini.append.php

<?php /*

[RegionalSettings]
TranslationExtensions[]=mytranslationext

*/ ?>

This is example content of untranslated translation.ts XML file. This is source file for other translation used in the extension. Use QT Linguist to make the translation:

Source: extension/mytranslationext/translations/untranslated/translation.ts

<!DOCTYPE TS><TS>
<context>
    <name>extension/mytranslationext</name>
    <message>
        <source>Example lable</source>
        <comment>Example comment</comment>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>More examples</source>
        <translation type="unfinished"></translation>
    </message>
</context>
</TS>

In templates use:

{'Example'|i18n( 'extension/mytranslationext' )}

Where i18n as parameter takes context name from your extension translation.ts.

3. Define translation with missing strings as an array then check current object locale and display correct translation.

I would recommend use translation extension.

Modified on Friday 14 July 2006 9:08:48 am by Ɓukasz Serwatka

Friday 14 July 2006 9:41:29 am

Hi,

Thanks for the explainations.

As an evolution, wouldn't it make sense to be able to put translations into the design instead of having another extension ? I mean, the translations are going to be used by the templates, so I'd rather keep them together instead of ending with one extension per site on the top of one settings/siteaccess and design/

I remember having seen a web interface to manage translations, but couldn't put my hand on it on the contrib. Does it rig a bell to someone or was I day dreaming ?

I'll let you know if I can find it ....

BTW, ez still doesn't provide any way to access the translation into another language than the current one (,something like : {'Example'|i18n( 'extension/mytranslationext',"eng-UK" )} ? That would come really handy.

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from