我目前正在翻译我们的 Qt gui。
我有以下代码:
// header file
static const QString Foo;
// cpp file
const QString FooConstants::Foo = "foo";
// another cpp file
editMenu->addAction(tr(FooConstants::Foo));
这似乎不起作用。
也就是说,.ts 文件中没有上述常量的条目。
如果我这样做,那么它会起作用:
// another cpp file
editMenu->addAction(tr("foo"));
但是,这个常量在很多地方都有使用,我不想手动更新每个字符串文字。(如果将来改变)
任何人都可以帮忙吗?