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>
|