Make WordPress Core


Ignore:
Timestamp:
01/30/2024 01:59:46 PM (2 years ago)
Author:
swissspidy
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/data/l10n/example-simple.php

    r57337 r57386  
    77            'plural0' . "\0" . 'plural1' => ['translation0', 'translation1'],
    88            'contextplural0 with context' . "\0" . 'plural1 with context' => ['translation0 with context', 'translation1 with context'],
     9            'Product' . "\0" . 'Products' => 'Produkt' . "\0" . 'Produkte',
    910        ],
    1011];
Note: See TracChangeset for help on using the changeset viewer.