Skip to content

Conversation

@ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented Aug 22, 2022

Fixes #32745.

The issue is that the translation string _%s user found_::_%s users found_ doesn't contain a %n, so it was wrongly assumed that this isn't a plural string and so the counter didn't get passed to Symfony. Symfony then didn't bother to split the plural string at | and the final text passed to vsprintf contained two %s.

The code now uses the | as indicator for a plural string.

Test added to reproduce the issue and confirm the fix.

Ref #26375
Ref #32155

@ChristophWurst ChristophWurst added bug 3. to review Waiting for reviews feature: language/translations (l10n/i18n) Localization and translation matters labels Aug 22, 2022
@ChristophWurst ChristophWurst added this to the Nextcloud 25 milestone Aug 22, 2022
@ChristophWurst ChristophWurst self-assigned this Aug 22, 2022
@ChristophWurst ChristophWurst changed the title Fix plural translation without count usage in string Fix plural translation without %n usage in string Aug 22, 2022
@ChristophWurst
Copy link
Member Author

/backport to stable24

@ChristophWurst
Copy link
Member Author

/backport to stable23

@ChristophWurst
Copy link
Member Author

/backport to stable22

@nickvergessen
Copy link
Member

Why can't the string be fixed to use %n ?

@nickvergessen
Copy link
Member

OCA\DAV\Tests\unit\Connector\Sabre\FileTest::testSimplePutFailsSizeCheck
Sabre\DAV\Exception: vsprintf(): Too few arguments

Failing some tests now

@nickvergessen
Copy link
Member

Basically 16d4ff4 is buggy as it uses n() without using the plural placeholder. Should be fixed there instead?

@nickvergessen
Copy link
Member

Proper fix in #33639

@ChristophWurst ChristophWurst deleted the fix/plural-translation-without-count-usage branch August 22, 2022 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug feature: language/translations (l10n/i18n) Localization and translation matters

Projects

Development

Successfully merging this pull request may close these issues.

[Bug]: vsprintf()

3 participants