Zend Framework

Language fallback doenst work

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Not an Issue
  • Affects Version/s: 1.9.3
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Translate
  • Labels:
    None

Description

As mentioned in the manual the locale "en_US" should downgrade to "en", if "en_US" not exists, but "en" does. This does not work. I have a language file with "de", but if I set my browser to prefer "de_DE" before "de" the Exception "No translation for language "de_DE" available. I looked into Translate/Adapter.php and found something at line 330

if (empty($this->_translate[$locale])) {
            if (!$this->_options['disableNotices']) {
                if ($this->_options['log']) {
                    $this->_options['log']->notice("No translation for the language '{$locale}' available.");
                } else {
                    trigger_error("No translation for the language '{$locale}' available.", E_USER_NOTICE);
                }
            }
        }

If I var_dump() $this->_translate I see, that there is a key "de_DE" with an empty array as valie, which I have never added. I dont know, where it come from, but its quite annoying.

Activity

Hide
Thomas Weidner added a comment -

I don't see where the problem should be.
According to manual you can disable the triggered notice with the "disableNotices" option.

Or simply look into the codeline you copied...

Show
Thomas Weidner added a comment - I don't see where the problem should be. According to manual you can disable the triggered notice with the "disableNotices" option. Or simply look into the codeline you copied...
Hide
Thomas Weidner added a comment -

Closing as non-issue

Show
Thomas Weidner added a comment - Closing as non-issue
Hide
Sebastian Krebs added a comment -

The notice itself its not the problem. And of course I see, that I can disable them But where did the "phantom language" data for "de_DE" come from? As I said I never added it. And therefore this notice shouldnt occur here, or what I misunderstood?

Show
Sebastian Krebs added a comment - The notice itself its not the problem. And of course I see, that I can disable them But where did the "phantom language" data for "de_DE" come from? As I said I never added it. And therefore this notice shouldnt occur here, or what I misunderstood?
Hide
Thomas Weidner added a comment -

As your issue is about "Language fallback does not work", it has been closed.

What you call "Phantom language" depends on how you initiate Zend_Translate, how your data structure looks like, how you cache, how your locale is detected and some other variants.

It is possible and logical to have phantom languages, for example when you do file search or when you add empty files.

As you did not gave any code or description on how you are using Zend_Translate I see this issue as fixed because code works as expected.

Show
Thomas Weidner added a comment - As your issue is about "Language fallback does not work", it has been closed. What you call "Phantom language" depends on how you initiate Zend_Translate, how your data structure looks like, how you cache, how your locale is detected and some other variants. It is possible and logical to have phantom languages, for example when you do file search or when you add empty files. As you did not gave any code or description on how you are using Zend_Translate I see this issue as fixed because code works as expected.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: