From e8b6055e103d03b62b2c09b04435ac8f0093d327 Mon Sep 17 00:00:00 2001 From: niuzhist Date: Sat, 31 May 2014 18:26:12 -0700 Subject: yaml: Chinese translation --- zh-cn/yaml-cn.html.markdown | 136 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 zh-cn/yaml-cn.html.markdown (limited to 'zh-cn') diff --git a/zh-cn/yaml-cn.html.markdown b/zh-cn/yaml-cn.html.markdown new file mode 100644 index 00000000..8370b224 --- /dev/null +++ b/zh-cn/yaml-cn.html.markdown @@ -0,0 +1,136 @@ +--- +language: yaml +contributors: + - ["Adam Brenecki", "https://github.com/adambrenecki"] +translators: + - ["Zach Zhang", "https://github.com/checkcheckzz"] +filename: learnyaml-cn.yaml +lang: zh-cn +--- + +YAML是一个数据序列化语言,被设计成人类直接可写可读的。 + +它是JSON的严格超集,增加了语法显著换行符和缩进,就像Python。但和Python不一样, +YAML根本不容许文字制表符。 + + +```yaml +# YAML中的注解看起来像这样。 + +################ +# 标量类型 # +################ + +# 我们的根对象 (它们在整个文件里延续) 将会是一个地图, +# 它等价于在别的语言里的一个字典,哈西表或对象。 +key: value +another_key: Another value goes here. +a_number_value: 100 +scientific_notation: 1e+12 +boolean: true +null_value: null +key with spaces: value +# 注意到字符串不需要被引用。但是,它们可以被引用。 +"Keys can be quoted too.": "Useful if you want to put a ':' in your key." + +# 多行字符串既可以写成像一个'文字块'(使用 |), +# 或像一个'折叠块'(使用 '>')。 +literal_block: | + This entire block of text will be the value of the 'literal_block' key, + with line breaks being preserved. + + The literal continues until de-dented, and the leading indentation is + stripped. + + Any lines that are 'more-indented' keep the rest of their indentation - + these lines will be indented by 4 spaces. +folded_style: > + This entire block of text will be the value of 'folded_style', but this + time, all newlines will be replaced with a single space. + + Blank lines, like above, are converted to a newline character. + + 'More-indented' lines keep their newlines, too - + this text will appear over two lines. + +#################### +# 集合类型 # +#################### + +# 嵌套是通过缩进完成的。 +a_nested_map: + key: value + another_key: Another Value + another_nested_map: + hello: hello + +# 图不用有字符串键值。 +0.25: a float key + +# 键值也可以是多行对象,用?表明键值的开始。 +? | + This is a key + that has multiple lines +: and this is its value + +# YAML也容许键值是集合类型,但是很多语言将会抱怨。 + +# 序列 (等价于表或数组) 看起来像这样: +a_sequence: + - Item 1 + - Item 2 + - 0.5 # sequences can contain disparate types + - Item 4 + - key: value + another_key: another_value + - + - This is a sequence + - inside another sequence + +# 因为YAML是JSON的超集,你也可以写JSON风格的地图和序列: +json_map: {"key": "value"} +json_seq: [3, 2, 1, "takeoff"] + +####################### +# 其余的YAML特点 # +####################### + +# YAML还有一个方便的特点叫'锚',它让你简单地在整个文件里重复内容。 +# 两个键值将会有相同的值: +anchored_content: &anchor_name This string will appear as the value of two keys. +other_anchor: *anchor_name + +# YAML还有标签,你可以用它显示地声明类型。 +explicit_string: !!str 0.5 +# 一些解析器实现特定语言的标签,就像这个为了Python的复数类型。 +python_complex_number: !!python/complex 1+2j + +#################### +# 其余的YAML类型 # +#################### + +# 字符串和数字不是仅有的YAML可以理解的标量。 +# ISO 格式的日期和日期时间文字也是可以被解析的。 +datetime: 2001-12-15T02:59:43.1Z +datetime_with_spaces: 2001-12-14 21:59:43.10 -5 +date: 2002-12-14 + +# 这个!!binary标签表明一个字符串实际上是一个二进制blob的base64编码表示。 +gif_file: !!binary | + R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5 + OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+ + +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC + AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs= + +# YAML还有一个集合类型,它看起来像这样: +set: + ? item1 + ? item2 + ? item3 + +# 像Python一样,集合仅是有null数值的地图;上面的集合等价于: +set2: + item1: null + item2: null + item3: null +``` -- cgit v1.2.3 From 195735fd176b359f98450891ce00a233ccd585a8 Mon Sep 17 00:00:00 2001 From: niuzhist Date: Sat, 31 May 2014 18:34:05 -0700 Subject: fix encoding issue --- zh-cn/yaml-cn.html.markdown | 56 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'zh-cn') diff --git a/zh-cn/yaml-cn.html.markdown b/zh-cn/yaml-cn.html.markdown index 8370b224..bcc41067 100644 --- a/zh-cn/yaml-cn.html.markdown +++ b/zh-cn/yaml-cn.html.markdown @@ -8,21 +8,21 @@ filename: learnyaml-cn.yaml lang: zh-cn --- -YAML是一个数据序列化语言,被设计成人类直接可写可读的。 +YAML鏄竴涓暟鎹簭鍒楀寲璇█锛岃璁捐鎴愪汉绫荤洿鎺ュ彲鍐欏彲璇荤殑銆 -它是JSON的严格超集,增加了语法显著换行符和缩进,就像Python。但和Python不一样, -YAML根本不容许文字制表符。 +瀹冩槸JSON鐨勪弗鏍艰秴闆嗭紝澧炲姞浜嗚娉曟樉钁楁崲琛岀鍜岀缉杩涳紝灏卞儚Python銆備絾鍜孭ython涓嶄竴鏍凤紝 +YAML鏍规湰涓嶅璁告枃瀛楀埗琛ㄧ銆 ```yaml -# YAML中的注解看起来像这样。 +# YAML涓殑娉ㄨВ鐪嬭捣鏉ュ儚杩欐牱銆 ################ -# 标量类型 # +# 鏍囬噺绫诲瀷 # ################ -# 我们的根对象 (它们在整个文件里延续) 将会是一个地图, -# 它等价于在别的语言里的一个字典,哈西表或对象。 +# 鎴戜滑鐨勬牴瀵硅薄 (瀹冧滑鍦ㄦ暣涓枃浠堕噷寤剁画) 灏嗕細鏄竴涓湴鍥撅紝 +# 瀹冪瓑浠蜂簬鍦ㄥ埆鐨勮瑷閲岀殑涓涓瓧鍏革紝鍝堣タ琛ㄦ垨瀵硅薄銆 key: value another_key: Another value goes here. a_number_value: 100 @@ -30,11 +30,11 @@ scientific_notation: 1e+12 boolean: true null_value: null key with spaces: value -# 注意到字符串不需要被引用。但是,它们可以被引用。 +# 娉ㄦ剰鍒板瓧绗︿覆涓嶉渶瑕佽寮曠敤銆備絾鏄紝瀹冧滑鍙互琚紩鐢ㄣ "Keys can be quoted too.": "Useful if you want to put a ':' in your key." -# 多行字符串既可以写成像一个'文字块'(使用 |), -# 或像一个'折叠块'(使用 '>')。 +# 澶氳瀛楃涓叉棦鍙互鍐欐垚鍍忎竴涓'鏂囧瓧鍧'(浣跨敤 |)锛 +# 鎴栧儚涓涓'鎶樺彔鍧'(浣跨敤 '>')銆 literal_block: | This entire block of text will be the value of the 'literal_block' key, with line breaks being preserved. @@ -54,28 +54,28 @@ folded_style: > this text will appear over two lines. #################### -# 集合类型 # +# 闆嗗悎绫诲瀷 # #################### -# 嵌套是通过缩进完成的。 +# 宓屽鏄氳繃缂╄繘瀹屾垚鐨勩 a_nested_map: key: value another_key: Another Value another_nested_map: hello: hello -# 图不用有字符串键值。 +# 鍦板浘涓嶇敤鏈夊瓧绗︿覆閿笺 0.25: a float key -# 键值也可以是多行对象,用?表明键值的开始。 +# 閿间篃鍙互鏄琛屽璞★紝鐢?琛ㄦ槑閿肩殑寮濮嬨 ? | This is a key that has multiple lines : and this is its value -# YAML也容许键值是集合类型,但是很多语言将会抱怨。 +# YAML涔熷璁搁敭鍊兼槸闆嗗悎绫诲瀷锛屼絾鏄緢澶氳瑷灏嗕細鎶辨ㄣ -# 序列 (等价于表或数组) 看起来像这样: +# 搴忓垪 (绛変环浜庤〃鎴栨暟缁) 鐪嬭捣鏉ュ儚杩欐牱锛 a_sequence: - Item 1 - Item 2 @@ -87,48 +87,48 @@ a_sequence: - This is a sequence - inside another sequence -# 因为YAML是JSON的超集,你也可以写JSON风格的地图和序列: +# 鍥犱负YAML鏄疛SON鐨勮秴闆嗭紝浣犱篃鍙互鍐橨SON椋庢牸鐨勫湴鍥惧拰搴忓垪锛 json_map: {"key": "value"} json_seq: [3, 2, 1, "takeoff"] ####################### -# 其余的YAML特点 # +# 鍏朵綑鐨刌AML鐗圭偣 # ####################### -# YAML还有一个方便的特点叫'锚',它让你简单地在整个文件里重复内容。 -# 两个键值将会有相同的值: +# YAML杩樻湁涓涓柟渚跨殑鐗圭偣鍙'閿'锛屽畠璁╀綘绠鍗曞湴鍦ㄦ暣涓枃浠堕噷閲嶅鍐呭銆 +# 涓や釜閿煎皢浼氭湁鐩稿悓鐨勫硷細 anchored_content: &anchor_name This string will appear as the value of two keys. other_anchor: *anchor_name -# YAML还有标签,你可以用它显示地声明类型。 +# YAML杩樻湁鏍囩锛屼綘鍙互鐢ㄥ畠鏄剧ず鍦板0鏄庣被鍨嬨 explicit_string: !!str 0.5 -# 一些解析器实现特定语言的标签,就像这个为了Python的复数类型。 +# 涓浜涜В鏋愬櫒瀹炵幇鐗瑰畾璇█鐨勬爣绛撅紝灏卞儚杩欎釜涓轰簡Python鐨勫鏁扮被鍨嬨 python_complex_number: !!python/complex 1+2j #################### -# 其余的YAML类型 # +# 鍏朵綑鐨刌AML绫诲瀷 # #################### -# 字符串和数字不是仅有的YAML可以理解的标量。 -# ISO 格式的日期和日期时间文字也是可以被解析的。 +# 瀛楃涓插拰鏁板瓧涓嶆槸浠呮湁鐨刌AML鍙互鐞嗚В鐨勬爣閲忋 +# ISO 鏍煎紡鐨勬棩鏈熷拰鏃ユ湡鏃堕棿鏂囧瓧涔熸槸鍙互琚В鏋愮殑銆 datetime: 2001-12-15T02:59:43.1Z datetime_with_spaces: 2001-12-14 21:59:43.10 -5 date: 2002-12-14 -# 这个!!binary标签表明一个字符串实际上是一个二进制blob的base64编码表示。 +# 杩欎釜!!binary鏍囩琛ㄦ槑涓涓瓧绗︿覆瀹為檯涓婃槸涓涓簩杩涘埗blob鐨刡ase64缂栫爜琛ㄧず銆 gif_file: !!binary | R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5 OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+ +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs= -# YAML还有一个集合类型,它看起来像这样: +# YAML杩樻湁涓涓泦鍚堢被鍨嬶紝瀹冪湅璧锋潵鍍忚繖鏍凤細 set: ? item1 ? item2 ? item3 -# 像Python一样,集合仅是有null数值的地图;上面的集合等价于: +# 鍍廝ython涓鏍凤紝闆嗗悎浠呮槸鏈塶ull鏁板肩殑鍦板浘锛涗笂闈㈢殑闆嗗悎绛変环浜庯細 set2: item1: null item2: null -- cgit v1.2.3