diff --git a/src/content/docs/concept/size.mdx b/src/content/docs/concept/size.mdx index 88178995d..86f5c4286 100644 --- a/src/content/docs/concept/size.mdx +++ b/src/content/docs/concept/size.mdx @@ -17,6 +17,7 @@ Dependent on whether you use the stable or nightly Rust toolchain the options av + ```toml # src-tauri/Cargo.toml [profile.dev] @@ -28,11 +29,12 @@ lto = true # Enables link-time-optimizations. opt-level = "s" # Prioritizes small binary size. Use `3` if you prefer speed. panic = "abort" # Higher performance by disabling panic handlers. strip = true # Ensures debug symbols are removed. +``` -```` + ```toml # src-tauri/Cargo.toml [profile.dev] @@ -47,7 +49,7 @@ panic = "abort" # Higher performance by disabling panic handlers. strip = true # Ensures debug symbols are removed. trim-paths = "all" # Removes potentially privileged information from your binaries. rustflags = ["-Cdebuginfo=0", "-Zthreads=8"] # Better compile performance. -```` +``` diff --git a/src/content/docs/ja/concept/size.mdx b/src/content/docs/ja/concept/size.mdx index 74c6d1348..b213c621c 100644 --- a/src/content/docs/ja/concept/size.mdx +++ b/src/content/docs/ja/concept/size.mdx @@ -17,6 +17,7 @@ Stable 版(安定版)の Rust ツールチェーンを使用するか、Nigh + ```toml # src-tauri/Cargo.toml [profile.dev] @@ -28,11 +29,12 @@ lto = true # Enables link-time-optimizations. opt-level = "s" # Prioritizes small binary size. Use `3` if you prefer speed. panic = "abort" # Higher performance by disabling panic handlers. strip = true # Ensures debug symbols are removed. +``` -```` + ```toml # src-tauri/Cargo.toml [profile.dev] @@ -47,7 +49,7 @@ panic = "abort" # Higher performance by disabling panic handlers. strip = true # Ensures debug symbols are removed. trim-paths = "all" # Removes potentially privileged information from your binaries. rustflags = ["-Cdebuginfo=0", "-Zthreads=8"] # Better compile performance. -```` +``` diff --git a/src/content/docs/ja/develop/calling-rust.mdx b/src/content/docs/ja/develop/calling-rust.mdx index 7f8ed7bcf..cee9c4ae1 100644 --- a/src/content/docs/ja/develop/calling-rust.mdx +++ b/src/content/docs/ja/develop/calling-rust.mdx @@ -37,7 +37,7 @@ fn my_custom_command() { `lib.rs` ファイルに定義されたコマンドは、「[グルーコード](https://ja.wikipedia.org/wiki/グルーコード)生成」に対する制約のため、`pub`(パブリック/公開)として指定できません。 「パブリック関数」として指定すると、次のようなエラーが表示されます: -```` +``` error[E0255]: the name `__cmd__command_name` is defined multiple times 《`__cmd__command_name`という名称は複数定義されています》 --> src/lib.rs:28:8 | @@ -48,6 +48,7 @@ error[E0255]: the name `__cmd__command_name` is defined multiple times 《`__c | = note: `__cmd__command_name` must be defined only once in the macro namespace of this module 《注記: `__cmd__command_name` はこのモジュールのマクロ名前空間に一度だけ定義できます》 ``` + ::: コマンドのリストは、次のように、「ビルダー」関数に提供する必要があります。 @@ -60,7 +61,7 @@ pub fn run() { .run(tauri::generate_context!()) .expect("error while running tauri application"); } -```` +``` これで、JavaScript コードからコマンドを呼び出すことができます。 diff --git a/src/content/docs/ja/start/prerequisites.mdx b/src/content/docs/ja/start/prerequisites.mdx index 02bbb55e4..e049c8ec1 100644 --- a/src/content/docs/ja/start/prerequisites.mdx +++ b/src/content/docs/ja/start/prerequisites.mdx @@ -332,8 +332,10 @@ $VERSION = Get-ChildItem -Name "$env:LocalAppData\Android\Sdk\ndk" PowerShell は、再起動またはログアウトするまで、新しい環境変数の設定が有効になりませんが、 現在のセッションを更新することはできます: -````ps +```ps [System.Environment]::GetEnvironmentVariables("User").GetEnumerator() | % { Set-Item -Path "Env:\$($_.key)" -Value $_.value } +``` + ::: @@ -344,7 +346,7 @@ PowerShell は、再起動またはログアウトするまで、新しい環境 ```sh rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android -```` +``` 次のステップ: [iOS 用の設定](#ios) または [プロジェクトの作成](/ja/start/create-project/)。 diff --git a/src/content/docs/ko/concept/size.mdx b/src/content/docs/ko/concept/size.mdx index e9b3d0e60..d07b2abbf 100644 --- a/src/content/docs/ko/concept/size.mdx +++ b/src/content/docs/ko/concept/size.mdx @@ -17,6 +17,7 @@ Stable 버전(안정판)의 Rust 툴체인을 사용하는지, Nightly 버전( + ```toml # src-tauri/Cargo.toml [profile.dev] @@ -28,11 +29,12 @@ lto = true # 링크 타임 최적화를 활성화합니다. opt-level = "s" # 작은 바이너리 크기를 우선시합니다. 속도를 선호하는 경우 `3`을 사용하십시오. panic = "abort" # 패닉 핸들러를 비활성화하여 성능을 향상시킵니다. strip = true # 디버그 심볼이 제거되도록 합니다. +``` -```` + ```toml # src-tauri/Cargo.toml [profile.dev] @@ -47,7 +49,7 @@ panic = "abort" # 패닉 핸들러를 비활성화하여 성능을 향상시킵 strip = true # 디버그 심볼이 제거되도록 합니다. trim-paths = "all" # 바이너리에서 잠재적으로 권한 있는 정보를 제거합니다. rustflags = ["-Cdebuginfo=0", "-Zthreads=8"] # 더 나은 컴파일 성능. -```` +``` diff --git a/src/content/docs/ko/develop/calling-rust.mdx b/src/content/docs/ko/develop/calling-rust.mdx index 3ead8b00d..e517d2745 100644 --- a/src/content/docs/ko/develop/calling-rust.mdx +++ b/src/content/docs/ko/develop/calling-rust.mdx @@ -37,7 +37,7 @@ fn my_custom_command() { `lib.rs` 파일에 정의된 명령은 "[글루 코드](https://ko.wikipedia.org/wiki/글루_코드) 생성"에 대한 제약 때문에 `pub`(공개)으로 지정할 수 없습니다. "공개 함수"로 지정하면 다음과 같은 오류가 표시됩니다: -```` +``` error[E0255]: the name `__cmd__command_name` is defined multiple times 《`__cmd__command_name`이라는 이름이 여러 번 정의되었습니다》 --> src/lib.rs:28:8 | @@ -48,6 +48,7 @@ error[E0255]: the name `__cmd__command_name` is defined multiple times 《`__cmd | = note: `__cmd__command_name` must be defined only once in the macro namespace of this module 《참고: `__cmd__command_name`은 이 모듈의 매크로 네임스페이스에 한 번만 정의해야 합니다》 ``` + ::: 명령 목록은 다음과 같이 "빌더" 함수에 제공해야 합니다. @@ -60,7 +61,7 @@ pub fn run() { .run(tauri::generate_context!()) .expect("error while running tauri application"); } -```` +``` 이제 JavaScript 코드에서 명령을 호출할 수 있습니다. diff --git a/src/content/docs/plugin/sql.mdx b/src/content/docs/plugin/sql.mdx index 82b4f5d8d..22d8748a6 100644 --- a/src/content/docs/plugin/sql.mdx +++ b/src/content/docs/plugin/sql.mdx @@ -154,48 +154,51 @@ We use [sqlx](https://docs.rs/sqlx/latest/sqlx/) as the underlying library and a Use the "$#" syntax when substituting query data + ```javascript const result = await db.execute( - "INSERT into todos (id, title, status) VALUES ($1, $2, $3)", - [todos.id, todos.title, todos.status], + 'INSERT into todos (id, title, status) VALUES ($1, $2, $3)', + [todos.id, todos.title, todos.status] ); const result = await db.execute( -"UPDATE todos SET title = $1, status = $2 WHERE id = $3", -[todos.title, todos.status, todos.id], + 'UPDATE todos SET title = $1, status = $2 WHERE id = $3', + [todos.title, todos.status, todos.id] ); +``` -```` Use "?" when substituting query data + ```javascript const result = await db.execute( - "INSERT into todos (id, title, status) VALUES (?, ?, ?)", - [todos.id, todos.title, todos.status], + 'INSERT into todos (id, title, status) VALUES (?, ?, ?)', + [todos.id, todos.title, todos.status] ); const result = await db.execute( - "UPDATE todos SET title = ?, status = ? WHERE id = ?", - [todos.title, todos.status, todos.id], + 'UPDATE todos SET title = ?, status = ? WHERE id = ?', + [todos.title, todos.status, todos.id] ); -```` +``` Use the "$#" syntax when substituting query data + ```javascript const result = await db.execute( - "INSERT into todos (id, title, status) VALUES ($1, $2, $3)", - [todos.id, todos.title, todos.status], + 'INSERT into todos (id, title, status) VALUES ($1, $2, $3)', + [todos.id, todos.title, todos.status] ); const result = await db.execute( -"UPDATE todos SET title = $1, status = $2 WHERE id = $3", -[todos.title, todos.status, todos.id], + 'UPDATE todos SET title = $1, status = $2 WHERE id = $3', + [todos.title, todos.status, todos.id] ); +``` -```` @@ -218,7 +221,7 @@ let migration = Migration { sql: "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT);", kind: MigrationKind::Up, }; -```` +``` Or if you want to use SQL from a file, you can include it by using `include_str!`: diff --git a/src/content/docs/zh-cn/concept/size.mdx b/src/content/docs/zh-cn/concept/size.mdx index ef3dde79d..f2f8581cb 100644 --- a/src/content/docs/zh-cn/concept/size.mdx +++ b/src/content/docs/zh-cn/concept/size.mdx @@ -17,6 +17,7 @@ import { Tabs, TabItem } from '@astrojs/starlight/components'; + ```toml # src-tauri/Cargo.toml [profile.dev] @@ -28,11 +29,12 @@ lto = true # 启用链接时优化。 opt-level = "s" # 优先考虑小的二进制文件大小。如果您更喜欢速度,请使用 `3`。 panic = "abort" # 通过禁用 panic 处理程序来提高性能。 strip = true # 确保移除调试符号。 +``` -```` + ```toml # src-tauri/Cargo.toml [profile.dev] @@ -47,7 +49,7 @@ panic = "abort" # 通过禁用 panic 处理程序来提高性能。 strip = true # 确保移除调试符号。 trim-paths = "all" # 从您的二进制文件中移除潜在的特权信息。 rustflags = ["-Cdebuginfo=0", "-Zthreads=8"] # 提高编译性能。 -```` +``` diff --git a/src/content/docs/zh-cn/plugin/sql.mdx b/src/content/docs/zh-cn/plugin/sql.mdx index b287289d6..1b687bebb 100644 --- a/src/content/docs/zh-cn/plugin/sql.mdx +++ b/src/content/docs/zh-cn/plugin/sql.mdx @@ -92,22 +92,21 @@ await db.execute('INSERT INTO ...'); -```javascript +```javascript import Database from '@tauri-apps/plugin-sql'; const db = await Database.load('mysql://user:pass@host/database'); await db.execute('INSERT INTO ...'); +``` -```` + ```javascript - -import Database from "@tauri-apps/plugin-sql"; -const db = await Database.load("postgres://postgres:password@localhost/test"); -await db.execute("INSERT INTO ..."); - -```` +import Database from '@tauri-apps/plugin-sql'; +const db = await Database.load('postgres://postgres:password@localhost/test'); +await db.execute('INSERT INTO ...'); +``` @@ -119,48 +118,51 @@ await db.execute("INSERT INTO ..."); 在替换查询数据时使用 "$#" 语法 + ```javascript const result = await db.execute( - "INSERT into todos (id, title, status) VALUES ($1, $2, $3)", - [todos.id, todos.title, todos.status], + 'INSERT into todos (id, title, status) VALUES ($1, $2, $3)', + [todos.id, todos.title, todos.status] ); const result = await db.execute( -"UPDATE todos SET title = $1, status = $2 WHERE id = $3", -[todos.title, todos.status, todos.id], + 'UPDATE todos SET title = $1, status = $2 WHERE id = $3', + [todos.title, todos.status, todos.id] ); +``` -```` 在替换查询数据时使用 "?" 语法 + ```javascript const result = await db.execute( - "INSERT into todos (id, title, status) VALUES (?, ?, ?)", - [todos.id, todos.title, todos.status], + 'INSERT into todos (id, title, status) VALUES (?, ?, ?)', + [todos.id, todos.title, todos.status] ); const result = await db.execute( - "UPDATE todos SET title = ?, status = ? WHERE id = ?", - [todos.title, todos.status, todos.id], + 'UPDATE todos SET title = ?, status = ? WHERE id = ?', + [todos.title, todos.status, todos.id] ); -```` +``` 在替换查询数据时使用 "$#" 语法 + ```javascript const result = await db.execute( - "INSERT into todos (id, title, status) VALUES ($1, $2, $3)", - [todos.id, todos.title, todos.status], + 'INSERT into todos (id, title, status) VALUES ($1, $2, $3)', + [todos.id, todos.title, todos.status] ); const result = await db.execute( -"UPDATE todos SET title = $1, status = $2 WHERE id = $3", -[todos.title, todos.status, todos.id], + 'UPDATE todos SET title = $1, status = $2 WHERE id = $3', + [todos.title, todos.status, todos.id] ); +``` -```` @@ -184,7 +186,7 @@ let migration = Migration { sql: "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT);", kind: MigrationKind::Up, }; -```` +``` ### 向插件构建器添加迁移 diff --git a/src/content/docs/zh-cn/plugin/window-state.mdx b/src/content/docs/zh-cn/plugin/window-state.mdx index 7a58ecfb9..79fc4ff54 100644 --- a/src/content/docs/zh-cn/plugin/window-state.mdx +++ b/src/content/docs/zh-cn/plugin/window-state.mdx @@ -49,7 +49,7 @@ import PluginPermissions from '@components/PluginPermissions.astro'; 2. 修改 `lib.rs` 来初始化插件。 - ````rust title="src-tauri/src/lib.rs" ins={4} + ```rust title="src-tauri/src/lib.rs" ins={4} #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default()