Commit 377ae06c94 for wordpress.org
commit 377ae06c9432d6ee2dcf77e8f0fd63a40d5dc471
Author: swissspidy <swissspidy@git.wordpress.org>
Date: Thu Nov 26 16:03:07 2026 +0000
I18N: Read both revision date header names in `.l10n.php` files.
Language packs from translate.wordpress.org store the revision date as `translation-revision-date`, while files converted from a PO or MO source store it as `po-revision-date`. `wp_get_l10n_php_file_data()` only read the latter, so `PO-Revision-Date` came back empty for language packs, and `wp_get_installed_translations()` could then offer an installed, up-to-date pack for update again when no `.po` file sits next to it. Both names are now read, with the first one present used.
Developed in: https://github.com/WordPress/wordpress-develop/pull/12844
Props bejignesh, irozum, swissspidy.
Fixes #65809.
Built from https://develop.svn.wordpress.org/trunk@65803
git-svn-id: http://core.svn.wordpress.org/trunk@64832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php
index e90f97fd20..7450e11323 100644
--- a/wp-includes/l10n.php
+++ b/wp-includes/l10n.php
@@ -1828,11 +1828,13 @@ function wp_get_l10n_php_file_data( $php_file ) {
$data = (array) include $php_file;
unset( $data['messages'] );
+
+ // The revision date field has a different name depending on the source, support both.
$headers = array(
- 'POT-Creation-Date' => 'pot-creation-date',
- 'PO-Revision-Date' => 'po-revision-date',
- 'Project-Id-Version' => 'project-id-version',
- 'X-Generator' => 'x-generator',
+ 'POT-Creation-Date' => array( 'pot-creation-date' ),
+ 'PO-Revision-Date' => array( 'translation-revision-date', 'po-revision-date' ),
+ 'Project-Id-Version' => array( 'project-id-version' ),
+ 'X-Generator' => array( 'x-generator' ),
);
$result = array(
@@ -1842,9 +1844,12 @@ function wp_get_l10n_php_file_data( $php_file ) {
'X-Generator' => '',
);
- foreach ( $headers as $po_header => $php_header ) {
- if ( isset( $data[ $php_header ] ) && is_string( $data[ $php_header ] ) ) {
- $result[ $po_header ] = $data[ $php_header ];
+ foreach ( $headers as $po_header => $php_headers ) {
+ foreach ( $php_headers as $php_header ) {
+ if ( isset( $data[ $php_header ] ) && is_string( $data[ $php_header ] ) ) {
+ $result[ $po_header ] = $data[ $php_header ];
+ break;
+ }
}
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index b59b4a61f8..0d72f4a777 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.3-alpha-65802';
+$wp_version = '7.3-alpha-65803';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.