WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.62k stars 1.02k forks source link

Incorrect Placeholder Check for Plural Forms in Weblate #13016

Open eschumacher-99 opened 16 hours ago

eschumacher-99 commented 16 hours ago

Describe the issue

I encountered a bug in Weblate related to the placeholder check when handling plural forms. Specifically, when plural forms use variables that differ from those in the singular form, Weblate incorrectly validates the placeholders in the translation.

I already tried

Steps to reproduce the behavior

  1. Create a translation entry with the following: Singular form: @(count) Stck. Plural form: @(otherVariable) Stck.

  2. Use the placeholder check feature in Weblate: placeholders:r"@([^)]+)"

  3. Attempt to translate both forms.

  4. The placeholder check incorrectly validates the plural form. Weblate expects the variable @(count) in the plural form, marking @(otherVariable) as superfluous and @(count) as missing.

Expected behavior

The placeholder check should correctly recognize and validate the variables specific to each form (plural or singular). In this case, it should acknowledge @(otherVariable) as the appropriate variable for the plural form without expecting @(count).

Screenshots

image

Exception traceback

No response

How do you run Weblate?

PyPI module

Weblate versions

5.4.2

Weblate deploy checks

No response

Additional context

No response

nijel commented 11 hours ago

Indeed, this situation is not gracefully handled. On the other side I think this is a bad approach because it will become tricky once the target language has a different number of plurals. The PlaceholderCheck could be updated to use PluralMapper, but still, this can't handle 100% of cases with different number of plurals.

github-actions[bot] commented 9 hours ago

This issue has been put aside. It is currently unclear if it will ever be implemented as it seems to cover too narrow of a use case or doesn't seem to fit into Weblate.

Please try to clarify the use case or consider proposing something more generic to make it useful to more users.