Stellarium 0.11.3
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

StelTranslator Class Reference

Class used to translate strings to any language. More...

#include <StelTranslator.hpp>

List of all members.

Public Member Functions

 StelTranslator (const QString &adomain, const QString &amoDirectory, const QString &alangName)
QString qtranslate (const QString &s)
const QString & getTrueLocaleName (void) const
QStringList getAvailableLanguagesNamesNative (const QString &localeDir="") const

Static Public Member Functions

static QString iso639_1CodeToNativeName (const QString &languageCode)
static QString nativeNameToIso639_1Code (const QString &languageName)
static void init (const QString &fileName)

Static Public Attributes

static StelTranslator globalTranslator

Detailed Description

Class used to translate strings to any language.

Implements a nice interface to gettext which is UTF-8 compliant and is somewhat multiplateform All its operations do not modify the global locale. The purpose of this class is to remove all non-OO C locale functions from stellarium.

Fabien Chereau

Constructor & Destructor Documentation

StelTranslator::StelTranslator ( const QString &  adomain,
const QString &  amoDirectory,
const QString &  alangName 
) [inline]

Create a translator from a language name.

If the passed locale name cannot be handled by the system, default value will be used. The passed language name is a language code string like "fr" or "fr_FR". This class wrap gettext to simulate an object oriented multiplateform gettext UTF8 translator

adomain The name of the domain to use for translation
amoDirectory The directory where to look for the translation files.
alangName The C locale name or language name like "fr" or "fr_FR". If string is "" or "system" it will use the system locale.

Member Function Documentation

const QString& StelTranslator::getTrueLocaleName ( void   )  const [inline]

Get true translator locale name.

Actual locale, never "system".

Locale name e.g "fr_FR"
static void StelTranslator::init ( const QString &  fileName  )  [static]

Initialize Translation.

fileName file containing the list of language codes
static QString StelTranslator::iso639_1CodeToNativeName ( const QString &  languageCode  )  [static]

Convert from ISO639-1 langage code to native language name.

languageCode the code to look up
QString StelTranslator::qtranslate ( const QString &  s  )  [inline]

Translate input message and return it as a QString.

s input string in english.
The translated QString
Generated on Thu May 31 10:37:22 2012 for Stellarium by  doxygen 1.6.3