Open rumia0601 opened 4 years ago
Good idea.
One issue we need to think about is older URLs. How do we make sure the old web based URLs are redirected to the new ones? Can the Sphinx tool do this, or do we need to do this ourselves somehow. If Sphinx can't do this, we could add some redirects on the website. But we'd need a mapping of old_url -> new_url.
How do different languages folders fit in here? Is there a Sphinx recommended way to do this? What are other projects doing? tut/en, tut/ko, tut/no etc?
What about ordering by topic instead? From a users perspective it may be nicer.
Currently docs/reST/tut/ has these files in there. Note all the image files.
CameraIntro.rst
ChimpLineByLine.rst
DisplayModes.rst
ImportInit.rst
MakeGames.rst
MoveIt.rst
PygameIntro.rst
SpriteIntro.rst
SurfarrayIntro-rest
SurfarrayIntro.rst
camera_average.jpg
camera_background.jpg
camera_green.jpg
camera_hsv.jpg
camera_mask.jpg
camera_rgb.jpg
camera_thresh.jpg
camera_thresholded.jpg
camera_yuv.jpg
chimp.py.rst
chimpshot.gif
common.txt
intro_ball.gif
intro_blade.jpg
intro_freedom.jpg
newbieguide.rst
surfarray.png
surfarray_allblack.png
surfarray_flipped.png
surfarray_redimg.png
surfarray_rgbarray.png
surfarray_scaledown.png
surfarray_scaleup.png
surfarray_soften.png
surfarray_striped.png
surfarray_xfade.png
tom_basic.png
tom_event-flowchart.png
tom_formulae.png
tom_games2.rst
tom_games3.rst
tom_games4.rst
tom_games5.rst
tom_games6.rst
tom_radians.png
MyreMylarLa on discord mentioned this extension: https://github.com/sphinx-contrib/redirects This requires Javascript however.
We need a sphinx native extension(like 'redirects'), and a mapping for the website.
There is an internationalization guide for sphinx. http://www.sphinx-doc.org/en/master/usage/advanced/intl.html
However this works on translatable strings instead. I don't think it's suitable for whole tutorial documents.
Here's how the pygame zero does it: https://pygame-zero.readthedocs.io/en/stable/contributing.html#translating They have one github repository per translation, using a fork model, and link to the other translations from the main english translation.
I'm not sure how successful that worked out, because I can't see any translations linked there yet. It's not clear how to find the other translations.
Additionally, some content is original in languages other than English. I'm not sure how this model would support this. For example: there are Polish, German, and soon Korean articles that don't exist in English.
Mu-editor has "Internationalisation of Mu" https://mu.readthedocs.io/en/latest/translations.html
However, it doesn't seem to be a very good idea for tutorials and long form documents.
Folder structure now:
11:52:32-rene~/dev/pygame/pygame/docs/reST (master)$ tree
.
โโโ Makefile
โโโ _static
โย ย โโโ pygame.ico
โย ย โโโ pygame_tiny.png
โย ย โโโ reset.css
โย ย โโโ tooltip.css
โโโ _templates
โย ย โโโ header.h
โย ย โโโ sourcelink.html
โโโ c_api
โย ย โโโ base.rst
โย ย โโโ bufferproxy.rst
โย ย โโโ cdrom.rst
โย ย โโโ color.rst
โย ย โโโ display.rst
โย ย โโโ event.rst
โย ย โโโ freetype.rst
โย ย โโโ mixer.rst
โย ย โโโ rect.rst
โย ย โโโ rwobject.rst
โย ย โโโ slots.rst
โย ย โโโ surface.rst
โย ย โโโ surflock.rst
โย ย โโโ version.rst
โโโ c_api.rst
โโโ common.txt
โโโ conf.py
โโโ ext
โย ย โโโ __init__.py
โย ย โโโ boilerplate.py
โย ย โโโ customversion.py
โย ย โโโ edit_on_github.py
โย ย โโโ headers.py
โย ย โโโ indexer.py
โย ย โโโ utils.py
โโโ filepaths.rst
โโโ index.rst
โโโ ref
โย ย โโโ bufferproxy.rst
โย ย โโโ camera.rst
โย ย โโโ cdrom.rst
โย ย โโโ code_examples
โย ย โย ย โโโ draw_module_example.png
โย ย โย ย โโโ draw_module_example.py
โย ย โย ย โโโ joystick_calls.png
โย ย โย ย โโโ joystick_calls.py
โย ย โโโ color.rst
โย ย โโโ common.txt
โย ย โโโ cursors.rst
โย ย โโโ display.rst
โย ย โโโ draw.rst
โย ย โโโ event.rst
โย ย โโโ examples.rst
โย ย โโโ font.rst
โย ย โโโ freetype.rst
โย ย โโโ gfxdraw.rst
โย ย โโโ image.rst
โย ย โโโ joystick.rst
โย ย โโโ key.rst
โย ย โโโ locals.rst
โย ย โโโ mask.rst
โย ย โโโ math.rst
โย ย โโโ midi.rst
โย ย โโโ mixer.rst
โย ย โโโ mouse.rst
โย ย โโโ music.rst
โย ย โโโ overlay.rst
โย ย โโโ pixelarray.rst
โย ย โโโ pixelcopy.rst
โย ย โโโ pygame.rst
โย ย โโโ rect.rst
โย ย โโโ scrap.rst
โย ย โโโ sndarray.rst
โย ย โโโ sprite.rst
โย ย โโโ surface.rst
โย ย โโโ surfarray.rst
โย ย โโโ tests.rst
โย ย โโโ time.rst
โย ย โโโ touch.rst
โย ย โโโ transform.rst
โโโ themes
โย ย โโโ classic
โย ย โโโ elements.html
โย ย โโโ page.html
โย ย โโโ static
โย ย โย ย โโโ pygame.css_t
โย ย โโโ theme.conf
โโโ tut
โโโ CameraIntro.rst
โโโ ChimpLineByLine.rst
โโโ DisplayModes.rst
โโโ ImportInit.rst
โโโ MakeGames.rst
โโโ MoveIt.rst
โโโ PygameIntro.rst
โโโ SpriteIntro.rst
โโโ SurfarrayIntro-rest
โโโ SurfarrayIntro.rst
โโโ camera_average.jpg
โโโ camera_background.jpg
โโโ camera_green.jpg
โโโ camera_hsv.jpg
โโโ camera_mask.jpg
โโโ camera_rgb.jpg
โโโ camera_thresh.jpg
โโโ camera_thresholded.jpg
โโโ camera_yuv.jpg
โโโ chimp.py.rst
โโโ chimpshot.gif
โโโ common.txt
โโโ intro_ball.gif
โโโ intro_blade.jpg
โโโ intro_freedom.jpg
โโโ newbieguide.rst
โโโ surfarray.png
โโโ surfarray_allblack.png
โโโ surfarray_flipped.png
โโโ surfarray_redimg.png
โโโ surfarray_rgbarray.png
โโโ surfarray_scaledown.png
โโโ surfarray_scaleup.png
โโโ surfarray_soften.png
โโโ surfarray_striped.png
โโโ surfarray_xfade.png
โโโ tom_basic.png
โโโ tom_event-flowchart.png
โโโ tom_formulae.png
โโโ tom_games2.rst
โโโ tom_games3.rst
โโโ tom_games4.rst
โโโ tom_games5.rst
โโโ tom_games6.rst
โโโ tom_radians.png
10 directories, 123 files
The cpython documentation uses this procedure: https://www.python.org/dev/peps/pep-0545/#new-translation-procedure
They already had two separate translation git repos (French and Japanese). One of them is here:
They seem to be based on translation files, and they do not use management software like Transiflex. It's not clear to me if they have original documentation mixed in.
One problem with having whole translations in separate folders is that the image paths and linking need to be changed. Maybe not such a bad thing.
docs/reST/tut/en/ChimpLineByLine/ChimpLineByLine.rst
docs/reST/tut/en/ChimpLineByLine/image1.png
docs/reST/tut/de/SchimpanseZeileFรผrZeile/SchimpanseZeileFรผrZeile.rst
Then things in "de/SchimpanseZeileFรผrZeile/" folder can reference images in the "../en/ChimpLineByLine"
Note that this way is not readable by people using the folder structure... (pretending you don't know English for one moment). As the filename is still "ChimpLineByLine-en.rst".
docs/reST/tut/ChimpLineByLine-en.rst
docs/reST/tut/ChimpLineByLine-de.rst
docs/reST/tut/ChimpLineByLine-ko.rst
Additionally, that is quite cluttered having them all in the same folder.
Note, the "en" is not a special case. It is alongside all the other locale/langs.
Talking with a couple of people who work in translation... They are happy to do documents using things like google docs, open office and word. Or working inside website systems when the text is small. They don't like long documents inside some translation websites because they are mainly meant for smaller pieces of text. None had heard of Sphinx or restructured text. One had heard of github but had never edited anything on there.
Currently our docs html output does not contain the human language of the page in the html meta data. Need to investigate how this can be included.
I know there are some tutorials at docs/reST/tut with different writers. However, every tutorials are putted in single directory. I think every files in docs/reST/tut should be divided to sub-directories by writter's ID. Then it will looks like arranged.