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

[PAGE ISSUE]: '高效 Dart 语言指南:文档' #409

Closed
YogiLiu opened this issue Nov 22, 2022 · 0 comments · Fixed by #410
Closed

[PAGE ISSUE]: '高效 Dart 语言指南:文档' #409

YogiLiu opened this issue Nov 22, 2022 · 0 comments · Fixed by #410
Labels
E: 页面问题 页面内容有误或需要改进。

Comments

@YogiLiu
Copy link
Contributor

YogiLiu commented Nov 22, 2022

页面 URL

https://dart.cn/guides/language/effective-dart/documentation

页面源地址

https://github.com/cfug/dart.cn/tree/master/src/_guides/language/effective-dart/documentation.md

描述问题

### DO use prose to explain parameters, return values, and exceptions.
### **** 使用散文的方式来描述参数、返回值以及异常信息。
Other languages use verbose tags and sections to describe what the parameters
and returns of a method are.
其他语言使用各种标签和额外的注释来描述参数和返回值。
{:.bad}
<?code-excerpt "docs_bad.dart (no-annotations)"?>
{% prettify dart tag=pre+code %}
/// Defines a flag with the given name and abbreviation.
///
/// @param name The name of the flag.
/// @param abbr The abbreviation for the flag.
/// @returns The new flag.
/// @throws ArgumentError If there is already an option with
/// the given name or abbreviation.
Flag addFlag(String name, String abbr) => ...
{% endprettify %}
The convention in Dart is to integrate that into the description of the method
and highlight parameters using square brackets.
{:.good}
<?code-excerpt "docs_good.dart (no-annotations)"?>
{% prettify dart tag=pre+code %}
/// Defines a flag.
///
/// Throws an [ArgumentError] if there is already an option named [name] or
/// there is already an option using abbreviation [abbr]. Returns the new flag.
Flag addFlag(String name, String abbr) => ...
{% endprettify %}

【散文】比较晦涩,翻译不全。

期望如何修复

No response

附加信息

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E: 页面问题 页面内容有误或需要改进。
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant