LangTag.Tag¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class LangTag.Tag¶
All the fields in the
LangTag.Tag
structure are private to theLangTag.Tag
implementation.- classmethod convert_from_locale(error)¶
- Parameters:
error (
LangTag.Error
orNone
) – aLangTag.Error
.- Returns:
a
LangTag.Tag
,None
if fails.- Return type:
Convert current locale to the language tag.
- classmethod convert_from_locale_string(locale, error)¶
- Parameters:
locale (
str
) – a locale stringerror (
LangTag.Error
orNone
) – aLangTag.Error
orNone
.
- Returns:
a
LangTag.Tag
,None
if fails.- Return type:
Convert locale to the language tag.
- classmethod new()¶
- Returns:
a new instance of
LangTag.Tag
.- Return type:
Create a new instance of
LangTag.Tag
.
- canonicalize(error)¶
- Parameters:
error (
LangTag.Error
orNone
) – aLangTag.Error
orNone
.- Returns:
a language tag string.
- Return type:
Canonicalize the language tag according to various information of subtags.
- canonicalize_in_extlang_form(error)¶
- Parameters:
error (
LangTag.Error
orNone
) – aLangTag.Error
orNone
.- Returns:
a language tag string.
- Return type:
Canonicalize the language tag in the extlang form according to various information of subtags.
- clear()¶
(Re-)Initialize all of the subtag information stored in self.
- compare(v2)¶
- Parameters:
v2 (
LangTag.Tag
) – aLangTag.Tag
.- Returns:
- Return type:
Compare if self and v2 is the same object or not.
- convert_to_locale(error)¶
- Parameters:
error (
LangTag.Error
orNone
) – aLangTag.Error
orNone
.- Returns:
a locale string or
None
if fails- Return type:
Convert the language tag to the locale.
- copy()¶
- Returns:
a new instance of
LangTag.Tag
orNone
if fails.- Return type:
Create a copy instance of self.
- dump()¶
Dumps the container information to the standard output.
- get_extension()¶
- Returns:
- Return type:
Obtain a
LangTag.Extension
instance in self.
- get_extlang()¶
- Returns:
- Return type:
Obtain a
LangTag.Extlang
instance in self.
- get_grandfathered()¶
- Returns:
- Return type:
Obtain a
LangTag.Grandfathered
instance in self.
- get_language()¶
- Returns:
a
LangTag.Lang
.- Return type:
Obtain a
LangTag.Lang
instance in self.
- get_privateuse()¶
- Returns:
- Return type:
Obtain a
LangTag.String
instance in self.
- get_region()¶
- Returns:
- Return type:
Obtain a
LangTag.Region
instance in self.
- get_script()¶
- Returns:
- Return type:
Obtain a
LangTag.Script
instance in self.
- get_string_with_filter(filter)¶
- Parameters:
filter (
int
) – a binary count sequence of #lt_tag_filter_t.- Returns:
a language tag string.
- Return type:
Obtains a language tag in string against filter.
- get_variants()¶
- Returns:
a
LangTag.List
containingLangTag.Variant
.- Return type:
Obtain a list of
LangTag.Variant
instance in self.
- lookup(pattern, error)¶
- Parameters:
pattern (
str
) – a language range string.error (
LangTag.Error
orNone
) – aLangTag.Error
orNone
.
- Returns:
a language tag string if any matches, otherwise
None
.- Return type:
Lookup the language tag that self meets with pattern. Any of subtags in pattern is allowed to use the wildcard according to the syntax in RFC 4647.
- match(v2, error)¶
- Parameters:
v2 (
str
) – a language range string.error (
LangTag.Error
orNone
) – aLangTag.Error
orNone
.
- Returns:
- Return type:
Try matching of self and v2. any of subtags in v2 is allowed to use the wildcard according to the syntax in RFC 4647.
- parse(tag_string, error)¶
- Parameters:
tag_string (
str
) – language tag to be parsed.error (
LangTag.Error
orNone
) – aLangTag.Error
orNone
.
- Returns:
- Return type:
Parse tag_string and create appropriate instances for subtags.
- parse_with_extra_token(tag_string, error)¶
- Parameters:
tag_string (
str
) – a language tag to be parsed much more.error (
LangTag.Error
orNone
) – aLangTag.Error
orNone
.
- Returns:
- Return type:
Continue to parse a language tag with tag_string. please use
LangTag.Tag.parse
() at first.
- ref()¶
- Returns:
the same self object.
- Return type:
Increases the reference count of self.
- transform(error)¶
- Parameters:
error (
LangTag.Error
) –- Return type:
- truncate(error)¶
- Parameters:
error (
LangTag.Error
) –- Return type:
- unref()¶
Decreases the reference count of self. when its reference count drops to 0, the object is finalized (i.e. its memory is freed).