|
Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <LangInfo.h>
Classes | |
| class | CRegion |
Public Types | |
| using | Tokens = std::set<std::string, std::less<>> |
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 |
| std::string | GetEnglishLanguageName (const std::string &locale="") const |
| Get the english language name from given locale, by searching in the installed language addons. | |
| std::string | GetLanguageAs (CLangCodeExpander::LANGFORMATS format, bool withRegion) const |
| The active language, named in the requested format. | |
| bool | SetLanguage (std::string strLanguage="", bool reloadServices=true) |
| Sets and loads the given (or configured) language, its details and strings. | |
| const KODI::UTILS::CLanguageTag & | GetAudioLanguage (bool allowFallback) const |
| Get the preferred audio language. | |
| void | SetAudioLanguage (const std::string &language) |
| Set the audio language. | |
| const KODI::UTILS::CLanguageTag & | GetSubtitleLanguage (bool allowFallback) const |
| Get the preferred subtitle language. | |
| void | SetSubtitleLanguage (const std::string &language) |
| Set the subtitle language. | |
| KODI::UTILS::CLanguageTag | GetDVDMenuLanguage () const |
| KODI::UTILS::CLanguageTag | GetDVDAudioLanguage () const |
| KODI::UTILS::CLanguageTag | GetDVDSubtitleLanguage () const |
| const std::string & | GetTimeZone () const |
| const std::string & | GetRegionLocale () const |
| std::string | GetRegionCodeAlpha2 () const |
| The current region as an ISO 3166-1 alpha-2 code. | |
| std::string | GetRegionCodeAlpha3 () const |
| The current region as an ISO 3166-1 alpha-3 code. | |
| const std::locale & | GetOriginalLocale () const |
| const CLocale & | GetLocale () 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) const |
| void | SetCurrentRegion (const std::string &strName) |
| const std::string & | GetCurrentRegion () const |
| Tokens | 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, Tokens &vecTokens) |
| static void | SettingOptionsLanguageNamesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t) |
| static void | SettingOptionsAudioStreamLanguagesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t) |
| static void | SettingOptionsSubtitleStreamLanguagesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t) |
| static void | SettingOptionsSubtitleDownloadlanguagesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t) |
| static void | SettingOptionsISO6391LanguagesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t) |
| static void | SettingOptionsRegionsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t, const CLangInfo &langInfo) |
| static void | SettingOptionsShortDateFormatsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t, const CLangInfo &langInfo) |
| static void | SettingOptionsLongDateFormatsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t, const CLangInfo &langInfo) |
| static void | SettingOptionsTimeFormatsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t, const CLangInfo &langInfo) |
| static void | SettingOptions24HourClockFormatsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t, const CLangInfo &langInfo) |
| static void | SettingOptionsTemperatureUnitsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t, const CLangInfo &langInfo) |
| static void | SettingOptionsSpeedUnitsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string ¤t, const CLangInfo &langInfo) |
Protected Types | |
| typedef std::map< std::string, CRegion > | MAPREGIONS |
| typedef std::map< std::string, CRegion >::iterator | ITMAPREGIONS |
| typedef std::pair< std::string, CRegion > | PAIR_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 |
| CRegion * | m_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 |
| Tokens | 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 |
| KODI::UTILS::CLanguageTag | m_audioLanguage |
| KODI::UTILS::CLanguageTag | m_subtitleLanguage |
| KODI::UTILS::CLanguageTag | m_uiLanguage |
| An unset audio or subtitle preference falls back to this. | |
|
protected |
|
protected |
|
protected |
| using CLangInfo::Tokens = std::set<std::string, std::less<>> |
| CLangInfo::CLangInfo | ( | ) |
|
overridedefault |
|
staticprotected |
|
static |
Convert an english language name to an addon locale, by searching in the installed language addons.
| langName | [IN] The english language name |
|
staticprotected |
|
staticprotected |
|
inline |
|
static |
| const CLanguageTag & CLangInfo::GetAudioLanguage | ( | bool | allowFallback | ) | const |
Get the preferred audio language.
| allowFallback | If set to true, when the audio language setting is set to "default", "original" or "mediadefault" the UI language is returned instead. |
| const std::string & CLangInfo::GetCurrentRegion | ( | ) | const |
| const std::string & CLangInfo::GetDateFormat | ( | bool | bLongDate = false | ) | const |
| CLanguageTag CLangInfo::GetDVDAudioLanguage | ( | ) | const |
| CLanguageTag CLangInfo::GetDVDMenuLanguage | ( | ) | const |
| CLanguageTag CLangInfo::GetDVDSubtitleLanguage | ( | ) | const |
| std::string CLangInfo::GetEnglishLanguageName | ( | const std::string & | locale = "" | ) | const |
Get the english language name from given locale, by searching in the installed language addons.
| locale | [OPT] Locale of the language (current if empty) |
| std::string CLangInfo::GetGuiCharSet | ( | ) | const |
| LanguageResourcePtr CLangInfo::GetLanguageAddon | ( | const std::string & | locale = "" | ) | const |
Returns the language addon for the given locale (or the current one).
| locale | (optional) Locale of the language (current if empty) |
| std::string CLangInfo::GetLanguageAs | ( | CLangCodeExpander::LANGFORMATS | format, |
| bool | withRegion ) const |
The active language, named in the requested format.
| format | The notation to name the language in. |
| withRegion | Append the active region, separated by "-", in the notation the format implies: an ISO 3166-1 code for the ISO 639 formats, the region's name otherwise. |
|
static |
|
inlinestatic |
|
static |
| const CLocale & CLangInfo::GetLocale | ( | ) | const |
Returns the full locale of the current language.
| const std::string & CLangInfo::GetLongDateFormat | ( | ) | const |
| const std::string & CLangInfo::GetMeridiemSymbol | ( | MeridiemSymbol | symbol | ) | const |
| const std::locale & CLangInfo::GetOriginalLocale | ( | ) | const |
| std::string CLangInfo::GetRegionCodeAlpha2 | ( | ) | const |
The current region as an ISO 3166-1 alpha-2 code.
| std::string CLangInfo::GetRegionCodeAlpha3 | ( | ) | const |
The current region as an ISO 3166-1 alpha-3 code.
| const std::string & CLangInfo::GetRegionLocale | ( | ) | const |
| void CLangInfo::GetRegionNames | ( | std::vector< std::string > & | array | ) | const |
| const std::string & CLangInfo::GetShortDateFormat | ( | ) | const |
| CLangInfo::Tokens CLangInfo::GetSortTokens | ( | ) | const |
| std::string CLangInfo::GetSpeedAsString | ( | const CSpeed & | speed | ) | const |
| CSpeed::Unit CLangInfo::GetSpeedUnit | ( | ) | const |
| const std::string & CLangInfo::GetSpeedUnitString | ( | ) | const |
|
static |
| std::string CLangInfo::GetSubtitleCharSet | ( | ) | const |
| const CLanguageTag & CLangInfo::GetSubtitleLanguage | ( | bool | allowFallback | ) | const |
Get the preferred subtitle language.
| allowFallback | If set to true, when the subtitle language setting is set to "original" or "forced_only" the preferred audio language is returned instead. |
|
inline |
Returns the system's current locale.
| std::string CLangInfo::GetTemperatureAsString | ( | const CTemperature & | temperature | ) | const |
| CTemperature::Unit CLangInfo::GetTemperatureUnit | ( | ) | const |
| const std::string & CLangInfo::GetTemperatureUnitString | ( | ) | const |
|
static |
| const std::string & CLangInfo::GetTimeFormat | ( | ) | const |
| const std::string & CLangInfo::GetTimeZone | ( | ) | const |
|
protected |
|
static |
|
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.
| setting | The setting whose value has been changed |
Reimplemented from ISettingCallback.
|
overridevirtual |
Settings have been loaded.
This callback can be used to trigger loading other settings.
Reimplemented from ISettingsHandler.
|
staticprotected |
| void CLangInfo::Set24HourClock | ( | const std::string & | str24HourClock | ) |
| void CLangInfo::SetAudioLanguage | ( | const std::string & | language | ) |
Set the audio language.
| language | The language can either be a two char language code, or a three char language code, or a language name in english, also user-defined languages are allowed. |
| void CLangInfo::SetCurrentRegion | ( | const std::string & | strName | ) |
|
protected |
Sets and loads the given (or configured) language, its details and strings.
| strLanguage | (optional) Language to be loaded. |
| reloadServices | (optional) Whether to reload services relying on localization. |
| void CLangInfo::SetLongDateFormat | ( | const std::string & | longDateFormat | ) |
| void CLangInfo::SetShortDateFormat | ( | const std::string & | shortDateFormat | ) |
| void CLangInfo::SetSpeedUnit | ( | const std::string & | speedUnit | ) |
| void CLangInfo::SetSpeedUnit | ( | CSpeed::Unit | speedUnit | ) |
| void CLangInfo::SetSubtitleLanguage | ( | const std::string & | language | ) |
Set the subtitle language.
| language | The language can either be a two char language code, or a three char language code, or a language name in english, also user-defined languages are allowed. |
| void CLangInfo::SetTemperatureUnit | ( | const std::string & | temperatureUnit | ) |
| void CLangInfo::SetTemperatureUnit | ( | CTemperature::Unit | temperatureUnit | ) |
| void CLangInfo::SetTimeFormat | ( | const std::string & | timeFormat | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| bool CLangInfo::Use24HourClock | ( | ) | const |
| bool CLangInfo::UseLocaleCollation | ( | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
An unset audio or subtitle preference falls back to this.
|
protected |