Can't apply translation for some files.
-
I have ts file with translation of many files including @RoutingPhonesModel.h@ file. But translation for this file don't applies. The following code: @ public: QVariant headerData(int section, Qt::Orientation orientation, int role) const {
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
switch(section) {
case ePort: return tr("Port");
case eType: return tr("Type");
case eNote: return tr("Note");
case ePhone: return tr("Phone");
}
return QVariant();
}@
is shown in linguist as translated. But when program executes in this place I see original text w/o translation. -
Have you executed lrelease? It will produces QM files out of TS files. For more details please have a look at "Qt Linguist Manual":http://qt-project.org/doc/qt-4.8/linguist-manager.html.
-
bq. Have you executed lrelease? It will produces QM files out of TS files. For more details please have a look at Qt Linguist Manual [qt-project.org].
Yes, I execute lupdate, then make translation and then execute lrelease. But translation applied not to all files. Maybe something wrong with code or settings in Visual Studio addin.
-
[quote author="Anticross" date="1352104364"]
Yes, I execute lupdate, then make translation and then execute lrelease. But translation applied not to all files. Maybe something wrong with code or settings in Visual Studio addin.[/quote]Please try to run qmake before running lupdate. And finally run lrelease.
-
[quote author="Anticross" date="1352099322"]I have ts file with translation of many files including @RoutingPhonesModel.h@ file. But translation for this file don't applies. The following code: @ public: QVariant headerData(int section, Qt::Orientation orientation, int role) const {
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
switch(section) {
case ePort: return tr("Port");
case eType: return tr("Type");
case eNote: return tr("Note");
case ePhone: return tr("Phone");
}
return QVariant();
}@
is shown in linguist as translated. But when program executes in this place I see original text w/o translation.[/quote]Might be that you have an inline problem with the translation.
In general, I would never make virtual methods (which means all methods of a model) inline. -
Class RoutingPhonesModel inhreits QAbstractItemModel @class RoutingPhonesModel : public QAbstractItemModel@ And hederData method is realisation. So I don't know how can a make this realization otherwise.
-
Are you sure that the translator is created before the RoutingPhonesModel is created?
-
bq. Are you sure that the translator is created before the RoutingPhonesModel is created?
What do you mean ? I install translator before all application windows created:
@QApplication::setWindowIcon(QPixmap(":/Images/logo.png"));// language choose and apply const Descriptor & descriptor = GET_DOCUMENT(DocOptions).getDescriptor(PROP_GENERAL); DescriptionPtr description = descriptor.value(PROP_LANGUAGE); int langID = description->value(PROP_VALUE).toInt(); Properties props = GET_DOCUMENT(DocLanguages).getLanguageByID(langID); QTranslator local(0); local.load(props.valueS(PROP_LOCAL), "."); QTranslator core(0); core.load(props.valueS(PROP_CORE), "."); a.installTranslator(&core); a.installTranslator(&local); //end MainWindow w; w.show(); w.updateAutorisationUI(); w.start(); return a.exec();
@