Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CLangInfo Class Reference

#include <LangInfo.h>

Inheritance diagram for CLangInfo:
ISettingCallback ISettingsHandler

Classes

class  CRegion
 

Public Member Functions

 CLangInfo ()
 
 ~CLangInfo () override
 
void OnSettingChanged (const std::shared_ptr< const CSetting > &setting) override
 The value of the given setting has changed.
 
void OnSettingsLoaded () override
 Settings have been loaded.
 
LanguageResourcePtr GetLanguageAddon (const std::string &locale="") const
 Returns the language addon for the given locale (or the current one).
 
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.
 
bool SetLanguage (std::string strLanguage="", bool reloadServices=true)
 Sets and loads the given (or configured) language, its details and strings.
 
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 ~ISettingCallback ()=default
 
virtual bool OnSettingChanging (const std::shared_ptr< const CSetting > &setting)
 The value of the given setting is being changed.
 
virtual void OnSettingAction (const std::shared_ptr< const CSetting > &setting)
 The given setting has been activated.
 
virtual bool OnSettingUpdate (const std::shared_ptr< CSetting > &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
 The given setting needs to be updated.
 
virtual void OnSettingPropertyChanged (const std::shared_ptr< const CSetting > &setting, const char *propertyName)
 The given property of the given setting has changed.
 
- Public Member Functions inherited from ISettingsHandler
virtual ~ISettingsHandler ()=default
 
virtual bool OnSettingsLoading ()
 Settings loading has been initiated.
 
virtual bool OnSettingsSaving () const
 Settings saving has been initiated.
 
virtual void OnSettingsSaved () const
 Settings have been saved.
 
virtual void OnSettingsUnloaded ()
 Setting values have been unloaded.
 
virtual void OnSettingsCleared ()
 Settings have been cleared.
 

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.
 
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 Typedef Documentation

◆ ITMAPREGIONS

std::map<std::string,CRegion>::iterator CLangInfo::ITMAPREGIONS
protected

◆ MAPREGIONS

std::map<std::string, CRegion> CLangInfo::MAPREGIONS
protected

◆ PAIR_REGIONS

std::pair<std::string, CRegion> CLangInfo::PAIR_REGIONS
protected

Constructor & Destructor Documentation

◆ CLangInfo()

CLangInfo::CLangInfo ( )

◆ ~CLangInfo()

CLangInfo::~CLangInfo ( )
overridedefault

Member Function Documentation

◆ AddLanguages()

void CLangInfo::AddLanguages ( std::vector< StringSettingOption > & list)
staticprotected

◆ 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

◆ DetermineUse24HourClockFromTimeFormat()

bool CLangInfo::DetermineUse24HourClockFromTimeFormat ( const std::string & timeFormat)
staticprotected

◆ DetermineUseMeridiemFromTimeFormat()

bool CLangInfo::DetermineUseMeridiemFromTimeFormat ( const std::string & timeFormat)
staticprotected

◆ ForceUnicodeFont()

bool CLangInfo::ForceUnicodeFont ( ) const
inline

◆ GetAddonsLanguageCodes()

void CLangInfo::GetAddonsLanguageCodes ( std::map< std::string, std::string > & languages)
static

◆ GetAudioLanguage()

const std::string & CLangInfo::GetAudioLanguage ( ) const

◆ GetCurrentRegion()

const std::string & CLangInfo::GetCurrentRegion ( ) const

◆ GetDateFormat()

const std::string & CLangInfo::GetDateFormat ( bool bLongDate = false) const

◆ GetDVDAudioLanguage()

const std::string CLangInfo::GetDVDAudioLanguage ( ) const

◆ GetDVDMenuLanguage()

const std::string CLangInfo::GetDVDMenuLanguage ( ) const

◆ GetDVDSubtitleLanguage()

const std::string CLangInfo::GetDVDSubtitleLanguage ( ) const

◆ 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)

◆ GetGuiCharSet()

std::string CLangInfo::GetGuiCharSet ( ) const

◆ 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.

◆ GetLanguageCode()

const std::string & CLangInfo::GetLanguageCode ( ) const
inline

◆ GetLanguageInfoPath()

std::string CLangInfo::GetLanguageInfoPath ( const std::string & language)
static

◆ GetLanguagePath() [1/2]

static std::string CLangInfo::GetLanguagePath ( )
inlinestatic

◆ GetLanguagePath() [2/2]

std::string CLangInfo::GetLanguagePath ( const std::string & language)
static

◆ GetLocale()

const CLocale & CLangInfo::GetLocale ( ) const

Returns the full locale of the current language.

◆ GetLongDateFormat()

const std::string & CLangInfo::GetLongDateFormat ( ) const

◆ GetMeridiemSymbol()

const std::string & CLangInfo::GetMeridiemSymbol ( MeridiemSymbol symbol) const

◆ GetOriginalLocale()

const std::locale & CLangInfo::GetOriginalLocale ( ) const

◆ GetRegionLocale()

const std::string & CLangInfo::GetRegionLocale ( ) const

◆ GetRegionNames()

void CLangInfo::GetRegionNames ( std::vector< std::string > & array)

◆ GetShortDateFormat()

const std::string & CLangInfo::GetShortDateFormat ( ) const

◆ GetSortTokens()

std::set< std::string > CLangInfo::GetSortTokens ( ) const

◆ GetSpeedAsString()

std::string CLangInfo::GetSpeedAsString ( const CSpeed & speed) const

◆ GetSpeedUnit()

CSpeed::Unit CLangInfo::GetSpeedUnit ( ) const

◆ GetSpeedUnitString() [1/2]

const std::string & CLangInfo::GetSpeedUnitString ( ) const

◆ GetSpeedUnitString() [2/2]

const std::string & CLangInfo::GetSpeedUnitString ( CSpeed::Unit speedUnit)
static

◆ GetSubtitleCharSet()

std::string CLangInfo::GetSubtitleCharSet ( ) const

◆ GetSubtitleLanguage()

const std::string & CLangInfo::GetSubtitleLanguage ( ) const

◆ GetSystemLocale()

const std::locale & CLangInfo::GetSystemLocale ( ) const
inline

Returns the system's current locale.

◆ GetTemperatureAsString()

std::string CLangInfo::GetTemperatureAsString ( const CTemperature & temperature) const

◆ GetTemperatureUnit()

CTemperature::Unit CLangInfo::GetTemperatureUnit ( ) const

◆ GetTemperatureUnitString() [1/2]

const std::string & CLangInfo::GetTemperatureUnitString ( ) const

◆ GetTemperatureUnitString() [2/2]

const std::string & CLangInfo::GetTemperatureUnitString ( CTemperature::Unit temperatureUnit)
static

◆ GetTimeFormat()

const std::string & CLangInfo::GetTimeFormat ( ) const

◆ GetTimeZone()

const std::string & CLangInfo::GetTimeZone ( ) const

◆ Load()

bool CLangInfo::Load ( const std::string & strLanguage)
protected

◆ LoadTokens()

void CLangInfo::LoadTokens ( const TiXmlNode * pTokens,
std::set< std::string > & vecTokens )
static

◆ MeridiemSymbolToString()

const std::string & CLangInfo::MeridiemSymbolToString ( MeridiemSymbol symbol)
static

◆ 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.

◆ PrepareTimeFormat()

std::string CLangInfo::PrepareTimeFormat ( const std::string & timeFormat,
bool use24HourClock )
staticprotected

◆ Set24HourClock() [1/2]

void CLangInfo::Set24HourClock ( bool use24HourClock)

◆ Set24HourClock() [2/2]

void CLangInfo::Set24HourClock ( const std::string & str24HourClock)

◆ SetAudioLanguage()

void CLangInfo::SetAudioLanguage ( const std::string & language)

◆ SetCurrentRegion()

void CLangInfo::SetCurrentRegion ( const std::string & strName)

◆ SetDateFormat()

void CLangInfo::SetDateFormat ( const std::string & dateFormat,
bool bLongDate = false )

◆ SetDefaults()

void CLangInfo::SetDefaults ( )
protected

◆ 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.

◆ SetLongDateFormat()

void CLangInfo::SetLongDateFormat ( const std::string & longDateFormat)

◆ SetShortDateFormat()

void CLangInfo::SetShortDateFormat ( const std::string & shortDateFormat)

◆ SetSpeedUnit() [1/2]

void CLangInfo::SetSpeedUnit ( const std::string & speedUnit)

◆ SetSpeedUnit() [2/2]

