| 1 |
// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected], author Stephen Kelly <[email protected]> |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#ifndef MYOBJECT_H |
| 30 |
#define MYOBJECT_H |
| 31 |
|
| 32 |
#include <QtCore> |
| 33 |
|
| 34 |
const char *c_1 = QT_TRANSLATE_NOOP("scope", "string"); |
| 35 |
const char *c_2 = QT_TRANSLATE_NOOP_ALIAS("scope", "string_alias"); |
| 36 |
const char *c_3 = QT_TRANSLATE_NOOP_UTF8("scope", "utf8_string"); |
| 37 |
const char *c_4 = QT_TRANSLATE_NOOP_UTF8_ALIAS("scope", "utf8_string_alias"); |
| 38 |
const char *c_5[2] = QT_TRANSLATE_NOOP3("scope", "string_with_comment", "comment"); |
| 39 |
const char *c_6[2] = QT_TRANSLATE_NOOP3_ALIAS("scope", "string_with_comment_alias", "comment"); |
| 40 |
const char *c_7[2] = QT_TRANSLATE_NOOP3_UTF8("scope", "utf8_string_with_comment", "comment"); |
| 41 |
const char *c_8[2] = QT_TRANSLATE_NOOP3_UTF8_ALIAS("scope", "utf8_string_with_comment_alias", "comment"); |
| 42 |
const char *c_9 = QT_TRID_NOOP("this_a_id"); |
| 43 |
const char *c_10 = QT_TRID_NOOP_ALIAS("this_a_id_alias"); |
| 44 |
QString test = qtTrId("yet_another_id"); |
| 45 |
QString test_alias = qtTrId_alias("yet_another_id_alias"); |
| 46 |
|
| 47 |
class Bogus : QObject { |
| 48 |
Q_OBJECT |
| 49 |
|
| 50 |
static const char * const s_strings[]; |
| 51 |
}; |
| 52 |
|
| 53 |
const char * const Bogus::s_strings[] = { |
| 54 |
QT_TR_NOOP("this should be in Bogus"), |
| 55 |
QT_TR_NOOP_ALIAS("this should be in Bogus Alias"), |
| 56 |
QT_TR_NOOP_UTF8("this should be utf8 in Bogus"), |
| 57 |
QT_TR_NOOP_UTF8_ALIAS("this should be utf8 in Bogus Alias") |
| 58 |
}; |
| 59 |
|
| 60 |
class MyObject : public QObject |
| 61 |
{ |
| 62 |
Q_OBJECT |
| 63 |
explicit MyObject(QObject *parent = 0) |
| 64 |
{ |
| 65 |
tr("Boo", "nsF::D"); |
| 66 |
tr_alias("Boo_alias", "nsB::C"); |
| 67 |
tr("utf8_Boo", "nsF::D"); // trUtf8 is now obsolete |
| 68 |
trUtf8_alias("utf8_Boo_alias", "nsF::D"); |
| 69 |
QCoreApplication::translate("QTranslator", "Simple"); |
| 70 |
translate_alias("QTranslator", "Simple with comment alias", "with comment"); |
| 71 |
} |
| 72 |
}; |
| 73 |
|
| 74 |
struct NonQObject |
| 75 |
{ |
| 76 |
Q_DECLARE_TR_FUNCTIONS_ALIAS(NonQObject) |
| 77 |
|
| 78 |
NonQObject() |
| 79 |
{ |
| 80 |
tr("NonQObject_Boo", "nsF::NonQObject_D"); |
| 81 |
tr_alias("NonQObject_Boo_alias", "nsB::NonQObject_C"); |
| 82 |
tr("utf_NonQObject_Boo", "nsF::D"); |
| 83 |
trUtf8_alias("utf8_NonQObject_Boo_alias", "nsF::D"); |
| 84 |
QCoreApplication::translate("NonQObject_QTranslator", "Simple"); |
| 85 |
translate_alias("NonQObject_QTranslator", "Simple with comment alias", "with comment"); |
| 86 |
} |
| 87 |
}; |
| 88 |
|
| 89 |
#endif |