{"action":"closed","issue":{"url":"https://api.github.com/repos/cariboufute/locale-route/issues/8","repository_url":"https://api.github.com/repos/cariboufute/locale-route","labels_url":"https://api.github.com/repos/cariboufute/locale-route/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/cariboufute/locale-route/issues/8/comments","events_url":"https://api.github.com/repos/cariboufute/locale-route/issues/8/events","html_url":"https://github.com/cariboufute/locale-route/issues/8","id":190563191,"number":8,"title":"Translate complex uri of nested route","user":{"login":"enstain","id":4801985,"avatar_url":"https://avatars.githubusercontent.com/u/4801985?v=3","gravatar_id":"","url":"https://api.github.com/users/enstain","html_url":"https://github.com/enstain","followers_url":"https://api.github.com/users/enstain/followers","following_url":"https://api.github.com/users/enstain/following{/other_user}","gists_url":"https://api.github.com/users/enstain/gists{/gist_id}","starred_url":"https://api.github.com/users/enstain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enstain/subscriptions","organizations_url":"https://api.github.com/users/enstain/orgs","repos_url":"https://api.github.com/users/enstain/repos","events_url":"https://api.github.com/users/enstain/events{/privacy}","received_events_url":"https://api.github.com/users/enstain/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-20T15:06:42Z","updated_at":"2016-11-22T06:06:44Z","closed_at":"2016-11-22T06:06:43Z","body":"LocaleRoute::group doesn't pick up translations from routes.php lang file, as I understand. It just adds locale code prefix before uri, but I want to translate all uri parts.\r\n\r\nSo, working recipe is very WET. I have to define LocaleRoute::get with full path for each route:\r\n\r\n```php\r\napp/Http/routes.php:\r\n\r\nRoute::group([\r\n  'namespace'   => 'Backend', \r\n  ...\r\n  ], function() {\r\n\r\n      LocaleRoute::get(\r\n        'Backend:Investments.ongoing',\r\n        'InvestmentsController@ongoing'\r\n      );\r\n\r\n      LocaleRoute::get(\r\n        'Backend:Investments.agreement',\r\n        'InvestmentsController@agreement'\r\n      );\r\n\r\n});\r\n```\r\n\r\nAnd then I define translation of full uri for each route:\r\n```php\r\nlang/en/routes.php:\r\n\r\n'Backend:Investments' => [\r\n    'ongoing' => 'backend-locale/investments-locale/ongoing-locale',\r\n    'agreement' => 'backend-locale/investments-locale/agreement-locale',\r\n],\r\n```\r\n\r\nMy expectation from route groups localization is that I define the hierarchy of routes like \r\n```php\r\napp/Http/routes.php:\r\n['as' => 'foo'], function() {\r\n    ['as' => 'bar'], function() {\r\n       ['as' => 'baz'], function() {}\r\n    }\r\n}\r\n``` \r\nand then define translation of each uri part. But it seems impossible too, because routes.php should contain each translation from collection of routes [\"foo\", \"foo.bar\", \"foo.bar.baz\"] to know how construct every localized path \"en/foo-locale\", \"en/foo-locale/bar-locale\", \"en/foo-locale/bar-locale/baz-locale\". One possible way I see to implement such thing is to complicate routes.php lang file structure:\r\n\r\n```php\r\nlang/en/routes.php:\r\n\r\n'foo' => [\r\n    'uri' => 'foo-locale',\r\n    'children' => [\r\n        'bar' => [\r\n            'uri' => 'bar-locale',\r\n            'children' => [\r\n                 'baz' => 'baz-locale'\r\n            ]\r\n        ]\r\n    ]\r\n]\r\n```\r\n\r\nBut, of course, there is also a lot of work with parsing such structure and find required locale uri by route name, so it's your vote whether such thing is important or not."}}
{"actor":{"display_login":"cariboufute"}}