diff --git a/po/ko.po b/po/ko.po index 544bd6352833..26f842ea82e5 100644 --- a/po/ko.po +++ b/po/ko.po @@ -12314,6 +12314,11 @@ msgid "" "$ acloud create\n" "```" msgstr "" +"```shell\n" +"$ source build/envsetup.sh\n" +"$ lunch aosp_cf_x86_64_phone-userdebug\n" +"$ acloud create\n" +"```" #: src/android/setup.md:12 msgid "" @@ -12369,7 +12374,7 @@ msgstr "간단한 응용 프로그램으로 시작해 보겠습니다. AOSP 체 #: src/android/build-rules/binary.md:6 src/android/build-rules/library.md:13 msgid "_hello_rust/Android.bp_:" -msgstr "" +msgstr "_hello_rust/Android.bp_:" #: src/android/build-rules/binary.md:8 msgid "" @@ -12381,10 +12386,17 @@ msgid "" "}\n" "```" msgstr "" +"```javascript\n" +"rust_binary {\n" +" name: \"hello_rust\",\n" +" crate_name: \"hello_rust\",\n" +" srcs: [\"src/main.rs\"],\n" +"}\n" +"```" #: src/android/build-rules/binary.md:16 src/android/build-rules/library.md:34 msgid "_hello_rust/src/main.rs_:" -msgstr "" +msgstr "_hello_rust/src/main.rs_:" #: src/android/build-rules/binary.md:18 msgid "" @@ -12397,6 +12409,14 @@ msgid "" "}\n" "```" msgstr "" +"```rust\n" +"//! Rust 데모입니다.\n" +"\n" +"/// 인사말을 표준 출력으로 인쇄합니다.\n" +"fn main() {\n" +" println!(\"Hello from Rust!\");\n" +"}\n" +"```" #: src/android/build-rules/binary.md:27 msgid "You can now build, push, and run the binary:" @@ -12412,6 +12432,22 @@ msgid "" "```" msgstr "" +#: src/android/build-rules/binary.md:29 +msgid "" +"```shell\n" +"$ m hello_rust\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust /data/local/tmp\"\n" +"$ adb shell /data/local/tmp/hello_rust\n" +"Hello from Rust!\n" +"```" +msgstr "" +"```shell\n" +"$ m hello_rust\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust /data/local/tmp\"\n" +"$ adb shell /data/local/tmp/hello_rust\n" +"Hello from Rust!\n" +"```" + #: src/android/build-rules/library.md:1 msgid "# Rust Libraries" msgstr "# 러스트 라이브러리" @@ -12454,6 +12490,24 @@ msgid "" "}\n" "```" msgstr "" +"```javascript\n" +"rust_binary {\n" +" name: \"hello_rust_with_dep\",\n" +" crate_name: \"hello_rust_with_dep\",\n" +" srcs: [\"src/main.rs\"],\n" +" rustlibs: [\n" +" \"libgreetings\",\n" +" \"libtextwrap\",\n" +" ],\n" +" prefer_rlib: true,\n" +"}\n" +"\n" +"rust_library {\n" +" name: \"libgreetings\",\n" +" crate_name: \"greetings\",\n" +" srcs: [\"src/lib.rs\"],\n" +"}\n" +"```" #: src/android/build-rules/library.md:36 msgid "" @@ -12469,10 +12523,21 @@ msgid "" "}\n" "```" msgstr "" +"```rust,ignore\n" +"//! Rust 데모입니다.\n" +"\n" +"use greetings::greeting;\n" +"use textwrap::fill;\n" +"\n" +"/// 인사말을 표준 출력으로 인쇄합니다.\n" +"fn main() {\n" +" println!(\"{}\", fill(&greeting(\"Bob\"), 24));\n" +"}\n" +"```" #: src/android/build-rules/library.md:48 msgid "_hello_rust/src/lib.rs_:" -msgstr "" +msgstr "_hello_rust/src/lib.rs_:" #: src/android/build-rules/library.md:50 msgid "" @@ -12485,6 +12550,14 @@ msgid "" "}\n" "```" msgstr "" +"```rust,ignore\n" +"//! 인사말 라이브러리입니다.\n" +"\n" +"/// `이름`에게 인사합니다.\n" +"pub fn greeting(name: &str) -> String {\n" +" format!(\"Hello {name}, it is very nice to meet you!\")\n" +"}\n" +"```" #: src/android/build-rules/library.md:59 msgid "You build, push, and run the binary like before:" @@ -12501,6 +12574,42 @@ msgid "" "```" msgstr "" +#: src/android/build-rules/library.md:61 +msgid "" +"```shell\n" +"$ m hello_rust_with_dep\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/hello_rust_with_dep\n" +"Hello Bob, it is very\n" +"nice to meet you!\n" +"```" +msgstr "" +"```shell\n" +"$ m hello_rust_with_dep\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/hello_rust_with_dep\n" +"Hello Bob, it is very\n" +"nice to meet you!\n" +"```" + +#: src/android/logging.md:44 +msgid "" +"```shell\n" +"$ m hello_rust_logs\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/hello_rust_logs\n" +"```" +msgstr "" +"```shell\n" +"$ m hello_rust_logs\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/hello_rust_logs\n" +"```" + #: src/android/aidl.md:1 msgid "# AIDL" msgstr "# AIDL" @@ -12530,6 +12639,7 @@ msgstr "AIDL 인터페이스를 이용해서 서비스의 API를 선언합니다 #: src/android/aidl/interface.md:5 msgid "*birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl*:" msgstr "" +"*birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl*:" #: src/android/aidl/interface.md:7 msgid "" @@ -12543,10 +12653,19 @@ msgid "" "}\n" "```" msgstr "" +"```java\n" +"package com.example.birthdayservice;\n" +"\n" +"/** 생일 서비스 인터페이스입니다. */\n" +"interface IBirthdayService {\n" +" /** Generate a Happy Birthday message. */\n" +" String wishHappyBirthday(String name, int years);\n" +"}\n" +"```" #: src/android/aidl/interface.md:17 msgid "*birthday_service/aidl/Android.bp*:" -msgstr "" +msgstr "*birthday_service/aidl/Android.bp*:" #: src/android/aidl/interface.md:19 msgid "" @@ -12563,6 +12682,18 @@ msgid "" "}\n" "```" msgstr "" +"```javascript\n" +"aidl_interface {\n" +" name: \"com.example.birthdayservice\",\n" +" srcs: [\"com/example/birthdayservice/*.aidl\"],\n" +" unstable: true,\n" +" backend: {\n" +" rust: { // Rust is not enabled by default\n" +" enabled: true,\n" +" },\n" +" },\n" +"}\n" +"```" #: src/android/aidl/interface.md:32 msgid "" @@ -12580,7 +12711,7 @@ msgstr "이제 AIDL서비스를 구현할 수 있습니다:" #: src/android/aidl/implementation.md:5 msgid "*birthday_service/src/lib.rs*:" -msgstr "" +msgstr "*birthday_service/src/lib.rs*:" #: src/android/aidl/implementation.md:7 msgid "" @@ -12603,11 +12734,32 @@ msgid "" "}\n" "```" msgstr "" +"```rust,ignore\n" +"//! `IBirthdayService` AIDL 인터페이스의 구현입니다.\n" +"use com_example_birthdayservice::aidl::com::example::birthdayservice::" +"IBirthdayService::IBirthdayService;\n" +"use com_example_birthdayservice::binder;\n" +"\n" +"/// `IBirthdayService` 구현입니다.\n" +"pub struct BirthdayService;\n" +"\n" +"impl binder::Interface for BirthdayService {}\n" +"\n" +"impl IBirthdayService for BirthdayService {\n" +" fn wishHappyBirthday(&self, name: &str, years: i32) -> binder::" +"Result {\n" +" Ok(format!(\n" +" \"Happy Birthday {name}, congratulations with the {years} years!" +"\"\n" +" ))\n" +" }\n" +"}\n" +"```" #: src/android/aidl/implementation.md:26 src/android/aidl/server.md:28 #: src/android/aidl/client.md:37 msgid "*birthday_service/Android.bp*:" -msgstr "" +msgstr "*birthday_service/Android.bp*:" #: src/android/aidl/implementation.md:28 msgid "" @@ -12623,6 +12775,17 @@ msgid "" "}\n" "```" msgstr "" +"```javascript\n" +"rust_library {\n" +" name: \"libbirthdayservice\",\n" +" srcs: [\"src/lib.rs\"],\n" +" crate_name: \"birthdayservice\",\n" +" rustlibs: [\n" +" \"com.example.birthdayservice-rust\",\n" +" \"libbinder_rs\",\n" +" ],\n" +"}\n" +"```" #: src/android/aidl/server.md:1 msgid "# AIDL Server" @@ -12634,7 +12797,7 @@ msgstr "마지막으로 서비스를 제공하는 서버를 만들 수 있습니 #: src/android/aidl/server.md:5 msgid "*birthday_service/src/server.rs*:" -msgstr "" +msgstr "*birthday_service/src/server.rs*:" #: src/android/aidl/server.md:7 msgid "" @@ -12659,6 +12822,28 @@ msgid "" "}\n" "```" msgstr "" +"```rust,ignore\n" +"//! 생일 서비스입니다.\n" +"use birthdayservice::BirthdayService;\n" +"use com_example_birthdayservice::aidl::com::example::birthdayservice::" +"IBirthdayService::BnBirthdayService;\n" +"use com_example_birthdayservice::binder;\n" +"\n" +"const SERVICE_IDENTIFIER: &str = \"birthdayservice\";\n" +"\n" +"/// 생일 서비스의 진입점입니다.\n" +"fn main() {\n" +" let birthday_service = BirthdayService;\n" +" let birthday_service_binder = BnBirthdayService::new_binder(\n" +" birthday_service,\n" +" binder::BinderFeatures::default(),\n" +" );\n" +" binder::add_service(SERVICE_IDENTIFIER, birthday_service_binder." +"as_binder())\n" +" .expect(\"Failed to register service\");\n" +" binder::ProcessState::join_thread_pool()\n" +"}\n" +"```" #: src/android/aidl/server.md:30 msgid "" @@ -12676,6 +12861,19 @@ msgid "" "}\n" "```" msgstr "" +"```javascript\n" +"rust_binary {\n" +" name: \"birthday_server\",\n" +" crate_name: \"birthday_server\",\n" +" srcs: [\"src/server.rs\"],\n" +" rustlibs: [\n" +" \"com.example.birthdayservice-rust\",\n" +" \"libbinder_rs\",\n" +" \"libbirthdayservice\",\n" +" ],\n" +" prefer_rlib: true,\n" +"}\n" +"```" #: src/android/aidl/deploy.md:1 msgid "# Deploy" @@ -12694,6 +12892,22 @@ msgid "" "```" msgstr "" +#: src/android/aidl/deploy.md:5 +msgid "" +"```shell\n" +"$ m birthday_server\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/birthday_server\n" +"```" +msgstr "" +"```shell\n" +"$ m birthday_server\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/birthday_server\n" +"```" + #: src/android/aidl/deploy.md:11 msgid "In another terminal, check that the service runs:" msgstr "다른 터미널을 띄워서 서비스가 잘 수행되고 있는지 확인합니다:" @@ -12705,6 +12919,10 @@ msgid "" "Service birthdayservice: found\n" "```" msgstr "" +"```shell\n" +"$ adb shell service check birthdayservice\n" +"Service birthdayservice: found\n" +"```" #: src/android/aidl/deploy.md:18 msgid "You can also call the service with `service call`:" @@ -12725,6 +12943,18 @@ msgid "" " 0x00000070: 00210073 00000000 's.!..... ')\n" "```" msgstr "" +"```shell\n" +"$ $ adb shell service call birthdayservice 1 s16 Bob i32 24\n" +"Result: Parcel(\n" +" 0x00000000: 00000000 00000036 00610048 00700070 '....6...H.a.p.p.'\n" +" 0x00000010: 00200079 00690042 00740072 00640068 'y. .B.i.r.t.h.d.'\n" +" 0x00000020: 00790061 00420020 0062006f 0020002c 'a.y. .B.o.b.,. .'\n" +" 0x00000030: 006f0063 0067006e 00610072 00750074 'c.o.n.g.r.a.t.u.'\n" +" 0x00000040: 0061006c 00690074 006e006f 00200073 'l.a.t.i.o.n.s. .'\n" +" 0x00000050: 00690077 00680074 00740020 00650068 'w.i.t.h. .t.h.e.'\n" +" 0x00000060: 00320020 00200034 00650079 00720061 ' .2.4. .y.e.a.r.'\n" +" 0x00000070: 00210073 00000000 's.!..... ')\n" +"```" #: src/android/aidl/client.md:1 msgid "# AIDL Client" @@ -12736,7 +12966,7 @@ msgstr "마지막으로, 아까 추가한 서비스에 대한 클라이언트를 #: src/android/aidl/client.md:5 msgid "*birthday_service/src/client.rs*:" -msgstr "" +msgstr "*birthday_service/src/client.rs*:" #: src/android/aidl/client.md:7 msgid "" @@ -12770,6 +13000,38 @@ msgid "" "}\n" "```" msgstr "" +"```rust,ignore\n" +"//! 생일 서비스입니다.\n" +"use com_example_birthdayservice::aidl::com::example::birthdayservice::" +"IBirthdayService::IBirthdayService;\n" +"use com_example_birthdayservice::binder;\n" +"\n" +"const SERVICE_IDENTIFIER: &str = \"birthdayservice\";\n" +"\n" +"/// BirthdayService에 연결합니다.\n" +"pub fn connect() -> Result, binder::" +"StatusCode> {\n" +" binder::get_interface(SERVICE_IDENTIFIER)\n" +"}\n" +"\n" +"/// 생일 서비스를 호출합니다.\n" +"fn main() -> Result<(), binder::Status> {\n" +" let name = std::env::args()\n" +" .nth(1)\n" +" .unwrap_or_else(|| String::from(\"Bob\"));\n" +" let years = std::env::args()\n" +" .nth(2)\n" +" .and_then(|arg| arg.parse::().ok())\n" +" .unwrap_or(42);\n" +"\n" +" binder::ProcessState::start_thread_pool();\n" +" let service = connect().expect(\"Failed to connect to " +"BirthdayService\");\n" +" let msg = service.wishHappyBirthday(&name, years)?;\n" +" println!(\"{msg}\");\n" +" Ok(())\n" +"}\n" +"```" #: src/android/aidl/client.md:39 msgid "" @@ -12786,6 +13048,18 @@ msgid "" "}\n" "```" msgstr "" +"```javascript\n" +"rust_binary {\n" +" name: \"birthday_client\",\n" +" crate_name: \"birthday_client\",\n" +" srcs: [\"src/client.rs\"],\n" +" rustlibs: [\n" +" \"com.example.birthdayservice-rust\",\n" +" \"libbinder_rs\",\n" +" ],\n" +" prefer_rlib: true,\n" +"}\n" +"```" #: src/android/aidl/client.md:52 msgid "Notice that the client does not depend on `libbirthdayservice`." @@ -12805,6 +13079,24 @@ msgid "" "```" msgstr "" +#: src/android/aidl/client.md:56 +msgid "" +"```shell\n" +"$ m birthday_client\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/birthday_client Charlie 60\n" +"Happy Birthday Charlie, congratulations with the 60 years!\n" +"```" +msgstr "" +"```shell\n" +"$ m birthday_client\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/birthday_client Charlie 60\n" +"Happy Birthday Charlie, congratulations with the 60 years!\n" +"```" + #: src/android/aidl/changing.md:1 msgid "# Changing API" msgstr "# API 수정" @@ -12827,6 +13119,15 @@ msgid "" "}\n" "```" msgstr "" +"```java\n" +"package com.example.birthdayservice;\n" +"\n" +"/** 생일 서비스 인터페이스입니다. */\n" +"interface IBirthdayService {\n" +" /** Generate a Happy Birthday message. */\n" +" String wishHappyBirthday(String name, int years, in String[] text);\n" +"}\n" +"```" #: src/android/logging.md:1 msgid "# Logging" @@ -12840,7 +13141,7 @@ msgstr "`log` 크레이트를 사용하면 안드로이드 디바이스 안에 #: src/android/logging.md:6 msgid "_hello_rust_logs/Android.bp_:" -msgstr "" +msgstr "_hello_rust_logs/Android.bp_:" #: src/android/logging.md:8 msgid "" @@ -12858,10 +13159,23 @@ msgid "" "}\n" "```" msgstr "" +"```javascript\n" +"rust_binary {\n" +" name: \"hello_rust_logs\",\n" +" crate_name: \"hello_rust_logs\",\n" +" srcs: [\"src/main.rs\"],\n" +" rustlibs: [\n" +" \"liblog_rust\",\n" +" \"liblogger\",\n" +" ],\n" +" prefer_rlib: true,\n" +" host_supported: true,\n" +"}\n" +"```" #: src/android/logging.md:22 msgid "_hello_rust_logs/src/main.rs_:" -msgstr "" +msgstr "_hello_rust_logs/src/main.rs_:" #: src/android/logging.md:24 msgid "" @@ -12883,6 +13197,23 @@ msgid "" "}\n" "```" msgstr "" +"```rust,ignore\n" +"//! Rust 로깅 데모입니다.\n" +"\n" +"use log::{debug, error, info};\n" +"\n" +"/// 인사말을 기록합니다.\n" +"fn main() {\n" +" logger::init(\n" +" logger::Config::default()\n" +" .with_tag_on_device(\"rust\")\n" +" .with_min_level(log::Level::Trace),\n" +" );\n" +" debug!(\"Starting program.\");\n" +" info!(\"Things are going fine.\");\n" +" error!(\"Something went wrong!\");\n" +"}\n" +"```" #: src/android/logging.md:42 src/android/interoperability/with-c/bindgen.md:98 #: src/android/interoperability/with-c/rust.md:73 @@ -12911,6 +13242,14 @@ msgid "" "09-08 08:38:32.454 2420 2420 E rust: hello_rust_logs: Something went wrong!\n" "```" msgstr "" +"```shell\n" +"$ adb logcat -s rust\n" +"09-08 08:38:32.454 2420 2420 D rust: hello_rust_logs: Starting program.\n" +"09-08 08:38:32.454 2420 2420 I rust: hello_rust_logs: Things are going " +"fine.\n" +"09-08 08:38:32.454 2420 2420 E rust: hello_rust_logs: Something went " +"wrong!\n" +"```" #: src/android/interoperability.md:1 msgid "# Interoperability" @@ -12964,6 +13303,17 @@ msgid "" "}\n" "```" msgstr "" +"```rust\n" +"extern \"C\" {\n" +" fn abs(x: i32) -> i32;\n" +"}\n" +"\n" +"fn main() {\n" +" let x = -42;\n" +" let abs_x = unsafe { abs(x) };\n" +" println!(\"{x}, {abs_x}\");\n" +"}\n" +"```" #: src/android/interoperability/with-c.md:20 msgid "" @@ -13292,7 +13642,7 @@ msgstr "전체적인 접근 방법은 다음과 같습니다:" #: src/android/interoperability/cpp.md:8 msgid "" -msgstr "" +msgstr "" #: src/android/interoperability/cpp.md:10 msgid "See the [CXX tutorial][2] for an full example of using this." @@ -13315,7 +13665,7 @@ msgstr "먼저, 자바로 내보낼 러스트 함수를 생성합니다:" #: src/android/interoperability/java.md:9 msgid "_interoperability/java/src/lib.rs_:" -msgstr "" +msgstr "_interoperability/java/src/lib.rs_:" #: src/android/interoperability/java.md:11 msgid "" @@ -13340,11 +13690,31 @@ msgid "" "}\n" "```" msgstr "" +"```rust,compile_fail\n" +"//! Rust <-> Java FFI 데모입니다.\n" +"\n" +"use jni::objects::{JClass, JString};\n" +"use jni::sys::jstring;\n" +"use jni::JNIEnv;\n" +"\n" +"/// HelloWorld::hello 메서드 구현입니다.\n" +"#[no_mangle]\n" +"pub extern \"system\" fn Java_HelloWorld_hello(\n" +" env: JNIEnv,\n" +" _class: JClass,\n" +" name: JString,\n" +") -> jstring {\n" +" let input: String = env.get_string(name).unwrap().into();\n" +" let greeting = format!(\"Hello, {input}!\");\n" +" let output = env.new_string(greeting).unwrap();\n" +" output.into_inner()\n" +"}\n" +"```" #: src/android/interoperability/java.md:32 #: src/android/interoperability/java.md:62 msgid "_interoperability/java/Android.bp_:" -msgstr "" +msgstr "_interoperability/java/Android.bp_:" #: src/android/interoperability/java.md:34 msgid "" @@ -13357,6 +13727,14 @@ msgid "" "}\n" "```" msgstr "" +"```javascript\n" +"rust_ffi_shared {\n" +" name: \"libhello_jni\",\n" +" crate_name: \"hello_jni\",\n" +" srcs: [\"src/lib.rs\"],\n" +" rustlibs: [\"libjni\"],\n" +"}\n" +"```" #: src/android/interoperability/java.md:43 msgid "Finally, we can call this function from Java:" @@ -13364,7 +13742,7 @@ msgstr "자바에서 이 함수를 호출 할 수 있습니다:" #: src/android/interoperability/java.md:45 msgid "_interoperability/java/HelloWorld.java_:" -msgstr "" +msgstr "_interoperability/java/HelloWorld.java_:" #: src/android/interoperability/java.md:47 msgid "" @@ -13383,6 +13761,20 @@ msgid "" "}\n" "```" msgstr "" +"```java\n" +"class HelloWorld {\n" +" private static native String hello(String name);\n" +"\n" +" static {\n" +" System.loadLibrary(\"hello_jni\");\n" +" }\n" +"\n" +" public static void main(String[] args) {\n" +" String output = HelloWorld.hello(\"Alice\");\n" +" System.out.println(output);\n" +" }\n" +"}\n" +"```" #: src/android/interoperability/java.md:64 msgid "" @@ -13395,6 +13787,14 @@ msgid "" "}\n" "```" msgstr "" +"```javascript\n" +"java_binary {\n" +" name: \"helloworld_jni\",\n" +" srcs: [\"HelloWorld.java\"],\n" +" main_class: \"HelloWorld\",\n" +" required: [\"libhello_jni\"],\n" +"}\n" +"```" #: src/android/interoperability/java.md:73 msgid "Finally, you can build, sync, and run the binary:" @@ -13408,6 +13808,11 @@ msgid "" "$ adb shell /system/bin/helloworld_jni\n" "```" msgstr "" +"```shell\n" +"$ m helloworld_jni\n" +"$ adb sync # requires adb root && adb remount\n" +"$ adb shell /system/bin/helloworld_jni\n" +"```" #: src/exercises/day-4/android.md:3 msgid ""