@@ -21,8 +21,8 @@ class I18nYamlFileLoader extends YamlFileLoader {
21
21
22
22
/**
23
23
* @param FileLocatorInterface $locator
24
- * @param array $locales
25
- * @param string $translationDomain
24
+ * @param I18nLoaderHelper $helper
25
+ * @param Registry $registry
26
26
*/
27
27
public function __construct (FileLocatorInterface $ locator , I18nLoaderHelper $ helper , Registry $ registry )
28
28
{
@@ -34,14 +34,20 @@ public function __construct(FileLocatorInterface $locator, I18nLoaderHelper $hel
34
34
35
35
/**
36
36
* @param mixed $resource
37
- * @param null $type
37
+ * @param string| null $type
38
38
* @return bool
39
39
*/
40
40
public function supports ($ resource , $ type = null )
41
41
{
42
42
return is_string ($ resource ) && 'yml ' === pathinfo ($ resource , PATHINFO_EXTENSION ) && (!$ type || 'yaml_i18n ' === $ type );
43
43
}
44
44
45
+ /**
46
+ * @param RouteCollection $collection
47
+ * @param string $name
48
+ * @param array $config
49
+ * @param string $path
50
+ */
45
51
protected function parseRoute (RouteCollection $ collection , $ name , array $ config , $ path )
46
52
{
47
53
$ defaults = isset ($ config ['defaults ' ]) ? $ config ['defaults ' ] : array ();
@@ -56,8 +62,8 @@ protected function parseRoute(RouteCollection $collection, $name, array $config,
56
62
$ route = new Route ($ config ['path ' ], $ defaults , $ requirements , $ options , $ host , $ schemes , $ methods );
57
63
58
64
if ($ i18n ) {
59
- $ route ->setPath ('/ ' . $ locale . $ this ->helper ->alterPath ($ config ['path ' ], $ locale ));
60
- $ route ->setDefaults ($ this ->helper ->alterdefaults ($ defaults , $ locale ));
65
+ $ route ->setPath ('/ ' . $ locale . ' / ' . ltrim ( $ this ->helper ->alterPath ($ config ['path ' ], $ locale), ' / ' ));
66
+ $ route ->setDefaults ($ this ->helper ->alterDefaults ($ defaults , $ locale ));
61
67
}
62
68
63
69
$ i18nName = $ i18n ? $ this ->helper ->alterName ($ name , $ locale ) : $ name ;
0 commit comments