Zend_View_Helper_Translate

View: New views
9 Messages — Rating Filter:   Alert me  

Zend_View_Helper_Translate

by thomasW :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hy interested ones,

I am pround to announce that Zend_View_Helper_Translate is finished and
ready for core.
You can find it within the incubator with testbed (100% code coverage) and
documentation.

Hopefully it will be cored with the next release.

Greetings
Thomas
I18N Team Leader


Re: [fw-general] Zend_View_Helper_Translate

by Noé Froidevaux-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Thanks for this!

But, why we haven't a "_" function (in place of "translate")?

noe


On Jan 13, 2008 11:27 AM, Thomas Weidner <thomas.weidner@...> wrote:

> Hy interested ones,
>
> I am pround to announce that Zend_View_Helper_Translate is finished and
> ready for core.
> You can find it within the incubator with testbed (100% code coverage) and
> documentation.
>
> Hopefully it will be cored with the next release.
>
> Greetings
> Thomas
> I18N Team Leader
>
>

Re: Re: [fw-general] Zend_View_Helper_Translate

by thomasW :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

See here for details from the dev-team response:
http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_Translate+-+Thomas+Weidner

Greetings
Thomas
I18N Team Leader
----- Original Message -----
From: "Noé Froidevaux" <noe.froidevaux@...>
To: <fw-i18n@...>
Sent: Monday, January 14, 2008 10:31 AM
Subject: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate


> Hi!
>
> Thanks for this!
>
> But, why we haven't a "_" function (in place of "translate")?
>
> noe
>
>
> On Jan 13, 2008 11:27 AM, Thomas Weidner <thomas.weidner@...> wrote:
>> Hy interested ones,
>>
>> I am pround to announce that Zend_View_Helper_Translate is finished and
>> ready for core.
>> You can find it within the incubator with testbed (100% code coverage)
>> and
>> documentation.
>>
>> Hopefully it will be cored with the next release.
>>
>> Greetings
>> Thomas
>> I18N Team Leader
>>
>>


Re: Re: [fw-general] Zend_View_Helper_Translate

by Sascha Göbel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

maybe I'm wrong, but I'm using the "_" View Helper (with autoloading)
for some time now without any problems. Is this more of a theoretical
restriction?

Best Regards
Sascha

Thomas Weidner schrieb:

> See here for details from the dev-team response:
> http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_Translate+-+Thomas+Weidner 
>
>
> Greetings
> Thomas
> I18N Team Leader
> ----- Original Message ----- From: "Noé Froidevaux"
> <noe.froidevaux@...>
> To: <fw-i18n@...>
> Sent: Monday, January 14, 2008 10:31 AM
> Subject: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate
>
>
>> Hi!
>>
>> Thanks for this!
>>
>> But, why we haven't a "_" function (in place of "translate")?
>>
>> noe
>>
>>
>> On Jan 13, 2008 11:27 AM, Thomas Weidner <thomas.weidner@...> wrote:
>>> Hy interested ones,
>>>
>>> I am pround to announce that Zend_View_Helper_Translate is finished and
>>> ready for core.
>>> You can find it within the incubator with testbed (100% code
>>> coverage) and
>>> documentation.
>>>
>>> Hopefully it will be cored with the next release.
>>>
>>> Greetings
>>> Thomas
>>> I18N Team Leader
>>>
>>>
>
>

Re: Re: [fw-general] Zend_View_Helper_Translate

by thomasW :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Within ZF you would have problems as soon as you use Zend_Loader because all
"_" are changed to "/".
This is written in the answer from the ZF-dev team on the bottom of the
comments.

Just see the previous link for details as I already wrote.

Greetings
Thomas
I18N Team Leader

----- Original Message -----
From: "Sascha Goebel" <zendframework@...>
To: "Thomas Weidner" <thomas.weidner@...>
Cc: "Noé Froidevaux" <noe.froidevaux@...>; <fw-i18n@...>
Sent: Monday, January 14, 2008 7:12 PM
Subject: Re: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate


