Stefan
Stefan

Reputation: 259

PHP Gettext: temporary language switch?

Is it possible to temporary switch a language with the php gettext module? I would like to change the language since an e-mail should be generated in two language for two different receivers.

Upvotes: 2

Views: 660

Answers (1)

hek2mgl
hek2mgl

Reputation: 158190

You need to set the LC_* variable(s). Like this:

putenv('LC_ALL=de_DE');
setlocale(LC_ALL, 'de_DE');

renderEmail();

putenv('LC_ALL=en_US');
setlocale(LC_ALL, 'en_US');

renderEmail();

Upvotes: 3

Related Questions