{"action":"created","issue":{"url":"https://api.github.com/repos/zsigmondrab/liferay-portal/issues/127","labels_url":"https://api.github.com/repos/zsigmondrab/liferay-portal/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/zsigmondrab/liferay-portal/issues/127/comments","events_url":"https://api.github.com/repos/zsigmondrab/liferay-portal/issues/127/events","html_url":"https://github.com/zsigmondrab/liferay-portal/pull/127","id":119127920,"number":127,"title":" [Technical Support] LPS-60636 New solution.","user":{"login":"zxdgoal","id":4162471,"avatar_url":"https://avatars.githubusercontent.com/u/4162471?v=3","gravatar_id":"","url":"https://api.github.com/users/zxdgoal","html_url":"https://github.com/zxdgoal","followers_url":"https://api.github.com/users/zxdgoal/followers","following_url":"https://api.github.com/users/zxdgoal/following{/other_user}","gists_url":"https://api.github.com/users/zxdgoal/gists{/gist_id}","starred_url":"https://api.github.com/users/zxdgoal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zxdgoal/subscriptions","organizations_url":"https://api.github.com/users/zxdgoal/orgs","repos_url":"https://api.github.com/users/zxdgoal/repos","events_url":"https://api.github.com/users/zxdgoal/events{/privacy}","received_events_url":"https://api.github.com/users/zxdgoal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-27T04:01:42Z","updated_at":"2015-11-30T11:59:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zsigmondrab/liferay-portal/pulls/127","html_url":"https://github.com/zsigmondrab/liferay-portal/pull/127","diff_url":"https://github.com/zsigmondrab/liferay-portal/pull/127.diff","patch_url":"https://github.com/zsigmondrab/liferay-portal/pull/127.patch"},"body":"Hey Zsigmond.\r\n\r\nI have to reopen LPS-60636 as I figure out a new solution which works on both trunk and 6.2.x\r\n\r\nFirst of all, I chose to use ``I18N_LANGUAGE_CODE`` instead of ``I18N_LANGUAGE_ID``.\r\n\r\nThe major reason is that, in 6.2.x, our previous fix does work is due to this code in I18nServlet.java\r\n\r\n```\r\n\t\tString i18nPath = StringPool.SLASH + i18nLanguageId;\r\n\r\n\t\tLocale locale = LocaleUtil.fromLanguageId(i18nLanguageId);\r\n\r\n\t\tString i18nLanguageCode = locale.getLanguage();\r\n\r\n\t\tif (Validator.isNull(locale.getCountry())) {\r\n\r\n\t\t\t// Locales must contain the country code\r\n\r\n\t\t\tlocale = LanguageUtil.getLocale(i18nLanguageCode);\r\n\r\n\t\t\ti18nLanguageId = LocaleUtil.toLanguageId(locale);\r\n\t\t}\r\n```\r\nAs discussed, LocaleUtil is filled with ``locales`` , it will return locales which are not in ``locales.enable``.\r\n\r\nSo,  ``i18nLanguageCode`` is the original, i.e. ``fr``. But the i18nLanguageId is reassigned to default locale, e.g. ``en_us`` because ``locale`` from ``LanguageUtil.getLocale(i18nLanguageCode);`` is ``null``.\r\n\r\n``LanguageUtil`` is considering the locale as ``company`` level, so it will just return locales in ``locales.enable``.\r\n\r\nChanging to use ``I18N_LANGUAGE_CODE``, we will get the original ``fr``, instead of  default ``en_us``. This is our desired behaviour.\r\n\r\nSimilarly, I also change to use ``LanguageUtil`` in https://github.com/zsigmondrab/liferay-portal/blob/cb88717e5bcadca1e9b1313fe457bab77413e4c2/portal-impl/src/com/liferay/portal/servlet/FriendlyURLServlet.java#L355-L356\r\nso that it is able to return null for locales which are not in ``locales.enable``\r\n\r\nFinally, I have to admit that I made these two mistakes.\r\n\r\nSorry for that.\r\n\r\nThanks\r\nJohn.."},"comment":{"url":"https://api.github.com/repos/zsigmondrab/liferay-portal/issues/comments/160610224","html_url":"https://github.com/zsigmondrab/liferay-portal/pull/127#issuecomment-160610224","issue_url":"https://api.github.com/repos/zsigmondrab/liferay-portal/issues/127","id":160610224,"user":{"login":"zsigmondrab","id":861161,"avatar_url":"https://avatars.githubusercontent.com/u/861161?v=3","gravatar_id":"","url":"https://api.github.com/users/zsigmondrab","html_url":"https://github.com/zsigmondrab","followers_url":"https://api.github.com/users/zsigmondrab/followers","following_url":"https://api.github.com/users/zsigmondrab/following{/other_user}","gists_url":"https://api.github.com/users/zsigmondrab/gists{/gist_id}","starred_url":"https://api.github.com/users/zsigmondrab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zsigmondrab/subscriptions","organizations_url":"https://api.github.com/users/zsigmondrab/orgs","repos_url":"https://api.github.com/users/zsigmondrab/repos","events_url":"https://api.github.com/users/zsigmondrab/events{/privacy}","received_events_url":"https://api.github.com/users/zsigmondrab/received_events","type":"User","site_admin":false},"created_at":"2015-11-30T11:59:51Z","updated_at":"2015-11-30T11:59:51Z","body":"Just started to review."}}