I am vaguely aware that it has something to do with the way WordPress is initialized. I know WPLANG can’t be changed on the fly.
It’s how PHP works: You can’t change an already defined constant.
But there’re filters for that. The following plugin is a sketch that you could use and try to see if this direction fits your needs.
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: (#102471) Query Locale
*/
add_filter( 'locale', 'wpse_102471_locale', 20 );
/**
* Callback to filter the locale/textdomain.
* Assumes that you got a `lang` query var
* @param bool $locale
* @return mixed string/bool $locale|$GLOBALS['wp_query']['lang']
*/
function wpse_102471_locale( $locale = false )
{
global $wp_query;
if ( isset( $wp_query['lang'] ) )
return $wp_query['lang'];
return $locale;
}
Related Posts:
- Does changing ‘WPLANG’ in wp-config.php just effect the admin language or does it have other consequences?
- Two language versions for each article
- Where to modify translation files by _e()
- Multilingual website without third-party plugin
- WordPress and Localization
- Changing interface language without multisite
- WordPress Translation to french, at -> à not working
- Wrong WordPress language?
- Localisation and WordPress
- Translation not working in sprinf variable
- Create a category in different language?
- Having problem in using wordpress with an other language
- HTML inside __() or _e() language translation string
- Best WordPress Multi-language Plugin? [closed]
- Setting WPLANG from a plugin
- Best WordPress Localization Plugin? [closed]
- WPML: getting page title in different language
- Titles in my sidebar widget appear in all languages – with qtranslate
- Having two different versions of the same post?
- What is better for wordpress performace?
- detect the language a post is written in
- One of the messages in .po file doesn’t show up
- How to change language file used by _e function
- Qtranslate + Advanced Custom Fields: how to have a multilanguage wysiwyg editor? [closed]
- Insights into WordPress Multi-Site, Domain Mapped, and Multilanguage site using WPML [closed]
- Get Polylang available languages on admin page of my plugin [closed]
- Polylang get non-current language/s
- Why isn’t WMPL correctly redirecting users based on browser language? [closed]
- WordPress For Urdu Language
- Why load_textdomain work but not load_plugin_textdomain?
- How to find a language direction?
- How to have english digits in some posts with an rtl WordPress theme
- Redirect one of two domains on one WordPress installation
- Getting translated string through a variable
- Two different domains for two different languages
- What is the correct way for multi-domain and multi-language website?
- How to reload wordpress textdomains at runtime
- How to set up WPLANG in wp-config.php for 4 languages?
- Were the language toggles removed from WP recently?
- Is it possible to temporarily override the language setting?
- make a mulitingual wordpress website Arabic-english
- Simple Multilanguage Switcher
- How to make a wordpress site multilingual by uploading a translated CSV file that has the traslations?
- can’t change a few lines of text to another language
- Country switcher, then option to choose language for that country [closed]
- Force language in translate function
- Specific content by country in multiple languages
- how to remove language selection option from wordpress?
- Localization: I want the backend: english and frontend in defined language
- Multisite WPLANG won’t save
- Get the ID of the default language equivalent page in Polylang [closed]
- Switch site language to en_ZA
- I display messages using code snippets but how can I use the right language?
- language_attributes for two languages?
- How to set a dual language site in wordpress?
- WPML customizing language selector [closed]
- how to have __() translating in languages different from admin?
- Website in multiple Language
- qtranslate arabic shortcode?
- Problems character encoding for pages in multiple languages
- Can I set is_rtl() to true?
- WordPress in 3 languages
- Can the qTranslateX-Plugin translate non-article text? [closed]
- Translate a theme with a PO file
- Transposh Japanese language transaltion not showing up
- WordPress Relative Path
- WordPress page with non-English text
- Redirection plugin and Chinese URLs
- WP E-commerce wpml translation or multilingual
- For multiple languages, two wordpress instances on subdomains or a plugin?
- I cant test my .po file for Turkish Language
- different domains disabled in polylang
- How to enqueue 2 rtl css
- where to add this filter? in which file should be added?
- Multilingual website with different content and look
- Language setting for Specific WordPress Page
- How to add language tags like “” in just some certain pages?
- 2 languages, 3 domains
- phantom language switcher
- Interface translation without plugins
- Polylang plugin translation problems
- Is there a way to ensure browser automatically translates page content to another language (via Google Translate)?
- Create a custom page to use in all the sites, A multisite question
- How to use get_post_type_archive_link for a given language?
- How to load rtl.css file without changing lanuage to persian in wordpress?
- Theme isn’t multilanguage ready. How can i still add a second language to the site?
- Which language files are loaded?
- Having a two language website
- What are the downsides to uploading filenames in different languages?
- Setting WPLANG from a plugin
- Hijack site url on sub domain for translation
- Translate placeholder text in search field
- WordPress NavXT plugin localization
- Set language from url?
- get_categories only getting categories in the main language
- site with two diffrent menus for difftent pages?
- white space appears when switch to rtl
- Website Language/Locale Switching
- How to make WP in two languages (e.g. English & Bengali) without plugins
- How to get locale within WP REST Request?