Forums / Setup & design / Multilingual static texts: how to reuse and customise ?

Multilingual static texts: how to reuse and customise ?

Author Message

Xavier Dutoit

Wednesday 12 July 2006 11:33:50 pm

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").

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

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

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+

http://www.sydesy.com

Ɓukasz Serwatka

Friday 14 July 2006 12: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.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Xavier Dutoit

Friday 14 July 2006 12: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.

http://www.sydesy.com

eZ debug

Timing: Jan 31 2025 06:19:18
Script start
Timing: Jan 31 2025 06:19:18
Module start 'content'
Timing: Jan 31 2025 06:19:18
Module end 'content'
Timing: Jan 31 2025 06:19:18
Script end

Main resources:

Total runtime0.2188 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0085 588.1719180.8125
Module start 'content' 0.00850.0124 768.984497.9766
Module end 'content' 0.02090.1978 866.9609526.8750
Script end 0.2187  1,393.8359 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00401.8070200.0002
Check MTime0.00150.6911200.0001
Mysql Total
Database connection0.00140.624510.0014
Mysqli_queries0.157872.12931410.0011
Looping result0.00150.68801390.0000
Template Total0.197390.210.1973
Template load0.00100.461710.0010
Template processing0.196389.730210.1963
Override
Cache load0.00080.343710.0008
Sytem overhead
Fetch class attribute can translate value0.00070.325410.0007
XML
Image XML parsing0.00030.131710.0003
General
dbfile0.01064.8251200.0005
String conversion0.00000.003130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs