-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
POT Generator: Add support for TRANSLATORS:
and NO_TRANSLATE
comments
#98099
base: master
Are you sure you want to change the base?
Conversation
8402557
to
2f1d828
Compare
Just curious, because it's missing from the examples: what happens to comments surrounding a single line with 2 tr()'s? Eg:
And when there's both a comment above and behind?
|
This will be applied to both strings, the parser does not check if the comment is consumed. But you can write: print(
tr("key_here"), # TRANSLATORS: hello
tr("another_key"), # TRANSLATORS: world
) or: print(
# TRANSLATORS: hello
tr("key_here"),
# TRANSLATORS: world
tr("another_key"),
)
Inline comment takes precedence, comment above will not be used. |
b2b6514
to
c37d2f3
Compare
In your example, print(tr("tr8", "ctx_c")) # TRANSLATORS: Message 8.1
print(tr("tr8", "ctx_c")) # TRANSLATORS: Message 8.2 generates #. TRANSLATORS: Message 8.1
#. TRANSLATORS: Message 8.2
#: node.gd
msgctxt "ctx_c"
msgid "tr8"
msgstr "" This makes the translators comment
The expected result is
|
@timothyqiu I wasn't sure if we need remove the |
print(tr("tr8", "ctx_c")) # TRANSLATORS: Message 8.1
print(tr("tr8", "ctx_c")) # TRANSLATORS: Message 8.2 @dalexeev I mean, the message Perhaps the |
c37d2f3
to
5dc6e83
Compare
@timothyqiu Done, updated the example. |
I think we should have a separate color for built-in comment keywords to distinguish them from user ones. I have a local branch for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested some common use cases locally, and it worked as expected.
5dc6e83
to
cab80cb
Compare
Fixed a case I forgot about (non-inline comment should only be taken into account if there is no code in that line). print(tr("tr10")) # TRANSLATORS: Message 10
print(tr("tr11")) |
This falls into the same category as translation context: godotengine/godot-proposals#8061 Currently, there are several one-to-many / many-to-one situations that need to be sorted out. I don't think node's auto translate system is ready for this. At least it should be a separate PR, it's not very GDScript related :P |
@timothyqiu Yes, it is indeed not very relevant to this PR. I want to reset the translation content generation process of the entire UI system, so that it can automatically collect the marked multilingual information from tscn. |
Example