{"action":"created","issue":{"url":"https://api.github.com/repos/qTranslate-Team/qtranslate-x/issues/298","labels_url":"https://api.github.com/repos/qTranslate-Team/qtranslate-x/issues/298/labels{/name}","comments_url":"https://api.github.com/repos/qTranslate-Team/qtranslate-x/issues/298/comments","events_url":"https://api.github.com/repos/qTranslate-Team/qtranslate-x/issues/298/events","html_url":"https://github.com/qTranslate-Team/qtranslate-x/issues/298","id":113820149,"number":298,"title":"Hide URL language information for default not checked","user":{"login":"Lesrad","id":7493934,"avatar_url":"https://avatars.githubusercontent.com/u/7493934?v=3","gravatar_id":"","url":"https://api.github.com/users/Lesrad","html_url":"https://github.com/Lesrad","followers_url":"https://api.github.com/users/Lesrad/followers","following_url":"https://api.github.com/users/Lesrad/following{/other_user}","gists_url":"https://api.github.com/users/Lesrad/gists{/gist_id}","starred_url":"https://api.github.com/users/Lesrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lesrad/subscriptions","organizations_url":"https://api.github.com/users/Lesrad/orgs","repos_url":"https://api.github.com/users/Lesrad/repos","events_url":"https://api.github.com/users/Lesrad/events{/privacy}","received_events_url":"https://api.github.com/users/Lesrad/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/qTranslate-Team/qtranslate-x/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-28T13:23:48Z","updated_at":"2015-10-29T09:57:11Z","closed_at":null,"body":"Hi John,\r\n\r\nAs you know I'm no coder, but I added this to my test server and it seems to work fine, maybe you can include it into your plugin.\r\n\r\nI found an issue in that my site uses option:__Hide URL language information for default language.__ under URL Modification Mode\r\n\r\nThe issue is with rel=\"alternate\"  languages not taking into account the default language should be hidden if checked as in the example below where en is the default language but its shown in the url instead of being hidden (/wordpress/en/).\r\n\r\n```<link hreflang=\"en\" href=\"http://127.0.0.1:4001/wordpress/en/\" rel=\"alternate\" />\r\n<link hreflang=\"da\" href=\"http://127.0.0.1:4001/wordpress/da/\" rel=\"alternate\" />\r\n<link hreflang=\"x-default\" href=\"http://127.0.0.1:4001/wordpress/\" rel=\"alternate\" />\r\n<meta name=\"generator\" content=\"qTranslate-X 3.4.6.2\" />```\r\n\r\nI added the code below to qtranslate_frontend.php and it seems to resolve the issue, feel free to use this code or add a more elegant solution.\r\n```\r\n// set links to translations of current page\r\n\tforeach($q_config['enabled_languages'] as $lang) {\r\n\t\tif(!empty($q_config['locale_html'][$lang])){\r\n\t\t\t$hreflang = $q_config['locale_html'][$lang];\r\n\t\t}elseif ($q_config['hide_default_language']=='checked' and $q_config['default_language']==$lang) {\r\n\t\t\t$hreflang = $lang;\r\n\t\t\techo '<link hreflang=\"'.$hreflang.'\" href=\"'.qtranxf_convertURL('',$q_config['default_language']).'\" rel=\"alternate\" />'.PHP_EOL;\r\n\t\t}else{\r\n\t\t\t$hreflang = $lang;\r\n\t\t\techo '<link hreflang=\"'.$hreflang.'\" href=\"'.qtranxf_convertURL('',$lang,false,true).'\" rel=\"alternate\" />'.PHP_EOL;\r\n\t\t}\r\n```\r\nOutput is now shown correctly as:\r\n```<link hreflang=\"en\" href=\"http://127.0.0.1:4001/wordpress/\" rel=\"alternate\" />\r\n<link hreflang=\"da\" href=\"http://127.0.0.1:4001/wordpress/da/\" rel=\"alternate\" />\r\n<link hreflang=\"x-default\" href=\"http://127.0.0.1:4001/wordpress/\" rel=\"alternate\" />\r\n<meta name=\"generator\" content=\"qTranslate-X 3.4.6.2\" />```\r\nI'm not sure if this could be used as a partial solution to: https://github.com/qTranslate-Team/qtranslate-x/issues/166\r\n\r\nThe plugin also ignores the \"hidden\" option when creating the widget\r\n```<li class=\"qtranxs-lang-menu-item qtranxs-lang-menu-item-en menu-item menu-item-type-custom menu-item-object-custom menu-item-42890\"><a title=\"English\" href=\"http://127.0.0.1:4001/wordpress/en/\"><img src=\"http://127.0.0.1:4001/wordpress/wp-content/plugins/qtranslate-x/flags/gb.png\" alt=\"English\" />&nbsp;English</a></li>```\r\nand\r\n```<ul class=\"language-chooser language-chooser-dropdown qtranxs_language_chooser\" id=\"qtranslate-chooser\">\r\n<li class=\"lang-en\"><a href=\"http://127.0.0.1:4001/wordpress/en/\" hreflang=\"en\" title=\"English (en)\"><span>English</span></a></li>```\r\nThis code fixes one of them in qtranslate_widget.php:\r\n```\r\n\t\t\t\tif ($q_config['hide_default_language']=='checked' and $q_config['default_language']==$language) {echo '<li class=\"'. implode(' ', $classes) .'\"><a href=\"'.qtranxf_convertURL('',$q_config['default_language']).'\"';}\r\n\t\t\t\telse {echo '<li class=\"'. implode(' ', $classes) .'\"><a href=\"'.qtranxf_convertURL($url, $language, false, true).'\"';}\r\n\t\t\t\t// set hreflang\r\n```"},"comment":{"url":"https://api.github.com/repos/qTranslate-Team/qtranslate-x/issues/comments/152132151","html_url":"https://github.com/qTranslate-Team/qtranslate-x/issues/298#issuecomment-152132151","issue_url":"https://api.github.com/repos/qTranslate-Team/qtranslate-x/issues/298","id":152132151,"user":{"login":"Lesrad","id":7493934,"avatar_url":"https://avatars.githubusercontent.com/u/7493934?v=3","gravatar_id":"","url":"https://api.github.com/users/Lesrad","html_url":"https://github.com/Lesrad","followers_url":"https://api.github.com/users/Lesrad/followers","following_url":"https://api.github.com/users/Lesrad/following{/other_user}","gists_url":"https://api.github.com/users/Lesrad/gists{/gist_id}","starred_url":"https://api.github.com/users/Lesrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lesrad/subscriptions","organizations_url":"https://api.github.com/users/Lesrad/orgs","repos_url":"https://api.github.com/users/Lesrad/repos","events_url":"https://api.github.com/users/Lesrad/events{/privacy}","received_events_url":"https://api.github.com/users/Lesrad/received_events","type":"User","site_admin":false},"created_at":"2015-10-29T09:57:11Z","updated_at":"2015-10-29T09:57:11Z","body":"So what you mean is that it should not concern me that the link is to a non existent location /wordpress/en/ (apart from a redirect)\r\n<link hreflang=\"en\" href=\"http://127.0.0.1:4001/__wordpress/en__/\r\n\r\nwhen it should show:\r\n<link hreflang=\"en\" href=\"http://127.0.0.1:4001/__wordpress/__\r\n\r\nSurely the later is better in instances where $q_config['hide_default_language']=='checked' (Hide URL language information for default language) is active?\r\n\r\nIf you are happy with the above scenario then please feel free to mark the issue as resolved.\r\n\r\nThanks"}}