> Hi,
>
> maybe I'm wrong, but I'm using the "_" View Helper (with autoloading) for
> some time now without any problems. Is this more of a theoretical
> restriction?
>
> Best Regards
> Sascha
>
> Thomas Weidner schrieb:
>> See here for details from the dev-team response:
>> http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_Translate+-+Thomas+Weidner 
>> Greetings
>> Thomas
>> I18N Team Leader
>> ----- Original Message ----- From: "Noé Froidevaux"
>> <noe.froidevaux@...>
>> To: <fw-i18n@...>
>> Sent: Monday, January 14, 2008 10:31 AM
>> Subject: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate
>>
>>
>>> Hi!
>>>
>>> Thanks for this!
>>>
>>> But, why we haven't a "_" function (in place of "translate")?
>>>
>>> noe
>>>
>>>
>>> On Jan 13, 2008 11:27 AM, Thomas Weidner <thomas.weidner@...> wrote:
>>>> Hy interested ones,
>>>>
>>>> I am pround to announce that Zend_View_Helper_Translate is finished and
>>>> ready for core.
>>>> You can find it within the incubator with testbed (100% code coverage)
>>>> and
>>>> documentation.
>>>>
>>>> Hopefully it will be cored with the next release.
>>>>
>>>> Greetings
>>>> Thomas
>>>> I18N Team Leader
>>>>
>>>>
>>

Re: Re: [fw-general] Zend_View_Helper_Translate

by Sascha Göbel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again,

sorry for the late answer.

 >> ... as soon as you use Zend_Loader ...

That's exactly my point ... I am using Zend_Loader. Attached you can
find the view helper (_.php), the action helper (Translate.php) and
here's the autoloading stuff from my bootstrap:

// Set include path for zend autodiscovery
set_include_path(PATH_APPLICATION_LIBRARY . PATH_SEPARATOR .
PATH_LIBRARY . PATH_SEPARATOR . PATH_APPLICATION_MODELS . PATH_SEPARATOR
. get_include_path());

// Autoload
require 'Zend/Loader.php';
Zend_Loader::registerAutoload();

Or do I miss something?

Best regards
Sascha


Thomas Weidner schrieb:

> Within ZF you would have problems as soon as you use Zend_Loader because
> all "_" are changed to "/".
> This is written in the answer from the ZF-dev team on the bottom of the
> comments.
>
> Just see the previous link for details as I already wrote.
>
> Greetings
> Thomas
> I18N Team Leader
>
> ----- Original Message ----- From: "Sascha Goebel"
> <zendframework@...>
> To: "Thomas Weidner" <thomas.weidner@...>
> Cc: "Noé Froidevaux" <noe.froidevaux@...>; <fw-i18n@...>
> Sent: Monday, January 14, 2008 7:12 PM
> Subject: Re: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate
>
>
>> Hi,
>>
>> maybe I'm wrong, but I'm using the "_" View Helper (with autoloading)
>> for some time now without any problems. Is this more of a theoretical
>> restriction?
>>
>> Best Regards
>> Sascha
>>
>> Thomas Weidner schrieb:
>>> See here for details from the dev-team response:
>>> http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_Translate+-+Thomas+Weidner 
>>> Greetings
>>> Thomas
>>> I18N Team Leader
>>> ----- Original Message ----- From: "Noé Froidevaux"
>>> <noe.froidevaux@...>
>>> To: <fw-i18n@...>
>>> Sent: Monday, January 14, 2008 10:31 AM
>>> Subject: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate
>>>
>>>
>>>> Hi!
>>>>
>>>> Thanks for this!
>>>>
>>>> But, why we haven't a "_" function (in place of "translate")?
>>>>
>>>> noe
>>>>
>>>>
>>>> On Jan 13, 2008 11:27 AM, Thomas Weidner <thomas.weidner@...> wrote:
>>>>> Hy interested ones,
>>>>>
>>>>> I am pround to announce that Zend_View_Helper_Translate is finished
>>>>> and
>>>>> ready for core.
>>>>> You can find it within the incubator with testbed (100% code
>>>>> coverage) and
>>>>> documentation.
>>>>>
>>>>> Hopefully it will be cored with the next release.
>>>>>
>>>>> Greetings
>>>>> Thomas
>>>>> I18N Team Leader
>>>>>
>>>>>
>>>
>

