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.

Reply via email to