Bug 386053

Summary: i18ncp() incorrectly appends I18N_EXCESS_ARGUMENTS_SUPPLIED when singular and plural format strings use different variables
Product: [Frameworks and Libraries] frameworks-ki18n Reporter: Nate Graham <nate>
Component: generalAssignee: Chusslove Illich <caslav.ilic>
Status: RESOLVED NOT A BUG    
Severity: normal CC: kdelibs-bugs, null
Priority: NOR    
Version: 5.39.0   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:

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.