當我使用QCoreApplication::translate()宣告一個沒有復數的可翻譯字串時,例如:
QCoreApplication::translate("Context", "[A] removed [B] item(s)");
運行 lupdate 后,我的 Qt5 Linguist 正確檢測到該字串。
當我使用復數形式宣告相同的字串時,例如:
QCoreApplication::translate("Context", "[A] removed %n item(s)", "", static_cast<int>(items));
我的 lupdate 不再檢測到該字串。
這不適用于tr()呼叫的使用,我的 lupdate 正確報告了它們的復數形式。
uj5u.com熱心網友回復:
問題是static_cast<>。將演員表移到單獨的行解決了這個問題:
int itemsAsInt = static_cast<int>(items);
QCoreApplication::translate("Context", "[A] removed %n item(s)", "", itemsAsInt);
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/378511.html
