本文整理匯總了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;
}