Skip to content

Add docs i18n infrastructure, with partial FR translations - #302

Closed
florimondmanca wants to merge 1 commit into
masterfrom
fm/i18n
Closed

Add docs i18n infrastructure, with partial FR translations#302
florimondmanca wants to merge 1 commit into
masterfrom
fm/i18n

Conversation

@florimondmanca

Copy link
Copy Markdown
Contributor

Follow-up to #285, prompted by #285 (review)

This pull request expands scripts/docs so that it supports generating translation files, and building/serving the docs for a given language. Currently only fr (French) is supported, since that's the language I'd be happy to contribute translations for. 😄

Here's how things work:

  • scripts/docs maketranslations - Sync translation files: this updates .*po files under docs/locale/... with any changes detected by Sphinx. Should be run to update translations after documentation has been edited.
  • SPHINX_LANGUAGE=<lang> scripts/docs build - Build the <lang> version of the docs.
  • SPHINX_LANGUAGE=<lang> scripts/docs - Serve (w/ reload, as for the English docs) the <lang> version of the docs. Any changes to .*po files are autodetected and trigger site reloads.

I wrote up translations for the home page to give an idea of what things look like. I'll do api.md and contributing.md as a follow-up.

Hosting the translated docs is a different matter and is not included in this PR (hence "Draft"), I'll discuss below.

@florimondmanca

florimondmanca commented Apr 10, 2021

Copy link
Copy Markdown
ContributorAuthor

Hosting

Easiest seems to be switching to ReadTheDocs (which would also give us easy versioning support, see #285 (comment)).

Localization of Documentation says that for multi-language sites, we need to create one project per translation there, so eg httpcore and httpcore-fr, indicating that httpcore-fr is a French translation for httpcore.

I'm not exactly sure how/if RTD will be able to use scripts/docs. In this PR I make scripts/docs accept a SPHINX_LANGUAGE environment variable to configure the target language. Not sure if RTD allows setting env vars, if it sets its own thing, calls Sphinx itself without us allowing to pass a custom script, etc. That's got to be investigated but unfortunately I don't have permissions to link with httpcore on RTD.

@pradyunsg

Copy link
Copy Markdown

I'm not exactly sure how/if RTD will be able to use scripts/docs.

No it won't. They run their own commands. Here's a recent run for pip's documentation.

You can configure those commands somewhat using .readthedocs.yml in the repository root or via their Web UI -- I'd recommend using the file whenever possible though, since that's under version control. :)

@florimondmanca

florimondmanca commented Jan 20, 2022

Copy link
Copy Markdown
ContributorAuthor

Closing since I think we moved back to MkDocs, so this is stale. 😅

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@florimondmanca@pradyunsg