Add initial support for app command localisation

This commit is contained in:
Rapptz
2022-08-02 10:05:32 -04:00
parent eb3bc7102b
commit 2d586ae805
16 changed files with 663 additions and 91 deletions

View File

@ -377,7 +377,7 @@ Enumerations
A message context menu command.
.. class:: AppCommandPermissionType
The application command's permission type.
.. versionadded:: 2.0
@ -596,6 +596,52 @@ Range
.. autoclass:: discord.app_commands.Range
:members:
Translations
~~~~~~~~~~~~~
Translator
+++++++++++
.. attributetable:: discord.app_commands.Translator
.. autoclass:: discord.app_commands.Translator
:members:
locale_str
+++++++++++
.. attributetable:: discord.app_commands.locale_str
.. autoclass:: discord.app_commands.locale_str
:members:
TranslationContext
+++++++++++++++++++
.. class:: TranslationContext
:module: discord.app_commands
An enum representing the context that the translation occurs in when requested for translation.
.. versionadded:: 2.0
.. attribute:: command_name
The translation involved a command name.
.. attribute:: command_description
The translation involved a command description.
.. attribute:: parameter_name
The translation involved a parameter name.
.. attribute:: parameter_description
The translation involved a parameter description.
.. attribute:: choice_name
The translation involved a choice name.
Exceptions
~~~~~~~~~~~
@ -608,6 +654,9 @@ Exceptions
.. autoexception:: discord.app_commands.TransformerError
:members:
.. autoexception:: discord.app_commands.TranslationError
:members:
.. autoexception:: discord.app_commands.CheckFailure
:members:
@ -653,6 +702,7 @@ Exception Hierarchy
- :exc:`~discord.app_commands.AppCommandError`
- :exc:`~discord.app_commands.CommandInvokeError`
- :exc:`~discord.app_commands.TransformerError`
- :exc:`~discord.app_commands.TranslationError`
- :exc:`~discord.app_commands.CheckFailure`
- :exc:`~discord.app_commands.NoPrivateMessage`
- :exc:`~discord.app_commands.MissingRole`