diff --git a/src/content/docs/develop/configuration-files.mdx b/src/content/docs/develop/configuration-files.mdx index 3c43d432e5..e8633ede25 100644 --- a/src/content/docs/develop/configuration-files.mdx +++ b/src/content/docs/develop/configuration-files.mdx @@ -203,7 +203,7 @@ tauri = { version = "2.0.0", features = [ ] } The most important parts to take note of are the `tauri-build` and `tauri` dependencies. Generally, they must both be on the same latest minor versions as the Tauri CLI, but this is not strictly required. If you encounter issues while trying to run your app you should check that any Tauri versions (`tauri` and `tauri-cli`) are on the latest versions for their respective minor releases. -Cargo version numbers use [Semantic Versioning]. Running `cargo update` in the `src-tauri` folder will pull the latest available Semver-compatible versions of all dependencies. For example, if you specify `2.0.0` as the version for `tauri-build`, Cargo will detect and download version `2.0.0.0` because it is the latest Semver-compatible version available. Tauri will update the major version number whenever a breaking change is introduced, meaning you should always be capable of safely upgrading to the latest minor and patch versions without fear of your code breaking. +Cargo version numbers use [Semantic Versioning]. Running `cargo update` in the `src-tauri` folder will pull the latest available Semver-compatible versions of all dependencies. For example, if you specify `2.0.0` as the version for `tauri-build`, Cargo will detect and download version `2.0.0` because it is the latest Semver-compatible version available. Tauri will update the major version number whenever a breaking change is introduced, meaning you should always be capable of safely upgrading to the latest minor and patch versions without fear of your code breaking. If you want to use a specific crate version you can use exact versions instead by prepending `=` to the version number of the dependency: @@ -231,8 +231,8 @@ An example of a barebones `package.json` file for a Tauri project might look a l "tauri": "tauri" }, "dependencies": { - "@tauri-apps/api": "^2.0.0.0", - "@tauri-apps/cli": "^2.0.0.0" + "@tauri-apps/api": "^2.0.0", + "@tauri-apps/cli": "^2.0.0" } } ``` diff --git a/src/content/docs/develop/sidecar.mdx b/src/content/docs/develop/sidecar.mdx index 30ced11300..b8afec9ffd 100644 --- a/src/content/docs/develop/sidecar.mdx +++ b/src/content/docs/develop/sidecar.mdx @@ -7,7 +7,7 @@ You may need to embed external binaries to add additional functionality to your Binaries are executables written in any programming language. Common use cases are Python CLI applications or API servers bundled using `pyinstaller`. -To bundle the binaries of your choice, you can add the `externalBin` property to the `tauri > bundle` object in your `tauri.conf.json`. +To bundle the binaries of your choice, you can add the `externalBin` property to the `bundle` object in your `tauri.conf.json`. The `externalBin` configuration expects a list of strings targeting binaries either with absolute or relative paths. Here is a Tauri configuration snippet to illustrate a sidecar configuration: diff --git a/src/content/docs/es/plugin/notification.mdx b/src/content/docs/es/plugin/notification.mdx index bdbd3f43af..2546b0af9b 100644 --- a/src/content/docs/es/plugin/notification.mdx +++ b/src/content/docs/es/plugin/notification.mdx @@ -65,7 +65,7 @@ Instala el plugin de notificaciones para comenzar. npm="npm install @tauri-apps/plugin-notification" yarn="yarn add @tauri-apps/plugin-notification" pnpm="pnpm add @tauri-apps/plugin-notification" - deno="bun add npm:@tauri-apps/plugin-notification" + deno="deno add npm:@tauri-apps/plugin-notification" bun="bun add @tauri-apps/plugin-notification" /> diff --git a/src/content/docs/es/start/migrate/from-tauri-1.mdx b/src/content/docs/es/start/migrate/from-tauri-1.mdx index f19ebf752e..766d6cdd6c 100644 --- a/src/content/docs/es/start/migrate/from-tauri-1.mdx +++ b/src/content/docs/es/start/migrate/from-tauri-1.mdx @@ -392,7 +392,7 @@ tauri::Builder::default() ### Migrar al Plugin del Sistema de Archivos -Las APIs de Rust `App::get_cli_matches` y JavaScript `@tauri-apps/api/fs` han sido eliminadas. En su lugar, utiliza [`std::fs`](https://doc.rust-lang.org/std/fs/) para Rust y el plugin `@tauri-apps/plugin-fs` para JavaScript: +Las APIs de Rust `tauri::api::fs` y JavaScript `@tauri-apps/api/fs` han sido eliminadas. En su lugar, utiliza [`std::fs`](https://doc.rust-lang.org/std/fs/) para Rust y el plugin `@tauri-apps/plugin-fs` para JavaScript: 1. Agrega a las dependencias de Cargo: diff --git a/src/content/docs/fr/start/migrate/from-tauri-1.mdx b/src/content/docs/fr/start/migrate/from-tauri-1.mdx index 7830622401..5112599f33 100644 --- a/src/content/docs/fr/start/migrate/from-tauri-1.mdx +++ b/src/content/docs/fr/start/migrate/from-tauri-1.mdx @@ -340,7 +340,7 @@ tauri::Builder::default() ### Migrer vers un "File System Plugin" -Les APIs Rust `App::get_cli_matches` et JavaScript `@tauri-apps/api/fs` ont été retirées. Utilisez le plugin [`std::fs`](https://doc.rust-lang.org/std/fs/) for Rust et `@tauri-apps/plugin-fs` for JavaScript à la place: +Les APIs Rust `tauri::api::fs` et JavaScript `@tauri-apps/api/fs` ont été retirées. Utilisez le plugin [`std::fs`](https://doc.rust-lang.org/std/fs/) for Rust et `@tauri-apps/plugin-fs` for JavaScript à la place: 1. Ajoutez vos dépendances Cargo: diff --git a/src/content/docs/ja/develop/configuration-files.mdx b/src/content/docs/ja/develop/configuration-files.mdx index f039ae9cbd..41ba9b41e3 100644 --- a/src/content/docs/ja/develop/configuration-files.mdx +++ b/src/content/docs/ja/develop/configuration-files.mdx @@ -211,7 +211,7 @@ tauri = { version = "2.0.0", features = [ ] } 注意を払うべき最も重要な部分は、`tauri-build` と `tauri` の依存関係です。通常、このふたつは両方とも Tauri CLI と同様、最新の「最新バグ修正版(マイナー・バージョン)」である必要がありますが、これは厳密には必須ではありません。アプリの実行中に問題が発生した場合には、すべての Tauri バージョン (`tauri` と `tauri-cli`)がそれぞれの「最新バグ修正版」(マイナー・リリースの最新バージョン)であることを確認する必要があります。 -Cargo のバージョン番号は [セマンティック・バージョニング] (Semver)方式[[参考](https://ja.wikipedia.org/wiki/セマンティックバージョニング)]を使用しています。`src-tauri` フォルダー内の `cargo update` を実行すると、すべての依存関係に対して Semver 互換の最新バージョンが取得されます。たとえば、`tauri-build` のバージョンとして `2.0.0` を指定すると、Cargo は最新の Semver 互換バージョンである `2.0.0.0` を検出してダウンロードします。Tauri は、重大な変更が導入されるときには「メジャー・バージョン番号」を更新します。つまり、最新のマイナー・バージョンとパッチ・バージョンの更新では、自分のコードが〔最新機能で〕破壊されることを心配することなく、常に安全にアップグレード可能です。 +Cargo のバージョン番号は [セマンティック・バージョニング] (Semver)方式[[参考](https://ja.wikipedia.org/wiki/セマンティックバージョニング)]を使用しています。`src-tauri` フォルダー内の `cargo update` を実行すると、すべての依存関係に対して Semver 互換の最新バージョンが取得されます。たとえば、`tauri-build` のバージョンとして `2.0.0` を指定すると、Cargo は最新の Semver 互換バージョンである `2.0.0` を検出してダウンロードします。Tauri は、重大な変更が導入されるときには「メジャー・バージョン番号」を更新します。つまり、最新のマイナー・バージョンとパッチ・バージョンの更新では、自分のコードが〔最新機能で〕破壊されることを心配することなく、常に安全にアップグレード可能です。 特定のクレート・バージョンを使用したい場合には、依存関係のバージョン番号の前に `=` を追加することで、指定したバージョンを使用できます: @@ -239,8 +239,8 @@ Tauri プロジェクトの必要最低限​​の `package.json` ファイル "tauri": "tauri" }, "dependencies": { - "@tauri-apps/api": "^2.0.0.0", - "@tauri-apps/cli": "^2.0.0.0" + "@tauri-apps/api": "^2.0.0", + "@tauri-apps/cli": "^2.0.0" } } ``` diff --git a/src/content/docs/ja/develop/sidecar.mdx b/src/content/docs/ja/develop/sidecar.mdx index bc65370e2e..cdf08a367d 100644 --- a/src/content/docs/ja/develop/sidecar.mdx +++ b/src/content/docs/ja/develop/sidecar.mdx @@ -9,7 +9,7 @@ i18nReady: true バイナリは、任意のプログラミング言語で記述された実行ファイルです。一般的な使用例としては、`pyinstaller` を使用してバンドルされた Python CLI アプリケーションや API サーバーなどが挙げられます。 -お望みのバイナリをバンドルするには、`tauri.conf.json` の `tauri > bundle` オブジェクトに `externalBin` プロパティを追加します。 +お望みのバイナリをバンドルするには、`tauri.conf.json` の `bundle` オブジェクトに `externalBin` プロパティを追加します。 `externalBin` の設定では、絶対パスまたは相対パスのいずれかを使用して対象のバイナリを指定する「文字列のリスト」が必要です。 以下は、「サイドカー」の設定を説明するための「Tauri の設定」の抜粋(スニペット)です: diff --git a/src/content/docs/ja/learn/system-tray.mdx b/src/content/docs/ja/learn/system-tray.mdx index b3b1b4c809..77c902e7a8 100644 --- a/src/content/docs/ja/learn/system-tray.mdx +++ b/src/content/docs/ja/learn/system-tray.mdx @@ -144,12 +144,12 @@ const tray = await TrayIcon.new(options); ```rust use tauri::{ - menu::{Menu, MenuItem}, + menu::{MenuBuilder, MenuItemBuilder}, tray::TrayIconBuilder, }; -let quit_i = MenuItem::with_id(app, "quit", "Quit", true, None::<&str>)?; -let menu = Menu::with_items(app, &[&quit_i])?; +let quit_i = MenuItemBuilder::with_id("quit", "Quit").build(app)?; +let menu = MenuBuilder::new(app).item(&quit_i).build()?; let tray = TrayIconBuilder::new() .menu(&menu) @@ -213,13 +213,13 @@ JavaScript では、「メニュー・クリック・イベント・リスナー use tauri::tray::TrayIconBuilder; TrayIconBuilder::new() - .on_menu_event(|app, event| match event.id.as_ref() { + .on_menu_event(|app, event| match event.id().as_ref() { "quit" => { println!("quit menu item was clicked"); app.exit(0); } _ => { - println!("menu item {:?} not handled", event.id); + println!("menu item {:?} not handled", event.id()); } }) ``` diff --git a/src/content/docs/ja/learn/window-menu.mdx b/src/content/docs/ja/learn/window-menu.mdx index 044b0f8c17..56e47e1850 100644 --- a/src/content/docs/ja/learn/window-menu.mdx +++ b/src/content/docs/ja/learn/window-menu.mdx @@ -237,8 +237,8 @@ fn main() { .build(app)?; let check_sub_item_2 = CheckMenuItemBuilder::new("Chinese") - .id("en") - .checked(lang_str == "en") + .id("zh") + .checked(lang_str == "zh") .enabled(false) .build(app)?; @@ -465,7 +465,7 @@ await menu.setAsAppMenu(); use tauri::{ image::Image, - menu::{CheckMenuItemBuilder, IconMenuItem, MenuBuilder, MenuItem, SubmenuBuilder}, + menu::{CheckMenuItemBuilder, IconMenuItemBuilder, MenuBuilder, MenuItemBuilder, SubmenuBuilder}, }; fn main() { @@ -479,24 +479,14 @@ fn main() { .checked(false) .build(app)?; - let text_menu = MenuItem::with_id( - app, - "change_text", - &"Change menu".to_string(), - true, - Some("Ctrl+Z"), - ) - .unwrap(); - - let icon_menu = IconMenuItem::with_id( - app, - "change_icon", - &"Change icon menu", - true, - Some(Image::from_bytes(include_bytes!("../icons/icon.png")).unwrap()), - Some("Ctrl+F"), - ) - .unwrap(); + let text_menu = MenuItemBuilder::with_id("change_text", "Change menu") + .accelerator("Ctrl+Z") + .build(app)?; + + let icon_menu = IconMenuItemBuilder::with_id("change_icon", "Change icon menu") + .icon(Image::from_bytes(include_bytes!("../icons/icon.png")).unwrap()) + .accelerator("Ctrl+F") + .build(app)?; let menu_item = SubmenuBuilder::new(app, "Change menu") .item(&text_menu) diff --git a/src/content/docs/ja/plugin/deep-linking.mdx b/src/content/docs/ja/plugin/deep-linking.mdx index 679d6c4f79..c4ed77ad13 100644 --- a/src/content/docs/ja/plugin/deep-linking.mdx +++ b/src/content/docs/ja/plugin/deep-linking.mdx @@ -162,7 +162,7 @@ iOS 上のリンクからアプリを開くには、次の二つの方法があ -上記 json にある "appIDs” の `$DEVELOPMENT_TEAM_ID` は `tauri.conf.json > tauri > bundle > iOS > developmentTeam` または `TAURI_APPLE_DEVELOPMENT_TEAM` 環境変数で定義された値であり、 +上記 json にある "appIDs” の `$DEVELOPMENT_TEAM_ID` は `tauri.conf.json > bundle > iOS > developmentTeam` または `TAURI_APPLE_DEVELOPMENT_TEAM` 環境変数で定義された値であり、 `$APP_BUNDLE_ID` は [`tauri.conf.json > identifier`](英語版参考資料)で定義された値です。 自分のドメインがアプリの関連付けを公開するように適切に設定されているかどうかを確認するには、 diff --git a/src/content/docs/ja/plugin/notification.mdx b/src/content/docs/ja/plugin/notification.mdx index 5b2054bed0..5a68530003 100644 --- a/src/content/docs/ja/plugin/notification.mdx +++ b/src/content/docs/ja/plugin/notification.mdx @@ -71,7 +71,7 @@ import TranslationNote from '@components/i18n/TranslationNote.astro'; npm="npm install @tauri-apps/plugin-notification" yarn="yarn add @tauri-apps/plugin-notification" pnpm="pnpm add @tauri-apps/plugin-notification" - deno="bun add npm:@tauri-apps/plugin-notification" + deno="deno add npm:@tauri-apps/plugin-notification" bun="bun add @tauri-apps/plugin-notification" /> diff --git a/src/content/docs/ja/start/migrate/from-tauri-1.mdx b/src/content/docs/ja/start/migrate/from-tauri-1.mdx index 484938649e..fce9aa5b01 100644 --- a/src/content/docs/ja/start/migrate/from-tauri-1.mdx +++ b/src/content/docs/ja/start/migrate/from-tauri-1.mdx @@ -392,7 +392,7 @@ tauri::Builder::default() ### File System プラグインの移行 -Rust の `App::get_cli_matches` および `@tauri-apps/api/fs` API は削除されました。代わりに、Rust には [`std::fs`](https://doc.rust-lang.org/std/fs/) を、JavaScript には `@tauri-apps/plugin-fs` プラグインを使用してください: +Rust の `tauri::api::fs` および `@tauri-apps/api/fs` API は削除されました。代わりに、Rust には [`std::fs`](https://doc.rust-lang.org/std/fs/) を、JavaScript には `@tauri-apps/plugin-fs` プラグインを使用してください: 1. Cargo へ依存関係を追加します: diff --git a/src/content/docs/ko/develop/configuration-files.mdx b/src/content/docs/ko/develop/configuration-files.mdx index 0cdb2d74a1..3fa739b745 100644 --- a/src/content/docs/ko/develop/configuration-files.mdx +++ b/src/content/docs/ko/develop/configuration-files.mdx @@ -211,7 +211,7 @@ tauri = { version = "2.0.0", features = [ ] } 주의해야 할 가장 중요한 부분은 `tauri-build`와 `tauri`의 종속성입니다. 일반적으로 이 둘은 모두 Tauri CLI와 마찬가지로 최신 "최신 버그 수정판(마이너 버전)"이어야 하지만, 이는 엄격하게 필수는 아닙니다. 앱 실행 중에 문제가 발생하면 모든 Tauri 버전(`tauri` 및 `tauri-cli`)이 각각의 "최신 버그 수정판"(마이너 릴리스의 최신 버전)인지 확인해야 합니다. -Cargo의 버전 번호는 [시맨틱 버전 관리](Semver) 방식([참고](https://ko.wikipedia.org/wiki/유의적_버전))을 사용합니다. `src-tauri` 폴더 내에서 `cargo update`를 실행하면 모든 종속성에 대해 Semver 호환 최신 버전이 가져옵니다. 예를 들어, `tauri-build`의 버전으로 `2.0.0`을 지정하면 Cargo는 최신 Semver 호환 버전인 `2.0.0.0`을 감지하고 다운로드합니다. Tauri는 중대한 변경이 도입될 때 "메이저 버전 번호"를 업데이트합니다. 즉, 최신 마이너 버전과 패치 버전 업데이트에서는 자신의 코드가 [최신 기능으로] 손상될 걱정 없이 항상 안전하게 업그레이드할 수 있습니다. +Cargo의 버전 번호는 [시맨틱 버전 관리](Semver) 방식([참고](https://ko.wikipedia.org/wiki/유의적_버전))을 사용합니다. `src-tauri` 폴더 내에서 `cargo update`를 실행하면 모든 종속성에 대해 Semver 호환 최신 버전이 가져옵니다. 예를 들어, `tauri-build`의 버전으로 `2.0.0`을 지정하면 Cargo는 최신 Semver 호환 버전인 `2.0.0`을 감지하고 다운로드합니다. Tauri는 중대한 변경이 도입될 때 "메이저 버전 번호"를 업데이트합니다. 즉, 최신 마이너 버전과 패치 버전 업데이트에서는 자신의 코드가 [최신 기능으로] 손상될 걱정 없이 항상 안전하게 업그레이드할 수 있습니다. 특정 크레이트 버전을 사용하려면 종속성 버전 번호 앞에 `=`를 추가하여 지정한 버전을 사용할 수 있습니다: @@ -239,8 +239,8 @@ Tauri 프로젝트의 최소한의 `package.json` 파일은 다음 예와 같습 "tauri": "tauri" }, "dependencies": { - "@tauri-apps/api": "^2.0.0.0", - "@tauri-apps/cli": "^2.0.0.0" + "@tauri-apps/api": "^2.0.0", + "@tauri-apps/cli": "^2.0.0" } } ``` diff --git a/src/content/docs/ko/develop/sidecar.mdx b/src/content/docs/ko/develop/sidecar.mdx index 3e331e6ef0..661c34ce71 100644 --- a/src/content/docs/ko/develop/sidecar.mdx +++ b/src/content/docs/ko/develop/sidecar.mdx @@ -9,7 +9,7 @@ i18nReady: true 바이너리는 모든 프로그래밍 언어로 작성된 실행 파일입니다. 일반적인 사용 예로는 `pyinstaller`를 사용하여 번들된 Python CLI 애플리케이션이나 API 서버 등이 있습니다. -원하는 바이너리를 번들링하려면 `tauri.conf.json`의 `tauri > bundle` 객체에 `externalBin` 속성을 추가합니다. +원하는 바이너리를 번들링하려면 `tauri.conf.json`의 `bundle` 객체에 `externalBin` 속성을 추가합니다. `externalBin` 설정에는 절대 경로 또는 상대 경로를 사용하여 대상 바이너리를 지정하는 "문자열 목록"이 필요합니다. 다음은 "사이드카" 설정을 설명하기 위한 "Tauri 설정"의 발췌(스니펫)입니다: diff --git a/src/content/docs/ko/start/migrate/from-tauri-1.mdx b/src/content/docs/ko/start/migrate/from-tauri-1.mdx index b44cff0b23..e25818d180 100644 --- a/src/content/docs/ko/start/migrate/from-tauri-1.mdx +++ b/src/content/docs/ko/start/migrate/from-tauri-1.mdx @@ -392,7 +392,7 @@ tauri::Builder::default() ### File System 플러그인 마이그레이션 -Rust의 `App::get_cli_matches` 및 `@tauri-apps/api/fs` API가 삭제되었습니다. 대신 Rust에는 [`std::fs`](https://doc.rust-lang.org/std/fs/)를, JavaScript에는 `@tauri-apps/plugin-fs` 플러그인을 사용하십시오: +Rust의 `tauri::api::fs` 및 `@tauri-apps/api/fs` API가 삭제되었습니다. 대신 Rust에는 [`std::fs`](https://doc.rust-lang.org/std/fs/)를, JavaScript에는 `@tauri-apps/plugin-fs` 플러그인을 사용하십시오: 1. Cargo에 종속성을 추가합니다: diff --git a/src/content/docs/learn/system-tray.mdx b/src/content/docs/learn/system-tray.mdx index cac1aa5b27..6a77df6202 100644 --- a/src/content/docs/learn/system-tray.mdx +++ b/src/content/docs/learn/system-tray.mdx @@ -137,12 +137,12 @@ const tray = await TrayIcon.new(options); ```rust use tauri::{ - menu::{Menu, MenuItem}, + menu::{MenuBuilder, MenuItemBuilder}, tray::TrayIconBuilder, }; -let quit_i = MenuItem::with_id(app, "quit", "Quit", true, None::<&str>)?; -let menu = Menu::with_items(app, &[&quit_i])?; +let quit_i = MenuItemBuilder::with_id("quit", "Quit").build(app)?; +let menu = MenuBuilder::new(app).item(&quit_i).build()?; let tray = TrayIconBuilder::new() .menu(&menu) @@ -206,13 +206,13 @@ Use the [`TrayIconBuilder::on_menu_event`] method to attach a tray menu click ev use tauri::tray::TrayIconBuilder; TrayIconBuilder::new() - .on_menu_event(|app, event| match event.id.as_ref() { + .on_menu_event(|app, event| match event.id().as_ref() { "quit" => { println!("quit menu item was clicked"); app.exit(0); } _ => { - println!("menu item {:?} not handled", event.id); + println!("menu item {:?} not handled", event.id()); } }) ``` diff --git a/src/content/docs/learn/window-menu.mdx b/src/content/docs/learn/window-menu.mdx index ba9697baee..2ce35c9c1d 100644 --- a/src/content/docs/learn/window-menu.mdx +++ b/src/content/docs/learn/window-menu.mdx @@ -292,8 +292,8 @@ fn main() { .build(app)?; let check_sub_item_2 = CheckMenuItemBuilder::new("Chinese") - .id("en") - .checked(lang_str == "en") + .id("zh") + .checked(lang_str == "zh") .enabled(false) .build(app)?; @@ -516,7 +516,7 @@ await menu.setAsAppMenu(); use tauri::{ image::Image, - menu::{CheckMenuItemBuilder, IconMenuItem, MenuBuilder, MenuItem, SubmenuBuilder}, + menu::{CheckMenuItemBuilder, IconMenuItemBuilder, MenuBuilder, MenuItemBuilder, SubmenuBuilder}, }; fn main() { @@ -530,24 +530,14 @@ fn main() { .checked(false) .build(app)?; - let text_menu = MenuItem::with_id( - app, - "change_text", - &"Change menu".to_string(), - true, - Some("Ctrl+Z"), - ) - .unwrap(); - - let icon_menu = IconMenuItem::with_id( - app, - "change_icon", - &"Change icon menu", - true, - Some(Image::from_bytes(include_bytes!("../icons/icon.png")).unwrap()), - Some("Ctrl+F"), - ) - .unwrap(); + let text_menu = MenuItemBuilder::with_id("change_text", "Change menu") + .accelerator("Ctrl+Z") + .build(app)?; + + let icon_menu = IconMenuItemBuilder::with_id("change_icon", "Change icon menu") + .icon(Image::from_bytes(include_bytes!("../icons/icon.png")).unwrap()) + .accelerator("Ctrl+F") + .build(app)?; let menu_item = SubmenuBuilder::new(app, "Change menu") .item(&text_menu) diff --git a/src/content/docs/plugin/deep-linking.mdx b/src/content/docs/plugin/deep-linking.mdx index 0b6866f111..70177def6f 100644 --- a/src/content/docs/plugin/deep-linking.mdx +++ b/src/content/docs/plugin/deep-linking.mdx @@ -142,7 +142,7 @@ The `.well-known/apple-app-site-association` endpoint must be served over HTTPS. To test localhost you can either use a self-signed TLS certificate and install it on the iOS simulator or use services like [ngrok]. ::: -Where `$DEVELOPMENT_TEAM_ID` is the value defined on `tauri.conf.json > tauri > bundle > iOS > developmentTeam` or the +Where `$DEVELOPMENT_TEAM_ID` is the value defined on `tauri.conf.json > bundle > iOS > developmentTeam` or the `TAURI_APPLE_DEVELOPMENT_TEAM` environment variable and `$APP_BUNDLE_ID` is the value defined on [`tauri.conf.json > identifier`]. To verify if your domain has been properly configured to expose the app associations, you can run the following command, diff --git a/src/content/docs/plugin/notification.mdx b/src/content/docs/plugin/notification.mdx index 22a150f0d6..93a0413d8b 100644 --- a/src/content/docs/plugin/notification.mdx +++ b/src/content/docs/plugin/notification.mdx @@ -65,7 +65,7 @@ Install the notifications plugin to get started. npm="npm install @tauri-apps/plugin-notification" yarn="yarn add @tauri-apps/plugin-notification" pnpm="pnpm add @tauri-apps/plugin-notification" - deno="bun add npm:@tauri-apps/plugin-notification" + deno="deno add npm:@tauri-apps/plugin-notification" bun="bun add @tauri-apps/plugin-notification" /> diff --git a/src/content/docs/start/migrate/from-tauri-1.mdx b/src/content/docs/start/migrate/from-tauri-1.mdx index 199b2261ca..e3af517dce 100644 --- a/src/content/docs/start/migrate/from-tauri-1.mdx +++ b/src/content/docs/start/migrate/from-tauri-1.mdx @@ -52,7 +52,7 @@ fn main() { :::danger -This command is not a substitude for this guide! Please read the _whole_ page regardless of whether you chose to use the command. +This command is not a substitute for this guide! Please read the _whole_ page regardless of whether you chose to use the command. ::: @@ -400,7 +400,7 @@ tauri::Builder::default() ### Migrate to File System Plugin -The Rust `App::get_cli_matches` JavaScript `@tauri-apps/api/fs` APIs have been removed. Use the [`std::fs`](https://doc.rust-lang.org/std/fs/) for Rust and `@tauri-apps/plugin-fs` plugin for JavaScript instead: +The Rust `tauri::api::fs` JavaScript `@tauri-apps/api/fs` APIs have been removed. Use the [`std::fs`](https://doc.rust-lang.org/std/fs/) for Rust and `@tauri-apps/plugin-fs` plugin for JavaScript instead: 1. Add to cargo dependencies: diff --git a/src/content/docs/zh-cn/develop/configuration-files.mdx b/src/content/docs/zh-cn/develop/configuration-files.mdx index 98c17424e1..6b4fa1f825 100644 --- a/src/content/docs/zh-cn/develop/configuration-files.mdx +++ b/src/content/docs/zh-cn/develop/configuration-files.mdx @@ -201,7 +201,7 @@ tauri = { version = "2.0.0", features = [ ] } 最需要重视的部分是 `tauri-build` 和 `tauri` 依赖项。通常,它们都必须与 Tauri CLI 一样处于最新的次要版本,但这并非严格要求。如果你在尝试运行应用时遇到问题,请检查所有 Tauri 版本( `tauri` 和 `tauri-cli` )是否处于其各自次要版本的最新版本。 -Cargo 版本号使用[语义化版本控制 (Semantic Versioning)] 。在 `src-tauri` 文件夹中运行 `cargo update` 将获取所有依赖项的最新可用语义兼容版本。例如,如果你指定 `2.0.0` 作为 `tauri-build` 的版本,Cargo 将检测并下载 `2.0.0.0` 版本,因为它是最新的可用语义兼容版本。每当引入重大变更时,Tauri 都会更新主版本号,这意味着你始终能够安全地升级到最新的次版本和补丁版本,而不必担心代码被破坏。 +Cargo 版本号使用[语义化版本控制 (Semantic Versioning)] 。在 `src-tauri` 文件夹中运行 `cargo update` 将获取所有依赖项的最新可用语义兼容版本。例如,如果你指定 `2.0.0` 作为 `tauri-build` 的版本,Cargo 将检测并下载 `2.0.0` 版本,因为它是最新的可用语义兼容版本。每当引入重大变更时,Tauri 都会更新主版本号,这意味着你始终能够安全地升级到最新的次版本和补丁版本,而不必担心代码被破坏。 如果你想使用特定的 crate 版本,你可以通过在依赖项的版本号前面添加 `=` 来使用精确的版本: @@ -229,8 +229,8 @@ Tauri 项目的 `package.json` 文件基本示例可能看起来像这样: "tauri": "tauri" }, "dependencies": { - "@tauri-apps/api": "^2.0.0.0", - "@tauri-apps/cli": "^2.0.0.0" + "@tauri-apps/api": "^2.0.0", + "@tauri-apps/cli": "^2.0.0" } } ``` diff --git a/src/content/docs/zh-cn/develop/sidecar.mdx b/src/content/docs/zh-cn/develop/sidecar.mdx index 713c2d156d..74c312d389 100644 --- a/src/content/docs/zh-cn/develop/sidecar.mdx +++ b/src/content/docs/zh-cn/develop/sidecar.mdx @@ -7,7 +7,7 @@ i18nReady: true 二进制文件是用任何编程语言编写的可执行文件。常见的用例是使用 `pyinstaller` 捆绑的 Python CLI 应用程序或 API 服务器。 -要捆绑您选择的二进制文件,您可以在 `tauri.conf.json` 中的 `tauri > bundle` 对象中添加 `externalBin` 属性。 +要捆绑您选择的二进制文件,您可以在 `tauri.conf.json` 中的 `bundle` 对象中添加 `externalBin` 属性。 `externalBin` 期望一个字符串列表,用于定位具有绝对或相对路径的二进制文件。 下面是一个示例来说明配置。这不是一个完整的 `tauri.conf.json` 文件。 @@ -110,7 +110,7 @@ tauri::async_runtime::spawn(async move { ```javascript import { Command } from '@tauri-apps/plugin-shell'; -// `binaries/my-sidecar` 是在 `tauri.conf.json > tauri > bundle > externalBin` 指定的确切值。 +// `binaries/my-sidecar` 是在 `tauri.conf.json > bundle > externalBin` 指定的确切值。 const sidecar_command = Command.sidecar('binaries/my-sidecar'); const output = await sidecar_command.execute(); ``` @@ -184,7 +184,7 @@ async fn call_my_sidecar(app: tauri::AppHandle) { ```javascript import { Command } from '@tauri-apps/plugin-shell'; -// `binaries/my-sidecar` 是在 `tauri.conf.json > tauri > bundle > externalBin` 指定的确切值。 +// `binaries/my-sidecar` 是在 `tauri.conf.json > bundle > externalBin` 指定的确切值。 // 请注意 args 数组需要与 `tauri.conf.json` 中指定的需完全匹配 const command = Command.sidecar('binaries/my-sidecar', [ 'arg1', diff --git a/src/content/docs/zh-cn/learn/system-tray.mdx b/src/content/docs/zh-cn/learn/system-tray.mdx index d13125118a..ef3eb45971 100644 --- a/src/content/docs/zh-cn/learn/system-tray.mdx +++ b/src/content/docs/zh-cn/learn/system-tray.mdx @@ -137,12 +137,12 @@ const tray = await TrayIcon.new(options); ```rust use tauri::{ - menu::{Menu, MenuItem}, + menu::{MenuBuilder, MenuItemBuilder}, tray::TrayIconBuilder, }; -let quit_i = MenuItem::with_id(app, "quit", "Quit", true, None::<&str>)?; -let menu = Menu::with_items(app, &[&quit_i])?; +let quit_i = MenuItemBuilder::with_id("quit", "Quit").build(app)?; +let menu = MenuBuilder::new(app).item(&quit_i).build()?; let tray = TrayIconBuilder::new() .menu(&menu) @@ -206,13 +206,13 @@ let tray = TrayIconBuilder::new() use tauri::tray::TrayIconBuilder; TrayIconBuilder::new() - .on_menu_event(|app, event| match event.id.as_ref() { + .on_menu_event(|app, event| match event.id().as_ref() { "quit" => { println!("quit menu item was clicked"); app.exit(0); } _ => { - println!("menu item {:?} not handled", event.id); + println!("menu item {:?} not handled", event.id()); } }) ``` diff --git a/src/content/docs/zh-cn/learn/window-menu.mdx b/src/content/docs/zh-cn/learn/window-menu.mdx index b9704ca3e6..e688c90dd5 100644 --- a/src/content/docs/zh-cn/learn/window-menu.mdx +++ b/src/content/docs/zh-cn/learn/window-menu.mdx @@ -236,8 +236,8 @@ fn main() { .build(app)?; let check_sub_item_2 = CheckMenuItemBuilder::new("Chinese") - .id("en") - .checked(lang_str == "en") + .id("zh") + .checked(lang_str == "zh") .enabled(false) .build(app)?; @@ -452,7 +452,7 @@ await menu.setAsAppMenu(); use tauri::{ image::Image, - menu::{CheckMenuItemBuilder, IconMenuItem, MenuBuilder, MenuItem, SubmenuBuilder}, + menu::{CheckMenuItemBuilder, IconMenuItemBuilder, MenuBuilder, MenuItemBuilder, SubmenuBuilder}, }; fn main() { @@ -466,24 +466,14 @@ fn main() { .checked(false) .build(app)?; - let text_menu = MenuItem::with_id( - app, - "change_text", - &"Change menu".to_string(), - true, - Some("Ctrl+Z"), - ) - .unwrap(); - - let icon_menu = IconMenuItem::with_id( - app, - "change_icon", - &"Change icon menu", - true, - Some(Image::from_bytes(include_bytes!("../icons/icon.png")).unwrap()), - Some("Ctrl+F"), - ) - .unwrap(); + let text_menu = MenuItemBuilder::with_id("change_text", "Change menu") + .accelerator("Ctrl+Z") + .build(app)?; + + let icon_menu = IconMenuItemBuilder::with_id("change_icon", "Change icon menu") + .icon(Image::from_bytes(include_bytes!("../icons/icon.png")).unwrap()) + .accelerator("Ctrl+F") + .build(app)?; let menu_item = SubmenuBuilder::new(app, "Change menu") .item(&text_menu) diff --git a/src/content/docs/zh-cn/plugin/deep-linking.mdx b/src/content/docs/zh-cn/plugin/deep-linking.mdx index 173cbc1b30..9bf7d6b533 100644 --- a/src/content/docs/zh-cn/plugin/deep-linking.mdx +++ b/src/content/docs/zh-cn/plugin/deep-linking.mdx @@ -112,7 +112,7 @@ fn run() { } ``` -其中 `$DEVELOPMENT_TEAM_ID` 是 `tauri.conf.json > tauri > bundle > iOS > developmentTeam` 或 `TAURI_APPLE_DEVELOPMENT_TEAM` 环境变量上定义的值,`$APP_BUNDLE_ID`是定义在`tauri.conf.json > identifier` 上的值。请参阅 [applinks.details](https://developer.apple.com/documentation/bundleresources/applinks/details) 以获取更多信息。 +其中 `$DEVELOPMENT_TEAM_ID` 是 `tauri.conf.json > bundle > iOS > developmentTeam` 或 `TAURI_APPLE_DEVELOPMENT_TEAM` 环境变量上定义的值,`$APP_BUNDLE_ID`是定义在`tauri.conf.json > identifier` 上的值。请参阅 [applinks.details](https://developer.apple.com/documentation/bundleresources/applinks/details) 以获取更多信息。 #### App diff --git a/src/content/docs/zh-cn/start/migrate/from-tauri-1.mdx b/src/content/docs/zh-cn/start/migrate/from-tauri-1.mdx index d8dccb79f4..afce10128d 100644 --- a/src/content/docs/zh-cn/start/migrate/from-tauri-1.mdx +++ b/src/content/docs/zh-cn/start/migrate/from-tauri-1.mdx @@ -387,7 +387,7 @@ tauri::Builder::default() ### 文件系统插件迁移 -Rust 的 `App::get_cli_matches` 和 JavaScript 的 `@tauri-apps/api/fs` API 被移除。使用 Rust 的 [`std::fs`](https://doc.rust-lang.org/std/fs/) 或 JavaScript 的 `@tauri-apps/plugin-fs` 插件作为替代: +Rust 的 `tauri::api::fs` 和 JavaScript 的 `@tauri-apps/api/fs` API 被移除。使用 Rust 的 [`std::fs`](https://doc.rust-lang.org/std/fs/) 或 JavaScript 的 `@tauri-apps/plugin-fs` 插件作为替代: 1. 添加 Cargo 依赖项: