ZF-2310: Add an default locale to Zend_Locale

Issue Type: New Feature Created: 2007-12-14T02:45:33.000+0000 Last Updated: 2008-02-26T12:55:58.000+0000 Status: Resolved Fix version(s): - 1.0.4 (26/Feb/08)

Reporter: Thomas Weidner (thomas) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: - ZF-2300



Add an default locale which will be used in the case that wether the browser nor the server provides a locale.

In this case the exception would not be thrown and instead the default locale would be used.


Posted by Thomas Weidner (thomas) on 2007-12-14T02:47:21.000+0000

First to solve the detection problems before handling the undetectable "C" locale.

Posted by Simone Carletti (weppos) on 2007-12-16T07:11:12.000+0000

I just come across this issue. I work on a MacBook Pro and I created a simple Zend_Service_Delicious script.

This issue causes Zend_Service_Delicious to fail when called via shell on my Mac. I posted all details here ZF-2318.

About this issue I [… a topic] that apparently describes the same problem. I vote +1 for a default locale setting on detection failure.

Posted by Thomas Weidner (thomas) on 2007-12-16T10:59:11.000+0000

Sorry, but Zend_Service_Delicious has NOTHING to do with Zend_Locale. You can solve your problem this way:

<pre class="highlight">
setlocale(LC_ALL, 'it_IT');
$service = new Zend_Service_Delicious();

In general the problem is that Zend_Service_Delicious does not handle exceptions from Zend_Locale properly.

Posted by Simone Carletti (weppos) on 2007-12-16T11:17:54.000+0000

Hi Thomas,

I know that the specific Zend_Service_Delicious issue has nothing to do with this Zend_Locale issue. This is why I posted ZF-2318 under the proper Zend_Service_Delicious category.

However, my comment was to point out how executing Zend_Locale under Mac Osx via shell causes

<pre class="highlight">
setlocale(LC_ALL, 0);

to return C string instead of a valid locale variable and, in general, it causes Zend_Locale to throw an Exception. In this specific issue, my comment was a kind of agreement to your 'default locale' suggestion. :)

I also noticed that Zend_Locale autodetection calls this function

<pre class="highlight">
     * Returns the locale which the framework is set to
    public function getFramework()
        $languages = array();
        return $languages;

but it seems closed to itself without any possibility of adding defaul languages without extending the class itself. Is it a bug or a design decision? (May be this should be a different issue?)

PS. About Zend_Service_Delicious, I already used setlocale(LC_ALL, 'en_US'); as a workaround before and it works but I think something should be improved in the class itself, this is why I opened a new issue at ZF-2318.

Posted by Thomas Weidner (thomas) on 2007-12-16T13:45:56.000+0000

The getFramework() method was added because when this proposal was made there was a discussion of adding a generic framework wide config.

There is still a proposal which aims to do so... this is what this method was made for. As the related proposal is still not implemented the method is still empty.

This is no bug, it was a design decision of the dev-team.

Posted by Simone Carletti (weppos) on 2007-12-16T14:48:29.000+0000

{quote}As the related proposal is still not implemented the method is still empty.{quote}

Thanks for your clarifications, Thomas.

Posted by Thomas Weidner (thomas) on 2007-12-17T14:35:36.000+0000

Implemented with SVN-7175.

Have you found an issue?

See the Overview section for more details.


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