Function qt_core::qt_tr_id_2a

source ·
pub unsafe fn qt_tr_id_2a(id: *const c_char, n: c_int) -> CppBox<QString>
Expand description

The qtTrId function finds and returns a translated string.

Calls C++ function: QString qtTrId(const char* id, int n = …).

C++ documentation:

The qtTrId function finds and returns a translated string.

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

If n >= 0, all occurrences of %n in the resulting string are replaced with a decimal representation of n. In addition, depending on 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:

//% <C string>

or

\begincomment% <C string> \endcomment

Example:

//% “%n fooish bar(s) found.\n” //% “Do you want to continue?” QString text = qtTrId(“qtn_foo_bar”, n);

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

Warning: This method is reentrant only if all translators are installed 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.

Note: This function is reentrant.

This function was introduced in Qt 4.6.

See also QObject::tr(), QCoreApplication::translate(), and Internationalization with Qt.