[wp-hackers] Multilanguage: how to redefine locale on the fly

Manuel Schmalstieg webdev at ms-studio.net
Tue Mar 5 23:45:24 UTC 2013


I am searching for a method that would allow me to assign a language
to specific posts/pages by using a *taxonomy*.

What I'm struggling with, is that there appears to be no easy way to
override the base language defined in wp-config.php (WPLANG).

Ideally, I would run a test in my header.php to detect the presence of
the "language" taxonomy, and change the WPLANG accordingly.

This would allow an extremely simple multi-language system, using only
a taxonomy, and something like posts-to-posts would link the
translated articles together. If only I could bring the built-in
translation features of WP to play nicely...

The basic php function setlocale(LC_ALL, 'fr_FR') doesn't have any impact.

I would be thankful for any hint towards a solution.


More information about the wp-hackers mailing list