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

StelLocaleMgr Class Reference

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

#include <StelLocaleMgr.hpp>

List of all members.

Public Types

enum  STimeFormat { STime24h, STime12h, STimeSystemDefault }
 

The time display format.

More...
enum  SDateFormat { SDateMMDDYYYY, SDateDDMMYYYY, SDateSystemDefault, SDateYYYYMMDD }
 

The date display format.

More...
enum  STzFormat { STzCustom, STzGMTShift, STzSystemDefault }

Public Member Functions

void init ()
 Initialize object.
QString getAppLanguage () const
 Get the application language currently used for GUI etc.
void setAppLanguage (const QString &newAppLangName)
 Set the application language.
StelTranslatorgetAppStelTranslator () const
 Get the StelTranslator object currently used for global application.
QString getSkyLanguage () const
 Get the language currently used for sky objects.
void setSkyLanguage (const QString &newSkyLangName)
 Set the sky language and reload the sky object names with the new translation.
StelTranslatorgetSkyTranslator ()
 Get a reference to the StelTranslator object currently used for sky objects.
QString getTimeFormatStr (void) const
 Get the format string which describes the current time format.
void setTimeFormatStr (const QString &tf)
 Set the time format from a format string.
QString getDateFormatStr (void) const
 Get the format string which describes the current date format.
void setDateFormatStr (const QString &df)
void setCustomTimezone (QString tZ)
 Set the time zone.
QString getPrintableDateLocal (double JD) const
 Get a localized, formatted string representation of the date component of a Julian date.
QString getPrintableTimeLocal (double JD) const
 Get a localized, formatted string representation of the time component of a Julian date.
void setGMTShift (int t)
 Get the current time shift at observator time zone with respect to GMT time.
float getGMTShift (double JD=0) const
 Get the current time shift in hours at observator time zone with respect to GMT time.
void setCustomTzName (const QString &tzname)
 Set the timezone by a TZ-style string (see tzset in the libc manual).
QString getCustomTzName (void) const
 Get the timezone name (a TZ-style string - see tzset in the libc manual).
STzFormat getTzFormat (void) const
 Get the current timezone format mode.
QString getISO8601TimeLocal (double JD) const
 Return the time in ISO 8601 format that is : Y-m-dTH:M:S.
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.

Static Public Member Functions

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

Detailed Description

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

Author:
Fabien Chereau

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

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.

Enumerator:
STzCustom 

User-specified timezone.

STzGMTShift 

GMT + offset.

STzSystemDefault 

System default.


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").
StelTranslator& StelLocaleMgr::getAppStelTranslator (  )  const

Get the StelTranslator object currently used for global application.

QString StelLocaleMgr::getCustomTzName ( void   )  const [inline]

Get the timezone name (a TZ-style string - see tzset in the libc manual).

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.

float StelLocaleMgr::getGMTShift ( double  JD = 0  )  const

Get the current time shift in hours at observator time zone with respect to GMT time.

QString StelLocaleMgr::getISO8601TimeLocal ( double  JD  )  const

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

Parameters:
JD the 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:
str the local time in ISO 8601 format.
ok set 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::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).
StelTranslator& StelLocaleMgr::getSkyTranslator (  ) 

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.

STzFormat StelLocaleMgr::getTzFormat ( void   )  const [inline]

Get the current timezone format mode.

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
void StelLocaleMgr::setAppLanguage ( const QString &  newAppLangName  ) 

Set the application language.

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

Parameters:
newAppLangName the abbreviated name of the language (e.g fr).
void StelLocaleMgr::setCustomTimezone ( QString  tZ  )  [inline]

Set the time zone.

Parameters:
tZ the time zone string as parsed from the TZ environment varibale by the tzset function from libc.
void StelLocaleMgr::setCustomTzName ( const QString &  tzname  ) 

Set the timezone by a TZ-style string (see tzset in the libc manual).

void StelLocaleMgr::setGMTShift ( int  t  )  [inline]

Get the current time shift at observator time zone with respect to GMT time.

void StelLocaleMgr::setSkyLanguage ( const QString &  newSkyLangName  ) 

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:
newSkyLangName The 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:
tf values are the same as the return values for getTimeFormatStr().
Generated on Sat Aug 25 22:13:32 2012 for Stellarium by  doxygen 1.6.3