/**
* Get locale according to the locale specified in the document or its parent.
*
* @param Document\Model $document Document
*
* @return void
*/
protected function getLocale($document)
{
$locale = null;
if (!$document->hasLocale()) {
$parent = $document->getParent();
if ($parent) {
$locale = $this->getLocale($parent);
}
} else {
$locale = $document->getLocale();
}
return $locale;
}