From 41ff1c7debb20b1e59be79cda0a6d10a5999e726 Mon Sep 17 00:00:00 2001 From: Henri F Date: Sat, 20 Jan 2024 15:04:38 -0800 Subject: [PATCH] zh-CN: cr2 Android translations (#1672) *Stats:* Before: 1018 translated messages, 368 fuzzy translations, 2074 untranslated messages. After: 1132 translated messages, 456 fuzzy translations, 1872 untranslated messages. #324 #1463 --------- Co-authored-by: Emma Li --- po/zh-CN.po | 405 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 252 insertions(+), 153 deletions(-) diff --git a/po/zh-CN.po b/po/zh-CN.po index 3129071903ef..206fea76d684 100644 --- a/po/zh-CN.po +++ b/po/zh-CN.po @@ -11046,31 +11046,39 @@ msgstr "" msgid "" "The speaker may mention any of the following given the increased use of Rust " "in Android:" -msgstr "" +msgstr "鉴于 Android 中越来越多地使用 Rust,演讲者可能会提到以下任何一项:" #: src/android.md:17 msgid "" "Service example: [DNS over HTTP](https://security.googleblog.com/2022/07/dns-" "over-http3-in-android.html)" msgstr "" +"服务示例:[DNS-over-HTTP](https://security.googleblog.com/2022/07/dns-over-" +"http3-in-android.html)" #: src/android.md:20 msgid "" "Libraries: [Rutabaga Virtual Graphics Interface](https://crosvm.dev/book/" "appendix/rutabaga_gfx.html)" msgstr "" +"库:[Rutabaga 虚拟图形接口](https://crosvm.dev/book/appendix/rutabaga_gfx." +"html)" #: src/android.md:23 msgid "" "Kernel Drivers: [Binder](https://lore.kernel.org/rust-for-linux/20231101-" "rust-binder-v1-0-08ba9197f637@google.com/)" msgstr "" +"内核驱动程序:[Binder](https://lore.kernel.org/rust-for-linux/20231101-rust-" +"binder-v1-0-08ba9197f637@google.com/)" #: src/android.md:26 msgid "" "Firmware: [pKVM firmware](https://security.googleblog.com/2023/10/bare-metal-" "rust-in-android.html)" msgstr "" +"固件:[pKVM 固件](https://security.googleblog.com/2023/10/bare-metal-rust-in-" +"android.html)" #: src/android/setup.md:3 #, fuzzy @@ -11090,16 +11098,21 @@ msgstr "" "setup/start)." #: src/android/setup.md:20 +#, fuzzy msgid "" "Cuttlefish is a reference Android device designed to work on generic Linux " "desktops. MacOS support is also planned." msgstr "" +"Cuttlefish 是一款 Android 引用设备,专用于通用 Linux 桌面设备。此外,我们还计" +"划支持 MacOS。" #: src/android/setup.md:23 msgid "" "The Cuttlefish system image maintains high fidelity to real devices, and is " "the ideal emulator to run many Rust use cases." msgstr "" +"Cuttlefish 系统映像会保持媲美真实设备的高保真度,是运行许多 Rust 用例的理想模" +"拟器。" #: src/android/build-rules.md:3 msgid "The Android build system (Soong) supports Rust via a number of modules:" @@ -11130,10 +11143,12 @@ msgid "Description" msgstr "描述" #: src/android/build-rules.md:7 +#, fuzzy msgid "`rust_binary`" msgstr "`rust_binary`" #: src/android/build-rules.md:7 +#, fuzzy msgid "Produces a Rust binary." msgstr "生成一个Rust二进制文件。" @@ -11146,8 +11161,9 @@ msgid "Produces a Rust library, and provides both `rlib` and `dylib` variants." msgstr "生成一个 Rust 库,并提供 `rlib` 和 `dylib` 两种变体。" #: src/android/build-rules.md:9 +#, fuzzy msgid "`rust_ffi`" -msgstr "`rust_ffi`" +msgstr "`rust_ffi `" #: src/android/build-rules.md:9 msgid "" @@ -11163,11 +11179,12 @@ msgstr "`rust_proc_macro`" msgid "" "Produces a `proc-macro` Rust library. These are analogous to compiler " "plugins." -msgstr "" +msgstr "生成“proc-macro”Rust 库。这些宏与编译器插件类似。" #: src/android/build-rules.md:11 +#, fuzzy msgid "`rust_test`" -msgstr "`rust_test`" +msgstr "`rust_test `" #: src/android/build-rules.md:11 msgid "Produces a Rust test binary that uses the standard Rust test harness." @@ -11179,7 +11196,7 @@ msgstr "`rust_fuzz`" #: src/android/build-rules.md:12 msgid "Produces a Rust fuzz binary leveraging `libfuzzer`." -msgstr "" +msgstr "生成使用 `libfuzzer` 的 Rust 模糊测试二进制文件。" #: src/android/build-rules.md:13 msgid "`rust_protobuf`" @@ -11192,8 +11209,9 @@ msgid "" msgstr "生成源代码并生成为特定 protobuf 提供接口的 Rust 库。" #: src/android/build-rules.md:14 +#, fuzzy msgid "`rust_bindgen`" -msgstr "" +msgstr "`rust_bindgen`" #: src/android/build-rules.md:14 msgid "" @@ -11207,25 +11225,29 @@ msgstr "下面我们来看看 `rust_binary` 和 `rust_library`。" #: src/android/build-rules.md:20 msgid "Additional items speaker may mention:" -msgstr "" +msgstr "演讲者可能会提及其他内容:" #: src/android/build-rules.md:22 msgid "" "Cargo is not optimized for multi-language repos, and also downloads packages " "from the internet." -msgstr "" +msgstr "Cargo 未针对多语言代码库进行优化,并且从互联网下载软件包。" #: src/android/build-rules.md:25 +#, fuzzy msgid "" "For compliance and performance, Android must have crates in-tree. It must " "also interop with C/C++/Java code. Soong fills that gap." msgstr "" +"为了确保合规性和性能,Android 必须具有树内 crate。它还必须与 C/C++/Java 代码" +"进行互操作。Soong 填补了这一空白。" #: src/android/build-rules.md:28 msgid "" "Soong has many similarities to Bazel, which is the open-source variant of " "Blaze (used in google3)." msgstr "" +"Soong 与 Bazel 有许多相似之处,后者是 Blaze 的开源变体(在 google3 中使用)。" #: src/android/build-rules.md:31 msgid "" @@ -11234,14 +11256,18 @@ msgid "" "com/chromiumos/bazel/), and [Fuchsia](https://source.android.com/docs/setup/" "build/bazel/introduction) to Bazel." msgstr "" +"我们计划逐渐在 [Android](https://source.android.com/docs/setup/build/bazel/" +"introduction),[ChromeOS](https://chromium.googlesource.com/chromiumos/" +"bazel/) 和 [Fuchsia](https://source.android.com/docs/setup/build/bazel/" +"introduction) 中采用 Bazel 进行开发。" #: src/android/build-rules.md:37 msgid "Learning Bazel-like build rules is useful for all Rust OS developers." -msgstr "" +msgstr "对所有 Rust 操作系统开发者而言,了解类似 Bazel 的构建规都很有用。" #: src/android/build-rules.md:39 msgid "Fun fact: Data from Star Trek is a Soong-type Android." -msgstr "" +msgstr "趣味小知识:《星际迷航》中的数据是 Soong 类型的 Android。" #: src/android/build-rules/binary.md:1 msgid "Rust Binaries" @@ -11258,14 +11284,15 @@ msgid "_hello_rust/Android.bp_:" msgstr "_hello_rust/Android.bp_:" #: src/android/build-rules/binary.md:10 src/android/build-rules/binary.md:11 +#, fuzzy msgid "\"hello_rust\"" -msgstr "" +msgstr "\"hello_rust\"" #: src/android/build-rules/binary.md:12 src/android/build-rules/library.md:19 #: src/android/logging.md:12 #, fuzzy msgid "\"src/main.rs\"" -msgstr "_hello_rust/src/main.rs_:" +msgstr "\"main.c\"" #: src/android/build-rules/binary.md:16 src/android/build-rules/library.md:34 msgid "_hello_rust/src/main.rs_:" @@ -11273,15 +11300,16 @@ msgstr "_hello_rust/src/main.rs_:" #: src/android/build-rules/binary.md:19 src/android/build-rules/library.md:37 msgid "//! Rust demo.\n" -msgstr "" +msgstr "//! Rust demo.\n" #: src/android/build-rules/binary.md:20 src/android/build-rules/library.md:41 msgid "/// Prints a greeting to standard output.\n" -msgstr "" +msgstr "/// Prints a greeting to standard output.\n" #: src/android/build-rules/binary.md:23 src/exercises/chromium/build-rules.md:9 +#, fuzzy msgid "\"Hello from Rust!\"" -msgstr "" +msgstr "\"Hello from Rust!\"" #: src/android/build-rules/binary.md:27 msgid "You can now build, push, and run the binary:" @@ -11330,16 +11358,17 @@ msgstr "" "crate。" #: src/android/build-rules/library.md:17 src/android/build-rules/library.md:18 +#, fuzzy msgid "\"hello_rust_with_dep\"" -msgstr "" +msgstr "\"hello_rust_with_dep\"" #: src/android/build-rules/library.md:21 src/android/build-rules/library.md:28 msgid "\"libgreetings\"" -msgstr "" +msgstr "\"libgreetings\"" #: src/android/build-rules/library.md:22 msgid "\"libtextwrap\"" -msgstr "" +msgstr "\"libtextwrap\"" #: src/android/build-rules/library.md:24 msgid "// Need this to avoid dynamic link error.\n" @@ -11347,13 +11376,13 @@ msgstr "" #: src/android/build-rules/library.md:29 msgid "\"greetings\"" -msgstr "" +msgstr "\"greetings\"" #: src/android/build-rules/library.md:30 src/android/aidl/implementation.md:29 #: src/android/interoperability/java.md:39 #, fuzzy msgid "\"src/lib.rs\"" -msgstr "_hello_rust/src/main.rs_:" +msgstr "\"lib.rs\"" #: src/android/build-rules/library.md:48 msgid "_hello_rust/src/lib.rs_:" @@ -11361,15 +11390,15 @@ msgstr "_hello_rust/src/lib.rs_:" #: src/android/build-rules/library.md:51 msgid "//! Greeting library.\n" -msgstr "" +msgstr "//! Greeting library.\n" #: src/android/build-rules/library.md:52 msgid "/// Greet `name`.\n" -msgstr "" +msgstr "/// Greet `name`.\n" #: src/android/build-rules/library.md:55 msgid "\"Hello {name}, it is very nice to meet you!\"" -msgstr "" +msgstr "\"Hello {name}, it is very nice to meet you!\"" #: src/android/build-rules/library.md:59 msgid "You build, push, and run the binary like before:" @@ -11424,29 +11453,29 @@ msgstr "" #: src/android/aidl/interface.md:9 src/android/aidl/changing.md:8 msgid "/** Birthday service interface. */" -msgstr "" +msgstr "/** Birthday service interface. */" #: src/android/aidl/interface.md:12 src/android/aidl/changing.md:11 msgid "/** Generate a Happy Birthday message. */" -msgstr "" +msgstr "/** Generate a Happy Birthday message. */" #: src/android/aidl/interface.md:17 msgid "_birthday_service/aidl/Android.bp_:" msgstr "_birthday_service/aidl/Android.bp_:" #: src/android/aidl/interface.md:21 +#, fuzzy msgid "\"com.example.birthdayservice\"" -msgstr "" +msgstr "\"com.example.birthdayservice\"" #: src/android/aidl/interface.md:22 #, fuzzy msgid "\"com/example/birthdayservice/*.aidl\"" -msgstr "" -"_birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl_:" +msgstr "\"com.example.birthdayservice\"" #: src/android/aidl/interface.md:25 msgid "// Rust is not enabled by default\n" -msgstr "" +msgstr "// Rust is not enabled by default\n" #: src/android/aidl/interface.md:32 msgid "" @@ -11470,16 +11499,16 @@ msgstr "_birthday_service/src/lib.rs_:" #: src/android/aidl/implementation.md:8 msgid "//! Implementation of the `IBirthdayService` AIDL interface.\n" -msgstr "" +msgstr "//! Implementation of the `IBirthdayService` AIDL interface.\n" #: src/android/aidl/implementation.md:11 #, fuzzy msgid "/// The `IBirthdayService` implementation.\n" -msgstr "服务实现" +msgstr "`IBirthdayService`实现 " #: src/android/aidl/implementation.md:19 msgid "\"Happy Birthday {name}, congratulations with the {years} years!\"" -msgstr "" +msgstr "\"Happy Birthday {name}, congratulations with the {years} years!\"" #: src/android/aidl/implementation.md:24 src/android/aidl/server.md:28 #: src/android/aidl/client.md:36 @@ -11489,23 +11518,24 @@ msgstr "_birthday_service/Android.bp_:" #: src/android/aidl/implementation.md:28 src/android/aidl/server.md:38 #, fuzzy msgid "\"libbirthdayservice\"" -msgstr "_birthday_service/src/lib.rs_:" +msgstr "\"libbirthday.c\"" #: src/android/aidl/implementation.md:30 src/android/aidl/server.md:13 #: src/android/aidl/client.md:12 #, fuzzy msgid "\"birthdayservice\"" -msgstr "_birthday_service/src/lib.rs_:" +msgstr "\"com.example.birthdayservice\"" #: src/android/aidl/implementation.md:32 src/android/aidl/server.md:36 #: src/android/aidl/client.md:44 +#, fuzzy msgid "\"com.example.birthdayservice-rust\"" -msgstr "" +msgstr "\"com.example.birthdayservice-rust\"" #: src/android/aidl/implementation.md:33 src/android/aidl/server.md:37 #: src/android/aidl/client.md:45 msgid "\"libbinder_rs\"" -msgstr "" +msgstr "\"libbinder_rs\"" #: src/android/aidl/server.md:1 msgid "AIDL Server" @@ -11520,21 +11550,22 @@ msgid "_birthday_service/src/server.rs_:" msgstr "_birthday_service/src/server.rs_:" #: src/android/aidl/server.md:8 src/android/aidl/client.md:8 +#, fuzzy msgid "//! Birthday service.\n" -msgstr "" +msgstr "//! Birthday service.\n" #: src/android/aidl/server.md:14 msgid "/// Entry point for birthday service.\n" -msgstr "" +msgstr "/// Entry point for birthday service.\n" #: src/android/aidl/server.md:23 msgid "\"Failed to register service\"" -msgstr "" +msgstr "\"Failed to register service\"" #: src/android/aidl/server.md:32 src/android/aidl/server.md:33 #, fuzzy msgid "\"birthday_server\"" -msgstr "_birthday_service/src/lib.rs_:" +msgstr "\"libbirthday_wrapper.h\"" #: src/android/aidl/server.md:34 #, fuzzy @@ -11588,30 +11619,32 @@ msgid "_birthday_service/src/client.rs_:" msgstr "_birthday_service/src/client.rs_:" #: src/android/aidl/client.md:13 +#, fuzzy msgid "/// Connect to the BirthdayService.\n" -msgstr "" +msgstr "/// Connect to the BirthdayService.\n" #: src/android/aidl/client.md:19 +#, fuzzy msgid "/// Call the birthday service.\n" -msgstr "" +msgstr "/// Call the birthday service.\n" #: src/android/aidl/client.md:29 msgid "\"Failed to connect to BirthdayService\"" -msgstr "" +msgstr "\"Failed to connect to BirthdayService\"" #: src/android/aidl/client.md:31 msgid "\"{msg}\"" -msgstr "" +msgstr "\"{msg}\"" #: src/android/aidl/client.md:40 src/android/aidl/client.md:41 #, fuzzy msgid "\"birthday_client\"" -msgstr "_birthday_service/src/client.rs_:" +msgstr "\"birthday_bindgen\"" #: src/android/aidl/client.md:42 #, fuzzy msgid "\"src/client.rs\"" -msgstr "`src/bin/client.rs`:" +msgstr "\"lib.rs\"" #: src/android/aidl/client.md:51 msgid "Notice that the client does not depend on `libbirthdayservice`." @@ -11659,15 +11692,16 @@ msgstr "_hello_rust_logs/Android.bp_:" #: src/android/logging.md:10 src/android/logging.md:11 #, fuzzy msgid "\"hello_rust_logs\"" -msgstr "_hello_rust_logs/Android.bp_:" +msgstr "\"hello_rust\"" #: src/android/logging.md:14 +#, fuzzy msgid "\"liblog_rust\"" -msgstr "" +msgstr "\"liblog_rust\"" #: src/android/logging.md:15 msgid "\"liblogger\"" -msgstr "" +msgstr "\"liblogger\"" #: src/android/logging.md:21 msgid "_hello_rust_logs/src/main.rs_:" @@ -11675,27 +11709,29 @@ msgstr "_hello_rust_logs/src/main.rs_:" #: src/android/logging.md:24 msgid "//! Rust logging demo.\n" -msgstr "" +msgstr "//! Rust logging demo.\n" #: src/android/logging.md:27 msgid "/// Logs a greeting.\n" -msgstr "" +msgstr "/// Logs a greeting.\n" #: src/android/logging.md:32 +#, fuzzy msgid "\"rust\"" -msgstr "" +msgstr "\"rust\"" #: src/android/logging.md:35 msgid "\"Starting program.\"" -msgstr "" +msgstr "\"Starting program.\"" #: src/android/logging.md:36 msgid "\"Things are going fine.\"" -msgstr "" +msgstr "\"Things are going fine.\"" #: src/android/logging.md:37 +#, fuzzy msgid "\"Something went wrong!\"" -msgstr "" +msgstr "\"Something went wrong!\"" #: src/android/logging.md:41 src/android/interoperability/with-c/bindgen.md:96 #: src/android/interoperability/with-c/rust.md:72 @@ -11763,7 +11799,7 @@ msgstr "如果你愿意的话,你可以手工完成它:" #: src/android/interoperability/with-c.md:16 msgid "\"{x}, {abs_x}\"" -msgstr "" +msgstr "\"{x}, {abs_x}\"" #: src/android/interoperability/with-c.md:20 msgid "" @@ -11809,29 +11845,26 @@ msgstr "_interoperability/bindgen/libbirthday.c_:" #: src/android/interoperability/with-c/bindgen.md:22 msgid "" -msgstr "" +msgstr "" #: src/android/interoperability/with-c/bindgen.md:23 #: src/android/interoperability/with-c/bindgen.md:50 #, fuzzy msgid "\"libbirthday.h\"" -msgstr "" -"```c\n" -"#include \"libbirthday.h\"\n" -"```" +msgstr "\"libbirthday.c\"" #: src/android/interoperability/with-c/bindgen.md:26 #: src/android/interoperability/with-c/bindgen.md:29 msgid "\"+--------------\\n\"" -msgstr "" +msgstr "\"+--------------\\n\"" #: src/android/interoperability/with-c/bindgen.md:27 msgid "\"| Happy Birthday %s!\\n\"" -msgstr "" +msgstr "\"| Happy Birthday %s!\\n\"" #: src/android/interoperability/with-c/bindgen.md:28 msgid "\"| Congratulations with the %i years!\\n\"" -msgstr "" +msgstr "\"| Congratulations with the %i years!\\n\"" #: src/android/interoperability/with-c/bindgen.md:33 msgid "Add this to your `Android.bp` file:" @@ -11846,12 +11879,14 @@ msgstr "_interoperability/bindgen/Android.bp_:" #: src/android/interoperability/with-c/bindgen.md:39 #: src/android/interoperability/with-c/bindgen.md:63 +#, fuzzy msgid "\"libbirthday\"" -msgstr "" +msgstr "\"libbirthday\"" #: src/android/interoperability/with-c/bindgen.md:40 +#, fuzzy msgid "\"libbirthday.c\"" -msgstr "" +msgstr "\"libbirthday.c\"" #: src/android/interoperability/with-c/bindgen.md:44 msgid "" @@ -11869,33 +11904,38 @@ msgstr "您现在可以自动生成绑定代码:" #: src/android/interoperability/with-c/bindgen.md:59 #: src/android/interoperability/with-c/bindgen.md:75 +#, fuzzy msgid "\"libbirthday_bindgen\"" -msgstr "" +msgstr "\"libbirthday_bindgen\"" #: src/android/interoperability/with-c/bindgen.md:60 +#, fuzzy msgid "\"birthday_bindgen\"" -msgstr "" +msgstr "\"birthday_bindgen\"" #: src/android/interoperability/with-c/bindgen.md:61 +#, fuzzy msgid "\"libbirthday_wrapper.h\"" -msgstr "" +msgstr "\"libbirthday_wrapper.h\"" #: src/android/interoperability/with-c/bindgen.md:62 +#, fuzzy msgid "\"bindings\"" -msgstr "" +msgstr "\"bindings\"" #: src/android/interoperability/with-c/bindgen.md:67 msgid "Finally, we can use the bindings in our Rust program:" msgstr "最后,我们可以在 Rust 程序中使用这些绑定:" #: src/android/interoperability/with-c/bindgen.md:73 +#, fuzzy msgid "\"print_birthday_card\"" -msgstr "" +msgstr "\"print_birthday_card\"" #: src/android/interoperability/with-c/bindgen.md:74 #, fuzzy msgid "\"main.rs\"" -msgstr "`main.rs`:" +msgstr "\"main.c\"" #: src/android/interoperability/with-c/bindgen.md:79 msgid "_interoperability/bindgen/main.rs_:" @@ -11903,7 +11943,7 @@ msgstr "_interoperability/bindgen/main.rs_:" #: src/android/interoperability/with-c/bindgen.md:82 msgid "//! Bindgen demo.\n" -msgstr "" +msgstr "//! Bindgen demo.\n" #: src/android/interoperability/with-c/bindgen.md:89 msgid "// SAFETY: `print_card` is safe to call with a valid `card` pointer.\n" @@ -11932,25 +11972,28 @@ msgstr "最后,我们可以运行自动生成的测试来确保绑定代码正 #: src/android/interoperability/with-c/bindgen.md:110 #: src/android/interoperability/with-c/bindgen.md:112 +#, fuzzy msgid "\"libbirthday_bindgen_test\"" -msgstr "" +msgstr "\"libbirthday_bindgen_test\"" #: src/android/interoperability/with-c/bindgen.md:111 +#, fuzzy msgid "\":libbirthday_bindgen\"" -msgstr "" +msgstr "\":libbirthday_bindgen\"" #: src/android/interoperability/with-c/bindgen.md:113 +#, fuzzy msgid "\"general-tests\"" -msgstr "" +msgstr "\"general-tests\"" #: src/android/interoperability/with-c/bindgen.md:115 #: src/android/interoperability/with-c/bindgen.md:116 msgid "\"none\"" -msgstr "" +msgstr "\"none\"" #: src/android/interoperability/with-c/bindgen.md:115 msgid "// Generated file, skip linting\n" -msgstr "" +msgstr "// Generated file, skip linting\n" #: src/android/interoperability/with-c/rust.md:1 msgid "Calling Rust" @@ -11966,19 +12009,19 @@ msgstr "_interoperability/rust/libanalyze/analyze.rs_" #: src/android/interoperability/with-c/rust.md:8 msgid "//! Rust FFI demo.\n" -msgstr "" +msgstr "//! Rust FFI demo.\n" #: src/android/interoperability/with-c/rust.md:12 msgid "/// Analyze the numbers.\n" -msgstr "" +msgstr "/// Analyze the numbers.\n" #: src/android/interoperability/with-c/rust.md:17 msgid "\"x ({x}) is smallest!\"" -msgstr "" +msgstr "\"x ({x}) is smallest!\"" #: src/android/interoperability/with-c/rust.md:19 msgid "\"y ({y}) is probably larger than x ({x})\"" -msgstr "" +msgstr "\"y ({y}) is probably larger than x ({x})\"" #: src/android/interoperability/with-c/rust.md:24 msgid "_interoperability/rust/libanalyze/analyze.h_" @@ -11991,15 +12034,16 @@ msgstr "_interoperability/rust/libanalyze/Android.bp_" #: src/android/interoperability/with-c/rust.md:41 #: src/android/interoperability/with-c/rust.md:68 msgid "\"libanalyze_ffi\"" -msgstr "" +msgstr "\"libanalyze_ffi\"" #: src/android/interoperability/with-c/rust.md:42 msgid "\"analyze_ffi\"" -msgstr "" +msgstr "\"analyze_ffi\"" #: src/android/interoperability/with-c/rust.md:43 +#, fuzzy msgid "\"analyze.rs\"" -msgstr "" +msgstr "\"analyze.rs\"" #: src/android/interoperability/with-c/rust.md:48 msgid "We can now call this from a C binary:" @@ -12011,7 +12055,7 @@ msgstr "_interoperability/rust/analyze/main.c_" #: src/android/interoperability/with-c/rust.md:53 msgid "\"analyze.h\"" -msgstr "" +msgstr "\"analyze.h\"" #: src/android/interoperability/with-c/rust.md:62 msgid "_interoperability/rust/analyze/Android.bp_" @@ -12019,11 +12063,12 @@ msgstr "_interoperability/rust/analyze/Android.bp_" #: src/android/interoperability/with-c/rust.md:66 msgid "\"analyze_numbers\"" -msgstr "" +msgstr "\"analyze_numbers\"" #: src/android/interoperability/with-c/rust.md:67 +#, fuzzy msgid "\"main.c\"" -msgstr "" +msgstr "\"main.c\"" #: src/android/interoperability/with-c/rust.md:74 #, fuzzy @@ -12073,19 +12118,21 @@ msgid "" "from each language to the other. You provide this description using extern " "blocks in a Rust module annotated with the `#[cxx::bridge]` attribute macro." msgstr "" +"CXX依赖于提供的函数签名说明,这些签名会在不用语言之间进行交互使用。您可以在带" +"有 `#[cxx::bridge]` 属性宏注解的 Rust 模块中使用 extern 代码块提供此说明。" #: src/android/interoperability/cpp/bridge.md:9 msgid "\"org::blobstore\"" -msgstr "" +msgstr "\"org::blobstore\"" #: src/android/interoperability/cpp/bridge.md:11 msgid "// Shared structs with fields visible to both languages.\n" -msgstr "" +msgstr "// Shared structs with fields visible to both languages.\n" #: src/android/interoperability/cpp/bridge.md:17 #: src/android/interoperability/cpp/generated-cpp.md:6 msgid "// Rust types and signatures exposed to C++.\n" -msgstr "" +msgstr "// Rust types and signatures exposed to C++.\n" #: src/android/interoperability/cpp/bridge.md:18 #: src/android/interoperability/cpp/rust-bridge.md:6 @@ -12096,28 +12143,28 @@ msgstr "" #: src/chromium/interoperability-with-cpp/error-handling-png.md:9 #, fuzzy msgid "\"Rust\"" -msgstr "Rustdoc" +msgstr "\"Rust\"" #: src/android/interoperability/cpp/bridge.md:24 #: src/android/interoperability/cpp/cpp-bridge.md:6 msgid "// C++ types and signatures exposed to Rust.\n" -msgstr "" +msgstr "// C++ types and signatures exposed to Rust.\n" #: src/android/interoperability/cpp/bridge.md:25 #: src/android/interoperability/cpp/cpp-bridge.md:7 #: src/android/interoperability/cpp/cpp-exception.md:6 #: src/chromium/interoperability-with-cpp/example-bindings.md:15 msgid "\"C++\"" -msgstr "" +msgstr "\"C++\"" #: src/android/interoperability/cpp/bridge.md:26 #: src/android/interoperability/cpp/cpp-bridge.md:8 msgid "\"include/blobstore.h\"" -msgstr "" +msgstr "\"include/blobstore.h\"" #: src/android/interoperability/cpp/bridge.md:40 msgid "The bridge is generally declared in an `ffi` module within your crate." -msgstr "" +msgstr "桥接通常在您的 crate 内的 `ffi` 模块中声明。" #: src/android/interoperability/cpp/bridge.md:41 msgid "" @@ -12125,6 +12172,8 @@ msgid "" "Rust and C++ type/function definitions in order to expose those items to " "both languages." msgstr "" +"根据在桥接模块中进行的声明,CXX 将生成匹配的 Rust 和 C++ 类型/函数定义,以便" +"将这些内容公开给这两种语言。" #: src/android/interoperability/cpp/bridge.md:44 msgid "" @@ -12133,22 +12182,26 @@ msgid "" "examples you would use `cargo expand ::ffi` to expand just the `ffi` module " "(though this doesn't apply for Android projects)." msgstr "" +"如需查看生成的 Rust 代码,请使用 [cargo-expand](https://github.com/dtolnay/" +"cargo-expand) 查看展开后的 proc 宏。对于大多数示例,您可以使用 `cargo " +"expand ::ffi` 来仅展开 `ffi` 模块(但这不适用于 Android 项目)。" #: src/android/interoperability/cpp/bridge.md:47 msgid "To view the generated C++ code, look in `target/cxxbridge`." -msgstr "" +msgstr "如需查看生成的 C++ 代码,请在 `target/cxxbridge` 中查找。" #: src/android/interoperability/cpp/rust-bridge.md:1 +#, fuzzy msgid "Rust Bridge Declarations" -msgstr "" +msgstr "Rust 桥接声明" #: src/android/interoperability/cpp/rust-bridge.md:7 msgid "// Opaque type\n" -msgstr "" +msgstr "// Opaque type\n" #: src/android/interoperability/cpp/rust-bridge.md:8 msgid "// Method on `MyType`\n" -msgstr "" +msgstr "// Method on `MyType`\n" #: src/android/interoperability/cpp/rust-bridge.md:9 #, fuzzy @@ -12159,7 +12212,7 @@ msgstr "函数" msgid "" "Items declared in the `extern \"Rust\"` reference items that are in scope in " "the parent module." -msgstr "" +msgstr "`extern \"Rust\"` 中声明的内容引用了父级模块中作用域内的内容。" #: src/android/interoperability/cpp/rust-bridge.md:30 msgid "" @@ -12168,26 +12221,28 @@ msgid "" "header has the same path as the Rust source file containing the bridge, " "except with a .rs.h file extension." msgstr "" +"CXX 代码生成器使用 `extern \"Rust\"` 部分生成包含相应 C++ 声明的 C++ 头文件。" +"生成的头文件与包含桥接的 Rust 源文件的路径相同,但文件扩展名为 .rs.h。" #: src/android/interoperability/cpp/generated-cpp.md:15 msgid "Results in (roughly) the following C++:" -msgstr "" +msgstr "大致生成以下 C++:" #: src/android/interoperability/cpp/cpp-bridge.md:1 msgid "C++ Bridge Declarations" -msgstr "" +msgstr "C++ 桥接声明" #: src/android/interoperability/cpp/cpp-bridge.md:20 msgid "Results in (roughly) the following Rust:" -msgstr "" +msgstr "大致生成以下 Rust:" #: src/android/interoperability/cpp/cpp-bridge.md:30 msgid "\"org$blobstore$cxxbridge1$new_blobstore_client\"" -msgstr "" +msgstr "\"org$blobstore$cxxbridge1$new_blobstore_client\"" #: src/android/interoperability/cpp/cpp-bridge.md:39 msgid "\"org$blobstore$cxxbridge1$BlobstoreClient$put\"" -msgstr "" +msgstr "\"org$blobstore$cxxbridge1$BlobstoreClient$put\"" #: src/android/interoperability/cpp/cpp-bridge.md:56 msgid "" @@ -12195,20 +12250,22 @@ msgid "" "in are accurate. CXX performs static assertions that the signatures exactly " "correspond with what is declared in C++." msgstr "" +"程序员无需承诺他们输入的签名准确无误。CXX 会执行静态断言,确认签名与 C++ 中声" +"明的内容完全一致。" #: src/android/interoperability/cpp/cpp-bridge.md:59 msgid "" "`unsafe extern` blocks allow you to declare C++ functions that are safe to " "call from Rust." -msgstr "" +msgstr "借助 `unsafe extern` 代码块,您可以声明可从 Rust 安全调用的 C++ 函数。" #: src/android/interoperability/cpp/shared-types.md:9 msgid "// A=1, J=11, Q=12, K=13\n" -msgstr "" +msgstr "// A=1, J=11, Q=12, K=13\n" #: src/android/interoperability/cpp/shared-types.md:23 msgid "Only C-like (unit) enums are supported." -msgstr "" +msgstr "仅支持类似 C 函数(单元)的枚举。" #: src/android/interoperability/cpp/shared-types.md:24 msgid "" @@ -12217,15 +12274,19 @@ msgid "" "derive `Hash` also generates an implementation of `std::hash` for the " "corresponding C++ type." msgstr "" +"共享类型的 `#[derive()]` 支持有限数量的 trait。系统还会针对 C++ 代码生成相应" +"的功能,例如,如果您派生了 `Hash`,还会为相应的 C++ 类型生成 `std::hash` 实" +"现。" #: src/android/interoperability/cpp/shared-enums.md:15 #, fuzzy msgid "Generated Rust:" -msgstr "不安全 Rust" +msgstr "生成的 Rust:" #: src/android/interoperability/cpp/shared-enums.md:33 +#, fuzzy msgid "Generated C++:" -msgstr "" +msgstr "生成的 C++:" #: src/android/interoperability/cpp/shared-enums.md:46 msgid "" @@ -12234,20 +12295,22 @@ msgid "" "class to hold a value different from all of the listed variants, and our " "Rust representation needs to have the same behavior." msgstr "" +"在 Rust 端,为共享枚举生成的代码实际上是封装数值的结构体。这是因为在 C++ 中," +"枚举类存储与所有已列变体不同的值不属于 UB,而 Rust 表示法需要具有相同的行为。" #: src/android/interoperability/cpp/rust-result.md:13 msgid "\"fallible1 requires depth > 0\"" -msgstr "" +msgstr "\"fallible1 requires depth > 0\"" #: src/android/interoperability/cpp/rust-result.md:16 msgid "\"Success!\"" -msgstr "" +msgstr "\"Success!\"" #: src/android/interoperability/cpp/rust-result.md:22 msgid "" "Rust functions that return `Result` are translated to exceptions on the C++ " "side." -msgstr "" +msgstr "在 C++ 方面,返回 `Result` 的 Rust 函数会被翻译为异常。" #: src/android/interoperability/cpp/rust-result.md:24 msgid "" @@ -12255,26 +12318,30 @@ msgid "" "exposes a way to get the error message string. The error message will come " "from the error type's `Display` impl." msgstr "" +"抛出的异常始终是 `rust::Error` 类型,该类型主要用于提供获取错误消息字符串的方" +"法。错误消息将由错误类型的 `Display` impl 提供。" #: src/android/interoperability/cpp/rust-result.md:27 msgid "" "A panic unwinding from Rust to C++ will always cause the process to " "immediately terminate." -msgstr "" +msgstr "当 panic 从 Rust 展开到 C++ 时,会始终导致进程立即终止。" #: src/android/interoperability/cpp/cpp-exception.md:7 msgid "\"example/include/example.h\"" -msgstr "" +msgstr "\"example/include/example.h\"" #: src/android/interoperability/cpp/cpp-exception.md:14 msgid "\"Error: {}\"" -msgstr "" +msgstr "\"Error: {}\"" #: src/android/interoperability/cpp/cpp-exception.md:22 msgid "" "C++ functions declared to return a `Result` will catch any thrown exception " "on the C++ side and return it as an `Err` value to the calling Rust function." msgstr "" +"声明用于返回 `Result` 的 C++ 函数将捕获 C++ 端抛出的任何异常,并将其作为 " +"`Err` 值返回给调用 Rust 函数。" #: src/android/interoperability/cpp/cpp-exception.md:24 msgid "" @@ -12283,6 +12350,9 @@ msgid "" "terminate`. The behavior is equivalent to the same exception being thrown " "through a `noexcept` C++ function." msgstr "" +"如果外部 “C++”函数抛出l了异常,但 CXX 桥接中未声明该函数用于返回 `Result`,则" +"程序会调用 C++ 的 `std::terminate`。此行为等同于通过 C++ 函数 `nowithout` 抛" +"出了相同的异常。" #: src/android/interoperability/cpp/type-mapping.md:3 #, fuzzy @@ -12297,7 +12367,7 @@ msgstr "C++ 示例" #: src/android/interoperability/cpp/type-mapping.md:5 #, fuzzy msgid "`rust::String`" -msgstr "String" +msgstr "`rust::String`" #: src/android/interoperability/cpp/type-mapping.md:6 msgid "`&str`" @@ -12306,7 +12376,7 @@ msgstr "`&str`" #: src/android/interoperability/cpp/type-mapping.md:6 #, fuzzy msgid "`rust::Str`" -msgstr "`rust_test`" +msgstr "`rust::Str`" #: src/android/interoperability/cpp/type-mapping.md:7 #, fuzzy @@ -12320,7 +12390,7 @@ msgstr "String" #: src/android/interoperability/cpp/type-mapping.md:8 msgid "`&[T]`/`&mut [T]`" -msgstr "" +msgstr "`&[T]`/`&mut [T]`" #: src/android/interoperability/cpp/type-mapping.md:8 #, fuzzy @@ -12328,16 +12398,18 @@ msgid "`rust::Slice`" msgstr "`rust_ffi`" #: src/android/interoperability/cpp/type-mapping.md:9 +#, fuzzy msgid "`rust::Box`" -msgstr "" +msgstr "`rust::Box`" #: src/android/interoperability/cpp/type-mapping.md:10 msgid "`UniquePtr`" -msgstr "" +msgstr "`UniquePtr`" #: src/android/interoperability/cpp/type-mapping.md:10 +#, fuzzy msgid "`std::unique_ptr`" -msgstr "" +msgstr "`std::unique_ptr`" #: src/android/interoperability/cpp/type-mapping.md:11 #, fuzzy @@ -12347,7 +12419,7 @@ msgstr "`Vec`" #: src/android/interoperability/cpp/type-mapping.md:11 #, fuzzy msgid "`rust::Vec`" -msgstr "`mpsc::Receiver`" +msgstr "`rust::Vec`" #: src/android/interoperability/cpp/type-mapping.md:12 #, fuzzy @@ -12357,36 +12429,40 @@ msgstr "`Cell`" #: src/android/interoperability/cpp/type-mapping.md:12 #, fuzzy msgid "`std::vector`" -msgstr "`mpsc::Receiver`" +msgstr "`std::vector`" #: src/android/interoperability/cpp/type-mapping.md:16 msgid "" "These types can be used in the fields of shared structs and the arguments " "and returns of extern functions." -msgstr "" +msgstr "这些类型可用于共享结构体的字段以及外部函数的参数和返回结果。" #: src/android/interoperability/cpp/type-mapping.md:18 msgid "" "Note that Rust's `String` does not map directly to `std::string`. There are " "a few reasons for this:" msgstr "" +"请注意,Rust 的 `String` 不会直接映射到 `std::string`。导致这种情况的原因有以" +"下几种:" #: src/android/interoperability/cpp/type-mapping.md:20 msgid "" "`std::string` does not uphold the UTF-8 invariant that `String` requires." -msgstr "" +msgstr "`std::string` 不遵循 `String` 所需的 UTF-8 不变性。" #: src/android/interoperability/cpp/type-mapping.md:21 msgid "" "The two types have different layouts in memory and so can't be passed " "directly between languages." -msgstr "" +msgstr "这两种类型的内存布局不同,因此无法直接在语言之间进行传递。" #: src/android/interoperability/cpp/type-mapping.md:23 msgid "" "`std::string` requires move constructors that don't match Rust's move " "semantics, so a `std::string` can't be passed by value to Rust." msgstr "" +"`std::string` 需要与 Rust 的移动语义不匹配的 move 构造函数,因此 `std::" +"string` 无法按值传递给 Rust。" #: src/android/interoperability/cpp/android-build-cpp.md:1 #: src/android/interoperability/cpp/android-cpp-genrules.md:1 @@ -12400,29 +12476,30 @@ msgid "" "Create a `cc_library_static` to build the C++ library, including the CXX " "generated header and source file." msgstr "" +"创建 `cc_library_static` 以构建 C++ 库,包括 CXX 生成的头文件和源文件。" #: src/android/interoperability/cpp/android-build-cpp.md:8 #: src/android/interoperability/cpp/android-build-rust.md:10 msgid "\"libcxx_test_cpp\"" -msgstr "" +msgstr "\"libcxx_test_cpp\"" #: src/android/interoperability/cpp/android-build-cpp.md:9 msgid "\"cxx_test.cpp\"" -msgstr "" +msgstr "\"cxx_test.cpp\"" #: src/android/interoperability/cpp/android-build-cpp.md:11 msgid "\"cxx-bridge-header\"" -msgstr "" +msgstr "\"cxx-bridge-header\"" #: src/android/interoperability/cpp/android-build-cpp.md:12 #: src/android/interoperability/cpp/android-cpp-genrules.md:10 msgid "\"libcxx_test_bridge_header\"" -msgstr "" +msgstr "\"libcxx_test_bridge_header\"" #: src/android/interoperability/cpp/android-build-cpp.md:14 #: src/android/interoperability/cpp/android-cpp-genrules.md:19 msgid "\"libcxx_test_bridge_code\"" -msgstr "" +msgstr "\"libcxx_test_bridge_code\"" #: src/android/interoperability/cpp/android-build-cpp.md:20 msgid "" @@ -12430,12 +12507,14 @@ msgid "" "the dependencies for the CXX-generated C++ bindings. We'll show how these " "are setup on the next slide." msgstr "" +"指出 `libcxx_test_bridge_header` 和 `libcxx_test_bridge_code` 是 CXX 生成的 " +"C++ 绑定的依赖项。我们将在下一张幻灯片中介绍具体的设置方法。" #: src/android/interoperability/cpp/android-build-cpp.md:23 msgid "" "Note that you also need to depend on the `cxx-bridge-header` library in " "order to pull in common CXX definitions." -msgstr "" +msgstr "请注意,您还需要依靠 `cxx-bridge-header` 库才能提取常见的 CXX 定义。" #: src/android/interoperability/cpp/android-build-cpp.md:25 msgid "" @@ -12445,55 +12524,68 @@ msgid "" "that link with the class so that students know where they can find these " "instructions again in the future." msgstr "" +"如需了解如何在 Android 中使用 CXX 的完整文档,请参阅 [Android 文档](https://" +"source.android.com/docs/setup/build/rust/building-rust-modules/android-rust-" +"patterns#rust-cpp-interop-using-cxx)。建议您与全班同学分享该链接,以便学生知" +"道日后可以在哪里找到这些说明。" #: src/android/interoperability/cpp/android-cpp-genrules.md:3 msgid "" "Create two genrules: One to generate the CXX header, and one to generate the " "CXX source file. These are then used as inputs to the `cc_library_static`." msgstr "" +"创建两个 genrule:一个用于生成 CXX 头文件,另一个用于生成 CXX 源文件。然后," +"这些内容会被用作 `cc_library_static` 的输入。" #: src/android/interoperability/cpp/android-cpp-genrules.md:7 msgid "" "// Generate a C++ header containing the C++ bindings\n" "// to the Rust exported functions in lib.rs.\n" msgstr "" +"// Generate a C++ header containing the C++ bindings\n" +"// to the Rust exported functions in lib.rs.\n" #: src/android/interoperability/cpp/android-cpp-genrules.md:11 #: src/android/interoperability/cpp/android-cpp-genrules.md:20 msgid "\"cxxbridge\"" -msgstr "" +msgstr "\"cxxbridge\"" #: src/android/interoperability/cpp/android-cpp-genrules.md:12 msgid "\"$(location cxxbridge) $(in) --header > $(out)\"" -msgstr "" +msgstr "\"$(location cxxbridge) $(in) --header > $(out)\"" #: src/android/interoperability/cpp/android-cpp-genrules.md:13 #: src/android/interoperability/cpp/android-cpp-genrules.md:22 #: src/android/interoperability/cpp/android-build-rust.md:8 +#, fuzzy msgid "\"lib.rs\"" -msgstr "" +msgstr "\"lib.rs\"" #: src/android/interoperability/cpp/android-cpp-genrules.md:14 +#, fuzzy msgid "\"lib.rs.h\"" -msgstr "" +msgstr "\"lib.rs.h\"" #: src/android/interoperability/cpp/android-cpp-genrules.md:16 msgid "// Generate the C++ code that Rust calls into.\n" -msgstr "" +msgstr "// Generate the C++ code that Rust calls into.\n" #: src/android/interoperability/cpp/android-cpp-genrules.md:21 msgid "\"$(location cxxbridge) $(in) > $(out)\"" -msgstr "" +msgstr "\"$(location cxxbridge) $(in) > $(out)\"" #: src/android/interoperability/cpp/android-cpp-genrules.md:23 +#, fuzzy msgid "\"lib.rs.cc\"" -msgstr "" +msgstr "\"lib.rs.cc\"" #: src/android/interoperability/cpp/android-cpp-genrules.md:29 msgid "" "The `cxxbridge` tool is a standalone tool that generates the C++ side of the " "bridge module. It is included in Android and available as a Soong tool." msgstr "" +"`cxxbridge` 工具是一款独立工具,用于生成桥接模块的 C++ 端。它包含在 Android " +"中,并作为 Soong 工具提供。" #: src/android/interoperability/cpp/android-cpp-genrules.md:31 msgid "" @@ -12501,19 +12593,21 @@ msgid "" "named `lib.rs.h` and your source file will be named `lib.rs.cc`. This naming " "convention isn't enforced, though." msgstr "" +"按照惯例,如果您的 Rust 源文件是 `lib.rs`,则头文件将命名为 `lib.rs.h`,源文" +"件将命名为 `lib.rs.cc`。不过,系统并不强制执行此命名惯例。" #: src/android/interoperability/cpp/android-build-rust.md:3 msgid "" "Create a `rust_binary` that depends on `libcxx` and your `cc_library_static`." -msgstr "" +msgstr "创建一个依赖于 `libcxx` 和 `cc_library_static` 的 `rust_binary`。" #: src/android/interoperability/cpp/android-build-rust.md:7 msgid "\"cxx_test\"" -msgstr "" +msgstr "\"cxx_test\"" #: src/android/interoperability/cpp/android-build-rust.md:9 msgid "\"libcxx\"" -msgstr "" +msgstr "\"libcxx\"" #: src/android/interoperability/java.md:1 msgid "Interoperability with Java" @@ -12539,19 +12633,22 @@ msgstr "_interoperability/java/src/lib.rs_:" #: src/android/interoperability/java.md:13 msgid "//! Rust <-> Java FFI demo.\n" -msgstr "" +msgstr "//! Rust <-> Java FFI demo.\n" #: src/android/interoperability/java.md:18 +#, fuzzy msgid "/// HelloWorld::hello method implementation.\n" -msgstr "" +msgstr "/// HelloWorld::hello method implementation.\n" #: src/android/interoperability/java.md:21 +#, fuzzy msgid "\"system\"" -msgstr "" +msgstr "\"system\"" #: src/android/interoperability/java.md:27 +#, fuzzy msgid "\"Hello, {input}!\"" -msgstr "" +msgstr "\"Hello, {input}!\"" #: src/android/interoperability/java.md:33 #: src/android/interoperability/java.md:63 @@ -12561,16 +12658,17 @@ msgstr "_interoperability/java/Android.bp_:" #: src/android/interoperability/java.md:37 #: src/android/interoperability/java.md:70 msgid "\"libhello_jni\"" -msgstr "" +msgstr "\"libhello_jni\"" #: src/android/interoperability/java.md:38 #: src/android/interoperability/java.md:53 +#, fuzzy msgid "\"hello_jni\"" -msgstr "" +msgstr "\"hello_jni\"" #: src/android/interoperability/java.md:40 msgid "\"libjni\"" -msgstr "" +msgstr "\"libjni\"" #: src/android/interoperability/java.md:44 msgid "Finally, we can call this function from Java:" @@ -12581,13 +12679,14 @@ msgid "_interoperability/java/HelloWorld.java_:" msgstr "_interoperability/java/HelloWorld.java_:" #: src/android/interoperability/java.md:67 +#, fuzzy msgid "\"helloworld_jni\"" -msgstr "" +msgstr "\"helloworld_jni\"" #: src/android/interoperability/java.md:68 #, fuzzy msgid "\"HelloWorld.java\"" -msgstr "Hello World!" +msgstr "\"HelloWorld.java\"" #: src/android/interoperability/java.md:69 #, fuzzy