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

Avoid punning enum names in documentation #84652

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

timothyqiu
Copy link
Member

This makes these descriptions easier to read & translate.

Information is not lost because these enum names are available in the function signature.

@timothyqiu timothyqiu added this to the 4.3 milestone Nov 9, 2023
@timothyqiu timothyqiu requested review from a team as code owners November 9, 2023 09:21
@timothyqiu timothyqiu removed request for a team November 9, 2023 09:21
@YuriSizov
Copy link
Contributor

Information is not lost because these enum names are available in the function signature.

About that... How well does this work in practice when the name in the signature is not translatable and the description only refers to it using plain language? Do people understand that whatever "transfer mode" is in, say, Chinese is the same as "MultiplayerPeer.TransferMode"?

@AThousandShips
Copy link
Member

Would be useful to have a link or the ability to add set what the text of a link is to allow both for ease of translation and of connecting it

@timothyqiu
Copy link
Member Author

How well does this work in practice when the name in the signature is not translatable and the description only refers to it using plain language?

These descriptions are mainly:

  • TransferMode get_transfer_mode():
    Returns the transfer mode of something.
  • void set_transfer_mode(id: int, mode: TransferMode):
    Sets the transfer mode of something identified by [param id] to [param mode].
  • void complex_operation(id: int, foo: int, mode: TransferMode):
    Some description of the complex operations.
    [param mode] is the transfer mode of something.

It's clear that "the transfer mode" is the return type of the function, or the type of the named parameter.

Say we have a function signature func 测试(a: 数据传输模式, b: 纹理压缩模式) -> 线程安全策略 and the description of it is:

This is a test function that does random things.
Returns the thread safety policy of this device.
An error is printed when [param a] is not set to a data transfer mode this device can handle.
Some random textures will be transfered using the texture compression mode specified in [param b].

Even though you probably don't know Chinese, it's still obvious what identifier "thread safety policy", "data transfer mode", and "texture compression mode" correspond to.

@YuriSizov
Copy link
Contributor

Okay, as long as we make it clear if something refers to a return value or a named parameter.

@YuriSizov YuriSizov merged commit 714e273 into godotengine:master Dec 19, 2023
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@timothyqiu timothyqiu deleted the enum-pun branch December 19, 2023 12:16
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