void CLangInfo::SetSpeedUnit ( CSpeed::Unit speedUnit)

◆ SetSubtitleLanguage()

void CLangInfo::SetSubtitleLanguage ( const std::string & language)

◆ SetTemperatureUnit() [1/2]

void CLangInfo::SetTemperatureUnit ( const std::string & temperatureUnit)

◆ SetTemperatureUnit() [2/2]

void CLangInfo::SetTemperatureUnit ( CTemperature::Unit temperatureUnit)

◆ SetTimeFormat()

void CLangInfo::SetTimeFormat ( const std::string & timeFormat)

◆ SettingOptions24HourClockFormatsFiller()

void CLangInfo::SettingOptions24HourClockFormatsFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsAudioStreamLanguagesFiller()

void CLangInfo::SettingOptionsAudioStreamLanguagesFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsISO6391LanguagesFiller()

void CLangInfo::SettingOptionsISO6391LanguagesFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsLanguageNamesFiller()

void CLangInfo::SettingOptionsLanguageNamesFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsLongDateFormatsFiller()

void CLangInfo::SettingOptionsLongDateFormatsFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsRegionsFiller()

void CLangInfo::SettingOptionsRegionsFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsShortDateFormatsFiller()

void CLangInfo::SettingOptionsShortDateFormatsFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsSpeedUnitsFiller()

void CLangInfo::SettingOptionsSpeedUnitsFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsSubtitleDownloadlanguagesFiller()

void CLangInfo::SettingOptionsSubtitleDownloadlanguagesFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsSubtitleStreamLanguagesFiller()

void CLangInfo::SettingOptionsSubtitleStreamLanguagesFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsTemperatureUnitsFiller()

void CLangInfo::SettingOptionsTemperatureUnitsFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ SettingOptionsTimeFormatsFiller()

void CLangInfo::SettingOptionsTimeFormatsFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< StringSettingOption > & list,
std::string & current,
void * data )
static

◆ Use24HourClock()

bool CLangInfo::Use24HourClock ( ) const

◆ UseLocaleCollation()

bool CLangInfo::UseLocaleCollation ( )

Member Data Documentation

◆ m_audioLanguage

std::string CLangInfo::m_audioLanguage
protected

◆ m_collationtype

int CLangInfo::m_collationtype
protected

◆ m_currentRegion

CRegion* CLangInfo::m_currentRegion
protected

◆ m_defaultRegion

CRegion CLangInfo::m_defaultRegion
protected

◆ m_forceUnicodeFont

bool CLangInfo::m_forceUnicodeFont
protected

◆ m_languageAddon

LanguageResourcePtr CLangInfo::m_languageAddon
protected

◆ m_languageCodeGeneral

std::string CLangInfo::m_languageCodeGeneral
protected

◆ m_longDateFormat

std::string CLangInfo::m_longDateFormat
protected

◆ m_originalLocale

std::locale CLangInfo::m_originalLocale
protected

◆ m_regions

MAPREGIONS CLangInfo::m_regions
protected

◆ m_shortDateFormat

std::string CLangInfo::m_shortDateFormat
protected

◆ m_sortTokens

std::set<std::string> CLangInfo::m_sortTokens
protected

◆ m_speedUnit

CSpeed::Unit CLangInfo::m_speedUnit
protected

◆ m_strDVDAudioLanguage

std::string CLangInfo::m_strDVDAudioLanguage
protected

◆ m_strDVDMenuLanguage

std::string CLangInfo::m_strDVDMenuLanguage
protected

◆ m_strDVDSubtitleLanguage

std::string CLangInfo::m_strDVDSubtitleLanguage
protected

◆ m_strGuiCharSet

std::string CLangInfo::m_strGuiCharSet
protected

◆ m_strSubtitleCharSet

std::string CLangInfo::m_strSubtitleCharSet
protected

◆ m_subtitleLanguage

std::string CLangInfo::m_subtitleLanguage
protected

◆ m_systemLocale

std::locale CLangInfo::m_systemLocale
protected

◆ m_temperatureUnit

CTemperature::Unit CLangInfo::m_temperatureUnit
protected

◆ m_timeFormat

std::string CLangInfo::m_timeFormat
protected

◆ m_use24HourClock

bool CLangInfo::m_use24HourClock
protected

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