darrenjacoby / intervention

WordPress plugin to configure wp-admin and application state using a single config file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Language not changing

huubl opened this issue · comments

commented

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.

image

commented

@darrenjacoby thanks. I think I found a solution, see #62

Oh, amazing, thanks so much! I'll test later and merge.

Thank you for the research and getting that sorted @huubl !