Skip to content

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

Merged
merged 2 commits into from
Nov 29, 2018

Conversation

realwunan
Copy link
Contributor

Simplify Chinese translation of Scala Tour: Packages and Imports

@realwunan realwunan force-pushed the packages-and-imports branch from 8e9243d to b1d43cb Compare November 15, 2018 04:38

class User
```
一个惯例是将包命名为与包含 Scala 文件的目录名相同。 但是,Scala 并不知道文件布局。 `package users` 的 sbt 工程的目录结构可能如下所示:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scala 并不知道文件布局

改为Scala 并未对文件布局作任何限制如何?

Copy link
Contributor

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翻译为工程还是项目好,貌似都可以。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得工程更加一目了然

UserPreferences.scala
- test
```
注意 `users` 目录是包含在在 `scala` 目录中的,以及该包中包含有多个 Scala 文件。 包中的每个 Scala 文件都可以具有相同的包声明。 声明包的另一种方式是使用大括号:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: 在在->

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以及该包中包含有多个 Scala 文件

删除以及,感觉读起来更自然

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot.

```
如你所见,这允许包嵌套并提供了对范围和封装的更好控制。

包名称应全部为小写,如果代码是在具有网站的组织内开发的,则应采用以下的约定格式:`<top-level-domain>.<domain-name>.<project-name>`。 例如,如果 Google 有一个名为 `SelfDrivingCar` 的项目,则包名称将如下所示:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

具有网站的组织

拥有独立网站的组织?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉是通顺一些

这可以对应于以下目录结构:`SelfDrivingCar/src/main/scala/com/google/selfdrivingcar/camera/Lens.scala`

## 导入
`import` 子句用于访问其他包中的成员(类,特质,函数等)。 访问相同包的成员不需要 `import` 子句。 导入子句可以有选择性:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: 子句? -> 语句?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用于访问 -> 用于导入?

访问相同包的成员 -> 使用相同包的成员

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trait翻译为特质感觉不是很好,@sadhen 有什么建议么,目前通用的翻译是什么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前已有的 Scala Tour 里是翻译成 特质

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

谢谢,我看链接里面,文中使用的是特征,这个的确比较难译。trait和class在语义上相近,要是能够找到与更相近的词就好了。

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liufengyun 目前国内都这样的。。。。看来大哥在国外太久了:stuck_out_tongue:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那就特质吧,谢谢🙏

Copy link
Contributor

@liufengyun liufengyun left a 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 🎉

@liufengyun liufengyun merged commit a202690 into scala:master Nov 29, 2018
@realwunan realwunan deleted the packages-and-imports branch November 30, 2018 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants