Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] add zh docs #3507

Merged
merged 13 commits into from
Nov 5, 2024
Merged

[docs] add zh docs #3507

merged 13 commits into from
Nov 5, 2024

Conversation

cdn0x12
Copy link
Contributor

@cdn0x12 cdn0x12 commented Nov 2, 2024

Description

This PR adds a currently-up-to-date Simplified Chinese support to the GotSocial documentation. The Chinese documentation will be available at https://docs.gotosocial.org/zh-cn/.

Key Changes

  • A locales directory has been created within the docs folder to store document translations, with Chinese documents located in docs/locales/zh. Repo docs (README, ROADMAP, etc.) are also translated, placed under docs/locales/zh/repo.
  • The Chinese documentation uses its own mkdocs and readthedocs configuration. The mkdocs config inherits shared settings from the main documentation, but has separate configurations for language-specific and translatable settings.
  • To allow different language versions to share the assets directory, it has been moved to a distinct overrides directory. To avoid conflicts with the material for mkdocs theme’s overrides directory, it has been renamed to public. That is to say, the docs/assets directory is now moved to docs/override/public, and both the original (English) and Chinese documentation references have been updated accordingly. The shared resource directory is set through theme.custom_dir.
  • The main documentation configuration excludes the docs/locales directory and its subdirectories to avoid redundant builds and warnings.

Note

  • Further configuration of the gotosocial-zh readthedocs project is needed. Under Settings, change the Path for .readthedocs.yaml to docs/locales/zh/.readthedocs.yaml, then save the settings to re-trigger a build.
  • I've noticed that after adding the new translation project, the Versions menu at the bottom right of the readthedocs page includes stable. This might be because readthedocs has automatically enabled a stable version build for the gotosocial-zh project. As we don’t currently have this version of the documentation, this branch should be temporarily disabled.
  • For document examples (like filter keywords), the Chinese documentation does not always strictly follow the original text word-by-word. I've noticed, through interactions in the fediverse, that users from different regions have distinct habits regarding the use of features (such as account profile bios, extra fields, hashtags). Therefore, in the current Chinese translation, I have replaced some examples with cases that I believe are easier for Chinese-speaking users to understand. I've tried my best made sure these examples are unbiased.

The Translation Workflow

To add a new document translation, fork the repo and create a docs/locales/<language_code> directory in the repository and add the translated documents in the same structure. Refer to docs/locales/zh to establish the corresponding readthedocs and mkdocs configurations. (The main documentation has a language switch feature, so you also need to update the corresponding language item in the main documentation configuration.) Then request the maintainers to create and configure a gotosocial-<language_code> project in Read the Docs to enable the language variant.

To update translations, simply make changes and raise a PR as you would with the original documentation. To avoid too many "Translation Update" PRs clogging the merging queue, consider suggesting a maximum update frequency, like every two weeks or once a month.

TODO

  1. As translations may inevitably lag behind the original documentation, it's important to include a note in the translated documents informing readers that the content may be outdated and that they should consult the English version for the most recent information. Additionally, if a language version hasn’t been updated for too long, consider removing it (or disabling the translation). You could set a minimum update interval, such as six months or five 0.x version updates. Will make a seperate PR if this is acceptable,
  2. Specifically, the Chinese Swagger documentation uses the translation I recently created for my own instance. This Swagger documentation aligns strictly with the original in terms of specifications. I’ve reverted all instance-specific changes to a neutral state. However there's a noticeable difference that the translated Swagger uses shorter titles as summary and puts detailed descriptions in the description section. For example, in the /.well-known/host-meta endpoint, the original title is "Returns a compliant hostmeta response to web host metadata queries," while in the Chinese version (translated back into English here), the title is "Get host-meta response," with the original title moved to the beginning of the description. This change was made for personal reasons, but given the large size of the Swagger file (over 10,000 lines), it’s challenging to revert this change. Since the meaning remains the same and no information is lost, I believe this does not impact comprehension.
  3. If needed, I am willing to draft separate guidance on creating and maintaining documentation translations for submission in another PR.
  4. While translating this document, I noticed several areas in the original GotoSocial documentation that do not reflect recent changes and new features. If time permits, I will submit a separate PR with the corresponding changes and use this to test the translation update workflow.
  5. Since the media resources are shared, the diagrams in the Chinese documentation are currently in English. I will provide translated versions of these diagrams in a future PR.

Checklist

Please put an x inside each checkbox to indicate that you've read and followed it: [ ] -> [x]

If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have not leveraged AI to create the proposed changes.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

@cdn0x12
Copy link
Contributor Author

cdn0x12 commented Nov 2, 2024

Below is the preview of the zh version of the gts document on Read the Docs. Temperately available until the pr is closed: https://gts-doc-test.readthedocs.io

gts chinese doc preview

@NyaaaWhatsUpDoc
Copy link
Member

god damn, this is brilliant work!

@tsmethurst
Copy link
Contributor

This is amazing, thank you!!! Will have a look through properly tomorrow, but the new structure and suggestions seem very sensible :)

@tsmethurst tsmethurst merged commit 38a08cd into superseriousbusiness:main Nov 5, 2024
2 checks passed
@tsmethurst
Copy link
Contributor

I've squash merged it! Thank you very very much for this brilliant work!

@cdn0x12
Copy link
Contributor Author

cdn0x12 commented Nov 5, 2024

Hooray! I'll do my best to keep up with maintaining this translation and get started on the TODO items!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants