@@ -25,7 +25,7 @@ module.exports = ({ page, section }) =>
25
25
</ div >
26
26
27
27
< div className = "marketing-col" >
28
- < h3 > Describe your data </ h3 >
28
+ < h3 > 描述你的数据 </ h3 >
29
29
< Prism language = "graphql" >
30
30
{ `type Project {
31
31
name: String
@@ -36,7 +36,7 @@ module.exports = ({ page, section }) =>
36
36
</ div >
37
37
38
38
< div className = "marketing-col" >
39
- < h3 > Ask for what you want </ h3 >
39
+ < h3 > 请求你所要的数据 </ h3 >
40
40
< Prism language = "graphql" >
41
41
{ `{
42
42
project(name: "GraphQL") {
@@ -47,7 +47,7 @@ module.exports = ({ page, section }) =>
47
47
</ div >
48
48
49
49
< div className = "marketing-col" >
50
- < h3 > Get predictable results </ h3 >
50
+ < h3 > 得到可预测的结果 </ h3 >
51
51
< Prism language = "json" >
52
52
{ `{
53
53
"project": {
@@ -60,36 +60,26 @@ module.exports = ({ page, section }) =>
60
60
61
61
< div className = "buttons-unit" >
62
62
< a className = "button" href = "/code/" >
63
- Get Started
63
+ 马上开始
64
64
</ a >
65
65
< a className = "button" href = "/learn/" >
66
- Learn More
66
+ 了解更多
67
67
</ a >
68
68
</ div >
69
69
70
70
</ div >
71
71
</ div >
72
72
73
73
< section className = "lead" >
74
- < h1 > A query language for your API</ h1 >
75
- < p >
76
- GraphQL is a query language for APIs and a runtime for fulfilling
77
- those queries with your existing data. GraphQL provides a complete
78
- and understandable description of the data in your API, gives
79
- clients the power to ask for exactly what they need and nothing
80
- more, makes it easier to evolve APIs over time, and enables powerful
81
- developer tools.</ p >
74
+ < h1 > 一种用于 API 的查询语言</ h1 >
75
+ < p > GraphQL 既是一种用于 API 的查询语言也是一个满足你数据查询的运行时。 GraphQL 对你的 API 中的数据提供了一套易于理解的完整描述,使得客户端能够准确地获得它需要的数据,而且没有任何冗余,也让 API 更容易地随着时间推移而演进,还能用于构建强大的开发者工具。</ p >
82
76
</ section >
83
77
84
78
< section className = "point1" id = "predictable-results" >
85
79
< div className = "prose" >
86
- < h2 > Ask for what you need, < br /> get exactly that </ h2 >
80
+ < h2 > 请求你所要的数据 < br /> 不多不少 </ h2 >
87
81
{ /*[Illustration: just a simple query and response?]*/ }
88
- < p >
89
- Send a GraphQL query to your API and get exactly what you need,
90
- nothing more and nothing less. GraphQL queries always return
91
- predictable results. Apps using GraphQL are fast and stable because
92
- they control the data they get, not the server.</ p >
82
+ < p > 向你的 API 发出一个 GraphQL 请求就能准确获得你想要的数据,不多不少。 GraphQL 查询总是返回可预测的结果。使用 GraphQL 的应用可以工作得又快又稳,因为控制数据的是应用,而不是服务器。</ p >
93
83
</ div >
94
84
< div className = "window faux-graphiql" aria-hidden >
95
85
< div className = "query" >
@@ -179,15 +169,9 @@ module.exports = ({ page, section }) =>
179
169
< div className = "grayWash" >
180
170
< section className = "point2" id = "single-request" >
181
171
< div className = "prose" >
182
- < h2 > Get many resources < br /> in a single request </ h2 >
172
+ < h2 > 获取多个资源 < br /> 只用一个请求 </ h2 >
183
173
{ /*Illustration: a query 2 or 3 levels deep]*/ }
184
- < p >
185
- GraphQL queries access not just the properties of one resource
186
- but also smoothly follow references between them. While typical
187
- REST APIs require loading from multiple URLs, GraphQL APIs get
188
- all the data your app needs in a single request. Apps using
189
- GraphQL can be quick even on slow mobile
190
- network connections.</ p >
174
+ < p > GraphQL 查询不仅能够获得资源的属性,还能沿着资源间引用进一步查询。典型的 REST API 请求多个资源时得载入多个 URL,而 GraphQL 可以通过一次请求就获取你应用所需的所有数据。这样一来,即使是比较慢的移动网络连接下,使用 GraphQL 的应用也能表现得足够迅速。</ p >
191
175
</ div >
192
176
< div className = "app-to-server" aria-hidden >
193
177
< img src = "/img/phone.svg" width = "496" height = "440" className = "phone" />
@@ -225,15 +209,10 @@ module.exports = ({ page, section }) =>
225
209
226
210
< section className = "point3" id = "type-system" >
227
211
< div className = "prose" >
228
- < h2 > Describe what’s possible < br /> with a type system </ h2 >
212
+ < h2 > 描述所有的可能 < br /> 类型系统 </ h2 >
229
213
{ /*Illustration of a type IDL following a query by line]*/ }
230
214
{ /*Under: a server <-> client (Capabilities, Requirements)]?*/ }
231
- < p >
232
- GraphQL APIs are organized in terms of types and fields,
233
- not endpoints. Access the full capabilities of your data from a
234
- single endpoint. GraphQL uses types to ensure Apps only ask for
235
- what’s possible and provide clear and helpful errors. Apps can
236
- use types to avoid writing manual parsing code.</ p >
215
+ < p > GraphQL API 基于类型和字段的方式进行组织,而非入口端点。你可以通过一个单一入口端点得到你所有的数据能力。GraphQL 使用类型来保证应用只请求可能的数据,还提供了清晰的辅助性错误信息。应用可以使用类型,而避免编写手动解析代码。</ p >
237
216
</ div >
238
217
< div className = "window strong-typed-query" aria-hidden >
239
218
< div className = "query" >
@@ -306,14 +285,11 @@ type Species {
306
285
< div className = "darkWash" >
307
286
< section className = "point4" id = "powerful-tools" >
308
287
< div className = "prose" >
309
- < h2 > Move faster with < br /> powerful developer tools </ h2 >
288
+ < h2 > 快步前进 < br /> 强大的开发者工具 </ h2 >
310
289
{ /*Illustration of GraphiQL validation error and typeahead, animated?]*/ }
311
- < p >
312
- Know exactly what data you can request from your API without
313
- leaving your editor, highlight potential issues before sending a
314
- query, and take advantage of improved code intelligence. GraphQL
315
- makes it easy to build powerful tools like < a href = "https://github.com/graphql/graphiql" target = "_blank" > Graph< em > i</ em > QL</ a > by
316
- leveraging your API’s type system.</ p >
290
+ < p > 不用离开编辑器就能准确知道你可以从 API 中请求的数据,发送查询之前就能高亮潜在问题,高级代码智能提示。利用 API 的类型系统,GraphQL 让你可以更简单地构建如同
291
+ < a href = "https://github.com/graphql/graphiql" target = "_blank" > Graph< em > i</ em > QL</ a >
292
+ 的强大工具。</ p >
317
293
</ div >
318
294
< div className = "graphiqlVid" dangerouslySetInnerHTML = { { __html : `
319
295
<video autoplay loop playsinline>
@@ -326,14 +302,9 @@ type Species {
326
302
< div className = "grayWash" >
327
303
< section className = "point5" id = "without-versions" >
328
304
< div className = "prose" >
329
- < h2 > Evolve your API< br /> without versions </ h2 >
305
+ < h2 > API 演进 < br /> 无需划分版本 </ h2 >
330
306
{ /*Illustration showing more legs added to a graph? Or a type evolving over time?]*/ }
331
- < p >
332
- Add new fields and types to your GraphQL API without impacting
333
- existing queries. Aging fields can be deprecated
334
- and hidden from tools. By using a single evolving version,
335
- GraphQL APIs give apps continuous access to new features and
336
- encourage cleaner, more maintainable server code.</ p >
307
+ < p > 给你的 GraphQL API 添加字段和类型而无需影响现有查询。老旧的字段可以废弃,从工具中隐藏。通过使用单一演进版本,GraphQL API 使得应用始终能够使用新的特性,并鼓励使用更加简洁、更好维护的服务端代码。</ p >
337
308
</ div >
338
309
< div className = "window type-evolution" aria-hidden >
339
310
< div id = "typeEvolveView" >
@@ -435,15 +406,9 @@ type Person {
435
406
436
407
< section className = "point6" id = "bring-your-own-code" >
437
408
< div className = "prose" >
438
- < h2 > Bring your own < br /> data and code </ h2 >
409
+ < h2 > 使用你现有的 < br /> 数据和代码 </ h2 >
439
410
{ /*Illustration of each field becoming a function?]*/ }
440
- < p >
441
- GraphQL creates a uniform API across your entire application
442
- without being limited by a specific storage engine. Write GraphQL
443
- APIs that leverage your existing data and code with GraphQL
444
- engines available in many languages. You provide functions for
445
- each field in the type system, and GraphQL calls them with
446
- optimal concurrency.</ p >
411
+ < p > GraphQL 让你的整个应用共享一套 API,而不用被限制于特定存储引擎。GraphQL 引擎已经有多种语言实现,通过 GraphQL API 能够更好利用你的现有数据和代码。你只需要为类型系统的字段编写函数,GraphQL 就能通过优化并发的方式来调用它们。</ p >
447
412
</ div >
448
413
< div className = "window leverage-code" aria-hidden >
449
414
< div id = "leverageCodeView" >
@@ -455,7 +420,7 @@ type Person {
455
420
}` }
456
421
</ Prism >
457
422
< Prism >
458
- { `// type Character {
423
+ { `// type Character
459
424
class Character {
460
425
// name: String
461
426
getName() {
@@ -474,7 +439,7 @@ class Character {
474
439
}` }
475
440
</ Prism >
476
441
< Prism language = "python" >
477
- { `# type Character {
442
+ { `# type Character
478
443
class Character:
479
444
# name: String
480
445
def name(self):
@@ -490,7 +455,7 @@ class Character:
490
455
` }
491
456
</ Prism >
492
457
< Prism >
493
- { `// type Character {
458
+ { `// type Character
494
459
public class Character {
495
460
// name: String
496
461
public String Name { get; }
@@ -523,18 +488,15 @@ public class Character {
523
488
524
489
< section className = "powered-by" id = "whos-using" >
525
490
< div className = "prose" >
526
- < h2 > Who’s using GraphQL?</ h2 >
527
- < p >
528
- Facebook's mobile apps have been powered by GraphQL since 2012.
529
- A GraphQL spec was open sourced in 2015 and is now available in
530
- many environments and used by teams of all sizes.</ p >
491
+ < h2 > 谁在使用 GraphQL?</ h2 >
492
+ < p > Facebook 的移动应用从 2012 年就开始使用 GraphQL。GraphQL 规范于 2015 年开源,现已经在多种环境下可用,并被各种体量的团队所使用。</ p >
531
493
</ div >
532
494
< div className = "logos" >
533
495
{ /* Waiting for permission from some of the below */ }
534
496
< a href = "https://www.facebook.com/" target = "_blank" rel = "noopener noreferrer" >
535
497
< img src = "/users/logos/facebook.png" title = "Facebook" />
536
498
</ a >
537
- { /** /}
499
+ { /**/ }
538
500
< a href = "https://twitter.com/" target = "_blank" rel = "noopener noreferrer" >
539
501
< img src = "/users/logos/twitter.png" title = "Twitter" className = "round" />
540
502
</ a >
@@ -545,7 +507,7 @@ public class Character {
545
507
< a href = "https://www.pinterest.com/" target = "_blank" rel = "noopener noreferrer" >
546
508
< img src = "/users/logos/pinterest.png" title = "Pinterest" className = "round" />
547
509
</ a >
548
- { /** /}
510
+ { /**/ }
549
511
< a href = "https://www.airbnb.com/" target = "_blank" rel = "noopener noreferrer" >
550
512
< img src = "/users/logos/airbnb.png" title = "Airbnb" className = "round" />
551
513
</ a >
@@ -562,9 +524,9 @@ public class Character {
562
524
</ div >
563
525
564
526
< a className = "button" href = "/users/" >
565
- More GraphQL Users
527
+ 更多 GraphQL 使用者
566
528
</ a >
567
529
568
530
</ section >
569
531
570
- </ Site >
532
+ </ Site > ;
0 commit comments