Zend Framework

Zend_Translate should find sources based solely on dir/file structure

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Not an Issue
  • Affects Version/s: 1.8.0
  • Fix Version/s: 1.8.2
  • Component/s: Zend_Translate
  • Labels:
    None

Description

When using the array adapter (not sure if it happens with other adapters), if you have multiple language files distributed over multiple folders and more than one file has the same index for a translate element ZF "chooses" one of the files and uses it, often generating wrong translations. For an example, if I have:

application/views/scripts/index/index.phtml and
application/views/scripts/contact/index.phtml

and I have my language files like this:

application/languages/en/US/index/index.php and
application/languages/en/US/contact/index.php

and both language files return a 'title' index, I may end up with the wrong 'title' translated. I believe Zend_Translate should look for sources based solely in folder/file structure, connecting views and language files.

Activity

Hide
Thomas Weidner added a comment -

You misunderstood how translation works:
There is no way to have two identical messageIds translated into two different translations.

Example:
When you write in your code...

translate('Title');

and the same in another file then the messageId 'Title' is used for both files.

On the other hand, when you have the messageId 'Title' in two different files then you will not know which of them will be used because the used adapter is responsible for this.

There is no way to support this as translations are not related to the path of a file, but to the text which has to be translated.

To have a solution you must use different messageIds:
For example 'Title_Index' and 'Title_Contact' when you are not using real content. Because when you have "My Title" in two files, the translation is for both files equal.

Show
Thomas Weidner added a comment - You misunderstood how translation works: There is no way to have two identical messageIds translated into two different translations. Example: When you write in your code... translate('Title'); and the same in another file then the messageId 'Title' is used for both files. On the other hand, when you have the messageId 'Title' in two different files then you will not know which of them will be used because the used adapter is responsible for this. There is no way to support this as translations are not related to the path of a file, but to the text which has to be translated. To have a solution you must use different messageIds: For example 'Title_Index' and 'Title_Contact' when you are not using real content. Because when you have "My Title" in two files, the translation is for both files equal.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: