WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#36918 closed defect (bug) (fixed)

Multisite: Can't set en_US for language, when creating a new site

Reported by: arkimedia Owned by: ocean90
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.4
Component: I18N Keywords: has-patch has-unit-tests
Focuses: administration, multisite Cc:

Description

Problem description:

  1. I have a multisite where default language is set to Finnish (fi) from the network settings, so that get_site_option('WPLANG') returns 'fi'.
  1. I want to create a new site and use en_US as a language.
  1. If I choose "en_US" from the language chooser in site-new.php, $_POST['WPLANG'] doesn't contain any language.
  1. Because $_POST['WPLANG'] is empty, no language is passed to the wpmu_create_blog function.
  1. If no language is passed wpmu_create_blog function, it uses network default, which in this case is 'fi'.add_option( 'WPLANG', get_site_option( 'WPLANG' ) );

This isn't a problem if the network default language is en_US, but causes problems in localized multisites.

Attachments (1)

36918.patch (4.1 KB) - added by ocean90 5 years ago.

Download all attachments as: .zip

Change History (6)

#1 @ocean90
6 years ago

  • Component changed from General to I18N
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 4.5.2 to 4.4

Hello @arkimedia, thanks for the report. Looks like we need to replace an empty() check with isset().

The language chooser was introduced in [33920].

#2 @ocean90
5 years ago

#36360 was marked as a duplicate.

@ocean90
5 years ago

#3 @ocean90
5 years ago

  • Keywords has-patch has-unit-tests added; needs-patch removed
  • Milestone changed from Future Release to 4.7

#4 @ocean90
5 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 38655:

Multisite: Allow to set the site language of a new site to English.

An empty string in WPLANG is used to define the site language as en_US. The ! empty() check didn't catch this case so that wpmu_create_blog() fell back to the network setting.

Fixes #36918.

#5 @arkimedia
5 years ago

Tested this with 4.7 beta 1 and issue seems to be fixed. Thank you for the patch @ocean90.

Note: See TracTickets for help on using tickets.