KNewStuff
KNS::KTranslatable Class Reference
#include <ktranslatable.h>
Detailed Description
String class with multiple localized representations.KTranslatable is used as a drop-in replacement for QString whenever human-visible information needs to be stored and this information depends on the current language.
Definition at line 43 of file ktranslatable.h.
Public Types | |
typedef QMapIterator< QString, QString > | Iterator |
typedef QMap< QString, QString > | Map |
Public Member Functions | |
void | addString (const QString &lang, const QString &string) |
bool | isEmpty () const |
bool | isTranslated () const |
KTranslatable (const KTranslatable &) | |
KTranslatable (const QString &string) | |
KTranslatable () | |
QString | language () const |
QStringList | languages () const |
KTranslatable & | operator= (const KTranslatable &) |
QString | representation () const |
QMap< QString, QString > | stringmap () const |
QStringList | strings () const |
QString | translated (const QString &lang) const |
~KTranslatable () |
Member Typedef Documentation
Definition at line 47 of file ktranslatable.h.
typedef QMap<QString, QString> KNS::KTranslatable::Map |
Definition at line 46 of file ktranslatable.h.
Constructor & Destructor Documentation
KTranslatable::KTranslatable | ( | ) |
KTranslatable::KTranslatable | ( | const QString & | string | ) |
Constructor.
Initializes the contents with a single string.
Definition at line 55 of file ktranslatable.cpp.
KTranslatable::KTranslatable | ( | const KTranslatable & | other | ) |
Definition at line 35 of file ktranslatable.cpp.
KTranslatable::~KTranslatable | ( | ) |
Definition at line 50 of file ktranslatable.cpp.
Member Function Documentation
Adds a string to the contents of this object.
- Parameters:
-
lang Language code in 'xx_XX' format string The string to be stored for this language
Definition at line 61 of file ktranslatable.cpp.
bool KTranslatable::isEmpty | ( | ) | const |
Returns whether no content is set yet.
- Returns:
- true if no content has been added yet, false otherwise
Definition at line 118 of file ktranslatable.cpp.
bool KTranslatable::isTranslated | ( | ) | const |
Returns whether the content provides alternative (translated) strings.
- Returns:
- true if contents are translated, false otherwise
Definition at line 113 of file ktranslatable.cpp.
QString KTranslatable::language | ( | ) | const |
Returns the language which most likely resembles the current language.
- Returns:
- Current language, or one close to it
Definition at line 79 of file ktranslatable.cpp.
QStringList KTranslatable::languages | ( | ) | const |
Returns the list of all languages for which strings are stored.
- Returns:
- All languages the content is available for
Definition at line 98 of file ktranslatable.cpp.
KTranslatable & KTranslatable::operator= | ( | const KTranslatable & | other | ) |
Definition at line 41 of file ktranslatable.cpp.
QString KTranslatable::representation | ( | ) | const |
Returns the string which matches most closely the current language.
- Returns:
- Contents for the current language
Definition at line 66 of file ktranslatable.cpp.
Returns a map of all languages and their strings.
- Returns:
- Map of all languages as keys and all strings as values
Definition at line 108 of file ktranslatable.cpp.
QStringList KTranslatable::strings | ( | ) | const |
Returns the list of all strings stored for all languages.
- Returns:
- All strings stored in this object
Definition at line 103 of file ktranslatable.cpp.
Returns the string which matches most closely the specified language.
- Parameters:
-
lang Language the contents should appear in, in 'xx_XX' format
- Returns:
- Contents for the specified language
Definition at line 91 of file ktranslatable.cpp.
The documentation for this class was generated from the following files: