I18N: Revert [57386] pending further investigation.

Reverts the change for fallback string lookup due to a performance regression in the bad case scenario.

See #59656.
Built from https://develop.svn.wordpress.org/trunk@57505


git-svn-id: http://core.svn.wordpress.org/trunk@57006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2024-01-31 21:51:14 +00:00
parent e9b8c1cd49
commit ec68b4743e
2 changed files with 2 additions and 19 deletions

View File

@ -203,24 +203,7 @@ abstract class WP_Translation_File {
$this->parse_file();
}
if ( isset( $this->entries[ $text ] ) ) {
return $this->entries[ $text ];
}
/*
* Handle cases where a pluralized string is only used as a singular one.
* For example, when both __( 'Product' ) and _n( 'Product', 'Products' )
* are used, the entry key will have the format "ProductNULProducts".
* Fall back to looking up just "Product" to support this edge case.
*/
foreach ( $this->entries as $key => $value ) {
if ( str_starts_with( $key, $text . "\0" ) ) {
$parts = explode( "\0", $value );
return $parts[0];
}
}
return false;
return $this->entries[ $text ] ?? false;
}
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.5-alpha-57504';
$wp_version = '6.5-alpha-57505';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.