Jump to content

Recommended Posts

Posted (edited)

You would have to do it at the block/page level because currently there is no way to do it otherwise. You would add something like this around the block @Jorge Varela

{{if \IPS\Member::loggedIn()->language()->bcp47() == 'en-US'}}
Block stuff here for English
{{endif}}

Replacing en-US with the language for the respective block.

Edited by Morrigan
Posted
3 hours ago, Morrigan said:

You would have to do it at the block/page level because currently there is no way to do it otherwise. You would add something like this around the block @Jorge Varela


{if \IPS\Member::loggedIn()->language()->bcp47() == 'en-US'}
Block stuff here for English
{{endif}}

Replacing en-US with the language for the respective block.

Yes, that works. It's also a fair bit to type, so in my site I have it in a shorter form:

{{if member.language()->id === 1 }}
	English
{{else}}
	Esperanto
{{endif}}

en_US in my site has the id 1. You'll have to adjust your code as necessary.

Posted
On 3/23/2020 at 2:03 AM, Morrigan said:

You would have to do it at the block/page level because currently there is no way to do it otherwise. You would add something like this around the block @Jorge Varela


{if \IPS\Member::loggedIn()->language()->bcp47() == 'en-US'}
Block stuff here for English
{{endif}}

Replacing en-US with the language for the respective block.

Thanks for your help. I tried to add this but im not sure how to do it. Could you please explain me how to tackle it?  I'm creating a PHP module and creating the if statement  but It's throwing me an error. What should I add? I'm just adding the if statement. 

Posted (edited)

You don't want it in PHP, this is code for a standard HTML block.

I realized that the if statement (the first bit) is missing brackets it should be double brackets so {{ and }} I fixed my original code.

Edited by Morrigan
  • Recently Browsing   0 members

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