Make WordPress Core

Opened 4 months ago

Last modified 2 months ago

#63009 new defect (bug)

setup-config errors are not localised

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: I18N Keywords: needs-patch
Focuses: Cc:

Description (last modified by johnbillion)

There are two error messages shown in setup-config.php that are not localised.

  1. If wp-config-sample.php is missing during the initial installation, the error message stating this is always shown in English rather than the language chosen in the first step of installation (from $_REQUEST['language']).
    • To reproduce, delete or rename both wp-config.php and wp-config-sample.php and then attempt tp proceed through the installation steps.
  2. Manually visiting wp-admin/setup-config.php during normal site operation will show an error message stating that the wp-config.php file already exists. This is always shown in English rather than the installed site language (from the WPLANG option).
    • To reproduce, visit wp-admin/setup-config.php during normal site operation.

Affected error messages: https://github.com/WordPress/wordpress-develop/blob/fc96319aa770050d22cfdc1bbab437154017bcf7/src/wp-admin/setup-config.php#L43-L82

Change History (6)

#1 @johnbillion
4 months ago

  • Description modified (diff)

#2 @swissspidy
4 months ago

For (1):

When I rename/delete both wp-config.php wp-config-sample.php, I don't even get to the language chooser. I immediately get redirected to setup-config.php with "Sorry, I need a wp-config-sample.php file to work from.". In this case no language information is available of course and this will always be in English.

Can you perhaps clarify this part?

For (2):

The main issue here seems to be that the found wp-config.php file isn't actually loaded, so wp-settings.php (which was loaded earlier by itself) and wpdb don't know the actual table prefix, so the locale information can't be loaded from the database.

To change the behavior here, I think the file would need to be refactored quite a bit so that if a config file already exists, it is actually loaded. Then the locale information is known and the translation could be loaded.

#3 @johnbillion
4 months ago

Looks like I got confused while testing this. The wp-config-sample.php error message is correctly localised when you attempt to install a localised package, for example the de_DE package from https://de.wordpress.org/latest-de_DE.zip:

Die Datei wp-config-sample.php ist erforderlich. Bitte lade diese erneut zu deiner WordPress-Installation hoch.

There doesn't appear to be a way to reach this error message in the standard package, unless you manually delete wp-config-sample.php after you've selected a language.

So it looks like the only actual issue is the second one, whereby visiting wp-admin/setup-config.php during normal site operation always shows the message in English.

#4 @swissspidy
4 months ago

The wp-config-sample.php error message is correctly localised when you attempt to install a localised package

Huh, I wonder why that is though.

#5 @johnbillion
4 months ago

Probably due to the $wp_local_package = 'de_DE'; line in wp-includes/version.php.

#6 @swissspidy
2 months ago

Really not sure what would be the best way to address (2), additional suggestions welcome.

Note: See TracTickets for help on using tickets.