translate(func_get_args()); } }
_logTranslation($input); return self::$translator->_($input); } // No arguments, no translation elseif (0 == $numArgs) { return ''; } // Translate and replace $args = func_get_args(); array_shift($args); $this->_logTranslation($input); return vsprintf(self::$translator->_($input), $args); } public function direct($input) { return $this->translate($input); } private function _logTranslation($string) { $data = '_(\'' . str_replace("'", "\\'", $string) . '\'); ?>'; if (false === strpos(file_get_contents(PATH_TEMP . 'translation.temp.php'), $data)) { $fp = fopen(PATH_TEMP . 'translation.temp.php', 'a'); fwrite($fp, $data . "\n"); fclose($fp); } } }

Re: Re: [fw-general] Zend_View_Helper_Translate

by thomasW :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You are missing that Zend_Loader changes any "_" character in the classname
to the directory separator.
This means that "Zend_View_Helper__" would be changed to the path
"Zend/View/Helper//"... which would not work.
Also within the Controller several function are working on "_" to get the
helper and so on...

That was the reason from the dev-team and matthew to reject this part of my
proposal.
If you see any chance of getting Zend_View_Helper__ included then it would
be best if you speak with matthew in the MVC list.
He is the one with the background to MVC and Loader.

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

----- Original Message -----
From: "Sascha Goebel" <zendframework@...>
To: "Thomas Weidner" <thomas.weidner@...>
Cc: "Noé Froidevaux" <noe.froidevaux@...>; <fw-i18n@...>
Sent: Saturday, January 19, 2008 1:42 PM
Subject: Re: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate


> Hi again,
>
> sorry for the late answer.
>
> >> ... as soon as you use Zend_Loader ...
>
> That's exactly my point ... I am using Zend_Loader. Attached you can
> find the view helper (_.php), the action helper (Translate.php) and
> here's the autoloading stuff from my bootstrap:
>
> // Set include path for zend autodiscovery
> set_include_path(PATH_APPLICATION_LIBRARY . PATH_SEPARATOR .
> PATH_LIBRARY . PATH_SEPARATOR . PATH_APPLICATION_MODELS . PATH_SEPARATOR
> . get_include_path());
>
> // Autoload
> require 'Zend/Loader.php';
> Zend_Loader::registerAutoload();
>
> Or do I miss something?
>
> Best regards
> Sascha
>
>
> Thomas Weidner schrieb:
>> Within ZF you would have problems as soon as you use Zend_Loader because
>> all "_" are changed to "/".
>> This is written in the answer from the ZF-dev team on the bottom of the
>> comments.
>>
>> Just see the previous link for details as I already wrote.
>>
>> Greetings
>> Thomas
>> I18N Team Leader
>>
>> ----- Original Message ----- From: "Sascha Goebel"
>> <zendframework@...>
>> To: "Thomas Weidner" <thomas.weidner@...>
>> Cc: "Noé Froidevaux" <noe.froidevaux@...>; <fw-i18n@...>
>> Sent: Monday, January 14, 2008 7:12 PM
>> Subject: Re: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate
>>
>>
>>> Hi,
>>>
>>> maybe I'm wrong, but I'm using the "_" View Helper (with autoloading)
>>> for some time now without any problems. Is this more of a theoretical
>>> restriction?
>>>
>>> Best Regards
>>> Sascha
>>>
>>> Thomas Weidner schrieb:
>>>> See here for details from the dev-team response:
>>>> http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_Translate+-+Thomas+Weidner
>>>> Greetings
>>>> Thomas
>>>> I18N Team Leader
>>>> ----- Original Message ----- From: "Noé Froidevaux"
>>>> <noe.froidevaux@...>
>>>> To: <fw-i18n@...>
>>>> Sent: Monday, January 14, 2008 10:31 AM
>>>> Subject: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate
>>>>
>>>>
>>>>> Hi!
>>>>>
>>>>> Thanks for this!
>>>>>
>>>>> But, why we haven't a "_" function (in place of "translate")?
>>>>>
>>>>> noe
>>>>>
>>>>>
>>>>> On Jan 13, 2008 11:27 AM, Thomas Weidner <thomas.weidner@...>
>>>>> wrote:
>>>>>> Hy interested ones,
>>>>>>
>>>>>> I am pround to announce that Zend_View_Helper_Translate is finished
>>>>>> and
>>>>>> ready for core.
>>>>>> You can find it within the incubator with testbed (100% code
>>>>>> coverage) and
>>>>>> documentation.
>>>>>>
>>>>>> Hopefully it will be cored with the next release.
>>>>>>
>>>>>> Greetings
>>>>>> Thomas
>>>>>> I18N Team Leader
>>>>>>
>>>>>>
>>>>
>>
>


