1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5 \macro QT_TR_NOOP(sourceText)
6 \relates <QtTranslation>
8 Marks the UTF-8 encoded string literal \a sourceText for delayed
9 translation in the current context (class).
11 The macro tells lupdate to collect the string, and expands to
16 \snippet code/src_corelib_global_qglobal.cpp 34
18 The macro QT_TR_NOOP_UTF8() is identical and obsolete; this applies
19 to all other _UTF8 macros as well.
21 \sa QT_TRANSLATE_NOOP(), {Internationalization with Qt}
25 \macro QT_TRANSLATE_NOOP(context, sourceText)
26 \relates <QtTranslation>
28 Marks the UTF-8 encoded string literal \a sourceText for delayed
29 translation in the given \a context. The \a context is typically
30 a class name and also needs to be specified as a string literal.
32 The macro tells lupdate to collect the string, and expands to
37 \snippet code/src_corelib_global_qglobal.cpp 35
39 \sa QT_TR_NOOP(), QT_TRANSLATE_NOOP3(), {Internationalization with Qt}
43 \macro QT_TRANSLATE_NOOP3(context, sourceText, disambiguation)
44 \relates <QtTranslation>
47 Marks the UTF-8 encoded string literal \a sourceText for delayed
48 translation in the given \a context with the given \a disambiguation.
49 The \a context is typically a class and also needs to be specified
50 as a string literal. The string literal \a disambiguation should be
51 a short semantic tag to tell apart otherwise identical strings.
53 The macro tells lupdate to collect the string, and expands to an
54 anonymous struct of the two string literals passed as \a sourceText
55 and \a disambiguation.
59 \snippet code/src_corelib_global_qglobal.cpp 36
61 \sa QT_TR_NOOP(), QT_TRANSLATE_NOOP(), {Internationalization with Qt}
65 \macro QT_TR_N_NOOP(sourceText)
66 \relates <QtTranslation>
69 Marks the UTF-8 encoded string literal \a sourceText for numerator
70 dependent delayed translation in the current context (class).
72 The macro tells lupdate to collect the string, and expands to
75 The macro expands to \a sourceText.
79 \snippet code/src_corelib_global_qglobal.cpp qttrnnoop
81 \sa QT_TR_NOOP, {Internationalization with Qt}
85 \macro QT_TRANSLATE_N_NOOP(context, sourceText)
86 \relates <QtTranslation>
89 Marks the UTF-8 encoded string literal \a sourceText for numerator
90 dependent delayed translation in the given \a context.
91 The \a context is typically a class name and also needs to be
92 specified as a string literal.
94 The macro tells lupdate to collect the string, and expands to
99 \snippet code/src_corelib_global_qglobal.cpp qttranslatennoop
101 \sa QT_TRANSLATE_NOOP(), QT_TRANSLATE_N_NOOP3(),
102 {Internationalization with Qt}
106 \macro QT_TRANSLATE_N_NOOP3(context, sourceText, comment)
107 \relates <QtTranslation>
110 Marks the UTF-8 encoded string literal \a sourceText for numerator
111 dependent delayed translation in the given \a context with the given
113 The \a context is typically a class and also needs to be specified
114 as a string literal. The string literal \a comment should be
115 a short semantic tag to tell apart otherwise identical strings.
117 The macro tells lupdate to collect the string, and expands to an
118 anonymous struct of the two string literals passed as \a sourceText
123 \snippet code/src_corelib_global_qglobal.cpp qttranslatennoop3
125 \sa QT_TR_NOOP(), QT_TRANSLATE_NOOP(), QT_TRANSLATE_NOOP3(),
126 {Internationalization with Qt}
130 \fn QString qtTrId(const char *id, int n = -1)
131 \relates <QtTranslation>
135 \brief The qtTrId function finds and returns a translated string.
137 Returns a translated string identified by \a id.
138 If no matching string is found, the id itself is returned. This
139 should not happen under normal conditions.
141 If \a n >= 0, all occurrences of \c %n in the resulting string
142 are replaced with a decimal representation of \a n. In addition,
143 depending on \a n's value, the translation text may vary.
145 Meta data and comments can be passed as documented for QObject::tr().
146 In addition, it is possible to supply a source string template like that:
152 \tt{\\begincomment% <C string> \\endcomment}
156 \snippet code/src_corelib_global_qglobal.cpp qttrid
158 Creating QM files suitable for use with this function requires passing
159 the \c -idbased option to the \c lrelease tool.
161 \warning This method is reentrant only if all translators are
162 installed \e before calling this method. Installing or removing
163 translators while performing translations is not supported. Doing
164 so will probably result in crashes or other undesirable behavior.
166 \sa QObject::tr(), QCoreApplication::translate(), {Internationalization with Qt}
170 \macro QT_TRID_NOOP(id)
171 \relates <QtTranslation>
174 \brief The QT_TRID_NOOP macro marks an id for dynamic translation.
176 The only purpose of this macro is to provide an anchor for attaching
177 meta data like to qtTrId().
179 The macro expands to \a id.
183 \snippet code/src_corelib_global_qglobal.cpp qttrid_noop
185 \sa qtTrId(), {Internationalization with Qt}
189 \macro QT_TRID_N_NOOP(id)
190 \relates <QtTranslation>
193 \brief The QT_TRID_N_NOOP macro marks an id for numerator
194 dependent dynamic translation.
196 The only purpose of this macro is to provide an anchor for attaching
197 meta data like to qtTrId().
199 The macro expands to \a id.
203 \snippet code/src_corelib_global_qglobal.cpp qttrid_n_noop
205 \sa qtTrId(), {Internationalization with Qt}