20 #ifndef _STELTRANSLATOR_HPP_ 21 #define _STELTRANSLATOR_HPP_ 32 #define q_(str) StelTranslator::globalTranslator->qtranslate(str) 37 #define qc_(str, ctxt) StelTranslator::globalTranslator->qtranslate(str, ctxt) 69 QString
qtranslate(
const QString& s,
const QString& c = QString())
const;
76 QString
tryQtranslate(
const QString& s,
const QString& c = QString())
const;
82 if (langName==
"system" || langName==
"system_default")
83 return StelTranslator::systemLangName;
103 static void init(
const QString& fileName);
111 static void initIso639_1LanguageCodes(
const QString& fileName);
114 QStringList getAvailableIso639_1Codes(
const QString& localeDir=
"")
const;
123 class QTranslator* translator;
126 static void initSystemLanguage(
void);
129 static QString systemLangName;
132 static QMap<QString, QString> iso639codes;
135 #endif // _STELTRANSLATOR_HPP_ const QString & getTrueLocaleName() const
Get true translator locale name.
Class used to translate strings to any language.
static QString nativeNameToIso639_1Code(const QString &languageName)
Convert from native language name to ISO639-1 2 letters langage code.
static QString iso639_1CodeToNativeName(const QString &languageCode)
Convert from ISO639-1 langage code to native language name.
static StelTranslator * globalTranslator
Used as a global translator by the whole app.
QString tryQtranslate(const QString &s, const QString &c=QString()) const
Try to translate input message and return it as a QString.
static void init(const QString &fileName)
Initialize Translation.
QStringList getAvailableLanguagesNamesNative(const QString &localeDir="", const QString §ion="") const
Get available language name in native language from passed locales directory.
StelTranslator(const QString &adomain, const QString &alangName)
Create a translator from a language name.
QString qtranslate(const QString &s, const QString &c=QString()) const
Translate input message and return it as a QString.