-
Notifications
You must be signed in to change notification settings - Fork 1k
Simplify Chinese translation of Scala Tour: packages-and-imports.md #1212
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
Conversation
8e9243d
to
b1d43cb
Compare
_zh-cn/tour/packages-and-imports.md
Outdated
|
||
class User | ||
``` | ||
一个惯例是将包命名为与包含 Scala 文件的目录名相同。 但是,Scala 并不知道文件布局。 `package users` 的 sbt 工程的目录结构可能如下所示: |
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.
Scala 并不知道文件布局
改为Scala 并未对文件布局作任何限制
如何?
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.
package users
的 sbt 工程
"在一个sbt 项目*中,package users
的目录结构可能如下所示..."如何?
*我不是很确定project
翻译为工程
还是项目
好,貌似都可以。
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.
我觉得工程更加一目了然
_zh-cn/tour/packages-and-imports.md
Outdated
UserPreferences.scala | ||
- test | ||
``` | ||
注意 `users` 目录是包含在在 `scala` 目录中的,以及该包中包含有多个 Scala 文件。 包中的每个 Scala 文件都可以具有相同的包声明。 声明包的另一种方式是使用大括号: |
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.
typo: 在在
->在
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.
以及该包中包含有多个 Scala 文件
删除以及
,感觉读起来更自然
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.
Thanks a lot.
_zh-cn/tour/packages-and-imports.md
Outdated
``` | ||
如你所见,这允许包嵌套并提供了对范围和封装的更好控制。 | ||
|
||
包名称应全部为小写,如果代码是在具有网站的组织内开发的,则应采用以下的约定格式:`<top-level-domain>.<domain-name>.<project-name>`。 例如,如果 Google 有一个名为 `SelfDrivingCar` 的项目,则包名称将如下所示: |
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.
具有网站的组织
拥有独立网站的组织?
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.
感觉是通顺一些
_zh-cn/tour/packages-and-imports.md
Outdated
这可以对应于以下目录结构:`SelfDrivingCar/src/main/scala/com/google/selfdrivingcar/camera/Lens.scala` | ||
|
||
## 导入 | ||
`import` 子句用于访问其他包中的成员(类,特质,函数等)。 访问相同包的成员不需要 `import` 子句。 导入子句可以有选择性: |
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.
typo: 子句
? -> 语句
?
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.
用于访问
-> 用于导入
?
访问相同包的成员
-> 使用相同包的成员
?
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.
trait
翻译为特质
感觉不是很好,@sadhen 有什么建议么,目前通用的翻译是什么?
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.
目前已有的 Scala Tour 里是翻译成 特质 的
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.
谢谢,我看链接里面,文中使用的是特征
,这个的确比较难译。trait和class在语义上相近,要是能够找到与类
更相近的词就好了。
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.
@liufengyun 目前国内都这样的。。。。看来大哥在国外太久了:stuck_out_tongue:
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.
那就特质
吧,谢谢🙏
…according to liufengyun's suggestion
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.
LGTM, thanks a lot @realwunan 🎉
Simplify Chinese translation of Scala Tour: Packages and Imports