Language not changing
huubl opened this issue · comments
Hi,
I try to set the default language to dutch in version: 2.0.0-rc.2 with the config below:
return [
'application' => [
'general' => [
[...]
'language' => 'nl_NL',
'timezone' => 'Europe/Amsterdam',
'date-format' => 'j F Y',
'time-format' => 'H:i',
'week-starts' => 'Mon',
],
[...]
];
Somehow the language is not changing, you know why?
Hey @huubl ,
Changing language in WordPress programatically is a bit of a pain, I almost left it out of Intervention, but under the hood it's using this function, switch_to_locale()
.
Basically, the language needs to be installed first. You will be able to see from the list below. It's not ideal, but after some further research it seemed like the best way to change languages programatically.
@darrenjacoby thanks. I think I found a solution, see #62
Oh, amazing, thanks so much! I'll test later and merge.
No problem :)
I looked at this post and WPML classes/localization/class-wpml-download-localization.php#L23-L56
Thank you for the research and getting that sorted @huubl !