Locale

Represents Discord's locale.

Attributes

name : str

The default name of the locale.

native_name : str

The native name of the language.

value : str

The Discord side identifier value of the locale.

Class Attributes

DEFAULT_NAME : str = 'Undefined'

The default name of the locales.

INSTANCES : dict of (str, Locale) items

Stores the predefined locales. This container is accessed when translating a Discord side identifier of a locale. The identifier value is used as a key to get it's wrapper side representation.

VALUE_TYPE : type = str

The locales' values' type.

Every predefined locale is also stored as a class attribute:

Type attribute nameNameValueNative name
bulgarianBulgarianbgбългарски
chinese_cnChinese (China)zh-CN中文
chinese_twChinese (Taiwan)zh-TW繁體中文
croatianCroatianhrHrvatski
czechCzechcsČeština
danishDanishdaDansk
dutchDutchnlNederlands
english_gbEnglish (Great Britain)en-GBEnglish, UK
english_usEnglish (United States)en-USEnglish, US
finnishFinnishfiSuomi
frenchFrenchfrFrançais
germanGermandeDeutsch
greekGreekelΕλληνικά
hindiHindihiहिन्दी
hungarianHungarianhuMagyar
indonesianIndonesianidBahasa Indonesia
italianItalianitItaliano
japaneseJapanesejp日本語
koreanKoreanko한국어
lithuanianLithuanianltLietuviškai
norwegianNorwegiannoNorsk
polishPolishplPolski
portuguesePortuguese, Brazilianpt-BRPortuguês do Brasil
romanianRomanian, RomaniaroRomână
russianRussianruPусский
spanishSpanishes-ESEspañol
spanish_laSpanish (Latin America)es-419Español, LATAM
swedishSwedishsv-SESvenska
thaiThaithไทย
turkishTurkishtrTürkçe
ukrainianUkrainianukУкраїнська
vietnameseVietnameseviTiếng Việt

Methods

__init__(value, name, native_name)

Creates an Locale and stores it at the class's .INSTANCES class attribute as well.

ParameterTypeDescription
value

int

The Discord side identifier value of the locale.

name

str

The default name of the locale.

native_name

str

The native name of the locale.

get(value)

Returns the value's representation. If the value is already preinstanced, returns that, else creates a new object.

ParameterTypeDescription
value

None, .VALUE_TYPE

The value to get it's representation.

Returns

obj_ : PreinstancedBase

_from_value(value)

Creates a new locale with the given value.

ParameterTypeDescription
value

int

The locale's identifier value.

Returns

self : Locale

The created instance.

__eq__()

Returns whether self's value equals to the other object's.

__ge__()

Returns whether self's value is greater or equal to the other object's.

__getattr__()

Drops a rich attribute error.

__gt__()

Returns whether self's value is greater than the other object's.

__hash__()

Returns the hash of the preinstanced object.

__le__()

Returns whether self's value is less or equal to the other object's.

__lt__()

Returns whether self's value is less than the other object's.

__ne__()

Returns whether self's not equals to the other object's.

__repr__()

Returns the representation of the preinstanced object.