Just for understanding, do you think it's possible to implement (in the core class) another method who simply output the content of the translated text without any vsprintf? Otherwise I have resolved with a simple custom helper :)

Short term no... have to think about pro and con... could be that it has to be a own helper even in core.

Another question is:

If I try this code:
<?php
// within your view
$date = array("Monday", "April", "11:20:55");

// returns 'de' as set default locale from our above examples
$this->getLocale();

$this->setLocale('it')->translate('Today is %1\$s in %2\$s. Actual time: %3\$s', $date);

// returns 'it' as new set default locale
$this->getLocale();
?>
I have this Exception return:

helper 'GetLocale' not found in path

The Zend_Translate object was correctly stored in the Registry as indicated in the manual (as best solution).
Any idea?

$this->getLocale and $this->setLocale are impossible to work because $this is the view itself... from within the view you can only call view helpers. And the error you get is saying that there is no helper named "getLocale" which is correct... it would also throw an error on setLocale because the helper is named translate().

The correct way is described within the manual:
$this->translate()->getLocale()

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 2:07 PM
Subject: Re: [fw-general] Zend_View_Helper_Translate problem with HTML in translated text


Just for understanding, do you think it's possible to implement (in the core class) another method who simply output the content of the translated text without any vsprintf? Otherwise I have resolved with a simple custom helper :)

Another question is:

If I try this code:
<?php
// within your view
$date = array("Monday", "April", "11:20:55");

// returns 'de' as set default locale from our above examples
$this->getLocale();

$this->setLocale('it')->translate('Today is %1\$s in %2\$s. Actual time: %3\$s', $date);

// returns 'it' as new set default locale
$this->getLocale();
?>
I have this Exception return:

helper 'GetLocale' not found in path

The Zend_Translate object was correctly stored in the Registry as indicated in the manual (as best solution).
Any idea?

---
Emanuele Deserti
Netwing S.r.l.
<[EMAIL PROTECTED]>
Tel. 0532-1901110
http://www.netwing.it

Il giorno 28/feb/08, alle ore 10:06, Thomas Weidner ha scritto:

Every existing adapter can handle html... except possibly csv.
You should not throw multiple components together when you have problems... one thing is Zend_Translate... the other thing is Zend_View_Helper_Translate...these are two complete different components.

For examples how different translation formats are created please use a search engine... this would really go beyond the scope of our manual as it would cover about 100 pages only for the fundamentals.

Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

----- Original Message ----- From: "Lord_Lele" <[EMAIL PROTECTED]
>
To: <[email protected]>
Sent: Thursday, February 28, 2008 9:49 AM
Subject: Re: [fw-general] Zend_View_Helper_Translate problem with HTML in translated text



Hi,

thanks for response :)

Probably the best solution it's the 3.
I'm working on a custom helper to do this.

But only for my curiosity, where is an adapter who can handle HTML without
problems?
At this URL: http://framework.zend.com/manual/en/zend.translate.adapter.html
I have read this:
"37.2.1.8. Zend_Translate_Adapter_XmlTm
The XmlTm Adapter is the Adapter which will be used by customers which do
their layout themself. XmlTm is a format which allows the complete  html
source to be included in the translation source, so the translation  is
coupled with the layout. XLIFF is a XML file based format, which is related
to XLIFF but its not as simple to read."

But I haven't find any example on how to use this adapter...


Thomas Weidner-2 wrote:

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


--
View this message in context: http://www.nabble.com/Zend_View_Helper_Translate-problem-with-HTML-in-translated-text-tp15716917s16154p15732113.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Reply via email to