public function getRoutesPrefix($group = array())
{
// Get locale
$locale = $this->container['polyglot.url']->locale();
// Cancel if invalid locale in URL
if (!$this->container['translator']->valid($locale)) {
return $group;
}
// Set locale on translator
$this->container['translator']->setLocale($locale);
// Return group untouched if default
if ($locale == $this->container['config']->get('polyglot::default')) {
return $group;
}
// Merge prefixes if necessary
if (isset($group['prefix'])) {
$locale = array($locale, $group['prefix']);
$locale = implode($locale, '/');
}
return array_merge($group, array('prefix' => $locale));
}