Closed derby closed 8 years ago
not sure why that wouldn't work... can you var_dump(get_locale());
and reply back with the results?
Ok I made a mistake, get_locale() is not empty but it always returns "de_DE" ( var_dump: string(5) "de_DE"). My WP setup is german and I use qtranslate x for translation. I resume: no matter which language is active when I submit an acf-contact-form, the locale in the mail template is always "de_DE". Inside the mail preview (?acf-mail-preview=...) the locale is correct ... strange behavior ...
You may have to save and store the locale when saving the form submission.
Yes I did this but I cannot set locale inside the ACF Mail Templates, it always results in the default language which is in my case german. Could and would you try this out?
Hi @derby try this
add_filter( 'locale', 'set_my_locale' );
function set_my_locale( $lang ) {
return 'en_US';
}
$local = get_locale();
var_dump($local);
Hi again,
finally I have another problem. Inside the acf mail templates I can use any WP function BUT there is no locale set. If you try to echo get_locale(); it will be empty in the email. Since I currently develop a multilingual website I have to use the wp translation functions like __() or _e() but these do not work without locale. Even if I set locale inside a mail template (e.g. setlocale(LC_ALL, 'en_US'); ) it does not work. Can you help me Christine?