From 7b2a16a7c7cea4b3eff3c0384ccfd89b5855c9e9 Mon Sep 17 00:00:00 2001 From: fantasy0x1 Date: Thu, 3 Jul 2025 11:20:23 -0300 Subject: [PATCH] docs(locale): document fallback behavior for language_code property --- discord/enums.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/discord/enums.py b/discord/enums.py index 2a70cb5ab..acc780120 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -772,6 +772,9 @@ class Locale(Enum): 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)