Issues

ZF-11567: automatic detection of locales based on directory structure fails

Issue Type: Bug Created: 2011-07-15T13:52:03.000+0000 Last Updated: 2011-08-03T12:00:10.000+0000 Status: Resolved Fix version(s): - 1.11.10 (04/Aug/11)

  • Next Major Release ()

Reporter: Paul Winnen (winnenp) Assignee: Thomas Weidner (thomas) Tags: - Zend_Translate

Related issues: - ZF-11546

Attachments:

Description

version 1.11.9 seems to haven introduced a bug in the automatic detection of locales via directory scanning.

I use the following setup:

The default locale is set to "en"

Zend_Translate is configured with the following options:

<pre class="highlight">
$translate = new Zend_Translate(
  array(
    'adapter' => 'gettext',
    'content' => APPLICATION_PATH . "/locale",
    'scan'    => Zend_Translate::LOCALE_DIRECTORY,
  )
);
Zend_Registry::set('Zend_Translate', $translate);

The directory structure containing the gettext files is as follows

<pre class="literal"> 
APPLICATION_PATH
  locale
    de
      LC_MESSAGES
        messages.mo
    en
      LC_MESSAGES
        messages.mo
    fr
      LC_MESSAGES
        messages.mo

When i upgraded from version 1.11.8 to 1.11.9 only one locale was fetched. It was recognized as the default locale ("en" in my case), although it contained the translation strings of the last locale in the content-directory.

The problem seems to be caused by the new code on line 248 in Zend_Translator_Adapter.

The iterator seems to contain only files and no directories, so the different locales never get identified and correctly added.

Based on the code from version 1.11.8 i added the RecursiveIteratorIterator::SELF_FIRST parameter to the RecursiveIteratorIterator constructor. This seems to have solved the problem.

Comments

Posted by Guilherme Blanco (guilhermeblanco) on 2011-07-25T14:53:57.000+0000

This issue is now fixed by r24268

Thanks a lot for the input.

Posted by Thomas Weidner (thomas) on 2011-07-26T15:38:22.000+0000

Fixed implementation with GH-259 See ZF-11546 for details

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts