summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qttranslation.qdoc
blob: b2b0b1f3c3c26f0abae06fe13b65f464955b6fe4 (plain)
1
2
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \macro QT_TR_NOOP(sourceText)
    \relates <QtTranslation>

    Marks the UTF-8 encoded string literal \a sourceText for delayed
    translation in the current context (class).

    The macro tells lupdate to collect the string, and expands to
    \a sourceText itself.

    Example:

    \snippet code/src_corelib_global_qglobal.cpp 34

    The macro QT_TR_NOOP_UTF8() is identical and obsolete; this applies
    to all other _UTF8 macros as well.

    \sa QT_TRANSLATE_NOOP(), {Internationalization with Qt}
*/

/*!
    \macro QT_TRANSLATE_NOOP(context, sourceText)
    \relates <QtTranslation>

    Marks the UTF-8 encoded string literal \a sourceText for delayed
    translation in the given \a context. The \a context is typically
    a class name and also needs to be specified as a string literal.

    The macro tells lupdate to collect the string, and expands to
    \a sourceText itself.

    Example:

    \snippet code/src_corelib_global_qglobal.cpp 35

    \sa QT_TR_NOOP(), QT_TRANSLATE_NOOP3(), {Internationalization with Qt}
*/

/*!
    \macro QT_TRANSLATE_NOOP3(context, sourceText, disambiguation)
    \relates <QtTranslation>
    \since 4.4

    Marks the UTF-8 encoded string literal \a sourceText for delayed
    translation in the given \a context with the given \a disambiguation.
    The \a context is typically a class and also needs to be specified
    as a string literal. The string literal \a disambiguation should be
    a short semantic tag to tell apart otherwise identical strings.

    The macro tells lupdate to collect the string, and expands to an
    anonymous struct of the two string literals passed as \a sourceText
    and \a disambiguation.

    Example:

    \snippet code/src_corelib_global_qglobal.cpp 36

    \sa QT_TR_NOOP(), QT_TRANSLATE_NOOP(), {Internationalization with Qt}
*/

/*!
    \macro QT_TR_N_NOOP(sourceText)
    \relates <QtTranslation>
    \since 5.12

    Marks the UTF-8 encoded string literal \a sourceText for numerator
    dependent delayed translation in the current context (class).

    The macro tells lupdate to collect the string, and expands to
    \a sourceText itself.

    The macro expands to \a sourceText.

    Example:

    \snippet code/src_corelib_global_qglobal.cpp qttrnnoop

    \sa QT_TR_NOOP, {Internationalization with Qt}
*/

/*!
    \macro QT_TRANSLATE_N_NOOP(context, sourceText)
    \relates <QtTranslation>
    \since 5.12

    Marks the UTF-8 encoded string literal \a sourceText for numerator
    dependent delayed translation in the given \a context.
    The \a context is typically a class name and also needs to be
    specified as a string literal.

    The macro tells lupdate to collect the string, and expands to
    \a sourceText itself.

    Example:

    \snippet code/src_corelib_global_qglobal.cpp qttranslatennoop

    \sa QT_TRANSLATE_NOOP(), QT_TRANSLATE_N_NOOP3(),
    {Internationalization with Qt}
*/

/*!
    \macro QT_TRANSLATE_N_NOOP3(context, sourceText, comment)
    \relates <QtTranslation>
    \since 5.12

    Marks the UTF-8 encoded string literal \a sourceText for numerator
    dependent delayed translation in the given \a context with the given
    \a comment.
    The \a context is typically a class and also needs to be specified
    as a string literal. The string literal \a comment should be
    a short semantic tag to tell apart otherwise identical strings.

    The macro tells lupdate to collect the string, and expands to an
    anonymous struct of the two string literals passed as \a sourceText
    and \a comment.

    Example:

    \snippet code/src_corelib_global_qglobal.cpp qttranslatennoop3

    \sa QT_TR_NOOP(), QT_TRANSLATE_NOOP(), QT_TRANSLATE_NOOP3(),
    {Internationalization with Qt}
*/

/*!
    \fn QString qtTrId(const char *id, int n = -1)
    \relates <QtTranslation>
    \reentrant
    \since 4.6

    \brief The qtTrId function finds and returns a translated string.

    Returns a translated string identified by \a id.
    If no matching string is found, the id itself is returned. This
    should not happen under normal conditions.

    If \a n >= 0, all occurrences of \c %n in the resulting string
    are replaced with a decimal representation of \a n. In addition,
    depending on \a n's value, the translation text may vary.

    Meta data and comments can be passed as documented for QObject::tr().
    In addition, it is possible to supply a source string template like that:

    \tt{//% <C string>}

    or

    \tt{\\begincomment% <C string> \\endcomment}

    Example:

    \snippet code/src_corelib_global_qglobal.cpp qttrid

    Creating QM files suitable for use with this function requires passing
    the \c -idbased option to the \c lrelease tool.

    \warning This method is reentrant only if all translators are
    installed \e before calling this method. Installing or removing
    translators while performing translations is not supported. Doing
    so will probably result in crashes or other undesirable behavior.

    \sa QObject::tr(), QCoreApplication::translate(), {Internationalization with Qt}
*/

/*!
    \macro QT_TRID_NOOP(id)
    \relates <QtTranslation>
    \since 4.6

    \brief The QT_TRID_NOOP macro marks an id for dynamic translation.

    The only purpose of this macro is to provide an anchor for attaching
    meta data like to qtTrId().

    The macro expands to \a id.

    Example:

    \snippet code/src_corelib_global_qglobal.cpp qttrid_noop

    \sa qtTrId(), {Internationalization with Qt}
*/

/*!
    \macro QT_TRID_N_NOOP(id)
    \relates <QtTranslation>
    \since 6.3

    \brief The QT_TRID_N_NOOP macro marks an id for numerator
    dependent dynamic translation.

    The only purpose of this macro is to provide an anchor for attaching
    meta data like to qtTrId().

    The macro expands to \a id.

    Example:

    \snippet code/src_corelib_global_qglobal.cpp qttrid_n_noop

    \sa qtTrId(), {Internationalization with Qt}
*/