define words and use them in different languages

Author Message

Dhaval Patel

Thursday 29 November 2007 4:31:42 am

hello

I have some words like "Next" , "Previous" , "Back To List" etc...

and my site is in french language.

so i want a file or admin setting in which i can set these words in different languages and can use those words in template files.

so please help me in two things,
1. how to set words from admin side
2. how to use those words at user side in ez templates

With Best Regards,

Dhaval Patel
Team Leader - iNETProcess(I) Pvt. LTD.
dhaval.patel@inetprocess.com
Ph No: +91 79 65 12 35 00
http://www.inetprocess.co.in

Pascal Specht

Thursday 29 November 2007 5:29:58 am

Hello Dhaval,

If your question is about how to use translated texts in templates etc, the usual way to do this is to use the .ts files:

Typically, you should use the english word in the template file, and have the associated .ts file filled with the corresponding translation file. You can even have these .ts files stored in your extension, which makes it possible to override the standard eZ Publish translations.

For example, you'd have the file extension/mymodule/translations/fre-FR/translation.ts

<!DOCTYPE TS><TS>
<context>
    <name>mymodule/example</name>
    <message>
        <source>Next</source>
        <translation>Suivant</translation>
    </message>
</context>
</TS>

and to use it, you'd have to use the i18n template function in your template, like this:

<input class="defaultbutton" type="submit" name="NextButton" value="{'Next'|i18n('mymodule/example')}" tabindex="1" />

If you put your translation files into an extension, make sure you use [RegionalSettings] and TranslationExtensions[]=yourmodule in the extension's site.ini. Search for these keywords on the forum to get more help about this.
I think I've seen also some tools to help editing thoses .TS files, but I can't remember where.

Now if you want to dynamically change the content of a button text through some interface in the back-end, that's a totally different story: you would have to create a new Class in the backend, and add Text attributes to it. Then you need to write a template operator that reads these texts from that instance, and prints them. This makes sense if you have just a few of these texts, like a special message in some login pages or so.

I answered a topic recently on that:

See here: http://ez.no/developer/forum/setup_design/include_editable_content_in_login_page/re_include_editable_content_in_login_page

</Pascal>

Dhaval Patel

Friday 30 November 2007 1:42:54 am

thanks a lot Mr. Pascal.

Its done.

but a little problem is that i have to use share/translations/fre-FR/translation.ts file.

cannot i use translation.ts file from the extension/ezwebin/translations/fre-FR/translation.ts?

With Best Regards,

Dhaval Patel
Team Leader - iNETProcess(I) Pvt. LTD.
dhaval.patel@inetprocess.com
Ph No: +91 79 65 12 35 00
http://www.inetprocess.co.in

Pascal Specht

Friday 30 November 2007 1:56:25 am

Hello Dhaval,

I agree it's not correct to modify the share content.

You should be able to use the extension/ezwebin/translations/fre-FR/translation.ts file, but often you'll see changes only after the cache has been rebuilt.

To rebuild the cache, I usually remove the two folders the 'hard' way under UNIX:

rm -fr /home/site/www/var/cache/
rm -fr /home/site/www/var/ezwebin_site/cache

Hope this helps,

</pascal>

Dhaval Patel

Friday 30 November 2007 2:50:15 am

hi pascal,

thanks for reply.

but the problem is same that no result.

i want to use i18n in overrided templates. means templates in design/ezwebin/override/templates/

the other words like "Login" etc are also not reflecting which resides at extension/ezwebin/design/ezwebin/templates/user/login.tpl from extension/ezwebin/translations/fre-FR/translation.ts.

so what could be the reason?

thanks once again.

With Best Regards,

Dhaval Patel
Team Leader - iNETProcess(I) Pvt. LTD.
dhaval.patel@inetprocess.com
Ph No: +91 79 65 12 35 00
http://www.inetprocess.co.in

Pascal Specht

Friday 30 November 2007 3:53:01 am

Did you make sure that the parameter in the i18n function matches the section your using in the ts file, i.e.:

<!DOCTYPE TS><TS>
<context>
<name><b>mymodule/example</b></name>
...
must match i18n('<b>mymodule/example</b>')

Other than that and clearing the cache I can't see what could be wrong: Did you turn on debugging messages to see if there's something wrong?

</Pascal>

Jan Baelemans

Sunday 02 December 2007 10:13:34 am

Hi Dhaval,

I've been struggling with dutch translations, but the principle is the same for french.
Not all text you see on the site is translated by the eZ Publish mechanism. If you use the ezwebin-interface, the labels at the right corner on top of the (main)page are labels you can define at the different (language)siteaccesses. If you installed f.e. english and french (if not altered accesses eng and fre) log in on the desired language and choose site settings. You'll see all the labels like login, logout, tag cloud etc.. Give them a new label in french, f.e. entree and exit, regulation and so on.
Other issues are the messages the eZ Publish system which uses the i18n-function. If you want to play the translating role for the site (tolk in dutch) you can use the software of trolltech, They make available (for free) several programs to administrate translations. How to make your own .ts-file. How to create a phrasebook to use with linquist and manage your own translations. It costed me a lot of time, but now I'm using a translation I can show my clients and that gives me satisfaction. Independently from the translations from the distribution or from the contribution of others. And remember, the translationmechanism also relies on the concept of context. So, if you translated the word "next" it may exists in several contexts in the translation file.

And please, don't call me mister (;-)), it makes me feel old.

ZjeeBie (www.baelemans.eu)

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.