GetSimple Support Forum

Full Version: i18n component language conditions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I need help with i18n and components. I want to change some text directly in the components with conditions. I searched the official manual and found the following:

<?php if ($language == 'en') { ?>English text<?php } ?>
<?php if ($language == 'de') { ?>Deutscher Text<?php } ?>
<?php if ($language == 'es') { ?>...<?php } ?>

But it only works directly in the template. Doesn`t work in components. How do I need to change it?

thanx
(2013-07-05, 17:16:19)itsmeee Wrote: [ -> ]Hi guys,

I need help with i18n and components. I want to change some text directly in the components with conditions. I searched the official manual and found the following:

<?php if ($language == 'en') { ?>English text<?php } ?>
<?php if ($language == 'de') { ?>Deutscher Text<?php } ?>
<?php if ($language == 'es') { ?>...<?php } ?>

But it only works directly in the template. Doesn`t work in components. How do I need to change it?

thanx

If you add
Code:
<?php global $language; ?>
at the beginning, it should work in the component, too.

But you can also use multiple components suffixed with the language.
Tried to add globals but it didn`t work for me.

Found a solution:
<?php $language = $_GET["lang"] ?>

This should do it. Thanks for your help.
components run anonymously, you must declare globals in scope.

so
Code:
GLOBAL $language,$blargh;

Maybe $language is wrong or not defined yet.
but in this case, why do you need to switch between components this way, when it's perfectly working with suffixes ?
This methods you mentioned above doesn't work neither on template files nor on components.