xbmc
Classes | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
CLangInfo Class Reference
Inheritance diagram for CLangInfo:
Inheritance graph
[legend]
Collaboration diagram for CLangInfo:
Collaboration graph
[legend]

Classes

class  CRegion
 

Public Member Functions

void OnSettingChanged (const std::shared_ptr< const CSetting > &setting) override
 The value of the given setting has changed. More...
 
void OnSettingsLoaded () override
 Settings have been loaded. More...
 
LanguageResourcePtr GetLanguageAddon (const std::string &locale="") const
 Returns the language addon for the given locale (or the current one). More...
 
std::string GetGuiCharSet () const
 
std::string GetSubtitleCharSet () const
 
const std::string & GetLanguageCode () const
 
std::string GetEnglishLanguageName (const std::string &locale="") const
 Get the english language name from given locale, by searching in the installed language addons. More...
 
bool SetLanguage (std::string strLanguage="", bool reloadServices=true)
 Sets and loads the given (or configured) language, its details and strings. More...
 
const std::string & GetAudioLanguage () const
 
void SetAudioLanguage (const std::string &language)
 
const std::string & GetSubtitleLanguage () const
 
void SetSubtitleLanguage (const std::string &language)
 
const std::string GetDVDMenuLanguage () const
 
const std::string GetDVDAudioLanguage () const
 
const std::string GetDVDSubtitleLanguage () const
 
const std::string & GetTimeZone () const
 
const std::string & GetRegionLocale () const
 
const std::locale & GetOriginalLocale () const
 
const CLocaleGetLocale () const
 Returns the full locale of the current language.
 
const std::locale & GetSystemLocale () const
 Returns the system's current locale.
 
bool ForceUnicodeFont () const
 
const std::string & GetDateFormat (bool bLongDate=false) const
 
void SetDateFormat (const std::string &dateFormat, bool bLongDate=false)
 
const std::string & GetShortDateFormat () const
 
void SetShortDateFormat (const std::string &shortDateFormat)
 
const std::string & GetLongDateFormat () const
 
void SetLongDateFormat (const std::string &longDateFormat)
 
const std::string & GetTimeFormat () const
 
void SetTimeFormat (const std::string &timeFormat)
 
bool Use24HourClock () const
 
void Set24HourClock (bool use24HourClock)
 
void Set24HourClock (const std::string &str24HourClock)
 
const std::string & GetMeridiemSymbol (MeridiemSymbol symbol) const
 
CTemperature::Unit GetTemperatureUnit () const
 
void SetTemperatureUnit (CTemperature::Unit temperatureUnit)
 
void SetTemperatureUnit (const std::string &temperatureUnit)
 
const std::string & GetTemperatureUnitString () const
 
std::string GetTemperatureAsString (const CTemperature &temperature) const
 
CSpeed::Unit GetSpeedUnit () const
 
void SetSpeedUnit (CSpeed::Unit speedUnit)
 
void SetSpeedUnit (const std::string &speedUnit)
 
const std::string & GetSpeedUnitString () const
 
std::string GetSpeedAsString (const CSpeed &speed) const
 
void GetRegionNames (std::vector< std::string > &array)
 
void SetCurrentRegion (const std::string &strName)
 
const std::string & GetCurrentRegion () const
 
std::set< std::string > GetSortTokens () const
 
bool UseLocaleCollation ()
 
- Public Member Functions inherited from ISettingCallback
virtual bool OnSettingChanging (const std::shared_ptr< const CSetting > &setting)
 The value of the given setting is being changed. More...
 
virtual void OnSettingAction (const std::shared_ptr< const CSetting > &setting)
 The given setting has been activated. More...
 
