鏡花水月
5 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
48 additions and
0 deletions
-
discord/enums.py
|
|
@ -21,6 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
|
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
|
|
DEALINGS IN THE SOFTWARE. |
|
|
|
""" |
|
|
|
|
|
|
|
from __future__ import annotations |
|
|
|
|
|
|
|
import types |
|
|
@ -694,6 +695,42 @@ class MFALevel(Enum, comparable=True): |
|
|
|
require_2fa = 1 |
|
|
|
|
|
|
|
|
|
|
|
_UNICODE_LANG_MAP: Dict[str, str] = { |
|
|
|
'bg': 'bg-BG', |
|
|
|
'zh-CN': 'zh-CN', |
|
|
|
'zh-TW': 'zh-TW', |
|
|
|
'hr': 'hr-HR', |
|
|
|
'cs': 'cs-CZ', |
|
|
|
'da': 'da-DK', |
|
|
|
'nl': 'nl-NL', |
|
|
|
'en-US': 'en-US', |
|
|
|
'en-GB': 'en-GB', |
|
|
|
'fi': 'fi-FI', |
|
|
|
'fr': 'fr-FR', |
|
|
|
'de': 'de-DE', |
|
|
|
'el': 'el-GR', |
|
|
|
'hi': 'hi-IN', |
|
|
|
'hu': 'hu-HU', |
|
|
|
'id': 'id-ID', |
|
|
|
'it': 'it-IT', |
|
|
|
'ja': 'ja-JP', |
|
|
|
'ko': 'ko-KR', |
|
|
|
'lt': 'lt-LT', |
|
|
|
'no': 'no-NO', |
|
|
|
'pl': 'pl-PL', |
|
|
|
'pt-BR': 'pt-BR', |
|
|
|
'ro': 'ro-RO', |
|
|
|
'ru': 'ru-RU', |
|
|
|
'es-ES': 'es-ES', |
|
|
|
'es-419': 'es-419', |
|
|
|
'sv-SE': 'sv-SE', |
|
|
|
'th': 'th-TH', |
|
|
|
'tr': 'tr-TR', |
|
|
|
'uk': 'uk-UA', |
|
|
|
'vi': 'vi-VN', |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class Locale(Enum): |
|
|
|
american_english = 'en-US' |
|
|
|
british_english = 'en-GB' |
|
|
@ -731,6 +768,17 @@ class Locale(Enum): |
|
|
|
def __str__(self) -> str: |
|
|
|
return self.value |
|
|
|
|
|
|
|
@property |
|
|
|
def language_code(self) -> str: |
|
|
|
""":class:`str`: Returns the locale's BCP 47 language code in the format of ``language-COUNTRY``. |
|
|
|
|
|
|
|
This is derived from a predefined mapping based on Discord's supported locales. |
|
|
|
If no mapping exists for the current locale, this returns the raw locale value as a fallback. |
|
|
|
|
|
|
|
.. versionadded:: 2.6 |
|
|
|
""" |
|
|
|
return _UNICODE_LANG_MAP.get(self.value, self.value) |
|
|
|
|
|
|
|
|
|
|
|
E = TypeVar('E', bound='Enum') |
|
|
|
|
|
|
|