本文整理汇总了PHP中Translatable::current_lang方法的典型用法代码示例。如果您正苦于以下问题:PHP Translatable::current_lang方法的具体用法?PHP Translatable::current_lang怎么用?PHP Translatable::current_lang使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translatable
的用法示例。
在下文中一共展示了Translatable::current_lang方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MetaTags
/**
* Return the title, description, keywords and language metatags.
* @param boolean|string $includeTitle Show default <title>-tag, set to false for custom templating
*
* @param boolean $includeTitle Show default <title>-tag, set to false for
* custom templating
* @return string The XHTML metatags
*/
public function MetaTags($includeTitle = true)
{
$tags = "";
if ($includeTitle === true || $includeTitle == 'true') {
$tags .= "<title>" . Convert::raw2xml($this->MetaTitle ? $this->MetaTitle : $this->Title) . "</title>\n";
}
$tags .= "<meta name=\"generator\" http-equiv=\"generator\" content=\"SilverStripe 2.0 - http://www.silverstripe.com\" />\n";
$charset = ContentNegotiator::get_encoding();
$tags .= "<meta http-equiv=\"Content-type\" content=\"text/html; charset={$charset}\" />\n";
if ($this->MetaKeywords) {
$tags .= "<meta name=\"keywords\" http-equiv=\"keywords\" content=\"" . Convert::raw2att($this->MetaKeywords) . "\" />\n";
}
if ($this->MetaDescription) {
$tags .= "<meta name=\"description\" http-equiv=\"description\" content=\"" . Convert::raw2att($this->MetaDescription) . "\" />\n";
}
if ($this->ExtraMeta) {
$tags .= $this->ExtraMeta . "\n";
}
$tags .= "<meta http-equiv=\"Content-Language\" content=\"" . Translatable::current_lang() . "\"/>\n";
return $tags;
}
示例2: LangAttributes
/**
* Returns the xml:lang and lang attributes
*/
function LangAttributes() {
$lang = Translatable::current_lang();
return "xml:lang=\"$lang\" lang=\"$lang\"";
}
示例3: EditingLang
/**
* Get the name of the language that we are translating in
*/
function EditingLang()
{
if (!Translatable::is_default_lang()) {
return i18n::get_language_name(Translatable::current_lang());
} else {
return false;
}
}
示例4: MetaTags
/**
* Return the title, description, keywords and language metatags.
*
* @todo Move <title> tag in separate getter for easier customization and more obvious usage
*
* @param boolean|string $includeTitle Show default <title>-tag, set to false for custom templating
* @param boolean $includeTitle Show default <title>-tag, set to false for
* custom templating
* @return string The XHTML metatags
*/
public function MetaTags($includeTitle = true) {
$tags = "";
if($includeTitle === true || $includeTitle == 'true') {
$tags .= "<title>" . Convert::raw2xml(($this->MetaTitle)
? $this->MetaTitle
: $this->Title) . "</title>\n";
}
$version = new SapphireInfo();
$tags .= "<meta name=\"generator\" http-equiv=\"generator\" content=\"SilverStripe ". $version->Version() ." - http://www.silverstripe.com\" />\n";
$charset = ContentNegotiator::get_encoding();
$tags .= "<meta http-equiv=\"Content-type\" content=\"text/html; charset=$charset\" />\n";
if($this->MetaKeywords) {
$tags .= "<meta name=\"keywords\" http-equiv=\"keywords\" content=\"" .
Convert::raw2att($this->MetaKeywords) . "\" />\n";
}
if($this->MetaDescription) {
$tags .= "<meta name=\"description\" http-equiv=\"description\" content=\"" .
Convert::raw2att($this->MetaDescription) . "\" />\n";
}
if($this->ExtraMeta) {
$tags .= $this->ExtraMeta . "\n";
}
$tags .= "<meta http-equiv=\"Content-Language\" content=\"". Translatable::current_lang() ."\"/>\n";
// DEPRECATED 2.3: Use MetaTags
$this->extend('updateMetaTags', $tags);
$this->extend('MetaTags', $tags);
return $tags;
}