本文整理汇总了PHP中Translatable::current_locale方法的典型用法代码示例。如果您正苦于以下问题:PHP Translatable::current_locale方法的具体用法?PHP Translatable::current_locale怎么用?PHP Translatable::current_locale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translatable
的用法示例。
在下文中一共展示了Translatable::current_locale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InvalidArgumentException
/**
* Set the reading language, either namespaced to 'site' (website content)
* or 'cms' (management backend). This value is used in {@link augmentSQL()}
* to "auto-filter" all SELECT queries by this language.
* See {@link disable_locale_filter()} on how to override this behaviour temporarily.
*
* @param string $lang New reading language.
*/
static function set_current_locale($locale)
{
if ($locale && !i18n::validate_locale($locale)) {
throw new InvalidArgumentException(sprintf('Invalid locale "%s"', $locale));
}
self::$current_locale = $locale;
}
示例2:
/**
* Set the reading language, either namespaced to 'site' (website content)
* or 'cms' (management backend). This value is used in {@link augmentSQL()}
* to "auto-filter" all SELECT queries by this language.
* See {@link $enable_lang_filter} on how to override this behaviour temporarily.
*
* @param string $lang New reading language.
*/
static function set_current_locale($locale)
{
self::$current_locale = $locale;
}