Is there an easier way to get the CP's currently selected locale? In my plugin I am currently using this method.
public function getCurrentLocale() {
$id = is_array($this->value) ? $this->value[0] : false;
$segments = craft()->request->segments;
$lastSegment = end($segments);
$locales = craft()->elements->getEnabledLocalesForElement($id);
if (in_array($lastSegment, $locales)) {
return $lastSegment;
}
return null;
}