If you use a commercial plugin (wpml.org) and need support, please go to their official support channel. In order to be good stewards of the WordPress community, and encourage innovation and progress, we feel it’s important to direct people to those official locations.
Forum volunteers are also not given access to commercial products, so they would not know why your commercial theme or plugin is not working properly. This is one other reason why volunteers forward you to the commercial product’s vendors. The vendors are responsible for supporting their commercial product.
Thread Starter
Tom
(@tomybyte)
Hi Fahim, you didn’t read my post above. I know WPML very well and I’m the owner of a lifetime licence. I could use WPML but that would be overkill. In this case I want a very small and lightweight solution. By the way WPML puts very much data in tables. I have another website using WPML, there is a table with a size bigger than 1 GByte. No – WPML is here absolutely no solution. But thank you for your time to answer.
-
This reply was modified 4 years, 5 months ago by
Tom.
Thread Starter
Tom
(@tomybyte)
Maybe helpful for someone else too. This little code in my plugins function file does the trick:
function maybe_set_locale_to_german( $locale ) {
$l = t3c_get_user_lang();
if( $l=='de_DE' ){
$locale = 'de_DE';
}
return $locale;
}
add_filter( 'locale', 'maybe_set_locale_to_german', 1, 1 );
function t3c_get_user_lang(){
static $set_lang = '';
$server_lang = filter_var( $_SERVER['HTTP_ACCEPT_LANGUAGE'], FILTER_SANITIZE_STRING );
$browserlang = substr($server_lang, 0, 2);
if( $browserlang == "de" ){
$set_lang = 'de_DE';
}
return $set_lang;
}
-
This reply was modified 4 years, 5 months ago by
Tom.
Thanks so much Tom, for sharing the solution.