From cc21872072b5fde6bbc1470c441f4a416bc7b73e Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 23 Feb 2022 08:41:50 -0500 Subject: [PATCH] Add Locale enum --- discord/enums.py | 37 ++++++++++++++ docs/api.rst | 127 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) diff --git a/discord/enums.py b/discord/enums.py index 82e9163c6..4488198a8 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -57,6 +57,7 @@ __all__ = ( 'InteractionResponseType', 'NSFWLevel', 'MFALevel', + 'Locale', ) @@ -615,6 +616,42 @@ class MFALevel(Enum, comparable=True): require_2fa = 1 +class Locale(Enum): + american_english = 'en-US' + british_english = 'en-GB' + bulgarian = 'bg' + chinese = 'zh-CN' + taiwan_chinese = 'zh-TW' + croatian = 'hr' + czech = 'cs' + danish = 'da' + dutch = 'nl' + finnish = 'fi' + french = 'fr' + german = 'de' + greek = 'el' + hindi = 'hi' + hungarian = 'hu' + italian = 'it' + japanese = 'ja' + korean = 'ko' + lithuanian = 'lt' + norwegian = 'no' + polish = 'pl' + brazil_portuguese = 'pt-BR' + Romanian = 'ro' + Russian = 'ru' + spain_spanish = 'es-ES' + swedish = 'sv-SE' + thai = 'th' + turkish = 'tr' + ukrainian = 'uk' + vietnamese = 'vi' + + def __str__(self) -> str: + return self.value + + E = TypeVar('E', bound='Enum') diff --git a/docs/api.rst b/docs/api.rst index c7132313e..284d0d311 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -2648,6 +2648,133 @@ of :class:`enum.Enum`. The guild may contain NSFW content. +.. class:: Locale + + Supported locales by Discord. Mainly used for application command localisation. + + .. versionadded:: 2.0 + + .. attribute:: american_english + + The ``en-US`` locale. + + .. attribute:: british_english + + The ``en-GB`` locale. + + .. attribute:: bulgarian + + The ``bg`` locale. + + .. attribute:: chinese + + The ``zh-CN`` locale. + + .. attribute:: taiwan_chinese + + The ``zh-TW`` locale. + + .. attribute:: croatian + + The ``hr`` locale. + + .. attribute:: czech + + The ``cs`` locale. + + .. attribute:: danish + + The ``da`` locale. + + .. attribute:: dutch + + The ``nl`` locale. + + .. attribute:: finnish + + The ``fi`` locale. + + .. attribute:: french + + The ``fr`` locale. + + .. attribute:: german + + The ``de`` locale. + + .. attribute:: greek + + The ``el`` locale. + + .. attribute:: hindi + + The ``hi`` locale. + + .. attribute:: hungarian + + The ``hu`` locale. + + .. attribute:: italian + + The ``it`` locale. + + .. attribute:: japanese + + The ``ja`` locale. + + .. attribute:: korean + + The ``ko`` locale. + + .. attribute:: lithuanian + + The ``lt`` locale. + + .. attribute:: norwegian + + The ``no`` locale. + + .. attribute:: polish + + The ``pl`` locale. + + .. attribute:: brazil_portuguese + + The ``pt-BR`` locale. + + .. attribute:: Romanian + + The ``ro`` locale. + + .. attribute:: Russian + + The ``ru`` locale. + + .. attribute:: spain_spanish + + The ``es-ES`` locale. + + .. attribute:: swedish + + The ``sv-SE`` locale. + + .. attribute:: thai + + The ``th`` locale. + + .. attribute:: turkish + + The ``tr`` locale. + + .. attribute:: ukrainian + + The ``uk`` locale. + + .. attribute:: vietnamese + + The ``vi`` locale. + + .. class:: MFALevel Represents the Multi-Factor Authentication requirement level of a guild.