pygame / pygame

๐Ÿ๐ŸŽฎ pygame (the library) is a Free and Open Source python programming language library for making multimedia applications like games built on top of the excellent SDL library. C, Python, Native, OpenGL.
https://www.pygame.org
7.42k stars 3.31k forks source link

docs/reST/tut needs to be classified #1471

Open rumia0601 opened 4 years ago

rumia0601 commented 4 years ago

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.

illume commented 4 years ago

Good idea.

illume commented 4 years ago

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.

illume commented 4 years ago

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
illume commented 4 years ago

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.

illume commented 4 years ago

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.

illume commented 4 years ago

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.

illume commented 4 years ago

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.

illume commented 4 years ago

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
illume commented 4 years ago

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.

illume commented 4 years ago

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.

illume commented 4 years ago

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.

illume commented 4 years ago

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.