I18N: Improve singular lookup of pluralized strings.

Ensures that looking up a singular that is also used as a pluralized string works as expected.
This improves compatibility for cases where for example both `__( 'Product' )` and `_n( 'Product', 'Products’, num )` are used in a project, where both will use the same translation for the singular version.

Although such usage is not really recommended nor documented, it must continue to work in the new i18n library in order to maintain backward compatibility and maintain expected behavior.

See #59656.

git-svn-id: https://develop.svn.wordpress.org/trunk@57386 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler
2024-01-30 13:59:46 +00:00
parent cabfa6f52c
commit 71b8dcb08c
5 changed files with 28 additions and 2 deletions

View File

@@ -6,5 +6,6 @@ return [
'contextoriginal with context' => ['translation with context'],
'plural0' . "\0" . 'plural1' => ['translation0', 'translation1'],
'contextplural0 with context' . "\0" . 'plural1 with context' => ['translation0 with context', 'translation1 with context'],
'Product' . "\0" . 'Products' => 'Produkt' . "\0" . 'Produkte',
],
];

View File

@@ -20,4 +20,7 @@ msgid_plural "plural1 with context"
msgstr[0] "translation0 with context"
msgstr[1] "translation1 with context"
msgid "Product"
msgid_plural "Products"
msgstr[0] "Produkt"
msgstr[1] "Produkte"