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

Otto otto at ottodestruct.com
Wed Mar 6 00:24:41 UTC 2013


Don't try to change WPLANG, you can't change a define'd constant.

Instead, change the global $locale, or put a filter on 'locale'.

-Otto



On Tue, Mar 5, 2013 at 5:45 PM, Manuel Schmalstieg <webdev at ms-studio.net> wrote:
> 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.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list