Stellarium 0.90.0
List of all members | Public Types | Public Member Functions | Static Public Member Functions
StelLocaleMgr Class Reference

Manage i18n operations such as message translation and date/time localization. More...

#include <StelLocaleMgr.hpp>

Public Types

enum  STimeFormat { STime24h, STime12h, STimeSystemDefault }
 The time display format. More...
 
enum  SDateFormat { SDateMMDDYYYY, SDateDDMMYYYY, SDateSystemDefault, SDateYYYYMMDD }
 The date display format. More...
 

Public Member Functions

void init ()
 Initialize object. More...
 
QString getAppLanguage () const
 Get the application language currently used for GUI etc. More...
 
void setAppLanguage (const QString &newAppLangName, bool refreshAll=true)
 Set the application language. More...
 
const StelTranslatorgetAppStelTranslator () const
 Get the StelTranslator object currently used for global application. More...
 
bool isAppRTL () const
 Get the type (RTL or LTR) of application language currently used for GUI etc. More...
 
QString getSkyLanguage () const
 Get the language currently used for sky objects. More...
 
void setSkyLanguage (const QString &newSkyLangName, bool refreshAll=true)
 Set the sky language and reload the sky object names with the new translation. More...
 
const StelTranslatorgetSkyTranslator () const
 Get a reference to the StelTranslator object currently used for sky objects. More...
 
bool isSkyRTL () const
 Get the type (RTL or LTR) of language currently used for sky objects. More...
 
QString getTimeFormatStr (void) const
 Get the format string which describes the current time format. More...
 
void setTimeFormatStr (const QString &tf)
 Set the time format from a format string. More...
 
QString getDateFormatStr (void) const
 Get the format string which describes the current date format. More...
 
void setDateFormatStr (const QString &df)
 
QString getQtDateFormatStr (void) const
 Get the format string which describes the current date format (Qt style). More...
 
QString getPrintableDateLocal (double JD) const
 Get a localized, formatted string representation of the date component of a Julian date. More...
 
QString getPrintableTimeLocal (double JD) const
 Get a localized, formatted string representation of the time component of a Julian date. More...
 
QString getPrintableTimeZoneLocal (double JD) const
 Get a localized, formatted string representation of the time zone of a Julian date. More...
 
QString getISO8601TimeLocal (double JD) const
 Return the time in ISO 8601 format that is : Y-m-dTH:M:S. More...
 
double getJdFromISO8601TimeLocal (const QString &str, bool *ok) const
 Return the JD time for a local time ISO 8601 format that is: Y-m-dTH:M:S, but Y can be a large number with sign, and Y can be zero. More...
 

Static Public Member Functions

static QString countryCodeToString (const QString &countryCode)
 Convert a 2 letter country code to string. More...
 
static QStringList getAllCountryNames ()
 Return an alphabetically ordered list of all the known country names. More...
 

Detailed Description

Manage i18n operations such as message translation and date/time localization.

Author
Fabien Chereau

Definition at line 29 of file StelLocaleMgr.hpp.

Member Enumeration Documentation

The date display format.

Enumerator
SDateMMDDYYYY 

e.g. "07-05-1998" for July 5th 1998

SDateDDMMYYYY 

e.g. "05-07-1998" for July 5th 1998

SDateSystemDefault 

Use the system default date format.

SDateYYYYMMDD 

e.g. "1998-07-05" for July 5th 1998

Definition at line 115 of file StelLocaleMgr.hpp.

The time display format.

Enumerator
STime24h 

24 hour clock, e.g. "18:22:00"

STime12h 

12 hour clock, e.g. "06:22:00 pm"

STimeSystemDefault 

use the system default format.

Definition at line 107 of file StelLocaleMgr.hpp.

Member Function Documentation

static QString StelLocaleMgr::countryCodeToString ( const QString &  countryCode)
static

Convert a 2 letter country code to string.

