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

[3.x] i18n: Add support for translating the class reference #53511

Merged
merged 7 commits into from
Oct 7, 2021

Conversation

akien-mga
Copy link
Member

This backports a feature from the master branch implemented back in March 2020, at a time where we did not intend prolonged feature development for 3.2.

Since we restarted 3.x development with the 3.x branch, 4.0 is still a ways off, and translators have already started translating the class reference on https://hosted.weblate.org/projects/godot-engine/godot-class-reference/, I'm bringing this to 3.x so that we can make use of the translators' work (mostly Chinese (Simplified) and Spanish which are 100% translated on Weblate, though they'll have 20% of the strings to review and 10% new strings to work on when I sync Weblate with 3.x).

Backports the following PRs:

Ref. godotengine/godot-docs-l10n#18

This PR doesn't include the actual translations, I'll sync them in a follow-up.

Once merged with the 3.x class reference content, it looks like this:

godot-zh-cn

Screenshot_20211007_114924

@akien-mga akien-mga force-pushed the 3.x-i18n-classref branch 2 times, most recently from 74f599a to 7651000 Compare October 7, 2021 10:19
core/io/translation_loader_po.cpp Outdated Show resolved Hide resolved
editor/create_dialog.cpp Outdated Show resolved Hide resolved
akien-mga and others added 6 commits October 7, 2021 12:48
Change extract script `path` argument to support specifying multiple
paths, like `makerst.py`. This prevents parsing invalid XML files while
scanning the whole repository.

(cherry picked from commit 87d23bf)
- Parse `.po` files from `doc/translations/*.po` like already done
  with `editor/translations/*.po`.
- Add logic to register a doc translation mapping in `TranslationServer`
  and `EditorSettings`.
- Add `DTR()` to lookup the doc translation mapping (similar to `TTR()`).
  Strings are automatically dedented and stripped of whitespace to ensure
  that they would match the translation catalog.
- Use `DTR()` to translate relevant strings in `EditorHelp`,
  `EditorInspector`, `CreateDialog`, `ConnectionsDialog`.
- Small simplification to `TranslationLoaderPO`, the path argument was
  not really meaningful.

(cherry picked from commit 4857648)
And do the dedent and stripping for both translated and
non-translated strings for consistency, and so that we
don't need to do it at the call site.

(cherry picked from commit a16031b)
Copy link
Member

@timothyqiu timothyqiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🎉

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

Successfully merging this pull request may close these issues.

4 participants