示例#1
0
文件: Data.php 项目: ngreimel/kovent
 /**
  * Set the current default locale and language.
  *
  * @param string $locale
  *
  * @throws \Punic\Exception\InvalidLocale Throws an exception if $locale is not a valid string
  */
 public static function setDefaultLocale($locale)
 {
     if (is_null(static::explodeLocale($locale))) {
         throw new Exception\InvalidLocale($locale);
     }
     static::$defaultLocale = $locale;
 }
示例#2
0
文件: Money.php 项目: lorenzo/money
 public function __construct($amount, $currency, $locale = null)
 {
     if (!empty($locale)) {
         static::$defaultLocale = $locale;
     }
     parent::__construct($amount, $currency);
 }
示例#3
0
文件: I18n.php 项目: margery/thelia
 public static function addI18nCondition(ModelCriteria $query, $i18nTableName, $tableIdColumn, $i18nIdColumn, $localeColumn, $locale)
 {
     if (null === static::$defaultLocale) {
         static::$defaultLocale = Lang::getDefaultLanguage()->getLocale();
     }
     $locale = static::realEscape($locale);
     $defaultLocale = static::realEscape(static::$defaultLocale);
     $query->_and()->where("CASE WHEN " . $tableIdColumn . " IN" . "(SELECT DISTINCT " . $i18nIdColumn . " " . "FROM `" . $i18nTableName . "` " . "WHERE locale={$locale}) " . "THEN " . $localeColumn . " = {$locale} " . "ELSE " . $localeColumn . " = {$defaultLocale} " . "END");
 }
 /**
  * Sets the default locale.
  *
  * @param string|null $locale The default locale string to be used or null.
  * @return void
  */
 public static function setDefaultLocale($locale = null)
 {
     static::$defaultLocale = $locale;
 }
示例#5
0
 /**
  * @param string $locale
  */
 public static function setDefaultLocale($locale = 'en_US')
 {
     static::$defaultLocale = $locale;
 }