• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KNewStuff

  • KNS
  • KTranslatable
Public Types | Public Member Functions | List of all members
KNS::KTranslatable Class Reference

#include <ktranslatable.h>

Public Types

typedef QMapIterator< QString,
QString > 
Iterator
 
typedef QMap< QString, QString > Map
 

Public Member Functions

 KTranslatable ()
 
 KTranslatable (const QString &string)
 
 KTranslatable (const KTranslatable &)
 
 ~KTranslatable ()
 
void addString (const QString &lang, const QString &string)
 
bool isEmpty () const
 
bool isTranslated () const
 
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
 

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.

Author
Josef Spillner (spill.nosp@m.ner@.nosp@m.kde.o.nosp@m.rg)

Definition at line 41 of file ktranslatable.h.

Member Typedef Documentation

typedef QMapIterator<QString, QString> KNS::KTranslatable::Iterator

Definition at line 45 of file ktranslatable.h.

typedef QMap<QString, QString> KNS::KTranslatable::Map

Definition at line 44 of file ktranslatable.h.

Constructor & Destructor Documentation

KTranslatable::KTranslatable ( )

Constructor.

Definition at line 28 of file ktranslatable.cpp.

KTranslatable::KTranslatable ( const QString &  string)

Constructor.

Initializes the contents with a single string.

Definition at line 53 of file ktranslatable.cpp.

KTranslatable::KTranslatable ( const KTranslatable &  other)

Definition at line 33 of file ktranslatable.cpp.

KTranslatable::~KTranslatable ( )

Definition at line 48 of file ktranslatable.cpp.

Member Function Documentation

void KTranslatable::addString ( const QString &  lang,
const QString &  string 
)

Adds a string to the contents of this object.

Parameters
langLanguage code in 'xx_XX' format
stringThe string to be stored for this language

Definition at line 59 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 116 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 111 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 77 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 96 of file ktranslatable.cpp.

KTranslatable & KTranslatable::operator= ( const KTranslatable &  other)

Definition at line 39 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 64 of file ktranslatable.cpp.

QMap< QString, QString > KTranslatable::stringmap ( ) const

Returns a map of all languages and their strings.

Returns
Map of all languages as keys and all strings as values

Definition at line 106 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 101 of file ktranslatable.cpp.

QString KTranslatable::translated ( const QString &  lang) const

Returns the string which matches most closely the specified language.

Parameters
langLanguage the contents should appear in, in 'xx_XX' format
Returns
Contents for the specified language

Definition at line 89 of file ktranslatable.cpp.


The documentation for this class was generated from the following files:
  • ktranslatable.h
  • ktranslatable.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:44 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KNewStuff

Skip menu "KNewStuff"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal