Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#34937 closed enhancement (fixed)

Language packs for plugins not installed on multisite installation

Reported by: pputzer's profile pputzer Owned by: ocean90's profile ocean90
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.4
Component: I18N Keywords: has-patch
Focuses: multisite Cc:

Description

I've recently switched my two plugins to use WP language packs for their translations. Somehow, the translations did not seem to work on my site. A closer look at /wp-content/languages/plugins/ of the production installation has revealed that directory to be empty, in contrast to the local MAMP installation I use for development. Language packs for themes and WP itself are present in both installations.

While i can't be completely sure (the production installation obviously has WP_DEBUG turned off and the error log is empty), the most salient difference between the two is the fact that the production environment is a multisite network.

Note: The bug would also appear to have been present in previous versions of WP, but I only looked after the site had already been upgraded to 4.4.

Attachments (1)

34937.patch (1.6 KB) - added by ocean90 9 years ago.

Download all attachments as: .zip

Change History (12)

#1 @ocean90
9 years ago

  • Keywords reporter-feedback added

Hello pputzer, thanks for your report.

Which locale is enabled for the main site? Which plugins are active? Is the production under version control? Can you reproduce this consistent? What about themes?

#2 @ocean90
9 years ago

  • Focuses ui removed

#3 @pputzer
9 years ago

@ocean90 The main site (site_id 1) is on en-US. The installation is not under version control.

There are quite a lot of plugins installed, but AFAIK the only one that hooks into the upgrade process is WP Pusher. To be sure, I tried to check for updates with WP Pusher disabled before filing the ticket.

Regarding themes: There are only two themes installed for which I'd expect there to be language packs and these language packs are present (Twenty Ten and Twenty Fifteen). The other themes are not hosted on WP.org, so no language packs.

I'll try to reproduce this on a minimal WP multisite installation, but those are difficult to setup in exactly the same way on a local installation.

#4 @ocean90
9 years ago

  • Keywords needs-patch added; reporter-feedback removed
  • Milestone changed from Awaiting Review to 4.5
  • Type changed from defect (bug) to enhancement

Currently the update check uses only the locale of the main site. To get updates for all locales you can use this code:

<?php
function update_check_include_all_locales( $locales ) {
        return array_values( get_available_languages() );
}
add_filter( 'plugins_update_check_locales', 'update_check_include_all_locales' );
add_filter( 'themes_update_check_locales', 'update_check_include_all_locales' );

I'm fine with changing the default value, at least for multisite installs.

#5 follow-up: @pputzer
9 years ago

Thanks! I installed that fragment as mu-plugin and now it did download all the missing translations.

This not being the default behaviour on multisite is weird, because you can add languages from each individual site on the network (and those core translations are downloaded). Personally, I'd still consider that a bug from the user's (adminstrator's) perspective, because AFAIK there is now way to trigger a manual download of the plugin translations from within the UI.

#6 @ocean90
9 years ago

#35599 was marked as a duplicate.

#7 in reply to: ↑ 5 @let me see...
9 years ago

Replying to pputzer:

This not being the default behaviour on multisite is weird, because you can add languages from each individual site on the network (and those core translations are downloaded). Personally, I'd still consider that a bug from the user's (adminstrator's) perspective, because AFAIK there is now way to trigger a manual download of the plugin translations from within the UI.

I would most definitely call that a bug. The only way to trigger translations to be offered to download is to change the root site lang to the desired locale, as I explained here: #35599

Last edited 9 years ago by let me see... (previous) (diff)

@ocean90
9 years ago

#8 @ocean90
9 years ago

  • Keywords has-patch added; needs-patch removed

#9 @let me see...
9 years ago

Thank you!

#10 @ocean90
9 years ago

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

In 36630:

Updates: Pass locales of all available languages to the themes/plugins update API.

This ensures that language packs for all languages in a Multisite install are updated.

Fixes #34937.

#11 @DrewAPicture
9 years ago

In 36966:

Docs: Improve two 4.5.0 changelog entries added for the plugins_update_check_locales and themes_update_check_locales filters, introduced in [36630].

See #34937. See #35986.

Note: See TracTickets for help on using tickets.