Share » Forums » Setup & design » i18n: doesn't show any translation

i18n: doesn't show any translation

i18n: doesn't show any translation

Wednesday 07 November 2007 12:51:44 am - 3 replies

Author Message

Mirko Battisti

Thursday 08 November 2007 5:50:57 am

I narrowed down the issue, and found out that what bothers the i18n function is the fact that there were some "entities" into the keys used to get the translated text. In particular:

(in the translation.ts file)
<message>
<source>No results were found when searching for &lt;%1&gt;</source>
<translation>Cercando &lt;%1&gt; non è stato trovato nessun risultato</translation>
</message>

The problem is somehow connected with the presence of the "&lt;" and "&gt;" entities. I don't know wether that is a configuration problem specific to our ez Publish installation, or if there is some other reason.

If someone could help sorting that out, it would be very much appreciated.

Thank you,
Mirko.

Mirko Battisti

Thursday 08 November 2007 6:33:34 am

Ok. I finally got it solved.
My fault.

In the xml file (translation.ts),I had something like:
<message>
<source>No results were found when searching for &lt;%1&gt;</source>
<translation>Cercando &lt;%1&gt; non è stato trovato nessun risultato</translation>
</message>

When calling the i18n function, I assumed (wrongly) that I should use the entities "&gt;" to specify the key (source), as follows:

<p>{'No results were found when searching for &lt;%1&gt;'|i18n('design/standard/content/search','',array($search_text|wash))}</p>

Changing that to:

<p>{'No results were found when searching for <%1&>'|i18n('design/standard/content/search','',array($search_text|wash))}</p>

Solved my problem.

It really gave me a headache. I hope this post will be useful to someone else.
And maybe this aspect of the i18n process should be pointed out in the documentation.

Regards,
Mirko.

Pierre SCALFATI

Monday 01 February 2010 8:50:16 am

Hello,

For me, the translation from English to French using the above solution didn't work. Maybe have I missed or misunderstood something in the above explanation.

So here is what I did. First of all, I must precise that I didn't use the Greater/lower signs. I used the double quotes instead.

In my template I put this :

<code>

<div class="feedback">
<h2>{"Search for \"%1\" returned %2 matches"|i18n("presse/content/search",,array($search_text|wash,$search_count))}</h2>
</div>
</code>

And in my translation.ts file I put in the right section (for me, in the "presse/content/search" section) the following :

<code>

<message>
<source>Search for "%1" returned %2 matches</source>
<translation>La recherche de "%1" a retourné %2 résultats</translation>
</message>

</code>

The displayed result on my page when I switch to French is :

La recherche de "mon texte" a retourné 7 résultats

The displayed result on my page when I switch to English is :

Search for "mon texte" returned 7 matches

If it can help :)

Cheers!

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

36 542 Users on board!

Forums menu