GetSimple Support Forum
i18n component language conditions - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: i18n component language conditions (/showthread.php?tid=4917)



i18n component language conditions - itsmeee - 2013-07-05

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


RE: i18n component language conditions - mvlcek - 2013-07-05

(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.


RE: i18n component language conditions - itsmeee - 2013-07-05

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.


RE: i18n component language conditions - shawn_a - 2013-07-09

components run anonymously, you must declare globals in scope.

so
Code:
GLOBAL $language,$blargh;

Maybe $language is wrong or not defined yet.


RE: i18n component language conditions - morvy - 2013-07-22

but in this case, why do you need to switch between components this way, when it's perfectly working with suffixes ?


RE: i18n component language conditions - barknezz - 2016-06-28

This methods you mentioned above doesn't work neither on template files nor on components.