JMSI18nRoutingBundle
JMSI18nRoutingBundle copied to clipboard
-
Sounds good.
If you can work on an implementation, that would be great!
We had a similar problem recently, and solved it quite simply in our own application by overriding the DefaultPatternGenerationStrategy. For the above 'en_US' example, we tell JMSI18nRoutingBundle:
locales: ['en_US']
Our PatternGenerationStrategy has this:
public function generateI18nPatterns($routeName, Route $route)
{
$patterns = parent::generateI18nPatterns($routeName, $route);
foreach ($patterns as $key => $pattern) {
// replace '/en_US/...' with '/en'
unset($patterns[$key]);
$replaced = preg_replace("/^\/en_US(.+)$/", "/en$1", $key);
$patterns[$replaced] = [$locale];
}
return $patterns;
}
(ours is actually configurable, the above is an example)
So this is possible to do with the existing bundle, you just have to override the default strategy. @schmittjoh is the proper solution here to document this capability, or to make it more easily accessible by providing the configuration that @ssalat proposes? Either way I'd be happy to take a look in my free time.