BuildmLearn Toolkit  2.0.4
BuildmLearn Toolkit is an easy-to-use program that helps users make mobile apps without any knowledge of application development.
 All Classes Functions Enumerations Groups Pages
Localization Class Reference

Localization facilities. More...

#include <localization.h>

Collaboration diagram for Localization:
Collaboration graph

Public Member Functions

QString desiredLanguage ()
 Access to code of language that should be loaded according to settings. More...
 
void load ()
 Loads currently active language.
 
QList< LanguageinstalledLanguages ()
 Gets list of installed languages. More...
 
QString loadedLanguage () const
 Access to code of loaded language. More...
 

Static Public Member Functions

static Localizationinstance ()
 Singleton getter. More...
 

Detailed Description

Localization facilities.

Definition at line 48 of file localization.h.

Member Function Documentation

QString Localization::desiredLanguage ( )

Access to code of language that should be loaded according to settings.

Returns
Returns code of language that should be loaded according to settings.

Definition at line 62 of file localization.cpp.

62  {
63  return qApp->settings()->value(APP_CFG_GEN,
64  "language",
65  QLocale::system().name()).toString();
66 }

Here is the caller graph for this function:

QList< Language > Localization::installedLanguages ( )

Gets list of installed languages.

Returns
Returns list of installed application localizations. This list is used ie. in settings dialog.

Definition at line 103 of file localization.cpp.

103  {
104  QList<Language> languages;
105  QDir file_dir(APP_LANG_PATH);
106  QTranslator translator;
107 
108  // Iterate all found language files.
109  foreach (const QFileInfo &file, file_dir.entryInfoList(QStringList() << "buildmlearn-toolkit-*.qm",
110  QDir::Files,
111  QDir::Name)) {
112  if (translator.load(file.absoluteFilePath())) {
113  Language new_language;
114  new_language.m_name = translator.translate("QObject", "LANG_NAME");
115  new_language.m_code = translator.translate("QObject", "LANG_ABBREV");
116  new_language.m_author = translator.translate("QObject", "LANG_AUTHOR");
117  new_language.m_email = translator.translate("QObject", "LANG_EMAIL");
118 
119  languages << new_language;
120  }
121  }
122  return languages;
123 }
Representation of single localization.
Definition: localization.h:40
Localization * Localization::instance ( )
static

Singleton getter.

Returns
Returns singleton.

Definition at line 54 of file localization.cpp.

54  {
55  if (s_instance.isNull()) {
56  s_instance = new Localization(qApp);
57  }
58 
59  return s_instance;
60 }
Localization facilities.
Definition: localization.h:48
QString Localization::loadedLanguage ( ) const
inline

Access to code of loaded language.

Returns
Returns empty string or loaded language name if it is really loaded.

Definition at line 80 of file localization.h.

80  {
81  return m_loadedLanguage;
82  }

The documentation for this class was generated from the following files: