Hy Emanuele/Lele,
the problem is not the adapter but your content.
As you already know you have 3 options:
1.) Change your translation to %% instead of %... I mentioned this before
2.) Change the local code for View_Helper_Translate as you stated... but
this will not be integrated into core for other reasons and leads to
problems when upgrading to a newer ZF version. (Never change a foreign
library :-) )
3.) Extend the existing helper and modify the needed function.
1. is simplest... 3. is best from oop point of view.
It's your decision
Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com
----- Original Message -----
From: "Emanuele Deserti" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, February 28, 2008 9:00 AM
Subject: Re: [fw-general] Zend_View_Helper_Translate problem with HTML in
translated text
Hi,
thanks for response.
It's not the messageid... my messageid is "index_content".
But the content (and even the format) of the page may vary between
Italian and English.
In Italian version of the page, we have a table with width="100%" and
even with CDATA tag, there's no chance to work correctly...
The CDATA can be a valid XML tag, but the vsprintf is done by PHP who
ignore the CDATA tag
I need to insert HTML in translation file because we have long text with
bold, italic, and many other little formatting encompassing all the text
and create a single translation unit for each can be very tedious :-)
So if it's not possible to insert HTML in TMX file... what other language
adapter I can use to do this? XmlTM? Xliff? or what?
Thanks in advance,
Regards
P.S.: this is my TMX code... maybe I'm missing something:
This is my TMX code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tmx SYSTEM
"http://www.lisa.org/fileadmin/standards/tmx1.4/tmx14.dtd.txt ">
<tmx version="1.4">
<header creationtoolversion="1.0.0"
datatype="winres"
segtype="sentence"
adminlang="it"
srclang="it"
o-tmf="abc"
creationtool="none" >
</header>
<body>
<tu tuid="index_content">
<tuv xml:lang="it"><seg>
<![CDATA[
<table width="100%">
<tr><td></td></tr>
</table>
]]>
</seg></tuv>
<tuv xml:lang="en"><seg>English Text</seg></tuv>
</tu>
</body>
</tmx>
---
Emanuele Deserti
Netwing S.r.l.
<[EMAIL PROTECTED]>
Tel. 0532-1901110
http://www.netwing.it
Il giorno 27/feb/08, alle ore 17:47, Thomas Weidner ha scritto:
Hy Lele,
the question is why you are using a HTML content as messageid ? This
makes no sense because the HTML content will not be different in other
languages... it's always the same, so why translate it ? You should only
translate text which differs in other languages.
Generally if you are using a % sign within the translation using
variable parameters you have to do "%%".
The problem with your code is that when a messageid "my %d counts" is
given without the required option it has to return an warning. How would
you otherwise know that you have a problem in your code ?
Your change should not be integrated in the core... it creates other
problems.
For information about how to integrate html code in your tmx file just
take a look in the tmx specification about how to archive this. A simple
cdata-tag should do it as tmx is 100% xml based.
Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com
----- Original Message ----- From: "Lord_Lele"
<[EMAIL PROTECTED]
>
To: <[email protected]>
Sent: Wednesday, February 27, 2008 5:26 PM
Subject: [fw-general] Zend_View_Helper_Translate problem with HTML in
translated text
Hi,
I have a TMX based translation and I'm using the new View Helper for
translate text in View scripts.
However, if I have some HTML in translated text I've this error:
Warning: vsprintf() [function.vsprintf]: Too few arguments in
/usr/local/www/apache22/Library/ZendFramework15/library/Zend/View/
Helper/Translate.php
on line 89
This is because in my HTML I have a table with 'width="100%"' and the
function vsprintf try to substitute the content of the string (with the
%),
but without any other params the function raise a Warning.
This is my workaround:
In Zend/View/Helper/Translate.php on line 89 instead of:
return vsprintf($message, $options);
now it is:
if (count($options)==0) {
return $message;
} else {
return vsprintf($message, $options);
}
Is this modification correct? Can be included in current library?
Or is not possible to insert HTML in a TMX file? If not, what's an
alternative?
--
View this message in context:
http://www.nabble.com/Zend_View_Helper_Translate-problem-with-HTML-in-translated-text-tp15716917s16154p15716917.html
Sent from the Zend Framework mailing list archive at Nabble.com.