wp-cli/language-command

switch-language not working for `de_DE_formal`

reitermarkus opened this issue · 10 comments

I noticed that wp site switch-language does not work for de_DE_formal when it is already active.


With wp language core list showing

de_DE_formal	German (Formal)	Deutsch (Sie)	active	available	2018-08-03 00:30:25

this happens

$ wp site switch-language 'de_DE_formal'
Error: Language not installed.

What kind of files are inside your wp-content/languages folder?

I cannot really reproduce this here. What I noticed however is that I cannot seem to use wp site switch-language en_US.

The result is this:

$ wp language core list --status=active --format=csv --fields=language
language
en_US
$ wp site switch-language de_DE
$ wp language core list --status=active --format=csv --fields=language
language
de_DE
$ wp site switch-language en_US
$ wp language core list --status=active --format=csv --fields=language
language
de_DE

Here is the content:

./wp-content/languages
├── admin-de_DE.mo
├── admin-de_DE.po
├── admin-de_DE_formal.mo
├── admin-de_DE_formal.po
├── admin-network-de_DE.mo
├── admin-network-de_DE.po
├── admin-network-de_DE_formal.mo
├── admin-network-de_DE_formal.po
├── continents-cities-de_DE.mo
├── continents-cities-de_DE.po
├── continents-cities-de_DE_formal.mo
├── continents-cities-de_DE_formal.po
├── de_DE.mo
├── de_DE.po
├── de_DE_formal.mo
└── de_DE_formal.po

These are installed by wp language core install.

@swissspidy Any ideas what this might be or should we close?

@danielbachhuber I intend to have a closer look at this command in general. I feel like this isn't the only inconsistency.

@reitermarkus I tried to add some tests for this in #57. Locally they all pass, so I am not sure how I can really reproduce this... Please have a look at the tests and let me know if I got my thinking wrong somewhere.

@reitermarkus Latest master now includes tests to test against this specific case (merged PR #57). Are you able to pull latest master and run the tests on your local install to see what result you get?

@schlessera, how do I run the tests?

If you clone this repository you can run composer install and afterwards composer test.

+1, same issue. A new site I just deployed to production doesn't have language support anymore.

Any fixes yet? The issue seems to be some years old now.

@strarsis make sure to install the language first before trying to switch to it. Open a new bug ticket with detailed information if it still doesn‘t work.

This ticket here can be closed as worksforme