virtual bool OnSettingUpdate (const std::shared_ptr< CSetting > &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
 The given setting needs to be updated. More...
 
virtual void OnSettingPropertyChanged (const std::shared_ptr< const CSetting > &setting, const char *propertyName)
 The given property of the given setting has changed. More...
 
- Public Member Functions inherited from ISettingsHandler
virtual bool OnSettingsLoading ()
 Settings loading has been initiated. More...
 
virtual bool OnSettingsSaving () const
 Settings saving has been initiated. More...
 
virtual void OnSettingsSaved () const
 Settings have been saved. More...
 
virtual void OnSettingsUnloaded ()
 Setting values have been unloaded. More...
 
virtual void OnSettingsCleared ()
 Settings have been cleared. More...
 

Static Public Member Functions

static void GetAddonsLanguageCodes (std::map< std::string, std::string > &languages)
 
static std::string ConvertEnglishNameToAddonLocale (const std::string &langName)
 Convert an english language name to an addon locale, by searching in the installed language addons. More...
 
static const std::string & MeridiemSymbolToString (MeridiemSymbol symbol)
 
static const std::string & GetTemperatureUnitString (CTemperature::Unit temperatureUnit)
 
static const std::string & GetSpeedUnitString (CSpeed::Unit speedUnit)
 
static std::string GetLanguagePath ()
 
static std::string GetLanguagePath (const std::string &language)
 
static std::string GetLanguageInfoPath (const std::string &language)
 
static void LoadTokens (const TiXmlNode *pTokens, std::set< std::string > &vecTokens)
 
static void SettingOptionsLanguageNamesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsAudioStreamLanguagesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsSubtitleStreamLanguagesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsSubtitleDownloadlanguagesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsISO6391LanguagesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsRegionsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsShortDateFormatsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsLongDateFormatsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsTimeFormatsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptions24HourClockFormatsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsTemperatureUnitsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsSpeedUnitsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 

Protected Types

typedef std::map< std::string, CRegionMAPREGIONS
 
typedef std::map< std::string, CRegion >::iterator ITMAPREGIONS
 
typedef std::pair< std::string, CRegionPAIR_REGIONS
 

Protected Member Functions

void SetDefaults ()
 
bool Load (const std::string &strLanguage)
 

Static Protected Member Functions

static bool DetermineUse24HourClockFromTimeFormat (const std::string &timeFormat)
 
static bool DetermineUseMeridiemFromTimeFormat (const std::string &timeFormat)
 
static std::string PrepareTimeFormat (const std::string &timeFormat, bool use24HourClock)
 
static void AddLanguages (std::vector< StringSettingOption > &list)
 

Protected Attributes

MAPREGIONS m_regions
 
CRegionm_currentRegion
 
CRegion m_defaultRegion
 
std::locale m_systemLocale
 
std::locale m_originalLocale
 
int m_collationtype
 
LanguageResourcePtr m_languageAddon
 
std::string m_strGuiCharSet
 
bool m_forceUnicodeFont
 
std::string m_strSubtitleCharSet
 
std::string m_strDVDMenuLanguage
 
std::string m_strDVDAudioLanguage
 
std::string m_strDVDSubtitleLanguage
 
std::set< std::string > m_sortTokens
 
std::string m_shortDateFormat
 
std::string m_longDateFormat
 
std::string m_timeFormat
 
bool m_use24HourClock
 
CTemperature::Unit m_temperatureUnit
 
CSpeed::Unit m_speedUnit
 
std::string m_audioLanguage
 
std::string m_subtitleLanguage
 
std::string m_languageCodeGeneral
 

Member Function Documentation

◆ ConvertEnglishNameToAddonLocale()

std::string CLangInfo::ConvertEnglishNameToAddonLocale ( const std::string &  langName)
static

Convert an english language name to an addon locale, by searching in the installed language addons.

Parameters
langName[IN] The english language name
Returns
The locale for the given english name, or empty if not found

◆ GetEnglishLanguageName()

std::string CLangInfo::GetEnglishLanguageName ( const std::string &  locale = "") const

Get the english language name from given locale, by searching in the installed language addons.

Parameters
locale[OPT] Locale of the language (current if empty)

◆ GetLanguageAddon()

LanguageResourcePtr CLangInfo::GetLanguageAddon ( const std::string &  locale = "") const

Returns the language addon for the given locale (or the current one).

Parameters
locale(optional) Locale of the language (current if empty)
Returns
Language addon for the given locale or NULL if the locale is invalid.

◆ OnSettingChanged()

void CLangInfo::OnSettingChanged ( const std::shared_ptr< const CSetting > &  setting)
overridevirtual

The value of the given setting has changed.

This callback is triggered whenever the value of a setting has been successfully changed (i.e. none of the OnSettingChanging() handlers) has reverted the change.

Parameters
settingThe setting whose value has been changed

Reimplemented from ISettingCallback.

◆ OnSettingsLoaded()

void CLangInfo::OnSettingsLoaded ( )
overridevirtual

Settings have been loaded.

This callback can be used to trigger loading other settings.

Reimplemented from ISettingsHandler.

◆ SetLanguage()

bool CLangInfo::SetLanguage ( std::string  strLanguage = "",
bool  reloadServices = true 
)

Sets and loads the given (or configured) language, its details and strings.

Parameters
strLanguage(optional) Language to be loaded.
reloadServices(optional) Whether to reload services relying on localization.
Returns
True if the language has been successfully loaded, false otherwise.

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