From afc30dd1c3cb32a369d73744fe35c758236f2309 Mon Sep 17 00:00:00 2001 From: palmtree5 <3577255+palmtree5@users.noreply.github.com> Date: Sun, 22 Oct 2017 17:24:24 -0800 Subject: [PATCH] [V3 Docs] Add docs on i18n (#1030) --- docs/framework_i18n.rst | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 docs/framework_i18n.rst diff --git a/docs/framework_i18n.rst b/docs/framework_i18n.rst new file mode 100644 index 000000000..590d57305 --- /dev/null +++ b/docs/framework_i18n.rst @@ -0,0 +1,54 @@ +.. i18n framework reference + +.. role:: python(code) + :language: python + +============================== +Internationalization Framework +============================== + +----------- +Basic Usage +----------- + +.. code-block:: python + + from discord.ext import commands + from redbot.core.i18n import CogI18n + + _ = CogI18n("ExampleCog", __file__) + + class ExampleCog: + """description""" + + @commands.command() + async def mycom(self, ctx): + """command description""" + await ctx.send(_("This is a test command")) + +-------- +Tutorial +-------- + +After making your cog, generate a :code:`messages.pot` file + +The process of generating this will depend on the operating system +you are using + +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 \Tools\i18n\pygettext.py -n -p locales` + +Mac: ? + +Linux: :code:`pygettext3 -n -p locales` + +This will generate a messages.pot file with strings to be translated + +------------- +API Reference +------------- + +.. automodule:: redbot.core.i18n \ No newline at end of file