Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Thomas Hop Posted December 19, 2018 Posted December 19, 2018 Hey guys, I have several pages that I made in the Pages application where I have some general information etc. But it's only viewable in the standard Dutch language of the website. I have English translations for every page but how can I make it so that whenever a user is using the English language the page is showing an English text. The only thing I can change is the name of the page based on language. But I need to change the content. Anyone knows how to do this? Kind regards
Marcher Technologies Posted December 19, 2018 Posted December 19, 2018 It is possible with code in a manual HTML page actually. Much less so with a page builder page. Check against \IPS\Member::loggedIn()->language()->id or if preferring to check against locale strings instead of numbers, \IPS\Member::loggedIn()->language()->short Despite the apparent use of a logged in member object, this works for guests as well due to the way \IPS\Member works. Alternatively, see this post. In 3.x any admin could just add a language string, but that was removed from the core in 4.x, or I would have just said to dump them into the language system to begin with.
Ramsesx Posted December 19, 2018 Posted December 19, 2018 1 hour ago, Thomas Hop said: Anyone knows how to do this? With this plugin you can basically translate a whole page, not articles. As a language string you can even insert large html parts.
Thomas Hop Posted December 19, 2018 Author Posted December 19, 2018 Hey Ramsesx, Thanks for the reply I will look into this plugin. Still I am a little bit baffled that this isnt something you can do from the CMS as is.
bfarber Posted December 19, 2018 Posted December 19, 2018 If you are creating a page in Pages, you can do this using HTML logic based on Marcher's suggestion. If you are adding a database record, however, it is not possible. Translatable fields should ONLY be available to administrators, however quite often database records can and are added on the front end, so we enter a bit of a gray zone there. I've seen this question come up before, but it's not as straightforward as it may seem from a software POV when you only consider one usage. The custom language strings approach is honestly your best option, even if it requires a separate app.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.