Skip to content
Advertisement

Php language class usage issue

My php multilanguage class returns translated text by field when i call the class. I use echo for return translated text because i fetch whole page in class and translate them in foreach. Problem is when i return translated text with echo, $lang->Translate(“PLANT”) it jumps outside where i put it. How can i solve this issue. (By the way i can’t use just return it only returns 1 row of language table)

The Language Table

enter image description here

JavaScript

my language class

JavaScript

Advertisement

Answer

As when you do this

JavaScript

you are making an array of word,translation i.e.

JavaScript

I see no reason why you cannot return the translation from this method I would change the method slightly as there seems to be no reason for a loop.

JavaScript

Or even like this so you dont need to make a copy of the array

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement