From 63eb9c465f8a7ff80513eededed9206e0670d3e4 Mon Sep 17 00:00:00 2001 From: zihang Date: Mon, 23 Dec 2024 14:28:33 +0800 Subject: [PATCH] doc(i18n): translate introduction --- next/language/introduction.md | 4 +- next/locales/zh_CN/LC_MESSAGES/language.po | 137 ++++++++++++--------- next/locales/zh_CN/LC_MESSAGES/tutorial.po | 5 +- 3 files changed, 81 insertions(+), 65 deletions(-) diff --git a/next/language/introduction.md b/next/language/introduction.md index fd310be7..973dab47 100644 --- a/next/language/introduction.md +++ b/next/language/introduction.md @@ -55,10 +55,10 @@ A top level variable binding ## Naming conventions -Variables, functions should start with lowercase letters `a-z` and can contain letters, numbers, and other non-ascii unicode chars. +Variables, functions should start with lowercase letters `a-z` and can contain letters, numbers, underscore, and other non-ascii unicode chars. It is recommended to name them with snake_case. -Constants, types should start with uppercase letters `A-Z` and can contain letters, numbers, and other non-ascii unicode chars. +Constants, types should start with uppercase letters `A-Z` and can contain letters, numbers, underscore, and other non-ascii unicode chars. It is recommended to name them with PascalCase or SCREAMING_SNAKE_CASE. ## Program entrance diff --git a/next/locales/zh_CN/LC_MESSAGES/language.po b/next/locales/zh_CN/LC_MESSAGES/language.po index badfac13..f2e937d9 100644 --- a/next/locales/zh_CN/LC_MESSAGES/language.po +++ b/next/locales/zh_CN/LC_MESSAGES/language.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: MoonBit Document \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-18 14:17+0800\n" +"POT-Creation-Date: 2024-12-23 14:26+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: zh_CN\n" @@ -2512,8 +2512,7 @@ msgstr "" #: ../../language/fundamentals.md:484 msgid "Autofill arguments" -msgstr "" -"自动填充参数" +msgstr "自动填充参数" #: ../../language/fundamentals.md:486 msgid "" @@ -2523,7 +2522,8 @@ msgid "" "`_` as default value. Now if the argument is not explicitly supplied, " "MoonBit will automatically fill it at the call site." msgstr "" -"MoonBit 支持在调用时自动填充特定类型的参数,例如函数调用的源位置。要声明一个自动填充参数,只需将一个可选参数声明为 `_` 作为默认值。现在,如果未显式提供参数,MoonBit 将在调用时自动填充它。" +"MoonBit 支持在调用时自动填充特定类型的参数,例如函数调用的源位置。要声明一个自动填充参数,只需将一个可选参数声明为 `_` " +"作为默认值。现在,如果未显式提供参数,MoonBit 将在调用时自动填充它。" #: ../../language/fundamentals.md:490 msgid "" @@ -2531,7 +2531,8 @@ msgid "" "which is the source location of the whole function call, and `ArgsLoc`, " "which is a array containing the source location of each argument, if any:" msgstr "" -"目前 MoonBit 支持两种类型的自动填充参数,`SourceLoc`,它是整个函数调用的源位置,以及 `ArgsLoc`,它是一个数组,包含每个参数的源位置(如果有):" +"目前 MoonBit 支持两种类型的自动填充参数,`SourceLoc`,它是整个函数调用的源位置,以及 " +"`ArgsLoc`,它是一个数组,包含每个参数的源位置(如果有):" #: ../../language/fundamentals.md:493 msgid "" @@ -2549,8 +2550,7 @@ msgstr "" msgid "" "Autofill arguments are very useful for writing debugging and testing " "utilities." -msgstr "" -"自动填充参数非常有用,用于编写调试和测试工具。" +msgstr "自动填充参数非常有用,用于编写调试和测试工具。" #: ../../language/fundamentals.md:501 msgid "Control Structures" @@ -4178,8 +4178,7 @@ msgstr "管道运算符" msgid "" "MoonBit provides a convenient pipe operator `|>`, which can be used to " "chain regular function calls:" -msgstr "" -"moonbit提供了一个方便的管道运算符`|>`,可以用于链接常规函数调用:" +msgstr "moonbit提供了一个方便的管道运算符`|>`,可以用于链接常规函数调用:" #: ../../language/fundamentals.md:1238 msgid "" @@ -4198,8 +4197,7 @@ msgstr "级联运算符" msgid "" "The cascade operator `..` is used to perform a series of mutable " "operations on the same value consecutively. The syntax is as follows:" -msgstr "" -"级联运算符`..`用于连续对同一值执行一系列可变操作。 语法如下:" +msgstr "级联运算符`..`用于连续对同一值执行一系列可变操作。 语法如下:" #: ../../language/fundamentals.md:1250 msgid "x..f()\n" @@ -4207,8 +4205,7 @@ msgstr "" #: ../../language/fundamentals.md:1257 msgid "`x..f()..g()` is equivalent to `{x.f(); x.g(); x}`." -msgstr "" -"`x..f()..g()` 等价于 `{x.f(); x.g(); x}`。" +msgstr "`x..f()..g()` 等价于 `{x.f(); x.g(); x}`。" #: ../../language/fundamentals.md:1259 msgid "" @@ -4216,8 +4213,7 @@ msgid "" "methods like `write_string`, `write_char`, `write_object`, etc., we often" " need to perform a series of operations on the same `StringBuilder` " "value:" -msgstr "" -"考虑以下情况:对于具有诸如`write_string`,`write_char`,`write_object`等方法的`StringBuilder`类型,我们经常需要对同一`StringBuilder`值执行一系列操作:" +msgstr "考虑以下情况:对于具有诸如`write_string`,`write_char`,`write_object`等方法的`StringBuilder`类型,我们经常需要对同一`StringBuilder`值执行一系列操作:" #: ../../language/fundamentals.md:1263 msgid "" @@ -4260,8 +4256,7 @@ msgid "" "The `todo` syntax (`...`) is a special construct used to mark sections of" " code that are not yet implemented or are placeholders for future " "functionality. For example:" -msgstr "" -"`todo`语法(`...`)是一种特殊构造,用于标记尚未实现或用于未来功能的占位符代码段。 例如:" +msgstr "`todo`语法(`...`)是一种特殊构造,用于标记尚未实现或用于未来功能的占位符代码段。 例如:" #: ../../language/fundamentals.md:1287 msgid "" @@ -4272,7 +4267,7 @@ msgstr "" #: ../../language/index.md:1 msgid "MoonBit Language" -msgstr "" +msgstr "MoonBit(月兔)编程语言" #: ../../language/index.md:3 msgid "" @@ -4281,14 +4276,17 @@ msgid "" "[https://try.moonbitlang.com](https://try.moonbitlang.com) without any " "installation; it does not rely on any server either." msgstr "" +"MoonBit是一个用于云和边缘计算的 WebAssembly 端到端编程语言工具链。无需安装即可在 " +"[https://try.moonbitlang.cn](https://try.moonbitlang.cn) 上使用 IDE " +"环境;它也不依赖任何服务器。" #: ../../language/index.md:5 msgid "**Status and aimed timeline**" -msgstr "" +msgstr "**状态**" #: ../../language/index.md:7 msgid "MoonBit is currently in beta-preview. We expect to reach 1.0 in 2025." -msgstr "" +msgstr "MoonBit 目前处于 beta-preview 阶段。我们预计在 2025 年达到 1.0 版本。" #: ../../language/index.md:9 msgid "" @@ -4299,61 +4297,65 @@ msgid "" "grow much faster than the typical language ecosystem, you won't wait long" " to use MoonBit in your production." msgstr "" +"当 MoonBit 达到 beta 阶段后,任何不兼容的更改将受到严格评估,MoonBit " +"将可以用于生产(只有非常罕见的编译器错误)。MoonBit " +"由一支才华横溢的全职团队开发,他们在构建语言工具链方面拥有丰富的经验,因此我们将比典型的语言生态系统发展得更快,您不必等太久就可以在生产中使用 " +"MoonBit。" #: ../../language/index.md:11 msgid "**Main advantages**" -msgstr "" +msgstr "**主要优势**" #: ../../language/index.md:13 msgid "Generate significantly smaller WASM output than any existing solutions." -msgstr "" +msgstr "生成比现有解决方案明显更小的 Wasm 文件。" #: ../../language/index.md:14 msgid "Much faster runtime performance." -msgstr "" +msgstr "更高的运行时性能。" #: ../../language/index.md:15 msgid "State of the art compile-time performance." -msgstr "" +msgstr "先进的编译时性能。" #: ../../language/index.md:16 msgid "Simple but practical, data-oriented language design." -msgstr "" +msgstr "简单且实用的数据导向语言设计。" #: ../../language/introduction.md:1 msgid "Introduction" -msgstr "" +msgstr "概述" #: ../../language/introduction.md:3 msgid "A MoonBit program consists of top-level definitions including:" -msgstr "" +msgstr "一个 MoonBit 程序由顶层定义组成,包括:" #: ../../language/introduction.md:5 msgid "type definitions" -msgstr "" +msgstr "类型定义" #: ../../language/introduction.md:6 msgid "function definitions" -msgstr "" +msgstr "函数定义" #: ../../language/introduction.md:7 msgid "constant definitions and variable bindings" -msgstr "" +msgstr "常数定义和变量绑定" #: ../../language/introduction.md:8 msgid "`init` functions, `main` function and/or `test` blocks." -msgstr "" +msgstr "`init` 函数,`main` 函数和/或 `test` 块。" #: ../../language/introduction.md:10 msgid "Expressions and Statements" -msgstr "" +msgstr "表达式和语句" #: ../../language/introduction.md:12 msgid "" "MoonBit distinguishes between statements and expressions. In a function " "body, only the last clause should be an expression, which serves as a " "return value. For example:" -msgstr "" +msgstr "MoonBit 区分语句和表达式。在函数体中,只有最后一个子句应该是一个表达式,它作为返回值。例如:" #: ../../language/introduction.md:14 msgid "" @@ -4371,80 +4373,80 @@ msgstr "" #: ../../language/introduction.md:20 msgid "Expressions include:" -msgstr "" +msgstr "表达式包括:" #: ../../language/introduction.md:22 msgid "" "Value literals (e.g. Boolean values, numbers, characters, strings, " "arrays, tuples, structs)" -msgstr "" +msgstr "值字面量(例如布尔值、数字、字符、字符串、数组、元组、结构体)" #: ../../language/introduction.md:23 msgid "Arithmetical, logical, or comparison operations" -msgstr "" +msgstr "算术、逻辑或比较操作" #: ../../language/introduction.md:24 msgid "" "Accesses to array elements (e.g. `a[0]`), struct fields (e.g `r.x`), " "tuple components (e.g. `t.0`), etc." -msgstr "" +msgstr "访问数组元素(例如 `a[0]`),结构体字段(例如 `r.x`),元组组件(例如 `t.0`)等。" #: ../../language/introduction.md:25 msgid "Variables and (capitalized) enum constructors" -msgstr "" +msgstr "变量和枚举构造函数" #: ../../language/introduction.md:26 msgid "Anonymous local function definitions" -msgstr "" +msgstr "匿名本地函数定义" #: ../../language/introduction.md:27 msgid "`match`, `if`, `loop` expressions, etc." -msgstr "" +msgstr "`match`,`if`,`loop` 表达式等。" #: ../../language/introduction.md:29 msgid "Statements include:" -msgstr "" +msgstr "语句包括:" #: ../../language/introduction.md:31 msgid "Named local function definitions" -msgstr "" +msgstr "命名本地函数定义" #: ../../language/introduction.md:32 msgid "Local variable bindings" -msgstr "" +msgstr "本地变量绑定" #: ../../language/introduction.md:33 msgid "Assignments" -msgstr "" +msgstr "赋值" #: ../../language/introduction.md:34 msgid "`return` statements" -msgstr "" +msgstr "`return` 语句" #: ../../language/introduction.md:35 msgid "Any expression whose return type is `Unit`, (e.g. `ignore`)" -msgstr "" +msgstr "任何返回类型为 `Unit` 的表达式(例如 `ignore`)" #: ../../language/introduction.md:37 msgid "" "A code block can contain multiple statements and one expression, and the " "value of the expression is the value of the code block." -msgstr "" +msgstr "代码块可以包含多个语句和一个表达式,表达式的值是代码块的值。" #: ../../language/introduction.md:39 msgid "Variable Binding" -msgstr "" +msgstr "变量绑定" #: ../../language/introduction.md:41 msgid "" "A variable can be declared as mutable or immutable using `let mut` or " "`let`, respectively. A mutable variable can be reassigned to a new value," " while an immutable one cannot." -msgstr "" +msgstr "变量可以使用 `let mut` 或 `let` 声明为可变或不可变。可变变量可以重新赋值为新值,而不可变变量则不能。" #: ../../language/introduction.md:43 msgid "A constant can only be declared at top level and cannot be changed." -msgstr "" +msgstr "常量只能在顶层声明,不能更改。" #: ../../language/introduction.md:45 msgid "" @@ -4462,57 +4464,62 @@ msgstr "" #: ../../language/introduction.md:50 msgid "A top level variable binding" -msgstr "" +msgstr "顶层变量绑定" #: ../../language/introduction.md:51 msgid "" "requires **explicit** type annotation (unless defined using literals such" " as string, byte or numbers)" -msgstr "" +msgstr "需要 **显式** 类型注释(除非使用字符串、字节或数字等字面量定义)" #: ../../language/introduction.md:52 msgid "can't be mutable (use `Ref` instead)" -msgstr "" +msgstr "不能是可变的(使用 `Ref` 代替)" #: ../../language/introduction.md:56 msgid "Naming conventions" -msgstr "" +msgstr "命名约定" #: ../../language/introduction.md:58 msgid "" "Variables, functions should start with lowercase letters `a-z` and can " -"contain letters, numbers, and other non-ascii unicode chars. It is " -"recommended to name them with snake_case." -msgstr "" +"contain letters, numbers, underscore, and other non-ascii unicode chars. " +"It is recommended to name them with snake_case." +msgstr "变量、函数应以小写字母 `a-z` 开头,可以包含字母、数字、下划线和其他非 ASCII 的 Unicode 字符。建议使用 snake_case 命名。" #: ../../language/introduction.md:61 msgid "" "Constants, types should start with uppercase letters `A-Z` and can " -"contain letters, numbers, and other non-ascii unicode chars. It is " -"recommended to name them with PascalCase or SCREAMING_SNAKE_CASE." +"contain letters, numbers, underscore, and other non-ascii unicode chars. " +"It is recommended to name them with PascalCase or SCREAMING_SNAKE_CASE." msgstr "" +"常量、类型应以大写字母 `A-Z` 开头,可以包含字母、数字、下划线和其他非 ASCII 的 Unicode 字符。建议使用 PascalCase 或 " +"SCREAMING_SNAKE_CASE 命名。" #: ../../language/introduction.md:64 msgid "Program entrance" -msgstr "" +msgstr "程序入口" #: ../../language/introduction.md:66 msgid "`init` and `main`" -msgstr "" +msgstr "`init` 和 `main`" #: ../../language/introduction.md:67 msgid "" "There is a specialized function called `init` function. The `init` " "function is special:" msgstr "" +"有一个专门的函数称为 `init` 函数。`init` 函数是特殊的:" #: ../../language/introduction.md:69 msgid "It has no parameter list nor return type." msgstr "" +"它没有参数列表也没有返回类型。" #: ../../language/introduction.md:70 msgid "There can be multiple `init` functions in the same package." msgstr "" +"同一个包中可以有多个 `init` 函数。" #: ../../language/introduction.md:71 msgid "" @@ -4521,6 +4528,7 @@ msgid "" "initializing a package. Therefore, `init` functions should only consist " "of statements." msgstr "" +"`init` 函数不能被显式调用或被其他函数引用。相反,所有 `init` 函数将在初始化包时隐式调用。因此,`init` 函数应该只包含语句。" #: ../../language/introduction.md:74 msgid "" @@ -4536,10 +4544,12 @@ msgid "" "function is the main entrance of the program, and it will be executed " "after the initialization stage." msgstr "" +"还有另一个专门的函数称为 `main` 函数。`main` 函数是程序的主入口,它将在初始化阶段之后执行。" #: ../../language/introduction.md:82 msgid "Same as the `init` function, it has no parameter list nor return type." msgstr "" +"与 `init` 函数相同,它没有参数列表也没有返回类型。" #: ../../language/introduction.md:84 msgid "" @@ -4552,6 +4562,7 @@ msgstr "" #: ../../language/introduction.md:90 msgid "The previous two code snippets will print the following at runtime:" msgstr "" +"前两个代码片段将在运行时打印以下内容:" #: ../../language/introduction.md:92 msgid "" @@ -4564,6 +4575,7 @@ msgid "" "Only packages that are `main` packages can define such `main` function. " "Check out [build system tutorial](/toolchain/moon/tutorial) for detail." msgstr "" +"只有 `main` 包的包才能定义这样的 `main` 函数。查看[构建系统教程](/toolchain/moon/tutorial)了解详情。" #: ../../language/introduction.md:99 msgid "moon.pkg.json" @@ -4585,6 +4597,7 @@ msgid "" "There's also a top-level structure called `test` block. A `test` block " "defines inline tests, such as:" msgstr "" +"还有一个称为 `test` 块的顶级结构。`test` 块定义内联测试,例如:" #: ../../language/introduction.md:108 ../../language/tests.md:11 msgid "" @@ -4601,6 +4614,7 @@ msgid "" "demonstrate the execution result, and we assume that all the `test` " "blocks pass unless stated otherwise." msgstr "" +"以下内容将使用 `test` 块和 `main` 函数来演示执行结果。我们假设所有 `test` 块都通过测试,除非另有说明。" #: ../../language/methods.md:1 msgid "Method and Trait" @@ -5938,3 +5952,4 @@ msgid "" "current package and the packages defined in the `import` and `test-" "import` sections of the package configuration (`moon.pkg.json`)." msgstr "" + diff --git a/next/locales/zh_CN/LC_MESSAGES/tutorial.po b/next/locales/zh_CN/LC_MESSAGES/tutorial.po index aa7669f8..a7b72313 100644 --- a/next/locales/zh_CN/LC_MESSAGES/tutorial.po +++ b/next/locales/zh_CN/LC_MESSAGES/tutorial.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: MoonBit Document \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-18 11:20+0800\n" +"POT-Creation-Date: 2024-12-23 14:26+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: zh_CN\n" @@ -2621,9 +2621,10 @@ msgid "Lambda calculus" msgstr "Lambda 演算" #: ../../tutorial/example/lambda/index.md:3 +#, fuzzy msgid "" "Functional programming rises with the fall of Moore's Law. The full " -"utilization of milti-core processors has become an increasingly important" +"utilization of multi-core processors has become an increasingly important" " optimization method, while functional programming also becomes more " "popularized with its affinity for parallel computation. The reasons " "behind this trend can be traced back to one of its theoretical "