Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PROBLEM PHP - button text translate to 3 languages
#7
use code tags..

That looks correct where you have it now. At the beginning of your component that uses it.
components are called like functions so imagine they are inside a function ( an anonymous function actually )
That is why the global is needed, because that variable is not in your scope.

It is possible your languages are not defined as 2 letter codes?
you can add a debugLog($language); in there and see

maybe you need a strtolower($language) == 'en'.

Not sure, could be language is not set

PHP Code:
<?php 
global $language;
debugLog($language);
$langlower strtolower($language);
if (
$langlower 'en') { // you might need to make sure this is case sensitive for all these checks
echo 'Next';
}else if (
$langlower 'de') {
echo 
'Naechste';
}else if (
$langlower 'fr') {
echo 
'Suivant ';
}
else echo 
"language not set"// catch if not set to any of these

?>
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply


Messages In This Thread
RE: PHP - button text translate to 3 languages - by shawn_a - 2014-08-12, 23:24:32



Users browsing this thread: 1 Guest(s)