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

Learn-Schema.md #38

Merged
merged 5 commits into from
Aug 9, 2017
Merged

Learn-Schema.md #38

merged 5 commits into from
Aug 9, 2017

Conversation

jonirrings
Copy link
Collaborator

Signed-off-by: Jonir Rings peterpuyi@live.cn

Signed-off-by: Jonir Rings <peterpuyi@live.cn>
@linhe0x0 linhe0x0 mentioned this pull request Jul 26, 2017
@linhe0x0 linhe0x0 self-requested a review July 26, 2017 07:35
Copy link
Collaborator

@ydfzgyj ydfzgyj left a comment

Choose a reason for hiding this comment

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

内容之前已校对过,“需要保留关键词的地方统一按照 中文翻译(英文关键词)的格式。”以及其他一些细节还需要再按新的格式规范修正一下


GraphQL services can be written in any language. Since we can't rely on a specific programming language syntax, like JavaScript, to talk about GraphQL schemas, we'll define our own simple language. We'll use the "GraphQL schema language" - it's similar to the query language, and allows us to talk about GraphQL schemas in a language-agnostic way.
GraphQL 服务可以用任何语言编写,因为我们并不依赖于任何特定语言的句法句式(譬如 JavaScript )来与 GraphQL schema 沟通,我们定义了自己的简单语言,称之为 “GraphQL schema 语言” —— 它和 GraphQL 的查询语言很相似,让我们能够和 GraphQL schema 之间可以无语言差异地沟通。
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. JavaScript 和右括号间不加空格
  2. “GraphQL schema language”与其他译者商议保留原文,以避免出现不伦不类的“schema 语言”

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

GraphQL schema language 和 GraphQL query language都保留不翻译么?

Copy link
Collaborator

Choose a reason for hiding this comment

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

query language 可以翻译,因为查询语言还是好理解的,schema 语言确实不知道是什么鬼东西


```graphql
myField: [String!]
```

This means that the _list itself_ can be null, but it can't have any null members. For example, in JSON:
这表示_数组本身_可以为空,但是其不能有任何空值成员。用JSON举例如下:
Copy link
Collaborator

Choose a reason for hiding this comment

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

JSON 前后加空格


```graphql
myField: [String]!
```

This means that the list itself cannot be null, but it can contain null values:
这表示数组本身不能为空,但是其可以包含空值成员:
Copy link
Collaborator

Choose a reason for hiding this comment

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

冒号是英文符号

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

话说这些符号问题,你是用什么工具识别出来的?

Copy link
Collaborator

Choose a reason for hiding this comment

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

肉眼观察😂
因为原文是英文符号嘛,下边没有绿色的背景色就说明是没替换掉
你也可以在 PR 创建完还没提交的时候先自查一下

@@ -293,19 +293,19 @@ query HeroForEpisode($ep: Episode!) {
}
```

Learn more about this in the [inline fragments](/learn/queries/#inline-fragments) section in the query guide.
你可以在查询指南的[内联片段](/learn/queries/#inline-fragments)章节了解更多相关信息。
Copy link
Collaborator

Choose a reason for hiding this comment

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

链接前后加空格

@jonirrings
Copy link
Collaborator Author

已修正,有劳再次审校

@@ -4,12 +4,12 @@ layout: ../_core/DocsLayout
category: 学习
permalink: /learn/schema/
next: /learn/validation/
sublinks: Type System / 类型系统,Type Language / 类型语言,Object Types and Fields / 对象类型和字段,Arguments / 参数,The Query and Mutation Types / 查询和变更类型,Scalar Types / 标量类型,Enumeration Types / 枚举类型,Lists and Non-Null / 列表和非空,Interfaces / 接口,Union Types / 联合类型,Input Types / 输入类型
sublinks: 类型系统(Type System),类型语言(Type Language),对象类型和字段(Object Types and Fields),参数(Arguments),查询和变更类型(The Query and Mutation Types),标量类型(Scalar Types),枚举类型(Enumeration Types),列表和非空(Lists and Non-Null),接口(Interfaces),联合类型(Union Types ),输入类型(Input Types
Copy link
Collaborator

Choose a reason for hiding this comment

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

Union Types 后边多了一个空格


### Union types/联合类型
### 联合类型(Union Types )
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里也多了一个空格


目前为止,我们只讨论过将例如枚举和字符串等标量值作为参数传递给字段,但是你也能很容易地传递复杂对象。这在 mutation/变更中特别有用,因为有时候你需要传递一整个对象作为新建对象。在 GraphQL schema 语言中,输入对象看上去和常规对象一模一样,除了关键字是 `input` 而不是 `type`:
目前为止,我们只讨论过将例如枚举和字符串等标量值作为参数传递给字段,但是你也能很容易地传递复杂对象。这在变更(mutation)中特别有用,因为有时候你需要传递一整个对象作为新建对象。在 GraphQL schema 语言中,输入对象看上去和常规对象一模一样,除了关键字是 `input` 而不是 `type`:
Copy link
Collaborator

Choose a reason for hiding this comment

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

还有一处“schema 语言”


### Object types and fields/对象类型和字段
### 对象类型和字段(Object Types and Fields)

一个 GraphQL schema 中的最基本的组件是对象类型,它就表示你可以从服务上获取到什么类型的对象,以及这个对象有什么字段。使用 GraphQL schema 语言,我们可以这样表示它:
Copy link
Collaborator

Choose a reason for hiding this comment

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

还有一处“schema 语言”


也称作_枚举/enum_,枚举类型是一种特殊的标量,它限制在一个特殊的可选值集合内。这让你能够:
也称作_枚举(enum)_,枚举类型是一种特殊的标量,它限制在一个特殊的可选值集合内。这让你能够:
Copy link
Collaborator

Choose a reason for hiding this comment

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

所有中文的斜体字都替换成加粗,出现了好几处,搜索下划线应该能全部找到

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

看来我翻译规范看得不仔细:joy:

@jonirrings
Copy link
Collaborator Author

已修正,有劳再次审校。

Copy link
Collaborator

@ydfzgyj ydfzgyj left a comment

Choose a reason for hiding this comment

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

还有最后一个空格,加油😂

@@ -329,7 +329,7 @@ union SearchResult = Human | Droid | Starship

### 输入类型(Input Types)

目前为止,我们只讨论过将例如枚举和字符串等标量值作为参数传递给字段,但是你也能很容易地传递复杂对象。这在变更(mutation)中特别有用,因为有时候你需要传递一整个对象作为新建对象。在 GraphQL schema 语言中,输入对象看上去和常规对象一模一样,除了关键字是 `input` 而不是 `type`:
目前为止,我们只讨论过将例如枚举和字符串等标量值作为参数传递给字段,但是你也能很容易地传递复杂对象。这在变更(mutation)中特别有用,因为有时候你需要传递一整个对象作为新建对象。在 GraphQL schema language中,输入对象看上去和常规对象一模一样,除了关键字是 `input` 而不是 `type`:
Copy link
Collaborator

Choose a reason for hiding this comment

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

language 后边加空格

Signed-off-by: Jonir Rings <peterpuyi@live.cn>
@jonirrings
Copy link
Collaborator Author

已修正,有劳再次审校。:joy:

Copy link
Collaborator

@ydfzgyj ydfzgyj left a comment

Choose a reason for hiding this comment

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

终于改完啦,棒棒哒

@jonirrings
Copy link
Collaborator Author

@sqrthree 老大,这个也麻烦来approve一下

- `String` is one of the built-in _scalar_ types - these are types that resolve to a single scalar object, and can't have sub-selections in the query. We'll go over scalar types more later.
- `String!` means that the field is _non-nullable_, meaning that the GraphQL service promises to always give you a value when you query this field. In the type language, we'll represent those with an exclamation mark.
- `[Episode]!` represents an _array_ of `Episode` objects. Since it is also _non-nullable_, you can always expect an array (with zero or more items) when you query the `appearsIn` field.
- `Character` 是一个** GraphQL 对象类型**,表示其是一个拥有一些字段的类型。你的 schema 中的大多数类型都会是对象类型。
Copy link
Member

Choose a reason for hiding this comment

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

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修正,有劳再次审校


### Arguments
###参数(Arguments
Copy link
Member

Choose a reason for hiding this comment

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

image


Object types, scalars, and enums are the only kinds of types you can define in GraphQL. But when you use the types in other parts of the schema, or in your query variable declarations, you can apply additional _type modifiers_ that affect validation of those values. Let's look at an example:
对象类型,标量以及枚举是 GraphQL 中你唯一可以定义的类型种类。但是当你在 schema 的其他部分使用这些类型时,或者在你的查询变量声明处使用时,你可以给它们应用额外的**类型修饰符**来影响这些值的验证。我们先来看一个例子:
Copy link
Member

Choose a reason for hiding this comment

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

『对象类型,标量以及枚举』=>『对象类型、标量以及枚举』

Copy link
Collaborator Author

@jonirrings jonirrings Aug 5, 2017

Choose a reason for hiding this comment

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

已修正,有劳再次审校

Signed-off-by: Jonir Rings <peterpuyi@live.cn>
@linhe0x0 linhe0x0 merged commit 4570af8 into xitu:zh-Hans Aug 9, 2017
@jonirrings jonirrings deleted the Learn-Schema branch May 23, 2021 12:26
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.

None yet

3 participants