Forums / Setup & design / Problems to setup extension for i18n

Problems to setup extension for i18n

Author Message

Ulrich L.

Wednesday 18 October 2006 12:55:09 pm

Hi all,

while multilingual content works fine, I have problems to make an own extension for translations with i18n running.

I setup my site as follows:

Extension "dictionary" is activated in settings/override/site.ini.append.php:

[ExtensionSettings]
ActiveExtensions[]=ezdhtml
ActiveExtensions[]=ezpaypal
ActiveExtensions[]=dictionary

Regional settings in settings/siteaccess/de (first language is english with sitaccess en, de is for German version) look like this:

[RegionalSettings]
Locale=ger-DE
SiteLanguageList[]=ger-DE
SiteLanguageList[]=eng-GB
SiteLanguageList[]=fre-FR
TextTranslation=enabled

In the extension directory I put the directory "dictionary" with subdirectories "settings" and "translations".
Extension/dictionary/settings/site.ini.append looks as follows:

[RegionalSettings]
TranslationExtensions[]=dictionary

Extension/dictionary/translations/ger-DE/translations.ts is

<!DOCTYPE TS><TS>
<context>
    <name>extension/dictionary</name>
    <message>
        <source>Content</source>
        <translation>Inhalt</translation>
    </message>
    <message>
        <source>Price</source>
        <translation>Preis</translation>
    </message>
    <message>
</context>
</TS>

Template code in one of my templates says:

<h6>{"Content"|i18n("extension/dictionary")}</h6

However - you are aready expecting it! - I don't get translated text (in the example above it should be "Inhalt" instead of "Content") with this piece of code. (I cleared all caches before.)
I get a debug warning instead:

No translation for file(translation.ts) in context(extension/dictionary): 'Content' with comment()

What is still wrong here?

Thanks for any help,
Ulrich

Ɓukasz Serwatka

Thursday 19 October 2006 12:01:55 am

Hi Ulrich,

i18n() is very sensitive on white-spaces, hidden extra chars, etc. Make sure that your translation.ts file is "clean". Remember to clear all the cache.

Check also if there is no typo somewhere.

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

Claudia Kosny

Thursday 19 October 2006 3:31:39 am

Hi Ulrich

Maybe it is just a typo but in your post you mentioned the filename

Extension/dictionary/translations/ger-DE/translations.ts

The file must be named translation.ts (you have an 's' to much in the filename).

Claudia

Ulrich L.

Thursday 19 October 2006 12:23:31 pm

@Lukasz: I cannot figure out any redundant whitespaces. The posting above including the content of the translation.ts file has been created using copy&paste, and there is no wrong character inside, I think.

@Claudia: This was my fault while typing this posting, the real file names are fine.

Hmmm....

Ulrich L.

Thursday 19 October 2006 11:13:02 pm

Heureka! I found it!
In the translation.ts file there is just one open tag "message" too much. Having removed this, everything works perfectly!

eZ debug

Timing: Jan 18 2025 18:25:55
Script start
Timing: Jan 18 2025 18:25:55
Module start 'content'
Timing: Jan 18 2025 18:25:55
Module end 'content'
Timing: Jan 18 2025 18:25:55
Script end

Main resources:

Total runtime0.1802 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.0110 587.8281180.8281
Module start 'content' 0.01100.0064 768.656398.0234
Module end 'content' 0.01740.1627 866.6797529.3281
Script end 0.1801  1,396.0078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00402.1988200.0002
Check MTime0.00160.8692200.0001
Mysql Total
Database connection0.00130.730510.0013
Mysqli_queries0.129371.75231410.0009
Looping result0.00150.81801390.0000
Template Total0.162490.110.1624
Template load0.00100.570610.0010
Template processing0.161389.542110.1613
Override
Cache load0.00080.431210.0008
Sytem overhead
Fetch class attribute can translate value0.00090.502910.0009
XML
Image XML parsing0.00020.128810.0002
General
dbfile0.00543.0107200.0003
String conversion0.00000.004530.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