ZF-5547: Allow to build the list of untranslated message IDs


In Zend_Translate_Adapter file we have following method:

    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.



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

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.

New feature added to trunk.

Under code review since 02.Feb.09

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...

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.

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.

New feature added with r14128