aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/qml/qqmlcompiler.cpp5
-rw-r--r--src/qml/qml/qqmlinstruction.cpp2
-rw-r--r--src/qml/qml/qqmlinstruction_p.h10
-rw-r--r--src/qml/qml/qqmlvme.cpp2
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp3
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions_p.h2
-rw-r--r--src/qml/qml/v8/qv8engine.cpp2
-rw-r--r--src/qmltest/quicktest.cpp2
-rw-r--r--tools/qmlscene/main.cpp8
9 files changed, 32 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp
index cdbdb1e059..0b22228034 100644
--- a/src/qml/qml/qqmlcompiler.cpp
+++ b/src/qml/qml/qqmlcompiler.cpp
@@ -3524,6 +3524,7 @@ void QQmlCompiler::genBindingAssignment(QQmlScript::Value *binding,
Q_ASSERT(binding->bindingReference);
const BindingReference &ref = *binding->bindingReference;
+#ifndef QT_NO_TRANSLATION
if (ref.dataType == BindingReference::TrId) {
const TrBindingReference &tr = static_cast<const TrBindingReference &>(ref);
@@ -3542,7 +3543,9 @@ void QQmlCompiler::genBindingAssignment(QQmlScript::Value *binding,
store.comment = output->indexForByteArray(tr.comment.toUtf8());
store.n = tr.n;
output->addInstruction(store);
- } else if (ref.dataType == BindingReference::V4) {
+ } else
+#endif
+ if (ref.dataType == BindingReference::V4) {
const JSBindingReference &js = static_cast<const JSBindingReference &>(ref);
Instruction::StoreV4Binding store;
diff --git a/src/qml/qml/qqmlinstruction.cpp b/src/qml/qml/qqmlinstruction.cpp
index 50ebbaacda..96d12cfc52 100644
--- a/src/qml/qml/qqmlinstruction.cpp
+++ b/src/qml/qml/qqmlinstruction.cpp
@@ -117,12 +117,14 @@ void QQmlCompiledData::dump(QQmlInstruction *instr, int idx)
case QQmlInstruction::StoreStringQList:
qWarning().nospace() << idx << "\t\t" << "STORE_STRING_QLIST\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
break;
+#ifndef QT_NO_TRANSLATION
case QQmlInstruction::StoreTrString:
qWarning().nospace() << idx << "\t\t" << "STORE_TR_STRING\t" << instr->storeTrString.propertyIndex << "\t" << instr->storeTrString.context << "\t" << instr->storeTrString.text << "\t" << instr->storeTrString.comment << "\t" << instr->storeTrString.n;
break;
case QQmlInstruction::StoreTrIdString:
qWarning().nospace() << idx << "\t\t" << "STORE_TRID_STRING\t" << instr->storeTrIdString.propertyIndex << "\t" << instr->storeTrIdString.text << "\t" << instr->storeTrIdString.n;
break;
+#endif
case QQmlInstruction::StoreByteArray:
qWarning().nospace() << idx << "\t\t" << "STORE_BYTEARRAY" << instr->storeByteArray.propertyIndex << "\t" << instr->storeByteArray.value << "\t\t" << datas.at(instr->storeByteArray.value);
break;
diff --git a/src/qml/qml/qqmlinstruction_p.h b/src/qml/qml/qqmlinstruction_p.h
index 6c1e4ab298..62ed0d53d5 100644
--- a/src/qml/qml/qqmlinstruction_p.h
+++ b/src/qml/qml/qqmlinstruction_p.h
@@ -85,8 +85,8 @@ QT_BEGIN_NAMESPACE
F(StoreJSValueBool, storeBool) \
F(StoreStringList, storeString) \
F(StoreStringQList, storeString) \
- F(StoreTrString, storeTrString) \
- F(StoreTrIdString, storeTrIdString) \
+ F_TRANSLATION(F, StoreTrString, storeTrString) \
+ F_TRANSLATION(F, StoreTrIdString, storeTrIdString) \
F(StoreByteArray, storeByteArray) \
F(StoreUrl, storeUrl) \
F(StoreUrlQList, storeUrl) \
@@ -136,6 +136,12 @@ QT_BEGIN_NAMESPACE
F(FetchValueType, fetchValue) \
F(PopValueType, fetchValue)
+#ifndef QT_NO_TRANSLATION
+#define F_TRANSLATION(F, I, FMT) F(I, FMT)
+#else
+#define F_TRANSLATION(F, I, FMT)
+#endif
+
#if defined(Q_CC_GNU) && (!defined(Q_CC_INTEL) || __INTEL_COMPILER >= 1200)
# define QML_THREADED_VME_INTERPRETER
#endif
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index 3ad442fb36..da918c3c71 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -396,12 +396,14 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_STORE_POINTER(StoreString, &PRIMITIVES.at(instr.value));
QML_STORE_POINTER(StoreByteArray, &DATAS.at(instr.value));
QML_STORE_POINTER(StoreUrl, &URLS.at(instr.value));
+#ifndef QT_NO_TRANSLATION
QML_STORE_VALUE(StoreTrString, QString,
QCoreApplication::translate(DATAS.at(instr.context).constData(),
DATAS.at(instr.text).constData(),
DATAS.at(instr.comment).constData(),
instr.n));
QML_STORE_VALUE(StoreTrIdString, QString, qtTrId(DATAS.at(instr.text).constData(), instr.n));
+#endif
// Store a literal value in a QList
QML_STORE_LIST(StoreStringList, QStringList, PRIMITIVES.at(instr.value));
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index c4352de9e9..8e8e320724 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -1328,6 +1328,7 @@ v8::Handle<v8::Value> createComponent(const v8::Arguments &args)
return v8engine->newQObject(c);
}
+#ifndef QT_NO_TRANSLATION
/*!
\qmlmethod string qsTranslate(string context, string sourceText, string disambiguation, int n)
@@ -1556,7 +1557,7 @@ v8::Handle<v8::Value> qsTrIdNoOp(const v8::Arguments &args)
return v8::Undefined();
return args[0];
}
-
+#endif // QT_NO_TRANSLATION
/*!
\qmlmethod Qt::locale(name)
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
index 08e7d4fd75..de171bb901 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
@@ -100,12 +100,14 @@ v8::Handle<v8::Value> quit(const v8::Arguments &args);
v8::Handle<v8::Value> resolvedUrl(const v8::Arguments &args);
v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args);
v8::Handle<v8::Value> createComponent(const v8::Arguments &args);
+#ifndef QT_NO_TRANSLATION
v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args);
v8::Handle<v8::Value> qsTranslateNoOp(const v8::Arguments &args);
v8::Handle<v8::Value> qsTr(const v8::Arguments &args);
v8::Handle<v8::Value> qsTrNoOp(const v8::Arguments &args);
v8::Handle<v8::Value> qsTrId(const v8::Arguments &args);
v8::Handle<v8::Value> qsTrIdNoOp(const v8::Arguments &args);
+#endif
v8::Handle<v8::Value> stringArg(const v8::Arguments &args);
v8::Handle<v8::Value> locale(const v8::Arguments &args);
v8::Handle<v8::Value> binding(const v8::Arguments &args);
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index 19aea297d3..030cfda484 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -640,12 +640,14 @@ void QV8Engine::initializeGlobal(v8::Handle<v8::Object> global)
qt->Set(v8::String::New("createComponent"), V8FUNCTION(createComponent, this));
}
+#ifndef QT_NO_TRANSLATION
global->Set(v8::String::New("qsTranslate"), V8FUNCTION(qsTranslate, this));
global->Set(v8::String::New("QT_TRANSLATE_NOOP"), V8FUNCTION(qsTranslateNoOp, this));
global->Set(v8::String::New("qsTr"), V8FUNCTION(qsTr, this));
global->Set(v8::String::New("QT_TR_NOOP"), V8FUNCTION(qsTrNoOp, this));
global->Set(v8::String::New("qsTrId"), V8FUNCTION(qsTrId, this));
global->Set(v8::String::New("QT_TRID_NOOP"), V8FUNCTION(qsTrIdNoOp, this));
+#endif
global->Set(v8::String::New("print"), consoleLogFn);
global->Set(v8::String::New("console"), console);
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 614dde3f6c..6a96395794 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -212,6 +212,7 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
QuickTestResult::parseArgs(argc, argv);
+#ifndef QT_NO_TRANSLATION
QTranslator translator;
if (!translationFile.isEmpty()) {
if (translator.load(translationFile)) {
@@ -220,6 +221,7 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
qWarning("Could not load the translation file '%s'.", qPrintable(translationFile));
}
}
+#endif
// Determine where to look for the test data.
if (testPath.isEmpty() && sourceDir) {
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index cee09e08a5..32bf32edd8 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -305,11 +305,13 @@ static void displayFileDialog(Options *options)
#endif
}
+#ifndef QT_NO_TRANSLATION
static void loadTranslationFile(QTranslator &translator, const QString& directory)
{
translator.load(QLatin1String("qml_" )+QLocale::system().name(), directory + QLatin1String("/i18n"));
QCoreApplication::installTranslator(&translator);
}
+#endif
static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory)
{
@@ -412,6 +414,7 @@ int main(int argc, char ** argv)
app.setOrganizationName("Qt Project");
app.setOrganizationDomain("qt-project.org");
+#ifndef QT_NO_TRANSLATION
QTranslator translator;
QTranslator qtTranslator;
QString sysLocale = QLocale::system().name();
@@ -432,6 +435,7 @@ int main(int argc, char ** argv)
qWarning() << "Could not load the translation file" << options.translationFile;
}
}
+#endif
QUnifiedTimer::instance()->setSlowModeEnabled(options.slowAnimations);
@@ -446,7 +450,9 @@ int main(int argc, char ** argv)
if (!options.file.isEmpty()) {
if (!options.versionDetection || checkVersion(options.file)) {
+#ifndef QT_NO_TRANSLATION
QTranslator translator;
+#endif
// TODO: as soon as the engine construction completes, the debug service is
// listening for connections. But actually we aren't ready to debug anything.
@@ -458,7 +464,9 @@ int main(int argc, char ** argv)
engine.addNamedBundle(bundles.at(i).first, bundles.at(i).second);
if (options.file.isLocalFile()) {
QFileInfo fi(options.file.toLocalFile());
+#ifndef QT_NO_TRANSLATION
loadTranslationFile(translator, fi.path());
+#endif
loadDummyDataFiles(engine, fi.path());
}
QObject::connect(&engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));