使用 QCoreApplication::translate() 时未找到多个翻译字符串
Plural translation strings not found when using QCoreApplication::translate()
当我用 QCoreApplication::translate() 声明一个没有复数的可翻译字符串时,例如 :
QCoreApplication::translate("Context", "[A] removed [B] item(s)");
我的 Qt5 Linguist 在 运行 lupdate 后正确检测到字符串。
当我使用复数声明相同的字符串时,例如:
QCoreApplication::translate("Context", "[A] removed %n item(s)", "", static_cast<int>(items));
我的 lupdate 不再检测到该字符串。
这不适用于 tr() 调用,我的 lupdate 正确报告了它们的复数形式。
问题是 static_cast<>。
将演员表移动到单独的行解决了问题:
int itemsAsInt = static_cast<int>(items);
QCoreApplication::translate("Context", "[A] removed %n item(s)", "", itemsAsInt);
当我用 QCoreApplication::translate() 声明一个没有复数的可翻译字符串时,例如 :
QCoreApplication::translate("Context", "[A] removed [B] item(s)");
我的 Qt5 Linguist 在 运行 lupdate 后正确检测到字符串。
当我使用复数声明相同的字符串时,例如:
QCoreApplication::translate("Context", "[A] removed %n item(s)", "", static_cast<int>(items));
我的 lupdate 不再检测到该字符串。
这不适用于 tr() 调用,我的 lupdate 正确报告了它们的复数形式。
问题是 static_cast<>。 将演员表移动到单独的行解决了问题:
int itemsAsInt = static_cast<int>(items);
QCoreApplication::translate("Context", "[A] removed %n item(s)", "", itemsAsInt);