diff --git a/core/control/ContentController.php b/core/control/ContentController.php index a014120c3..b98bf9c81 100644 --- a/core/control/ContentController.php +++ b/core/control/ContentController.php @@ -318,7 +318,7 @@ HTML; * Returns the xml:lang and lang attributes */ function LangAttributes() { - $lang = Translatable::current_locale(); + $lang = Translatable::get_current_locale(); return "xml:lang=\"$lang\" lang=\"$lang\""; } diff --git a/core/control/RootURLController.php b/core/control/RootURLController.php index c0ed8a277..dfd05daec 100755 --- a/core/control/RootURLController.php +++ b/core/control/RootURLController.php @@ -67,7 +67,7 @@ class RootURLController extends Controller { } if(singleton('SiteTree')->hasExtension('Translatable') && !$homePageOBJ) { - $urlSegment = Translatable::get_homepage_urlsegment_by_locale(Translatable::current_locale()); + $urlSegment = Translatable::get_homepage_urlsegment_by_locale(Translatable::get_current_locale()); } elseif($homePageOBJ) { $urlSegment = $homePageOBJ->URLSegment; } diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index f7457a1ee..6434576df 100644 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -884,7 +884,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid } // get the "long" lang name suitable for the HTTP content-language flag (with hyphens instead of underscores) - $currentLang = ($this->hasExtension('Translatable')) ? Translatable::current_locale() : i18n::get_locale(); + $currentLang = ($this->hasExtension('Translatable')) ? Translatable::get_current_locale() : i18n::get_locale(); $tags .= "\n"; // DEPRECATED 2.3: Use MetaTags diff --git a/core/model/Translatable.php b/core/model/Translatable.php index c6cf77a30..bb72d8fe8 100755 --- a/core/model/Translatable.php +++ b/core/model/Translatable.php @@ -187,7 +187,7 @@ class Translatable extends DataObjectDecorator { protected $original_values = null; /** - * @var boolean Temporarily override the "auto-filter" for {@link current_locale()} + * @var boolean Temporarily override the "auto-filter" for {@link get_current_locale()} * in {@link augmentSQL()}. IMPORTANT: You must set this value back to TRUE * after the temporary usage. */ @@ -260,7 +260,7 @@ class Translatable extends DataObjectDecorator { * Get the current reading language. * @return string */ - static function current_locale() { + static function get_current_locale() { if (!self::$language_decided) self::choose_site_locale(); return self::$reading_locale; } @@ -288,7 +288,7 @@ class Translatable extends DataObjectDecorator { * @return DataObject */ static function get_one_by_locale($class, $locale, $filter = '', $cache = false, $orderby = "") { - $orig = Translatable::current_locale(); + $orig = Translatable::get_current_locale(); Translatable::set_reading_locale($locale); $do = DataObject::get_one($class, $filter, $cache, $orderby); Translatable::set_reading_locale($orig); @@ -309,7 +309,7 @@ class Translatable extends DataObjectDecorator { * @return mixed The objects matching the conditions. */ static function get_by_locale($class, $locale, $filter = '', $sort = '', $join = "", $limit = "", $containerClass = "DataObjectSet", $having = "") { - $oldLang = self::current_locale(); + $oldLang = self::get_current_locale(); self::set_reading_locale($locale); $result = DataObject::get($class, $filter, $sort, $join, $limit, $containerClass, $having); self::set_reading_locale($oldLang); @@ -453,7 +453,7 @@ class Translatable extends DataObjectDecorator { /** * Changes any SELECT query thats not filtering on an ID - * to limit by the current language defined in {@link current_locale()}. + * to limit by the current language defined in {@link get_current_locale()}. * It falls back to "Locale='' OR Lang IS NULL" and assumes that * this implies querying for the default language. * @@ -463,7 +463,7 @@ class Translatable extends DataObjectDecorator { // If the record is saved (and not a singleton), and has a locale, // limit the current call to its locale. This fixes a lot of problems // with other extensions like Versioned - $locale = ($this->owner->ID && $this->owner->Locale) ? $this->owner->Locale : Translatable::current_locale(); + $locale = ($this->owner->ID && $this->owner->Locale) ? $this->owner->Locale : Translatable::get_current_locale(); $baseTable = ClassInfo::baseDataClass($this->owner->class); $where = $query->where; if( @@ -626,7 +626,7 @@ class Translatable extends DataObjectDecorator { function contentcontrollerInit($controller) { Translatable::choose_site_locale(); - $controller->Locale = Translatable::current_locale(); + $controller->Locale = Translatable::get_current_locale(); } function modelascontrollerInit($controller) { @@ -654,7 +654,7 @@ class Translatable extends DataObjectDecorator { // of the content, as a "single language" website might be expanded // later on. if(!$this->owner->ID && !$this->owner->Locale) { - $this->owner->Locale = Translatable::current_locale(); + $this->owner->Locale = Translatable::get_current_locale(); } // Specific logic for SiteTree subclasses. @@ -1153,10 +1153,10 @@ class Translatable extends DataObjectDecorator { } /** - * @deprecated 2.4 Use custom check: self::$default_locale == self::current_locale() + * @deprecated 2.4 Use custom check: self::$default_locale == self::get_current_locale() */ static function is_default_lang() { - return (self::$default_locale == self::current_locale()); + return (self::$default_locale == self::get_current_locale()); } /** @@ -1174,10 +1174,10 @@ class Translatable extends DataObjectDecorator { } /** - * @deprecated 2.4 Use current_locale() + * @deprecated 2.4 Use get_current_locale() */ static function current_lang() { - return i18n::get_lang_from_locale(self::current_locale()); + return i18n::get_lang_from_locale(self::get_current_locale()); } /** diff --git a/search/SearchForm.php b/search/SearchForm.php index 496db76ae..9b3f9309a 100755 --- a/search/SearchForm.php +++ b/search/SearchForm.php @@ -6,7 +6,7 @@ * If multilingual content is enabled through the {@link Translatable} extension, * only pages the currently set language on the holder for this searchform are found. * The language is set through a hidden field in the form, which is prepoluated - * with {@link Translatable::current_locale()} when then form is constructed. + * with {@link Translatable::get_current_locale()} when then form is constructed. * * @see Use ModelController and SearchContext for a more generic search implementation based around DataObject * @package sapphire @@ -55,7 +55,7 @@ class SearchForm extends Form { } if(singleton('SiteTree')->hasExtension('Translatable')) { - $fields->push(new HiddenField('locale', 'locale', Translatable::current_locale())); + $fields->push(new HiddenField('locale', 'locale', Translatable::get_current_locale())); } if(!$actions) { @@ -105,7 +105,7 @@ class SearchForm extends Form { // set language (if present) if(singleton('SiteTree')->hasExtension('Translatable') && isset($data['locale'])) { - $origLocale = Translatable::current_locale(); + $origLocale = Translatable::get_current_locale(); Translatable::set_reading_locale($data['locale']); } diff --git a/tasks/MigrateTranslatableTask.php b/tasks/MigrateTranslatableTask.php index a0c0e0e24..33463e3f3 100644 --- a/tasks/MigrateTranslatableTask.php +++ b/tasks/MigrateTranslatableTask.php @@ -152,7 +152,7 @@ class MigrateTranslatableTask extends BuildTask { } // Write the new translation to the database - $sitelang = Translatable::current_locale(); + $sitelang = Translatable::get_current_locale(); Translatable::set_reading_locale($newtrans->Locale); $newtrans->writeToStage($stage); Translatable::set_reading_locale($sitelang);