Zend Framework

getLocale() returns string instead of expected Zend_Locale

Details

  • Type: Docs:  Problem Docs: Problem
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5.0RC1
  • Fix Version/s: 1.5.1
  • Component/s: Zend_Translate
  • Labels:
    None
  • Language:
    English

Description

As API Doc says getLocale() should return a Zend_Locale instance. Instead it returns a string like 'de_DE'.

$locale = $translate->getLocale();
Zend_Debug::dump(is_object($locale)); #returns false;
Zend_Debug::dump(is_string($locale)); #returns true;
$lang = $locale->toString();  #Fatal error: Call to a member function toString() on a non-object

Activity

Hide
Thomas Weidner added a comment -

But "de_DE" is the locale.

A Zend_Locale can be

  • a object of type Zend_Locale
  • a locale definition string from Zend_Locale

Both are true and valid...
Every class which takes a locale must accepts both ways.

Show
Thomas Weidner added a comment - But "de_DE" is the locale. A Zend_Locale can be
  • a object of type Zend_Locale
  • a locale definition string from Zend_Locale
Both are true and valid... Every class which takes a locale must accepts both ways.
Hide
Thomas Weidner added a comment -

Changed the APIdoc to be consistent with the implementation.

Show
Thomas Weidner added a comment - Changed the APIdoc to be consistent with the implementation.
Hide
Wil Sinclair added a comment -

I can't tell which version this was fixed for.
Thomas, could you please add a rev number in the form rXXXX where X's are digits when you resolve the issue? Thanks.

Show
Wil Sinclair added a comment - I can't tell which version this was fixed for. Thomas, could you please add a rev number in the form rXXXX where X's are digits when you resolve the issue? Thanks.
Hide
Thomas Weidner added a comment -

Fixed with r8672

Show
Thomas Weidner added a comment - Fixed with r8672

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: