-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Kotlin:小菜一碟 #1793
Kotlin:小菜一碟 #1793
Conversation
uptodate June 20
Translation finished
校对认领 @sqrthree |
@sqrthree 校对认领 |
TODO/kotlin-its-the-little-things.md
Outdated
@@ -1,22 +1,21 @@ | |||
> * 原文地址:[Kotlin: It’s the little things](https://m.signalvnoise.com/kotlin-its-the-little-things-8c0f501bc6ea) | |||
> * 原文作者:[Dan Kim](https://m.signalvnoise.com/@lateplate) | |||
> * 译文出自:[掘金翻译计划](https://github.com/xitu/gold-miner) | |||
> * 译者: | |||
> * 译者:CACppuccino | |||
> * 校对者: |
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.
校对者:wilsonandusa
TODO/kotlin-its-the-little-things.md
Outdated
|
||
``` | ||
“View " + view + " has visibility " + view.getVisibility() + "." | ||
vs. | ||
“View $view has visibility ${view.visibility}." | ||
``` | ||
|
||
Kotlin provides [String interpolation](https://kotlinlang.org/docs/reference/idioms.html#string-interpolation). It’s such a stupid simple feature to have that makes working with Strings much easier and more readable. It’s particularly useful for logging. | ||
Kotlin 提供了[字符串插值](https://kotlinlang.org/docs/reference/idioms.html#string-interpolation)。它简单至极,使得对字符串的处理变得更加简单和可读,尤其对于记录相关工作帮助很大。 | ||
|
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.
[尤其对于记录相关工作帮助很大] => [尤其是当你需要记录日志时,这个特性的帮助很大]
TODO/kotlin-its-the-little-things.md
Outdated
|
||
*(Occasionally the Kotlin compiler can’t reconcile the getters/setters for a class and this won’t work, but that’s relatively rare.)* | ||
*(有时候 Kotlin 编译器不能够解析类中的 getter/setter 且它们不会起作用,不过这种情况比较罕见)* |
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.
[且它们不会起作用] =>[因此导致这个特性无法使用]
TODO/kotlin-its-the-little-things.md
Outdated
*If this article was helpful to you, please do hit the *💚* button below. Thanks!* | ||
|
||
*We’re hard at work making the *[*Basecamp 3 Android app*](https://play.google.com/store/apps/details?id=com.basecamp.bc3)* better every day (in Kotlin, of course). Please check it out!* | ||
将所有这些小的东西放在一起,包括小标题中 Kotlin 的特性,你会有一个不错的感觉。🍩 | ||
|
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.
@sqrthree @CACppuccino 校对完成
@Zhiw 别忘了来校对啊 |
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.
@sqrthree @CACppuccino 校对完毕
TODO/kotlin-its-the-little-things.md
Outdated
|
||
``` | ||
View view | ||
vs. | ||
val view | ||
``` | ||
|
||
Instead of explicitly declaring a variable type (in this case a `View`) Kotlin simply infers it from whatever is assigned to it. You just write `val` or `var`, assign it, and get on with your day. One less thing to think about. | ||
Kotlin 选择简单地根据被赋予的变量的类型来确定变量类型(这里是 `View`)而不是清晰地声明一个变量类型。你只需写 `val` 或 `var`, 赋值给它,就可以继续工作了,无需考虑更多。 |
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.
『Kotlin 选择简单地根据被赋予的变量的类型来确定变量类型(这里是 View
)而不是清晰地声明一个变量类型』=>『Kotlin 根据赋值内容推断变量类型(这里是 View
),而不是明确声明一个变量类型。』
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.
@wilsonandusa @CACppuccino 我觉得校对者的版本更通顺一点,你们呢?
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.
好的,已改
TODO/kotlin-its-the-little-things.md
Outdated
|
||
``` | ||
“View " + view + " has visibility " + view.getVisibility() + "." | ||
vs. | ||
“View $view has visibility ${view.visibility}." | ||
``` | ||
|
||
Kotlin provides [String interpolation](https://kotlinlang.org/docs/reference/idioms.html#string-interpolation). It’s such a stupid simple feature to have that makes working with Strings much easier and more readable. It’s particularly useful for logging. | ||
Kotlin 提供了[字符串插值](https://kotlinlang.org/docs/reference/idioms.html#string-interpolation)。它简单至极,使得对字符串的处理变得更加简单和可读,尤其对于记录相关工作帮助很大。 |
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.
『字符串插值』=>『字符串内插』,其实差不多
『尤其对于记录相关工作帮助很大』=>『对日志记录特别有用』
@sqrthree 请求最终检查 |
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.
还有一些小问题辛苦译者看一下哈。
TODO/kotlin-its-the-little-things.md
Outdated
> * 译者: | ||
> * 校对者: | ||
> * 译者:CACppuccino | ||
> * 校对者:wilsonandusa Zhiw |
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.
请问链接到哪里?
TODO/kotlin-its-the-little-things.md
Outdated
|
||
Kotlin has a bunch of amazing features, and certain ones tend to grab the headlines — things like [extension functions](https://kotlinlang.org/docs/reference/extensions.html#extension-functions), [higher order functions](https://kotlinlang.org/docs/reference/lambdas.html), and [null safety](https://kotlinlang.org/docs/reference/null-safety.html) among them. And rightfully so — those are all incredibly powerful, fundamental features of the language upon which everything else builds on. | ||
# Kotlin: 小菜一碟 | ||
Kotlin 有不少很棒的特性,而其中一些如[扩展函数](https://kotlinlang.org/docs/reference/extensions.html#extension-functions), [高阶函数](https://kotlinlang.org/docs/reference/lambdas.html), 和[Null 安全性](https://kotlinlang.org/docs/reference/null-safety.html)更是引人注意。 毫无疑问,这些基本而强大的特性正是这门语言的根基所在。 |
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.
『而其中一些如扩展函数, 高阶函数, 和Null 安全性更是引人注意』=>『而其中一些如扩展函数、高阶函数、和 Null 安全性更是引人注意』
TODO/kotlin-its-the-little-things.md
Outdated
|
||
*(Note: For clarity in the code snippets, Java is always shown first and Kotlin second. Contextual code is truncated and the diffs are bolded.)* | ||
*(注意:为了看的清楚,Java 总会首先展示,Kotlin 其次。代码的其余部分已被截掉,不同之处以粗体标出)* |
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.
TODO/kotlin-its-the-little-things.md
Outdated
|
||
*(Occasionally the Kotlin compiler can’t reconcile the getters/setters for a class and this won’t work, but that’s relatively rare.)* | ||
*(有时候 Kotlin 编译器不能够解析类中的 getter/setter,因而这个特性无法使用,不过这种情况比较罕见)* |
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.
TODO/kotlin-its-the-little-things.md
Outdated
|
||
``` | ||
View view | ||
vs. | ||
val view | ||
``` | ||
|
||
Instead of explicitly declaring a variable type (in this case a `View`) Kotlin simply infers it from whatever is assigned to it. You just write `val` or `var`, assign it, and get on with your day. One less thing to think about. | ||
Kotlin 选择简单地根据被赋予的变量的类型来确定变量类型(这里是 `View`)而不是清晰地声明一个变量类型。你只需写 `val` 或 `var`, 赋值给它,就可以继续工作了,无需考虑更多。 |
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.
@wilsonandusa @CACppuccino 我觉得校对者的版本更通顺一点,你们呢?
TODO/kotlin-its-the-little-things.md
Outdated
|
||
Put all these little things together with Kotlin’s headline features and you’re in for a real treat. 🍩 | ||
*荣幸地提示:虽然没有在文中展示,但再也*[*不用写 'new' 关键字*](https://kotlinlang.org/docs/reference/classes.html#creating-instances-of-classes)了! |
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.
@sqrthree 修正完毕,请求merge
TODO/kotlin-its-the-little-things.md
Outdated
> * 译者: | ||
> * 校对者: | ||
> * 译者:CACppuccino | ||
> * 校对者:wilsonandusa Zhiw |
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.
请问链接到哪里?
TODO/kotlin-its-the-little-things.md
Outdated
|
||
``` | ||
View view | ||
vs. | ||
val view | ||
``` | ||
|
||
Instead of explicitly declaring a variable type (in this case a `View`) Kotlin simply infers it from whatever is assigned to it. You just write `val` or `var`, assign it, and get on with your day. One less thing to think about. | ||
Kotlin 选择简单地根据被赋予的变量的类型来确定变量类型(这里是 `View`)而不是清晰地声明一个变量类型。你只需写 `val` 或 `var`, 赋值给它,就可以继续工作了,无需考虑更多。 |
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.
好的,已改
@CACppuccino 已经 merge 啦~ 快快麻溜发布到掘金专栏然后给我发下链接,方便及时添加积分哟。 |
@sqrthree 掘金后端似乎在迁移,暂时无法激活原创身份 lol |
@CACppuccino 好哒,那等迁移后吧。 |
翻译完毕 @sqrthree #1787