static QStringList StelLocaleMgr::getAllCountryNames ( )
static

Return an alphabetically ordered list of all the known country names.

QString StelLocaleMgr::getAppLanguage ( ) const
inline

Get the application language currently used for GUI etc.

This function has no permanent effect on the global locale.

Returns
the abbreviated name of the language (e.g "fr").

Definition at line 47 of file StelLocaleMgr.hpp.

const StelTranslator& StelLocaleMgr::getAppStelTranslator ( ) const

Get the StelTranslator object currently used for global application.

QString StelLocaleMgr::getDateFormatStr ( void  ) const
inline

Get the format string which describes the current date format.

Valid values:

  • "mmddyyyy"
  • "ddmmyyyy"
  • "system_default"
  • "yyyymmdd"

These values correspond to the similarly named values in the SDateFormat enum.

Definition at line 99 of file StelLocaleMgr.hpp.

QString StelLocaleMgr::getISO8601TimeLocal ( double  JD) const

Return the time in ISO 8601 format that is : Y-m-dTH:M:S.

Parameters
JDthe time and date expressed as a Julian date value.
double StelLocaleMgr::getJdFromISO8601TimeLocal ( const QString &  str,
bool *  ok 
) const

Return the JD time for a local time ISO 8601 format that is: Y-m-dTH:M:S, but Y can be a large number with sign, and Y can be zero.

Parameters
strthe local time in ISO 8601 format.
okset to false if the string was an invalid date.
QString StelLocaleMgr::getPrintableDateLocal ( double  JD) const

Get a localized, formatted string representation of the date component of a Julian date.

QString StelLocaleMgr::getPrintableTimeLocal ( double  JD) const

Get a localized, formatted string representation of the time component of a Julian date.

QString StelLocaleMgr::getPrintableTimeZoneLocal ( double  JD) const

Get a localized, formatted string representation of the time zone of a Julian date.

QString StelLocaleMgr::getQtDateFormatStr ( void  ) const

Get the format string which describes the current date format (Qt style).

QString StelLocaleMgr::getSkyLanguage ( ) const

Get the language currently used for sky objects.

This function has no permanent effect on the global locale.

Returns
the name of the language (e.g fr).
const StelTranslator& StelLocaleMgr::getSkyTranslator ( ) const

Get a reference to the StelTranslator object currently used for sky objects.

QString StelLocaleMgr::getTimeFormatStr ( void  ) const
inline

Get the format string which describes the current time format.

Valid values are:

  • "system_default"
  • "24h"
  • "12h"

These values correspond to the similarly named values in the STimeFormat enum.

Definition at line 87 of file StelLocaleMgr.hpp.

void StelLocaleMgr::init ( )

Initialize object.

This process includes:

  • Setting the sky and application languages
  • Setting the time and date formats
  • Setting up the time zone
bool StelLocaleMgr::isAppRTL ( ) const

Get the type (RTL or LTR) of application language currently used for GUI etc.

bool StelLocaleMgr::isSkyRTL ( ) const

Get the type (RTL or LTR) of language currently used for sky objects.

void StelLocaleMgr::setAppLanguage ( const QString &  newAppLangName,
bool  refreshAll = true 
)

Set the application language.

This applies to GUI etc. This function has no permanent effect on the global locale.

Parameters
newAppLangNamethe abbreviated name of the language (e.g fr).
void StelLocaleMgr::setSkyLanguage ( const QString &  newSkyLangName,
bool  refreshAll = true 
)

Set the sky language and reload the sky object names with the new translation.

This function has no permanent effect on the global locale.

Parameters
newSkyLangNameThe abbreviated name of the locale (e.g fr) to use for sky object labels.
void StelLocaleMgr::setTimeFormatStr ( const QString &  tf)
inline

Set the time format from a format string.

Parameters
tfvalues are the same as the return values for getTimeFormatStr().

Definition at line 90 of file StelLocaleMgr.hpp.


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