Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <LangCodeExpander.h>
Public Types | |
enum | LANGFORMATS { ISO_639_1 , ISO_639_2 , ENGLISH_NAME } |
enum class | LANG_LIST { DEFAULT , INCLUDE_ADDONS , INCLUDE_USERDEFINED , INCLUDE_ADDONS_USERDEFINED } |
Public Member Functions | |
CLangCodeExpander () | |
~CLangCodeExpander () | |
void | LoadUserCodes (const TiXmlElement *pRootElement) |
void | Clear () |
bool | Lookup (const std::string &code, std::string &desc) |
bool | Lookup (const int code, std::string &desc) |
bool | CompareFullLanguageNames (const std::string &lang1, const std::string &lang2) |
Determines if two english language names represent the same language. | |
bool | CompareISO639Codes (const std::string &code1, const std::string &code2) |
Determines if two languages given as ISO 639-1, ISO 639-2/T, or ISO 639-2/B codes represent the same language. | |
bool | ConvertToISO6391 (const std::string &lang, std::string &code) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 2-Char (ISO 639-1) code. | |
std::string | ConvertToISO6392B (const std::string &lang) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/B code. | |
bool | ConvertToISO6392B (const std::string &strCharCode, std::string &strISO6392B, bool checkWin32Locales=false) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code. | |
bool | ConvertToISO6392T (const std::string &strCharCode, std::string &strISO6392T, bool checkWin32Locales=false) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code. | |
std::string | ConvertToISO6392T (const std::string &lang) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code. | |
std::vector< std::string > | GetLanguageNames (LANGFORMATS format=ISO_639_1, LANG_LIST list=LANG_LIST::DEFAULT) |
Static Public Member Functions | |
static bool | ConvertISO6391ToISO6392B (const std::string &strISO6391, std::string &strISO6392B, bool checkWin32Locales=false) |
Converts a language given as 2-Char (ISO 639-1) to a 3-Char (ISO 639-2/T) code. | |
static std::string | FindLanguageCodeWithSubtag (const std::string &str) |
Protected Types | |
typedef std::map< std::string, std::string > | STRINGLOOKUPTABLE |
Protected Member Functions | |
bool | LookupInUserMap (const std::string &code, std::string &desc) |
bool | ReverseLookup (const std::string &desc, std::string &code) |
Looks up the ISO 639-1, ISO 639-2/T, or ISO 639-2/B, whichever it finds first, code of the given english language name. | |
bool | LookupUserCode (const std::string &desc, std::string &userCode) |
Looks up the user defined code of the given code or language name. | |
Static Protected Member Functions | |
static std::string | CodeToString (long code) |
static bool | LookupInISO639Tables (const std::string &code, std::string &desc) |
static bool | LookupInLangAddons (const std::string &code, std::string &desc) |
Protected Attributes | |
STRINGLOOKUPTABLE | m_mapUser |
|
protected |
|
strong |
|
default |
|
default |
void CLangCodeExpander::Clear | ( | ) |
|
staticprotected |
bool CLangCodeExpander::CompareFullLanguageNames | ( | const std::string & | lang1, |
const std::string & | lang2 ) |
Determines if two english language names represent the same language.
[in] | lang1 | The first language string to compare given as english language name. |
[in] | lang2 | The second language string to compare given as english language name. |
bool CLangCodeExpander::CompareISO639Codes | ( | const std::string & | code1, |
const std::string & | code2 ) |
Determines if two languages given as ISO 639-1, ISO 639-2/T, or ISO 639-2/B codes represent the same language.
[in] | code1 | The first language to compare given as ISO 639-1, ISO 639-2/T, or ISO 639-2/B code. |
[in] | code2 | The second language to compare given as ISO 639-1, ISO 639-2/T, or ISO 639-2/B code. |
|
static |
Converts a language given as 2-Char (ISO 639-1) to a 3-Char (ISO 639-2/T) code.
[in] | strISO6391 | The language that should be converted. |
[out] | strISO6392B | The 3-Char (ISO 639-2/B) language code of the given language strISO6391. |
[in] | checkWin32Locales | Whether to also check WIN32 specific language codes. |
bool CLangCodeExpander::ConvertToISO6391 | ( | const std::string & | lang, |
std::string & | code ) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 2-Char (ISO 639-1) code.
[out] | code | The 2-Char language code of the given language lang. |
[in] | lang | The language that should be converted. |
std::string CLangCodeExpander::ConvertToISO6392B | ( | const std::string & | lang | ) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/B code.
[in] | lang | The language that should be converted. |
bool CLangCodeExpander::ConvertToISO6392B | ( | const std::string & | strCharCode, |
std::string & | strISO6392B, | ||
bool | checkWin32Locales = false ) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code.
[in] | strCharCode | The language that should be converted. |
[out] | strISO6392B | The 3-Char (ISO 639-2/B) language code of the given language strISO6391. |
[in] | checkWin32Locales | Whether to also check WIN32 specific language codes. |
std::string CLangCodeExpander::ConvertToISO6392T | ( | const std::string & | lang | ) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code.
[in] | lang | The language that should be converted. |
bool CLangCodeExpander::ConvertToISO6392T | ( | const std::string & | strCharCode, |
std::string & | strISO6392T, | ||
bool | checkWin32Locales = false ) |
Converts a language given as 2-Char (ISO 639-1), 3-Char (ISO 639-2/T or ISO 639-2/B), or full english name string to a 3-Char ISO 639-2/T code.
[in] | strCharCode | The language that should be converted. |
[out] | strISO6392T | The 3-Char (ISO 639-2/T) language code of the given language strISO6391. |
[in] | checkWin32Locales | Whether to also check WIN32 specific language codes. |
|
static |
std::vector< std::string > CLangCodeExpander::GetLanguageNames | ( | LANGFORMATS | format = ISO_639_1, |
LANG_LIST | list = LANG_LIST::DEFAULT ) |
void CLangCodeExpander::LoadUserCodes | ( | const TiXmlElement * | pRootElement | ) |
bool CLangCodeExpander::Lookup | ( | const std::string & | code, |
std::string & | desc ) |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
Looks up the user defined code of the given code or language name.
[in] | desc | The language code or name that should be converted. |
[out] | userCode | The user defined language code of the given language desc. |
|
protected |
Looks up the ISO 639-1, ISO 639-2/T, or ISO 639-2/B, whichever it finds first, code of the given english language name.
[in] | desc | The english language name for which a code is looked for. |
[out] | code | The ISO 639-1, ISO 639-2/T, or ISO 639-2/B code of the given language desc. |
|
protected |