Fluent::install_locale PHP Method

install_locale() public static method

Installs the current locale into i18n
public static install_locale ( boolean $persist = true )
$persist boolean Attempt to persist any detected locale within session / cookies
    public static function install_locale($persist = true)
    {
        // Ensure the locale is set correctly given the designated parameters
        $locale = self::current_locale($persist);
        if (empty($locale)) {
            return;
        }
        i18n::set_locale($locale);
        // LC_NUMERIC causes SQL errors for some locales (comma as decimal indicator) so skip
        foreach (array(LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_TIME) as $category) {
            setlocale($category, "{$locale}.UTF-8", $locale);
        }
        // Get date/time formats from Zend
        require_once 'Zend/Date.php';
        i18n::config()->date_format = Zend_Locale_Format::getDateFormat($locale);
        i18n::config()->time_format = Zend_Locale_Format::getTimeFormat($locale);
    }

Usage Example

 /**
  * Ensure that the controller is correctly initialised
  *
  * @param ContentController $controller
  */
 public function contentcontrollerInit($controller)
 {
     Fluent::install_locale();
 }
All Usage Examples Of Fluent::install_locale