Bug 386053 - i18ncp() incorrectly appends I18N_EXCESS_ARGUMENTS_SUPPLIED when singular and plural format strings use different variables
Summary: i18ncp() incorrectly appends I18N_EXCESS_ARGUMENTS_SUPPLIED when singular and...
Status: RESOLVED NOT A BUG
Alias: None
Product: frameworks-ki18n
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.39.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Chusslove Illich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-22 02:02 UTC by Nate Graham
Modified: 2020-07-06 21:43 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2017-10-22 02:02:05 UTC
Consider the following code:

int numberOfImages = [1 or 2];
QString fileName = "someFile.jpg";
QString windowTitle = QString(i18ncp("@title:window", "Copy %2", "Copy %1 images", numberOfImages, fileName))

The singular case correctly displays "Copy someFile.jpg"

However, the plural case, displays "Copy 2 images(I18N_EXCESS_ARGUMENTS_SUPPLIED)"

In fact, there aren't excess arguments, it's just that both variables aren't used in each string. But besides the error message, the output is otherwise perfectly valid.
Comment 1 null 2017-10-22 22:15:58 UTC
Turns out this is not only intended behaviour, but also useful for catching bugs.

See here for the full explanation: https://phabricator.kde.org/D8409#158116
Comment 2 Nate Graham 2017-10-22 22:59:59 UTC
Yep, makes sense.