Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Franck Le Glasse Posted May 13, 2016 Posted May 13, 2016 Hello, Please could someone explain me how to display a different index page with Pages when the user change its language ? I already have different index pages created in Pages (version 4.1.11.1 of the Invision Power Suite) for different languages. When the user change its language, I want to display my articles in a different language (already stored in a different database). Thank you, Franck
Meddysong Posted May 13, 2016 Posted May 13, 2016 It's not possible, Franck. Changing a language just calls the language strings for that language, and headings, descriptions etc which were set in fields for that language. It doesn't cause a page to load. Unfortunately, it's not possible to submit content in language fields for Pages etc. I wish it were possible because my own site uses two languages, so it would be ideal for the content to change when the language does. I've requested this as a feature in the past, though unsuccessfully.
Franck Le Glasse Posted May 13, 2016 Author Posted May 13, 2016 Thank you Maddysong for your quick reply. Would it be possible then to add some code in the index page (created in Pages) in order to detect the language and display the right one (a page with the right language) ? For now I had to put a link on the index page, that the user has to click to see the index in a different language.
Meddysong Posted May 13, 2016 Posted May 13, 2016 1 hour ago, Franck Le Glasse said: Would it be possible then to add some code in the index page (created in Pages) in order to detect the language and display the right one (a page with the right language) It's not perfect, but this is what I do where I desperately need two languages: {{if \IPS\Member::loggedIn()->language()->short === 'eo_XX.UTF-8' }} <p><em>HTML to display for Esperanto</em></p> {{else}} <p><em>HTML to display for another language, including English</em></p> {{endif}} (Obviously in your case you will need to change the name of the language from eo_XX.UTF-8 to one of the languages on your site.) It looks as though it shouldn't work for people who aren't logged in but when I log out of my account and change languages, it still works:
Adlago Posted May 13, 2016 Posted May 13, 2016 1 hour ago, Meddysong said: {{if \IPS\Member::loggedIn()->language()->short === 'eo_XX.UTF-8' }} <p><em>HTML to display for Esperanto</em></p> {{else}} <p><em>HTML to display for another language, including English</em></p> {{endif}} If the code change as I say, it works perfectly. {{if \IPS\Member::loggedIn()->language()->short === 'eo_XX.UTF-8' }} <META http-equiv="REFRESH" content="0; url=http://your page lang1/"> {{else}} <META http-equiv="REFRESH" content="0; url=http://your page lang2//"> {{endif}} This code editing links should be in every page where there is need.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.