WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#29230 closed defect (bug) (fixed)

When installing a plugin/theme, translations fail to install

Reported by: netweb Owned by: ocean90
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Upgrade/Install Keywords: has-patch commit
Focuses: Cc:

Description

When installing a plugin that supports automatic translation updates, the translations will fail to install whilst installing the plugin.

Repro:

  • Install WordPress /trunk using the new language/locale selector
  • Select Korean (ko_KR - 한국어) and proceed with installing WordPress
  • Install either of the following three plugins, Akismet, bbPress or BuddyPress
  • Plugin will install successfully but translations fail to install
  • See attached images for detailed screenshots
    • ko_KO 16.JPG & ko_KO 16 - Translated.JPG
      • bbPress is installed successfully and part of the install process is to also install translations though fails with the error 패키지를 설치할 수 없습니다. 유효한 플러그인을 찾을 수 없습니다. and 번역 업데이트가 실패했습니다. or google translated You can not install the package. Can not find a valid plugin. and Translation update failed.

Expected Results:

  • Plugin and locale translations to both install successfully.

Workaround:

  • After the plugin has finished installing, go to WordPress Updates and download any available translations updates and the relevant plugin translations will download successfully.
    • * ko_KO 18.JPG & ko_KO 18 - Translated.JPG - bbPress Korean (ko_KO) translations now downloaded and installed successfully.

Notes: I used Korean because it is currently the only locale with 100% WordPress Core 3.9.x/dev translations, 100% Akismet 3.x/dev, 100% 2.5.x/dev bbPress and 2.x/dev BuddyPress translations

Attachments (5)

Korean - ko_KO 16.JPG (88.4 KB) - added by netweb 5 years ago.
Korean - ko_KO 16 - Translated.JPG (81.2 KB) - added by netweb 5 years ago.
Korean - ko_KO 18.JPG (71.8 KB) - added by netweb 5 years ago.
Korean - ko_KO 18 - Translated.JPG (70.2 KB) - added by netweb 5 years ago.
29230.patch (1.1 KB) - added by ocean90 5 years ago.

Download all attachments as: .zip

Change History (11)

@ocean90
5 years ago

#1 @ocean90
5 years ago

  • Component changed from I18N to Upgrade/Install
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.0

The check_package() callback from Plugin_Upgrader is still hooked into upgrader_source_selection and is used as first to check the translation package. After that the translation specific package check runs, which bails directly, because is_wp_error() is true.

Pseudo stack:

add_filter('upgrader_source_selection', array( 'Plugin_Upgrader', 'check_package') );
WP_Upgrader->run( array() );
    do_action( 'upgrader_process_complete' );
       Language_Pack_Upgrader:async_upgrade()
          Language_Pack_Upgrader:upgrade()
              Language_Pack_Upgrader:bulk_upgrade()
              add_filter( 'upgrader_source_selection', array( 'Language_Pack_Upgrader', 'check_package' ), 10, 2 );
              WP_Upgrader->run( array() );
              remove_filter( 'upgrader_source_selection', array( 'Language_Pack_Upgrader', 'check_package' ) );
remove_filter('upgrader_source_selection', array( 'Plugin_Upgrader', 'check_package') );

#2 @SergeyBiryukov
5 years ago

When installing a plugin that supports automatic translation updates, the translations will fail to install

A similar thing happens when installing a theme. My steps:

  1. Installed Semicolon theme.
  2. Got a bunch of errors (repeated for each language I have in wp-content/languages):
    Updating translations for WordPress (ru_RU)…
    The package could not be installed. The theme is missing the style.css stylesheet.
    Translation update failed.
    

#3 @ocean90
5 years ago

  • Summary changed from When installing a plugin, plugin translations fail to install to When installing a plugin/theme, translations fail to install

#4 @dd32
5 years ago

  • Keywords commit added

Upon initial review, this change looks okay to me, although it's really a brute force fix, but one that will work for the foreseeable future (I think).

This (upgrader_source_selection) is probably something that shouldn't have been a filter, but rather, a callback parameter passed into the update methods instead, so that it only applies to the update instance in question. Out of scope for 4.0 though, so this patch seems good to go.

#5 @ocean90
5 years ago

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

In 29621:

Language Pack Upgrader: Remove any pre-existing package checks and then set the new one for translations.

fixes #29230.

#6 @dd32
5 years ago

In 29685:

Language Pack Upgrader: Remove ALL pre-existing filters before performing a translation update these filters may act in an unexpected way during the upgrade process.
See #29230. Fixes #29425.

Note: See TracTickets for help on using tickets.