eZ Community » Forums » Developer » Use a word within a template
expandshrink

Use a word within a template

Use a word within a template

Monday 26 March 2012 11:48:07 am - 5 replies

Hello ezCommunity;

I would like to know if there is a way to use a undefined word like ("Written By: " ) or (Wellcome to  "name of the company " ) within a template that can be translated in correlation with the language of the page?

Thank you in advance

Modified on Monday 26 March 2012 11:55:49 am by ray lab

Monday 26 March 2012 12:27:27 pm

Hi Ray.

You can do this with i18n template operator.

More information in the documentation page : http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Template-operators/Formatting-and-internationalization/i18n

Monday 26 March 2012 2:20:57 pm

Thank you  Sylvain ;

But if i want to use it for the first time what should i write for <name>? 

should it be my template's address?

Monday 26 March 2012 3:24:08 pm

No,

It's just for the template operator. Sometimes, you must define a different translation for a different context. So, you can describe every case.

For example, you have an small extension (named mygreatextension), in translation.ts, you can do this :

 

 <context>
<name>mygreatextension</name>
<source>Written By</source>
<translation>Ecrit par</translation>
</context> 

 

and in your template :

 {"Written By"|i18n('mygreatextension')}

Tuesday 27 March 2012 10:09:51 am

Thanks so much that was very usefull happy.gif Emoticon

Tuesday 27 March 2012 10:33:22 am

Happy to hear that !

Don't hesitate to ask me any questions...

Cheers.

expandshrink

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

36 542 Users on board!

Forums menu