mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 09:56:05 -05:00
[V3 i18n] Internationalise help for commands and cogs (#1143)
* Framework for internationalised command help * Translator for class docstring of cog * Remove references to old context module * Use CogManagerUI as PoC * Replace all references to RedContext * Rename CogI18n object to avoid confusion * Update docs * Update i18n docs. * Store translators in list instead of dict * Change commands module to package, updated refs in cogs * Updated docs and more references in cogs * Resolve syntax error * Update from merge
This commit is contained in:
@@ -13,11 +13,12 @@ Basic Usage
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from discord.ext import commands
|
||||
from redbot.core.i18n import CogI18n
|
||||
from redbot.core import commands
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
|
||||
_ = CogI18n("ExampleCog", __file__)
|
||||
_ = Translator("ExampleCog", __file__)
|
||||
|
||||
@cog_i18n(_)
|
||||
class ExampleCog:
|
||||
"""description"""
|
||||
|
||||
@@ -39,16 +40,19 @@ In a command prompt in your cog's package (where yourcog.py is),
|
||||
create a directory called "locales".
|
||||
Then do one of the following:
|
||||
|
||||
Windows: :code:`python <your python install path>\Tools\i18n\pygettext.py -n -p locales`
|
||||
Windows: :code:`python <your python install path>\Tools\i18n\pygettext.py -D -n -p locales`
|
||||
|
||||
Mac: ?
|
||||
|
||||
Linux: :code:`pygettext3 -n -p locales`
|
||||
Linux: :code:`pygettext3 -D -n -p locales`
|
||||
|
||||
This will generate a messages.pot file with strings to be translated
|
||||
This will generate a messages.pot file with strings to be translated, including
|
||||
docstrings.
|
||||
|
||||
-------------
|
||||
API Reference
|
||||
-------------
|
||||
|
||||
.. automodule:: redbot.core.i18n
|
||||
.. automodule:: redbot.core.i18n
|
||||
:members:
|
||||
:special-members: __call__
|
||||
|
||||
Reference in New Issue
Block a user