API Reference
Classes
- class disnake.ext.fluent.FluentStore(*, strict: bool = False, default_language: str = 'en-US', functions: Dict[str, Callable[[...], ReturnT]] | None = None)
disnake.LocalizationProtocol
implementation for Fluent.Attributes
- CACHE_BY_DEFAULT: ClassVar[
str
] Controls the default value for
cache
inl10n()
. Does not affect caching of static-by-definition keys like application commands’ names/descriptions. Defaults toFalse
.
Parameters
- strict:
bool
If
True
, the store will raisedisnake.LocalizationKeyError
if a key or locale is not found.- default_language:
str
The “fallback” language to use if localization for the desired languages is not found. Defaults to
"en-US"
.
New in version 0.1.0.
- get(key: str) Dict[str, str] | None
Localization retriever for disnake. You should use
l10n()
instead.Parameters
- key:
str
The lookup key.
Raises
- LocalizationKeyError
No localizations for the provided key were found.
Returns
- key:
- load(path: str | os.PathLike[Any]) None
Initialize all internal attributes.
path must point to a directory structured as per Fluent’s guidelines.
Parameters
- path: Union[
str
,os.PathLike
] The path to the Fluent localization directory to load.
Raises
- RuntimeError
The provided path is invalid or couldn’t be loaded
- path: Union[
- CACHE_BY_DEFAULT: ClassVar[
Fluent Types
Re-exports from fluent.runtime
- disnake.ext.fluent.fluent_date(dt: date | datetime | FluentDateType | FluentNone, **kwargs: Any) FluentDateType | FluentNone
See Using fluent.runtime.
- disnake.ext.fluent.fluent_number(number: int | float | Decimal | FluentNumber | FluentNone, **kwargs: Any) FluentNumber | FluentNone
See Using fluent.runtime.
- class disnake.ext.fluent.FluentDate
See Using fluent.runtime.
- class disnake.ext.fluent.FluentDateTime
See Using fluent.runtime.
- class disnake.ext.fluent.FluentDecimal(value: int | float | Decimal | FluentNumber, **kwargs: Any)
See Using fluent.runtime.
- class disnake.ext.fluent.FluentFloat(value: int | float | Decimal | FluentNumber, **kwargs: Any)
See Using fluent.runtime.
- class disnake.ext.fluent.FluentInt(value: int | float | Decimal | FluentNumber, **kwargs: Any)
See Using fluent.runtime.
- class disnake.ext.fluent.FluentNone(name: str | None = None)
See Using fluent.runtime.
- class disnake.ext.fluent.FluentNumber(value: int | float | Decimal | FluentNumber, **kwargs: Any)
See Using fluent.runtime.