Allow templates easy access to the language of the current content.

This commit is contained in:
Simon Elvery 2012-11-05 09:32:19 +10:00
parent 1bb392c8dc
commit 8ec76b063c

View File

@ -1107,6 +1107,17 @@ class Translatable extends DataExtension implements PermissionProvider {
function extendWithSuffix($table) {
return $table;
}
/**
* Provide templates with an easy way to display the languate of the content being viewed, in both native language
* and english.
*
* @param boolean $native [true] Outputs the language name in its own language if true, english string if false.
* @return string The name of the content language.
*/
public function getContentLanguage($native = true) {
return i18n::get_language_name(i18n::get_lang_from_locale(i18n::convert_rfc1766($this->owner->Locale)),$native);
}
/**
* Gets all related translations for the current object,