--------------------------------------------------------------------------------


> translate(func_get_args()); } }


--------------------------------------------------------------------------------


> _logTranslation($input); return self::$translator->_($input); } // No
> arguments, no translation elseif (0 == $numArgs) { return ''; } //
> Translate and replace $args = func_get_args(); array_shift($args);
> $this->_logTranslation($input); return
> vsprintf(self::$translator->_($input), $args); } public function
> direct($input) { return $this->translate($input); } private function
> _logTranslation($string) { $data = '_(\'' . str_replace("'", "\\'",
> $string) . '\'); ?>'; if (false === strpos(file_get_contents(PATH_TEMP .
> 'translation.temp.php'), $data)) { $fp = fopen(PATH_TEMP .
> 'translation.temp.php', 'a'); fwrite($fp, $data . "\n");
> fclose($fp); } } }


Re: Re: [fw-general] Zend_View_Helper_Translate

by Sascha Göbel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Matthew,

please see the following thread regarding a "_" view helper for translation.

The point at issue is, that I'm already using such a helper together
with the Zend_Loader without any problems.

What do you think on this topic?

Best Regards,
Sascha

Thomas Weidner schrieb:

> You are missing that Zend_Loader changes any "_" character in the
> classname to the directory separator.
> This means that "Zend_View_Helper__" would be changed to the path
> "Zend/View/Helper//"... which would not work.
> Also within the Controller several function are working on "_" to get
> the helper and so on...
>
> That was the reason from the dev-team and matthew to reject this part of
> my proposal.
> If you see any chance of getting Zend_View_Helper__ included then it
> would be best if you speak with matthew in the MVC list.
> He is the one with the background to MVC and Loader.
>
> Greetings
> Thomas, I18N Team Leader
> http://www.thomasweidner.com
>
> ----- Original Message ----- From: "Sascha Goebel"
> <zendframework@...>
> To: "Thomas Weidner" <thomas.weidner@...>
> Cc: "Noé Froidevaux" <noe.froidevaux@...>; <fw-i18n@...>
> Sent: Saturday, January 19, 2008 1:42 PM
> Subject: Re: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate
>
>
>> Hi again,
>>
>> sorry for the late answer.
>>
>> >> ... as soon as you use Zend_Loader ...
>>
>> That's exactly my point ... I am using Zend_Loader. Attached you can
>> find the view helper (_.php), the action helper (Translate.php) and
>> here's the autoloading stuff from my bootstrap:
>>
>> // Set include path for zend autodiscovery
>> set_include_path(PATH_APPLICATION_LIBRARY . PATH_SEPARATOR .
>> PATH_LIBRARY . PATH_SEPARATOR . PATH_APPLICATION_MODELS . PATH_SEPARATOR
>> . get_include_path());
>>
>> // Autoload
>> require 'Zend/Loader.php';
>> Zend_Loader::registerAutoload();
>>
>> Or do I miss something?
>>
>> Best regards
>> Sascha
>>
>>
>> Thomas Weidner schrieb:
>>> Within ZF you would have problems as soon as you use Zend_Loader because
>>> all "_" are changed to "/".
>>> This is written in the answer from the ZF-dev team on the bottom of the
>>> comments.
>>>
>>> Just see the previous link for details as I already wrote.
>>>
>>> Greetings
>>> Thomas
>>> I18N Team Leader
>>>
>>> ----- Original Message ----- From: "Sascha Goebel"
>>> <zendframework@...>
>>> To: "Thomas Weidner" <thomas.weidner@...>
>>> Cc: "Noé Froidevaux" <noe.froidevaux@...>;
>>> <fw-i18n@...>
>>> Sent: Monday, January 14, 2008 7:12 PM
>>> Subject: Re: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate
>>>
>>>
>>>> Hi,
>>>>
>>>> maybe I'm wrong, but I'm using the "_" View Helper (with autoloading)
>>>> for some time now without any problems. Is this more of a theoretical
>>>> restriction?
>>>>
>>>> Best Regards
>>>> Sascha
>>>>
>>>> Thomas Weidner schrieb:
>>>>> See here for details from the dev-team response:
>>>>> http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_Translate+-+Thomas+Weidner 
>>>>>
>>>>> Greetings
>>>>> Thomas
>>>>> I18N Team Leader
>>>>> ----- Original Message ----- From: "Noé Froidevaux"
>>>>> <noe.froidevaux@...>
>>>>> To: <fw-i18n@...>
>>>>> Sent: Monday, January 14, 2008 10:31 AM
>>>>> Subject: [fw-i18n] Re: [fw-general] Zend_View_Helper_Translate
>>>>>
>>>>>
>>>>>> Hi!
>>>>>>
>>>>>> Thanks for this!
>>>>>>
>>>>>> But, why we haven't a "_" function (in place of "translate")?
>>>>>>
>>>>>> noe
>>>>>>
>>>>>>
>>>>>> On Jan 13, 2008 11:27 AM, Thomas Weidner <thomas.weidner@...>
>>>>>> wrote:
>>>>>>> Hy interested ones,
>>>>>>>
>>>>>>> I am pround to announce that Zend_View_Helper_Translate is finished
>>>>>>> and
>>>>>>> ready for core.
>>>>>>> You can find it within the incubator with testbed (100% code
>>>>>>> coverage) and
>>>>>>> documentation.
>>>>>>>
>>>>>>> Hopefully it will be cored with the next release.
>>>>>>>
>>>>>>> Greetings
>>>>>>> Thomas
>>>>>>> I18N Team Leader
>>>>>>>
>>>>>>>
>>>>>
>>>
>>
>
>
> --------------------------------------------------------------------------------
>
>
>
>> translate(func_get_args()); } }
>
>
> --------------------------------------------------------------------------------
>
>
>
>> _logTranslation($input); return self::$translator->_($input); } // No
>> arguments, no translation elseif (0 == $numArgs) { return ''; } //
>> Translate and replace $args = func_get_args(); array_shift($args);
>> $this->_logTranslation($input); return
>> vsprintf(self::$translator->_($input), $args); } public function
>> direct($input) { return $this->translate($input); } private function
>> _logTranslation($string) { $data = '_(\'' . str_replace("'", "\\'",
>> $string) . '\'); ?>'; if (false === strpos(file_get_contents(PATH_TEMP
>> . 'translation.temp.php'), $data)) { $fp = fopen(PATH_TEMP .
>> 'translation.temp.php', 'a'); fwrite($fp, $data . "\n"); fclose($fp);
>> } } }
>
>

Re: Re: [fw-general] Zend_View_Helper_Translate

by Pavel Franc-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sascha Goebel napsal(a):
> Hi Matthew,
>
> please see the following thread regarding a "_" view helper for
> translation.
>
> The point at issue is, that I'm already using such a helper together
> with the Zend_Loader without any problems.
>
> What do you think on this topic?

Hi all,
in our project we do also use

Zend_Loader::registerAutoload();

and

class Zend_View_Helper__
{
    public function setView(Zend_View_Interface $view) {}
    public function _($messageId, $param = null) {}
}
 
and everything works fine. IMHO this is due the fact that the class is
loaded in Zend_View_Abstract::_loadClass() directly with no str_replace
involved and not by Zend_Loader::loadClass()


Best,
Pavel Franc

LightInTheBox - Buy quality products at wholesale price