diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-12-10 04:21:25 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-12-10 04:29:00 (GMT) |
commit | 94d45cc06dabb8b1f8fc98e9f9b3dfaf49d0c4d7 (patch) | |
tree | 669201482949e4869b5d39e5d9e8e1f27e87a7f9 /src/script | |
parent | dd0ecf2c9abab285e14a398b3f901fbc69d48db1 (diff) | |
download | Qt-94d45cc06dabb8b1f8fc98e9f9b3dfaf49d0c4d7.zip Qt-94d45cc06dabb8b1f8fc98e9f9b3dfaf49d0c4d7.tar.gz Qt-94d45cc06dabb8b1f8fc98e9f9b3dfaf49d0c4d7.tar.bz2 |
Fix translation context for qsTr.
Use the base of the file name as the translation context. (This was
the original behavior before the switch to JSC.)
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index b6aa872..1879367 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -33,6 +33,7 @@ #include "qscriptvalue_p.h" #include "qscriptvalueiterator.h" #include "qscriptclass.h" +#include "qscriptcontextinfo.h" #include "qscriptprogram.h" #include "qscriptprogram_p.h" #include "qdebug.h" @@ -698,9 +699,9 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): third argument (n) must be a number"); #ifndef QT_NO_QOBJECT QString context; -// ### implement context resolution -// if (ctx->parentContext()) -// context = QFileInfo(ctx->parentContext()->fileName()).baseName(); + QScriptContext *ctx = QScriptEnginePrivate::contextForFrame(exec); + if (ctx && ctx->parentContext()) + context = QFileInfo(QScriptContextInfo(ctx->parentContext()).fileName()).baseName(); #endif QString text(args.at(0).toString(exec)); #ifndef QT_NO_QOBJECT |