Repository: ManimCommunity/manim

Issue:
Prepare documentation for translation
We should look into setting up https://www.sphinx-doc.org/en/master/usage/advanced/intl.html and document the steps required for adding translations.


Discussion:
Since I'm in Software Internationalization class in my university, I would like to help with this. Could help me with studies :)
I am assigning you @JPTIZ 
I also want to help with this issue. I can manage servers and software things if you want (even though you may be more qualified to do this than me). I've looked around and found Pootle software that made possible community translation (without spending a penny). What do you think of this ? Do you have other plans ?
I don't think we have decided upon what tools or frameworks we will use.

Could you please write a short blurb of why we should use Pootle instead of any other tools?

I suggest @MysaaJava and @JPTIZ work in tandem over discord :) 
Thanks a lot for the assign (and the help wish)!

@leotrs Okay :) Just joined the discord server. 
Pootle is only an interface for the translation. It is not part of the source code. It is sphynx that will manage the translated docs, pootle will only be a web UI for translating .pot files (untranslated) to .po files (translated in one language). 

Why pootle ? Because it is free unlike many translation interfaces, and it is the one that sphynx proposes on its [Documentation about translation](https://www.sphinx-doc.org/en/master/usage/advanced/intl.html).
The workflow is described on the page, through this drawing ![Screenshot_20201008-143432_Firefox.jpg](https://user-images.githubusercontent.com/33335046/95459096-7001fe80-0973-11eb-968b-3fe08474fca6.jpg)
Again, there is no need for choosing another framework as sphinx already supports internationalization. We only need to setup a web UI in order to make the translating process easier for community translators.

(JPITZ what is your discord name ?)
> (JPITZ what is your discord name ?)

Just renamed myself to `jptiz` there to make things easier :)
Yeah, if this is what is supported and recommended by sphinx then we should use this.
Any updates on this? Eager to see the translation move forward :) 
Well, i'm experimenting with the pootle server. The docs build fine with multiple languages and pootle seems to be usable.
I understood how to make translations on readTheDocs, see [My clone of the docs](https://manimdummyforintl.readthedocs.io/en/latest/), you can change the languages between english and french (i only translated the first paragraph into french). You can look at the [internationalization branch of my personnal fork](https://github.com/MysaaJava/manim/tree/internationalization) if you want to check.

The last think i have to do is to link pootle with github, so pootle will be aware of github pushes, and github aware of pootle new translations. I also need to find a host for the pootle server (i can do it, but i don't have a very stable internet connection), but i will address this issue on Discord.

Also feel free do DM or ping mi if you want updates, or have questions
Thanks a ton @MysaaJava, all your efforts do not go unnoticed. Please let us know if there's anything we need to setup on the GitHub side to keep moving this forward.

Also, the hosting for the pootle server sounds like a devops task to me #622. Cc @cobordism does the www.manim.community domain come with hosting? Or could we use github pages somehow?

Updates, we may be able to use transifex, which is a paid service, but is free for open-source projects.
I made a copy (not a fork) of manim community on which i will try to setup transifex. I also need to see if people can do anonymous translations.
I'll also write something in the docs, on the contribute page, to explain how to help with translating.

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -71,6 +71,16 @@
 
 exclude_patterns = []
 
+# -- Options for internationalization ----------------------------------------
+# Set the destination directory of the localized po files
+locale_dirs = ["../i18n/"]
+
+# Splits the text in more pot files.
+gettext_compact = False
+
+# Remove useless metadata from po files.
+gettext_last_translator = ""
+gettext_language_team = ""
 
 # -- Options for HTML output -------------------------------------------------
 


Test patch:
diff --git a/docs/i18n/en/LC_MESSAGES/contributing/testing.po b/docs/i18n/en/LC_MESSAGES/contributing/testing.po
new file mode 100644
--- /dev/null
+++ b/docs/i18n/en/LC_MESSAGES/contributing/testing.po
@@ -0,0 +1,328 @@
+
+msgid ""
+msgstr ""
+"Project-Id-Version: Manim \n"
+"POT-Creation-Date: 2021-09-16 14:16+0200\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 2.9.1\n"
+
+#: ../../source/contributing/testing.rst:3
+msgid "Adding Tests"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:4
+msgid ""
+"If you are adding new features to manim, you should add appropriate tests"
+" for them. Tests prevent manim from breaking at each change by checking "
+"that no other feature has been broken and/or been unintentionally "
+"modified."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:9
+msgid "How Manim tests"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:11
+msgid ""
+"Manim uses pytest as its testing framework. To start the testing process,"
+" go to the root directory of the project and run pytest in your terminal."
+" Any errors that occur during testing will be displayed in the terminal."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:15
+msgid "Some useful pytest flags:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:17
+msgid "``-x`` will make pytest stop at the first failure it encounters"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:19
+msgid ""
+"``-s`` will make pytest display all the print messages (including those "
+"during scene generation, like DEBUG messages)"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:21
+msgid "``--skip_slow`` will skip the (arbitrarily) slow tests"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:23
+msgid ""
+"``--show_diff`` will show a visual comparison in case a unit test is "
+"failing."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:27
+msgid "How it Works"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:29
+msgid "At the moment there are three types of tests:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:31
+msgid "Unit Tests:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:33
+msgid ""
+"Tests for most of the basic functionalities of manim. For example, there "
+"a test for ``Mobject``, that checks if it can be added to a Scene, etc."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:36
+msgid ""
+"Graphical unit tests: Because ``manim`` is a graphics library, we test "
+"frames. To do so, we create test scenes that render a specific feature. "
+"When pytest runs, it compares the result of the test to the control data,"
+" either at 6 fps or just the last frame. If it matches, the tests pass. "
+"If the test and control data differ, the tests fail. You can use "
+"``--show_diff`` flag with ``pytest`` to visually see the differences."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:42
+msgid "Videos format tests:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:44
+msgid ""
+"As Manim is a video library, we have to test videos as well. "
+"Unfortunately, we cannot directly test video content as rendered videos "
+"can differ slightly depending on the system (for reasons related to "
+"ffmpeg). Therefore, we only compare video configuration values, exported "
+"in .json."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:51
+msgid "Architecture"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:53
+msgid "The ``manim/tests`` directory looks like this:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:122
+msgid "The Main Directories"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:124
+msgid "``control_data/``:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:126
+msgid ""
+"The directory containing control data. "
+"``control_data/graphical_units_data/`` contains the expected and correct "
+"frame data for graphical tests, and ``control_data/videos_data/`` "
+"contains the .json files used to check videos."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:129
+msgid "``test_graphical_units/``:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:131
+msgid "Contains graphical tests."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:133
+msgid "``test_scene_rendering/``:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:135
+msgid ""
+"For tests that need to render a scene in some way, such as tests for CLI "
+"flags (end-to-end tests)."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:138
+msgid "``utils/``:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:140
+msgid "Useful internal functions used by pytest."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:142
+msgid "fixtures are not contained here, they are in ``conftest.py``."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:144
+msgid "``helpers/``:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:146
+msgid "Helper functions for developers to setup graphical/video tests."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:149
+msgid "Adding a New Test"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:152
+msgid "Unit Tests"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:154
+msgid ""
+"Pytest determines which functions are tests by searching for files whose "
+"names begin with \"test\\_\", and then within those files for functions "
+"beginning with \"test\" and classes beginning with \"Test\". These kinds "
+"of tests must be in ``tests/`` (e.g. ``tests/test_container.py``)."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:160
+msgid "Graphical Unit Test"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:162
+msgid ""
+"The test must be written in the correct file (i.e. the file that "
+"corresponds to the appropriate category the feature belongs to) and "
+"follow the structure of unit tests."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:165
+msgid ""
+"For example, to test the ``Circle`` VMobject which resides in "
+"``manim/mobject/geometry.py``, add the CircleTest to "
+"``test/test_geometry.py``."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:169
+msgid ""
+"The name of the module is indicated by the variable __module_test__, that"
+" **must** be declared in any graphical test file. The module name is used"
+" to store the graphical control data."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:172
+msgid ""
+"You will need to use the ``frames_comparison`` decorator to create a "
+"test. The test function **must** accept a parameter named ``scene`` that "
+"will be used like ``self`` in a standard ``construct`` method."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:175
+msgid "Here's an example in ``test_geometry.py``:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:190
+msgid ""
+"The decorator can be used with or without parentheses. **By default, the "
+"test only tests the last frame. To enable multi-frame testing, you have "
+"to set ``last_frame=False`` in the parameters.**"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:199
+msgid ""
+"You can also specify, when needed, which base scene you need "
+"(ThreeDScene, for example) :"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:208
+msgid "Feel free to check the documentation of ``@frames_comparison`` for more."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:210
+msgid ""
+"Note that tests name must follow the syntax ``test_<thing_to_test>``, "
+"otherwise pytest will not recognize it as a test."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:213
+msgid ""
+"If you run pytest now, you will get a ``FileNotFound`` error. This is "
+"because you have not created control data for your test."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:216
+msgid ""
+"To create the control data for your test, you have to use the flag "
+"``--set_test`` along with pytest. For the example above, it would be"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:223
+msgid "(``-s`` is here to see manim logs, so you can see what's going on)."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:225
+msgid ""
+"Please make sure to add the control data to git as soon as it is produced"
+" with ``git add <your-control-data.npz>``."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:229
+msgid "Videos tests"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:231
+msgid ""
+"To test videos generated, we use the decorator "
+"``tests.utils.videos_tester.video_comparison``:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:254
+msgid ""
+"``assert exit*\\ code == 0, err`` is used in case of the command fails to"
+" run. The decorator takes two arguments: json name and the path to where "
+"the video should be generated, starting from the ``media/`` dir."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:258
+msgid "Note the fixtures here:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:260
+msgid ""
+"tmp_path is a pytest fixture to get a tmp_path. Manim will output here, "
+"according to the flag ``--media_dir``."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:262
+msgid ""
+"``manim_cfg_file`` fixture that return a path pointing to "
+"``test_scene_rendering/standard_config.cfg``. It's just to shorten the "
+"code, in the case multiple tests need to use this cfg file."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:264
+msgid ""
+"``simple_scenes_path`` same as above, except for "
+"``test_scene_rendering/simple_scene.py``"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:266
+msgid ""
+"You have to generate a ``.json`` file first to be able to test your "
+"video. To do that, use ``helpers.save_control_data_from_video``."
+msgstr ""
+
+#: ../../source/contributing/testing.rst:269
+msgid ""
+"For instance, a test that will check if the l flag works properly will "
+"first require rendering a video using the -l flag from a scene. Then we "
+"will test (in this case, SquareToCircle), that lives in "
+"``test_scene_rendering/simple_scene.py``. Change directories to "
+"``tests/``, create a file (e.g. ``create\\_data.py``) that you will "
+"remove as soon as you're done. Then run:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:280
+msgid ""
+"Running this will save "
+"``control_data/videos_data/SquareToCircleWithlFlag.json``, which will "
+"look like this:"
+msgstr ""
+
+#: ../../source/contributing/testing.rst:298
+msgid ""
+"If you have any questions, please don't hesitate to ask on `Discord "
+"<https://www.manim.community/discord/>`_, in your pull request, or in an "
+"issue."
+msgstr ""
+
+