Zend Framework

Allow to build the list of untranslated message IDs

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.8.0
  • Component/s: Zend_Translate
  • Labels:
    None

Description

In Zend_Translate_Adapter file we have following method:

<?php
    public function translate($messageId, $locale = null)
    {
         // ..... method code ........



        // no translation found, return original
        return $messageId;
    }
?>

so if no translation found for particular message ID then original message Id returned.

Any way, its good to have the mechanism to collect untranslated message IDs and for example build some untranslated IDs list or add some missed translations reporting mechanism. Also such functionality would be good on application development stage to debug interface internationalization functionality.

From my point of view it need to have some enableTrackingMissedId() / disableTrackingMissedId()
And then at the end we can call ->getUntranslatedIds(); receive the list of all untranslated message Ids and use this array for further purposes.

Regards!

Activity

Hide
Thomas Weidner added a comment -

Use the isTranslated() method and log the requested translation when the method returns false.
All other ways are not practicable.

Show
Thomas Weidner added a comment - Use the isTranslated() method and log the requested translation when the method returns false. All other ways are not practicable.
Hide
Joseph Chereshnovsky added a comment -

The purpose of this feature was to use view helper $this->translate('My translatable message!') as usually.
So the solution I see will be to add custom translation view helper that will proxify calls to Zend_Translate_Adapter.

Issue can be closed now in such case, hope this issue can be useful for others who have the same goal as me.
Thanks Thomas.

Show
Joseph Chereshnovsky added a comment - The purpose of this feature was to use view helper $this->translate('My translatable message!') as usually. So the solution I see will be to add custom translation view helper that will proxify calls to Zend_Translate_Adapter. Issue can be closed now in such case, hope this issue can be useful for others who have the same goal as me. Thanks Thomas.
Hide
Thomas Weidner added a comment -

New feature added to trunk.

Under code review since 02.Feb.09

Show
Thomas Weidner added a comment - New feature added to trunk. Under code review since 02.Feb.09
Hide
Joseph Chereshnovsky added a comment -

Tested, and it works OK. Thanks!

just notice, - we can check if provided object implements required interface but not the "instanceof" particular class, here:
233: if (($key == 'log') && !($option instanceof Zend_Log)) {
then custom class can be used to process the untranslated MessageIds, with no need to use huge Zend_Log with custom Log Writer, etc...

Show
Joseph Chereshnovsky added a comment - Tested, and it works OK. Thanks! just notice, - we can check if provided object implements required interface but not the "instanceof" particular class, here: 233: if (($key == 'log') && !($option instanceof Zend_Log)) { then custom class can be used to process the untranslated MessageIds, with no need to use huge Zend_Log with custom Log Writer, etc...
Hide
Thomas Weidner added a comment -

And which interface ?
Zend_Log does not implement any interface so there is no interface to check for.

When doing your own Log implementation you would just have to extend Zend_Log and do what you need.

Show
Thomas Weidner added a comment - And which interface ? Zend_Log does not implement any interface so there is no interface to check for. When doing your own Log implementation you would just have to extend Zend_Log and do what you need.
Hide
Thomas Weidner added a comment -

To mention...
Code reviews are done by the dev-team and not by the community.
I am just waiting for the response to my request.

Show
Thomas Weidner added a comment - To mention... Code reviews are done by the dev-team and not by the community. I am just waiting for the response to my request.
Hide
Thomas Weidner added a comment -

New feature added with r14128

Show
Thomas Weidner added a comment - New feature added with r14128

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: