# class KTranslatable

###

Module | knewstuff
Namespace | KNS
Class | KTranslatable
Inherits |

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 (spillner@kde.org)

### methods

- KTranslatable ( )

  returns ctor

  Constructor.

- KTranslatable (string)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  string | QString |

  Constructor. Initializes the contents with a single string.

- KTranslatable (a0)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  a0 | KNS.KTranslatable |

- addString (lang, string)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  lang | QString |
  string | QString |

  Adds a string to the contents of this object.

  lang - Language code in 'xx_XX' format

  string - The string to be stored for this language

- isEmpty ( )

  returns bool

  Returns whether no content is set yet

  Returns true if no content has been added yet, false otherwise

- isTranslated ( )

  returns bool

  Returns whether the content provides alternative (translated) strings.

  Returns true if contents are translated, false otherwise

- language ( )

  returns QString

  Returns the language which most likely resembles the current language.

  Returns Current language, or one close to it

- languages ( )

  returns QStringList

  Returns the list of all languages for which strings are stored.

  Returns All languages the content is available for

- representation ( )

  returns QString

  Returns the string which matches most closely the current language.

  Returns Contents for the current language

- stringmap ( )

  returns QMap<QString,QString>

  Returns a map of all languages and their strings.

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

- strings ( )

  returns QStringList

  Returns the list of all strings stored for all languages.

  Returns All strings stored in this object

- translated (lang)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  lang | QString |

  Returns the string which matches most closely the specified language.

  lang - Language the contents should appear in, in 'xx_XX' format Returns Contents for the specified language