Jump to content

Different index in Pages depending on language


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:

en.thumb.jpg.3fa9126b07e3985bb5273a3e07f

eo.thumb.jpg.1b1b7e4c3a7876f2c2d67bd8363

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...