diff options
author | Lucie Gérard <lucie.gerard@qt.io> | 2023-10-10 15:33:48 +0200 |
---|---|---|
committer | Lucie Gérard <lucie.gerard@qt.io> | 2023-10-26 14:12:00 +0200 |
commit | d6e0d5630a49e9614a70bf960a213b3eff03a68e (patch) | |
tree | 1ecb2d4a5064328dfd4d55c27cdf87709470cef1 /src/qml/common | |
parent | 9187e07d36db8c262b51ba7d1ce35615b31ee918 (diff) |
Add pragma syntax to support translation context
Translator pragma can be used to set the translation context
instead of having the file name used
[ChangeLog][qml][translation][Important Behavior Changes] The context
for the translation can now be controled in a given file
using pragma Translator.
Task-number: QTBUG-114528
Change-Id: I6d9d7fb81ea969a90d8637d7277bdbe96c102088
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/common')
-rw-r--r-- | src/qml/common/qv4compileddata_p.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h index be7dac9f34..1a97ddc5a5 100644 --- a/src/qml/common/qv4compileddata_p.h +++ b/src/qml/common/qv4compileddata_p.h @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE // Also change the comment behind the number to describe the latest change. This has the added // benefit that if another patch changes the version too, it will result in a merge conflict, and // not get removed silently. -#define QV4_DATA_STRUCTURE_VERSION 0x3D // Reserve special value for "no translation context" +#define QV4_DATA_STRUCTURE_VERSION 0x3E // Add Translator pragma class QIODevice; class QQmlTypeNameCache; @@ -1331,6 +1331,20 @@ struct Unit return reinterpret_cast<const TranslationData *>(reinterpret_cast<const char *>(this) + offsetToTranslationTable); } + const quint32_le *translationContextIndex() const{ + if ( translationTableSize == 0) + return nullptr; + return reinterpret_cast<const quint32_le*>((reinterpret_cast<const char *>(this)) + + offsetToTranslationTable + + translationTableSize * sizeof(CompiledData::TranslationData)); } + + quint32_le *translationContextIndex() { + if ( translationTableSize == 0) + return nullptr; + return reinterpret_cast<quint32_le*>((reinterpret_cast<char *>(this)) + + offsetToTranslationTable + + translationTableSize * sizeof(CompiledData::TranslationData)); } + const ImportEntry *importEntryTable() const { return reinterpret_cast<const ImportEntry *>(reinterpret_cast<const char *>(this) + offsetToImportEntryTable); } const ExportEntry *localExportEntryTable() const { return reinterpret_cast<const ExportEntry *>(reinterpret_cast<const char *>(this) + offsetToLocalExportEntryTable); } const ExportEntry *indirectExportEntryTable() const { return reinterpret_cast<const ExportEntry *>(reinterpret_cast<const char *>(this) + offsetToIndirectExportEntryTable); } |