From https://gist.github.com/L1l1AnA/7428675/raw/57daf772f31eb3eaf48f0de5058ad966476f85e1/LocalizedRouteExtension.php