{"action":"created","issue":{"url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/issues/441","repository_url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent","labels_url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/issues/441/labels{/name}","comments_url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/issues/441/comments","events_url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/issues/441/events","html_url":"https://github.com/tractorcow-farm/silverstripe-fluent/issues/441","id":342563221,"node_id":"MDU6SXNzdWUzNDI1NjMyMjE=","number":441,"title":"pages under the home page do not have the right LocaleLink","user":{"login":"sunnysideup","id":167154,"node_id":"MDQ6VXNlcjE2NzE1NA==","avatar_url":"https://avatars1.githubusercontent.com/u/167154?v=4","gravatar_id":"","url":"https://api.github.com/users/sunnysideup","html_url":"https://github.com/sunnysideup","followers_url":"https://api.github.com/users/sunnysideup/followers","following_url":"https://api.github.com/users/sunnysideup/following{/other_user}","gists_url":"https://api.github.com/users/sunnysideup/gists{/gist_id}","starred_url":"https://api.github.com/users/sunnysideup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunnysideup/subscriptions","organizations_url":"https://api.github.com/users/sunnysideup/orgs","repos_url":"https://api.github.com/users/sunnysideup/repos","events_url":"https://api.github.com/users/sunnysideup/events{/privacy}","received_events_url":"https://api.github.com/users/sunnysideup/received_events","type":"User","site_admin":false},"labels":[{"id":744915116,"node_id":"MDU6TGFiZWw3NDQ5MTUxMTY=","url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/labels/affects/v4","name":"affects/v4","color":"5319e7","default":false},{"id":744915175,"node_id":"MDU6TGFiZWw3NDQ5MTUxNzU=","url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/labels/change/patch","name":"change/patch","color":"fef2c0","default":false},{"id":744915220,"node_id":"MDU6TGFiZWw3NDQ5MTUyMjA=","url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/labels/effort/medium","name":"effort/medium","color":"fef2c0","default":false},{"id":744915272,"node_id":"MDU6TGFiZWw3NDQ5MTUyNzI=","url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/labels/impact/medium","name":"impact/medium","color":"f7c6c7","default":false},{"id":44693477,"node_id":"MDU6TGFiZWw0NDY5MzQ3Nw==","url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/labels/type/bug","name":"type/bug","color":"d93f0b","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-07-19T03:09:25Z","updated_at":"2018-10-14T09:57:31Z","closed_at":null,"author_association":"NONE","body":"Version: SS4.1\r\n\r\nIf you have a sitetree like this:\r\n\r\n```\r\nhome\r\n    my-page-one\r\nabout-us\r\n   my-page-two\r\n```\r\nWith two locales: EN and MI, \r\nThen you can switch between MI and EN for `my-page-two` but not for `my-page-one`.  \r\n\r\nBasically, for `my-page-one` the Link **back to** EN does not contain the prefix (e.g. **nz_en** or **english**). \r\n\r\nThe \"switch language\" links show the problem more clearly: \r\n\r\n**Switch Language Links on `my-page-one`:**\r\n - `http://mysite/home/my-page-one`\r\n - `http://mysite/te-reo/home/my-page-one`\r\n\r\n**Switch Language Links on `my-page-two`:**\r\n - `http://mysite/english/about-us/my-page-two`\r\n - `http://mysite/te-reo/about-us/my-page-two`\r\n\r\nAs soon as we move `my-page-one` under `about-us` we get this as switch links: \r\n - `http://mysite/english/about-us/my-page-one`\r\n - `http://mysite/te-reo/about-us/my-page-one`\r\n\r\nAnd the problem no longer exists when we do this. \r\n\r\nMaking it:\r\n```\r\nhome\r\n    temp-page\r\n        my-page-one\r\n```\r\ndoes not solve the issue.\r\n\r\n**Our Guess**\r\nBecause the `Root Parent URLSegment` for `my-page-one` is `home` some sort of exception is triggered that should not be triggered. "},"comment":{"url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/issues/comments/429611527","html_url":"https://github.com/tractorcow-farm/silverstripe-fluent/issues/441#issuecomment-429611527","issue_url":"https://api.github.com/repos/tractorcow-farm/silverstripe-fluent/issues/441","id":429611527,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTYxMTUyNw==","user":{"login":"sunnysideup","id":167154,"node_id":"MDQ6VXNlcjE2NzE1NA==","avatar_url":"https://avatars1.githubusercontent.com/u/167154?v=4","gravatar_id":"","url":"https://api.github.com/users/sunnysideup","html_url":"https://github.com/sunnysideup","followers_url":"https://api.github.com/users/sunnysideup/followers","following_url":"https://api.github.com/users/sunnysideup/following{/other_user}","gists_url":"https://api.github.com/users/sunnysideup/gists{/gist_id}","starred_url":"https://api.github.com/users/sunnysideup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunnysideup/subscriptions","organizations_url":"https://api.github.com/users/sunnysideup/orgs","repos_url":"https://api.github.com/users/sunnysideup/repos","events_url":"https://api.github.com/users/sunnysideup/events{/privacy}","received_events_url":"https://api.github.com/users/sunnysideup/received_events","type":"User","site_admin":false},"created_at":"2018-10-14T09:57:31Z","updated_at":"2018-10-14T09:57:31Z","author_association":"NONE","body":"This is how I fixed it:\r\n\r\nin `HomePage.php`: \r\n\r\n![image](https://user-images.githubusercontent.com/167154/46915178-74091900-d004-11e8-9fb3-8ed4a62fb891.png)\r\n\r\n...\r\n```\r\n\r\n    /**\r\n     * hack for fluent!\r\n     * @param string|null\r\n     *\r\n     * @return string\r\n     */\r\n    public function RelativeLink($action = null)\r\n    {\r\n        $link = parent::RelativeLink($action);\r\n        $locale = Locale::getCurrentLocale();\r\n        if(strlen($link) > 2 && substr($link, 0, strlen($locale->URLSegment)) !== $locale->URLSegment) {\r\n            $link = $locale->URLSegment.'/'.$link;\r\n        }\r\n\r\n        return $link;\r\n    }\r\n```"}}
{"actor":{"display_login":"sunnysideup"}}