Skip to content

Commit 6db5e07

Browse files
swissspidyclaude
andcommitted
Test a self-hosted language pack the translations API does not know
Reproduces the actual cause from the PR discussion without network access: a plugin adds its own pack to the update transient, and the translations API has no entry for its slug. Also covers the Language column of --dry-run, which was empty before the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UWTd5pwpi2xQfDA6mUYkkx
1 parent f1c8c3e commit 6db5e07

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

‎features/language-plugin.feature‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,3 +653,73 @@ Feature: Manage plugin translation files for a WordPress install
653653
Updating 'de_DE' translation for Akismet
654654
"""
655655
And STDERR should be empty
656+
657+
@require-wp-4.0
658+
Scenario: Update a translation pack from a source that the translations API does not know
659+
Given a WP install
660+
And a wp-content/plugins/private-plugin/private-plugin.php file:
661+
"""
662+
<?php
663+
/**
664+
* Plugin Name: Private Plugin
665+
* Version: 0.1.0
666+
*/
667+
"""
668+
# Plugins that host their own language packs add them to the update transient.
669+
And a wp-content/mu-plugins/private-language-packs.php file:
670+
"""
671+
<?php
672+
add_filter( 'site_transient_update_plugins', function ( $value ) {
673+
if ( ! is_object( $value ) ) {
674+
$value = new stdClass();
675+
}
676+
$value->translations[] = array(
677+
'type' => 'plugin',
678+
'slug' => 'private-plugin',
679+
'language' => 'de_DE',
680+
'version' => '0.1.0',
681+
'updated' => '2026-01-01 00:00:00',
682+
'package' => 'https://example.invalid/private-plugin-de_DE.zip',
683+
'autoupdate' => true,
684+
);
685+
return $value;
686+
} );
687+
"""
688+
And that HTTP requests to api.wordpress.org/plugins/update-check/1.1/ will respond with:
689+
"""
690+
HTTP/1.1 200
691+
Content-Type: application/json
692+
693+
{"plugins":[],"translations":[],"no_update":[]}
694+
"""
695+
And that HTTP requests to api.wordpress.org/translations/plugins/1.0/ will respond with:
696+
"""
697+
HTTP/1.1 200
698+
Content-Type: application/json
699+
700+
{"translations":[]}
701+
"""
702+
And that HTTP requests to https://example.invalid/private-plugin-de_DE.zip will respond with:
703+
"""
704+
HTTP/1.1 404
705+
Content-Type: text/plain
706+
707+
Not found
708+
"""
709+
710+
When I run `wp language plugin update private-plugin --dry-run --format=csv`
711+
Then STDOUT should contain:
712+
"""
713+
Plugin,"Private Plugin",0.1.0,de_DE
714+
"""
715+
And STDERR should be empty
716+
717+
When I try `wp language plugin update private-plugin`
718+
Then STDOUT should contain:
719+
"""
720+
Updating 'de_DE' translation for Private Plugin 0.1.0...
721+
"""
722+
And STDERR should not contain:
723+
"""
724+
Undefined property
725+
"""

0 commit comments

Comments
 (0)