gettext in classes

maybe i am missing something, but i dont know what, i also googled and stuff and couldn’t come
up with any help :( so i hope one of you guys can tell me what my problem is:

i have a page (index.php) in which i do a require_once for my request handler class. obj1->handleRequest()
creates an action handler obj to get my action like this: $act = obj2->getAction(“actionString”) and after
that i call the returned action like this obj2->$act($params) now what i do in this action is send
e.g. an email and i am trying to translate the text with gettext. Everywhere else it works fine (putenv(“Lang=en”),setlocale,bindtextdomain and textomain are set in index.php) but all output coming from my action handler aren’t translated :’(
what am i missing?!

Presuming you have the gettext requirements set up correctly, do you have a translation table available? If so, is it filled?

yes, i already checked that i have the necessary strings in my .po file
it works fine for all other php files which are not classes :frowning:

Are you sure you’re looking for a .po file? People here are talking about an .mo file.

well yes .po is the plain file and .mo the converted one :slight_smile:

what i tried is, i also have some error strings in this action handler, i passed them down to the index and used gettext there, this works
fine, but i really want the email to be sent in the action handler, otherwise i have to do an ugly hack and i really dont want to do that :(

So the translation is going fine? Then it sounds like you’re dealing with a scope issue. Could you show us the (relevant) code for your class?

haha i am freaking out :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service