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

i18n: Add support for translating the class reference #37164

Merged
merged 2 commits into from
Mar 20, 2020

Conversation

akien-mga
Copy link
Member

  • 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()).
  • Use DTR() to translate relevant strings in EditorHelp.
  • Small simplification to TranslationLoaderPO, the path argument was
    not really meaningful.

Depends on #37114 to actually generate the translation catalog and start collecting doc translations on Weblate.

Screenshot_20200319_135713

@akien-mga
Copy link
Member Author

Refactored a bit to enforce the dedent().strip_edges() directly in RTR() and thus simplify call sites. Other locations where DocData strings are used now also use RTR().

Screenshot_20200319_145341
Screenshot_20200319_145421

akien-mga and others added 2 commits March 20, 2020 08:48
- 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.
@akien-mga
Copy link
Member Author

Added a commit (attributed to @ThakeeNathees who wrote it) to fix an issue parsing closing quotes preceded by multiple escaped blackslashes (see #37114 (comment)).

@akien-mga akien-mga merged commit a02c16c into godotengine:master Mar 20, 2020
@akien-mga akien-mga deleted the doc-translations branch March 20, 2020 08:44
@txj-mssl
Copy link

Submitting to weblate is very troublesome. Can you make a configuration file alone? The configuration file downloads the content of weblate and can be freely modified locally.

@txj-mssl
Copy link

In this way, even if there is no translation on weblite, I can translate and use it myself.

@akien-mga
Copy link
Member Author

You can download the Weblate .po file for your language, put it in doc/translations/ and recompile the engine (master branch only). But if you're going to spend a few hours translating content in your language, it would be very appreciated if you contributed it on Weblate so that all native speakers of your language can benefit from it.

@txj-mssl
Copy link

image
I tried to modify the Po file today. The built-in documents are displayed correctly, while the details panel does not display Chinese. Why?

@akien-mga
Copy link
Member Author

It's probably not using the DTR() macro, I'll have a look.

@txj-mssl
Copy link

Did you find out why?

@akien-mga
Copy link
Member Author

I was on my commute to the office... please have some patience.

@akien-mga
Copy link
Member Author

I can reproduce the issue, but I'm not sure why it happens yet. The translation does work properly, but the Chinese characters aren't display, yet the font used should support them in theory. Investigating further.

@akien-mga
Copy link
Member Author

The problem is somewhere in editor/editor_help.cpp's _add_text_to_rt method, the input is correct (e.g. in my test "Propriété : [u][b]text[/b][/u]\nLe texte à afficher sur l'écran. 汉语"), but the output lacks the Chinese characters.

It's the same method used for the main editor help so both should be using the same font which supports CJK glyphs.

I'll debug further to see where it breaks in that method.

@txj-mssl
Copy link

When can this feature be pushed to version 3.2?

@akien-mga
Copy link
Member Author

I don't plan to include it in 3.2, the amount of work necessary from translators to translate all the API reference is huge, and is better focused towards the next version 4.0.

It's of a higher priority that translators finish translating the online documentation before attempting to translate the class reference: https://hosted.weblate.org/projects/godot-engine/godot-docs/

@txj-mssl
Copy link

When to fix an incorrectly displayed problem?

@akien-mga
Copy link
Member Author

If you want to hire me to fix problems for you within one hour of their report, you can send me an email with a proposal.

Otherwise let me do my work as time permits, thanks.

akien-mga added a commit to akien-mga/godot that referenced this pull request May 28, 2020
Fixes godotengine#37164 (comment).

It seems to point at a bigger theme propagation issue though.
@akien-mga
Copy link
Member Author

Here you go, one day's worth of debugging a bigger issue to come up with a workaround... #39123

@txj-mssl
Copy link

txj-mssl commented Jun 9, 2020

Sorry, I didn't notice the news

@txj-mssl
Copy link

txj-mssl commented Jun 9, 2020

What should I do?

@akien-mga
Copy link
Member Author

Nothing, the PR I opened works it around but it's not a proper fix, the real bug is #39235.

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.

None yet

3 participants