The QTranslator class provides internationalization support for text output. More...
#include <qtranslator.h>
Inherits QObject.
The class is conceptually very simple: An object of this class contains a set of translations from the reference language to a target language, and provides functions to add, look up and remove such translations as well as the ability to load and save the object to a file.
The most common use of QTranslator is expected to be loading one from a file, installing it using QApplication::installTranslator(), and using it via QObject::tr().
Slightly more advanced usage of QTranslator includes direct lookup using find(), adding new translations using insert() and removing existing ones using remove() or even clear(), and testing whether the QTranslator contains a translation using contains().
The hash() function mentioned is a variant on the standard ELF hash, modified to work well with Unicode strings in UCS-2 format. Its algorithm is not specified beyond the fact that it will remain unchanged in future versions of Qt.
To examine the contents of a QTranslator, use QTranslatorIterator.
See also: QTranslatorIterator, QApplication::installTranslator, QApplication::removeTranslator(), QObject::tr() and QApplication::translate().
Examples: i18n/main.cpp
Constructs an empty message file, not connected to any file.
Destroys the object and frees any allocated resources.
Empties this translator of all contents.
Returns TRUE if this message file contains a message with hash value h, and FALSE if it does not.
(This is is a one-liner that calls find().).
[virtual]
Returns the translation for (scope, key), or QString::null in case there is none in this translator.
Inserts translation of message into this message file.
Loads filename, which may be an absolute file name or relative to directory. If the full filename does not exist, other filenames are tried in the following order:
Examples: i18n/main.cpp
Removes the string for h from this message file. If there is no string for h, this function does nothing.
Converts this message file to the compact format used to store message files on disk. You should never need to call this directly; save() and other functions call it as necessary.
Converts this message file into an easily modifiable data structure, less compact than the format used in the files.
You should never need to call this function; it is called by insert() etc. as necessary.
See also: squeeze().
Search the documentation, FAQ, qt-interest archive and more (uses
www.troll.no):
This file is part of the Qt toolkit, copyright © 1995-99 Troll Tech, all rights reserved.
Copyright İ 1999 Troll Tech | Trademarks | Qt version 2.0.2
|