diff --git a/src/content/docs/ja/plugin/autostart.mdx b/src/content/docs/ja/plugin/autostart.mdx new file mode 100644 index 0000000000..8c37e0f7fe --- /dev/null +++ b/src/content/docs/ja/plugin/autostart.mdx @@ -0,0 +1,169 @@ +--- +title: Autostart(自動起動) +description: システム起動時にアプリを自動的に起動します。 +plugin: autostart +i18nReady: true +--- + +import PluginLinks from '@components/PluginLinks.astro'; +import Compatibility from '@components/plugins/Compatibility.astro'; + +import { Tabs, TabItem, Steps } from '@astrojs/starlight/components'; +import CommandTabs from '@components/CommandTabs.astro'; +import PluginPermissions from '@components/PluginPermissions.astro'; +import TranslationNote from '@components/i18n/TranslationNote.astro'; + + + +**Plugin 説明内容の英語表記部分について** Plugin 関連の各章は、「Astro Web フレームワーク」により原文データからページ内容の一部が自動生成されているため、英語表記のままの部分があります。 + + + + + +システム起動時にアプリを自動的に起動します。 + +## 対応プラットフォーム + + + +## セットアップ + +はじめに、「Autostart(自動起動)」プラグインをインストールしてください。 + + + + + 自分のプロジェクトのパッケージ・マネージャーを使用して依存関係を追加します: + + {' '} + + + + + + + + 1. `src-tauri` フォルダで次のコマンドを実行して、`Cargo.toml` 内のプロジェクトの依存関係にこのプラグインを追加します: + + ```sh frame=none + cargo add tauri-plugin-autostart --target 'cfg(any(target_os = "macos", windows, target_os = "linux"))' + ``` + + 2. 追加したプラグインを初期化するために `lib.rs` を修正します: + + ```rust title="src-tauri/src/lib.rs" ins={5-6} + #[cfg_attr(mobile, tauri::mobile_entry_point)] + pub fn run() { + tauri::Builder::default() + .setup(|app| { + #[cfg(desktop)] + app.handle().plugin(tauri_plugin_autostart::init(tauri_plugin_autostart::MacosLauncher::LaunchAgent, Some(vec!["--flag1", "--flag2"]) /* アプリに渡す任意の数の引数 */)); + Ok(()) + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); + } + ``` + + 3. お好みの JavaScript パッケージ・マネージャーを使用して、「JavaScript Guest」バインディングをインストールします: + + + + + + + + +## 使用法 + +「Autostart(自動起動)」プラグインは、JavaScript と Rust の両方で利用できます。 + + + + +```javascript +import { enable, isEnabled, disable } from '@tauri-apps/plugin-autostart'; +// `"withGlobalTauri": true` を使用する場合は、 +// const { enable, isEnabled, disable } = window.__TAURI__.autostart; を使用できます; + +// autostart を有効化 +await enable(); +// 有効化状態を確認 +console.log(`registered for autostart? ${await isEnabled()}`); +// autostart を無効化 +disable(); +``` + + + + +```rust +#[cfg_attr(mobile, tauri::mobile_entry_point)] +pub fn run() { + tauri::Builder::default() + .setup(|app| { + #[cfg(desktop)] + { + use tauri_plugin_autostart::MacosLauncher; + use tauri_plugin_autostart::ManagerExt; + + app.handle().plugin(tauri_plugin_autostart::init( + MacosLauncher::LaunchAgent, + Some(vec!["--flag1", "--flag2"]), + )); + + // 「autostart マネージャー」を入手 + let autostart_manager = app.autolaunch(); + // autostart を有効化 + let _ = autostart_manager.enable(); + // 有効化状態を確認 + println!("registered for autostart? {}", autostart_manager.is_enabled().unwrap()); + // autostart を無効化 + let _ = autostart_manager.disable(); + } + Ok(()) + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} +``` + + + + +## アクセス権の設定 + +デフォルトでは、潜在的に危険なプラグイン・コマンドとそのスコープ(有効範囲)はすべてブロックされており、アクセスできません。これらを有効にするには、`capabilities` 設定でアクセス権限を変更する必要があります。 + +詳細については「[セキュリティ・レベル Capabilities](/ja/security/capabilities/)」の章を参照してください。また、プラグインのアクセス権限を設定するには「[プライグン・アクセス権の使用](/ja/learn/security/using-plugin-permissions/)」の章のステップ・バイ・ステップ・ガイドを参照してください。 + +```json title="src-tauri/capabilities/default.json" +{ + "permissions": [ + ..., + "autostart:allow-enable", + "autostart:allow-disable", + "autostart:allow-is-enabled" + ] +} +``` + + + +
+ 【※ この日本語版は、「Feb 22, 2025 英語版」に基づいています】 +
diff --git a/src/content/docs/ja/plugin/barcode-scanner.mdx b/src/content/docs/ja/plugin/barcode-scanner.mdx new file mode 100644 index 0000000000..87e9f59e41 --- /dev/null +++ b/src/content/docs/ja/plugin/barcode-scanner.mdx @@ -0,0 +1,149 @@ +--- +title: Barcode Scanner(バーコード・スキャナー) +description: モバイル・アプリでカメラを使用し、QR コード、EAN-13、その他のバーコードをスキャン可能にします。 +plugin: barcode-scanner +i18nReady: true +--- + +import PluginLinks from '@components/PluginLinks.astro'; +import Compatibility from '@components/plugins/Compatibility.astro'; + +import { Tabs, TabItem, Steps } from '@astrojs/starlight/components'; +import CommandTabs from '@components/CommandTabs.astro'; +import PluginPermissions from '@components/PluginPermissions.astro'; +import TranslationNote from '@components/i18n/TranslationNote.astro'; + + + +**Plugin 説明内容の英語表記部分について** Plugin 関連の各章は、「Astro Web フレームワーク」により原文データからページ内容の一部が自動生成されているため、英語表記のままの部分があります。 + + + + + +モバイル・アプリでカメラを使用し、QR コード、EAN-13、その他のバーコードをスキャン可能にします。 + + + +**EAN-13** European Article Number: 商品識別コード/バーコード規格のひとつで、13 桁の「欧州商品番号」の意味。日本で最も普及している商品識別コードである「JAN コード」と同等のもの。《[Wikipedia](https://ja.wikipedia.org/wiki/EANコード)》 + + + +## 対応プラットフォーム + + + +## セットアップ + +はじめに、「Barcode Scanner(バーコード・スキャナー)」プラグインをインストールしてください。 + + + + + 自分のプロジェクトのパッケージ・マネージャーを使用して依存関係を追加します: + + {' '} + + + + + + + + 1. `src-tauri` フォルダで次のコマンドを実行して、`Cargo.toml` 内のプロジェクトの依存関係にこのプラグインを追加します: + + ```sh frame=none + cargo add tauri-plugin-barcode-scanner --target 'cfg(any(target_os = "android", target_os = "ios"))' + ``` + + 2. 追加したプラグインを初期化するために `lib.rs` を修正します: + + ```rust title="src-tauri/src/lib.rs" ins={5-6} + #[cfg_attr(mobile, tauri::mobile_entry_point)] + pub fn run() { + tauri::Builder::default() + .setup(|app| { + #[cfg(mobile)] + app.handle().plugin(tauri_plugin_barcode_scanner::init()); + Ok(()) + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); + } + ``` + + 3. お好みの JavaScript パッケージ・マネージャーを使用して、「JavaScript Guest」バインディングをインストールします: + + + + + + + + +## 設定 + +iOS では、「Barcode Scanner」プラグインに、あなたのアプリがカメラを使用する理由を説明する `NSCameraUsageDescription` 情報プロパティ・リストの値が必要です。 + +`src-tauri/Info.ios.plist` ファイルには、以下のスニペット(内容)を追加してください。 + +```xml title=src-tauri/Info.ios.plist + + + + + NSCameraUsageDescription + Read QR codes + + +``` + +## 使用法 + +「Barcode Scanner」プラグインは JavaScript で利用できます。 + +```javascript +import { scan, Format } from '@tauri-apps/plugin-barcode-scanner'; +// `"withGlobalTauri": true` を使用する場合は、 +// const { scan, Format } = window.__TAURI__.barcodeScanner; を使用できます; + +// `windowed: true` は、カメラ用に別のビューを開くのではなく、 +// 実際には Webview を透明に設定します +// 要素の透明化により下にあるものが表示されるように、ユーザーインターフェースを設定しておいてください +scan({ windowed: true, formats: [Format.QRCode] }); +``` + +## アクセス権の設定 + +デフォルトでは、潜在的に危険なプラグイン・コマンドとそのスコープ(有効範囲)はすべてブロックされており、アクセスできません。これらを有効にするには、`capabilities` 設定でアクセス権限を変更する必要があります。 + +詳細については「[セキュリティ・レベル Capabilities](/ja/security/capabilities/)」の章を参照してください。また、プラグインのアクセス権限を設定するには「[プライグン・アクセス権の使用](/ja/learn/security/using-plugin-permissions/)」の章のステップ・バイ・ステップ・ガイドを参照してください。 + +```json title="src-tauri/capabilities/mobile.json" +{ + "$schema": "../gen/schemas/mobile-schema.json", + "identifier": "mobile-capability", + "windows": ["main"], + "platforms": ["iOS", "android"], + "permissions": ["barcode-scanner:allow-scan", "barcode-scanner:allow-cancel"] +} +``` + + + +
+ 【※ この日本語版は、「Jul 1, 2025 英語版」に基づいています】 +
diff --git a/src/content/docs/ja/plugin/biometric.mdx b/src/content/docs/ja/plugin/biometric.mdx new file mode 100644 index 0000000000..c90a69e177 --- /dev/null +++ b/src/content/docs/ja/plugin/biometric.mdx @@ -0,0 +1,239 @@ +--- +title: Biometric(生体認証) +description: Android および iOS で、ユーザーに生体認証を要求します。 +plugin: biometric +i18nReady: true +--- + +import PluginLinks from '@components/PluginLinks.astro'; +import Compatibility from '@components/plugins/Compatibility.astro'; + +import { Tabs, TabItem, Steps } from '@astrojs/starlight/components'; +import CommandTabs from '@components/CommandTabs.astro'; +import PluginPermissions from '@components/PluginPermissions.astro'; +import TranslationNote from '@components/i18n/TranslationNote.astro'; + + + +**Plugin 説明内容の英語表記部分について** Plugin 関連の各章は、「Astro Web フレームワーク」により原文データからページ内容の一部が自動生成されているため、英語表記のままの部分があります。 + + + + + +Android および iOS で、ユーザーに「生体認証 biometric authentication」を要求します。 + +## 対応プラットフォーム + + + +## セットアップ + +はじめに、「Biometric(生体認証)」プラグインをインストールしてください。 + + + + + 自分のプロジェクトのパッケージ・マネージャーを使用して依存関係を追加します: + + + + + + + 1. `src-tauri` フォルダで次のコマンドを実行して、`Cargo.toml` 内のプロジェクトの依存関係にこのプラグインを追加します: + + ```sh frame=none + cargo add tauri-plugin-biometric --target 'cfg(any(target_os = "android", target_os = "ios"))' + ``` + + 2. 追加したプラグインを初期化するために `lib.rs` を修正します: + + ```rust title="src-tauri/src/lib.rs" ins={5-6} + #[cfg_attr(mobile, tauri::mobile_entry_point)] + pub fn run() { + tauri::Builder::default() + .setup(|app| { + #[cfg(mobile)] + app.handle().plugin(tauri_plugin_biometric::Builder::new().build()); + Ok(()) + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); + } + ``` + + 3. お好みの JavaScript パッケージ・マネージャーを使用して、「JavaScript Guide」バインディングをインストールします: + + + + + + + +## 設定 + +iOS では、「Biometric(生体認証)」プラグインに、あなたのアプリが「生体認証」を使用する理由を説明する `NSFaceIDUsageDescription` 情報プロパティ・リストの値が必要です。 + +`src-tauri/Info.ios.plist` ファイルには、以下のスニペット(内容)を追加してください: + +```xml title=src-tauri/Info.ios.plist + + + + + NSFaceIDUsageDescription + Authenticate with biometric + + +``` + +## 使用法 + +このプラグインを使用すると、デバイス上で生体認証が利用可能かどうかを確認し、ユーザーに生体認証を要求し、その結果を検証して認証が成功したかどうかを判断できるようになります。 + +### プラグインの状態確認 + +生体認証が利用可能か、どのタイプの生体認証方法がサポートされているのか、などをはじめとして、「生体認証」の状態(ステータス)を確認できます。 + + + + +```javascript +import { checkStatus } from '@tauri-apps/plugin-biometric'; + +const status = await checkStatus(); +if (status.isAvailable) { + console.log('Yes! Biometric Authentication is available'); +} else { + console.log( + 'No! Biometric Authentication is not available due to ' + status.error + ); +} +``` + + + + +```rust +use tauri_plugin_biometric::BiometricExt; + +fn check_biometric(app_handle: tauri::AppHandle) { + let status = app_handle.biometric().status().unwrap(); + if status.is_available { + println!("Yes! Biometric Authentication is available"); + } else { + println!("No! Biometric Authentication is not available due to: {}", status.error.unwrap()); + } +} +``` + + + + +### 認証 + +ユーザーに「生体認証」を要求するには、`authenticate()` メソッドを使用します。 + + + + + +```javascript ins={18} +import { authenticate } from '@tauri-apps/plugin-biometric'; + +const options = { + // ユーザーが「電話のパスワード」を使用して認証できるようにするには、true に設定します + allowDeviceCredential: false, + cancelTitle: "Feature won't work if Canceled", + + // iOS のみの機能 + fallbackTitle: 'Sorry, authentication failed', + + // Android のみの機能 + title: 'Tauri feature', + subtitle: 'Authenticate to access the locked Tauri function', + confirmationRequired: true, +}; + +try { + await authenticate('This feature is locked', options); + console.log( + 'Hooray! Successfully Authenticated! We can now perform the locked Tauri function!' + ); +} catch (err) { + console.log('Oh no! Authentication failed because ' + err.message); +} +``` + + + + + +```rust ins={21} +use tauri_plugin_biometric::{BiometricExt, AuthOptions}; + +fn bio_auth(app_handle: tauri::AppHandle) { + + let options = AuthOptions { + // ユーザーが「電話のパスワード」を使用して認証できるようにするには、true に設定します + allow_device_credential:false, + cancel_title: Some("Feature won't work if Canceled".to_string()), + + // iOS のみの機能 + fallback_title: Some("Sorry, authentication failed".to_string()), + + // Android のみの機能 + title: Some("Tauri feature".to_string()), + subtitle: Some("Authenticate to access the locked Tauri function".to_string()), + confirmation_required: Some(true), + }; + + // 認証が成功した場合には、関数が Result::Ok() を、 + // それ以外の場合には Result::Error() を返します。 + match app_handle.biometric().authenticate("This feature is locked".to_string(), options) { + Ok(_) => { + println!("Hooray! Successfully Authenticated! We can now perform the locked Tauri function!"); + } + Err(e) => { + println!("Oh no! Authentication failed because : {e}"); + } + } +} +``` + + + + +## アクセス権の設定 + +デフォルトでは、潜在的に危険なプラグイン・コマンドとそのスコープ(有効範囲)はすべてブロックされており、アクセスできません。これらを有効にするには、`capabilities` 設定でアクセス権限を変更する必要があります。 + +詳細については「[セキュリティ・レベル Capabilities](/ja/security/capabilities/)」の章を参照してください。また、プラグインのアクセス権限を設定するには「[プライグン・アクセス権の使用](/ja/learn/security/using-plugin-permissions/)」の章のステップ・バイ・ステップ・ガイドを参照してください。 + +```json title="src-tauri/capabilities/default.json" ins={6} +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "main-capability", + "description": "Capability for the main window", + "windows": ["main"], + "permissions": ["biometric:default"] +} +``` + + + +
+ 【※ この日本語版は、「Jul 1, 2025 英語版」に基づいています】 +
diff --git a/src/content/docs/ja/plugin/cli.mdx b/src/content/docs/ja/plugin/cli.mdx new file mode 100644 index 0000000000..a9fe8edc7f --- /dev/null +++ b/src/content/docs/ja/plugin/cli.mdx @@ -0,0 +1,298 @@ +--- +title: CLI(コマンドライン・インターフェイス) +description: コマンドライン・インターフェイスから引数を解析します。 +plugin: cli +i18nReady: true +--- + +import PluginLinks from '@components/PluginLinks.astro'; +import Compatibility from '@components/plugins/Compatibility.astro'; + +import { Tabs, TabItem, Steps } from '@astrojs/starlight/components'; +import CommandTabs from '@components/CommandTabs.astro'; +import PluginPermissions from '@components/PluginPermissions.astro'; +import TranslationNote from '@components/i18n/TranslationNote.astro'; + + + +**Plugin 説明内容の英語表記部分について** Plugin 関連の各章は、「Astro Web フレームワーク」により原文データからページ内容の一部が自動生成されているため、英語表記のままの部分があります。 + + + + + +Tauriは、堅牢なコマンドライン引数パーサー(構文解析ツール)である [clap](https://github.com/clap-rs/clap)(英語版)を用いて、あなたのアプリに CLI 機能を追加できます。`tauri.conf.json` ファイルに簡単な CLI 定義を記述するだけで、インターフェースを定義し、JavaScript や Rust 上の引数照合マップを読み取ることが可能になります。 + +## 対応プラットフォーム + + + +- Windows + - OSの制限により、本番環境アプリでは、デフォルトでは呼び出しコンソールにテキストを書き戻すことができません。この回避策については、[tauri#8305](https://github.com/tauri-apps/tauri/issues/8305#issuecomment-1826871949) をご確認ください。{/* TODO: Inline the instructions into this guide */} + +## セットアップ + +はじめに、「CLI(コマンドライン・インターフェイス)」プラグインをインストールしてください。 + + + + + 自分のプロジェクトのパッケージ・マネージャーを使用して依存関係を追加します: + + + + + + + + 1. `src-tauri` フォルダで次のコマンドを実行して、`Cargo.toml` 内のプロジェクトの依存関係にプラグインを追加します: + + ```sh frame=none + cargo add tauri-plugin-cli --target 'cfg(any(target_os = "macos", windows, target_os = "linux"))' + ``` + + 2. 追加したプラグインを初期化するために `lib.rs` を修正します: + + ```rust title="src-tauri/src/lib.rs" ins={5-6} + #[cfg_attr(mobile, tauri::mobile_entry_point)] + pub fn run() { + tauri::Builder::default() + .setup(|app| { + #[cfg(desktop)] + app.handle().plugin(tauri_plugin_cli::init()); + Ok(()) + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); + } + ``` + + 3. お好みの JavaScript パッケージ・マネージャーを使用して、「JavaScript Guest」バインディングをインストールします: + + + + + + + + +## 基本設定 + +`tauri.conf.json` の中には、インターフェースを設定するための以下の項目があります: + +```json title="src-tauri/tauri.conf.json" +{ + "plugins": { + "cli": { + "description": "Tauri CLI Plugin Example" /* プラグインの説明 */, + "args": [ + /* 引数 */ + { + "short": "v", + "name": "verbose" /* 出力レベル(この場合は「詳細表示」) */, + "description": "Verbosity level" + } + ], + "subcommands": { + "run": { + "description": "Run the application" /* コマンドの内容(この場合は「アプリの実行」) */, + "args": [ + { + "name": "debug", + "description": "Run application in debug mode" /* 「デバッグ・モードでのアプリ実行」 */ + }, + { + "name": "release", + "description": "Run application in release mode" /* 「リリース・モードでのアプリ実行」 */ + } + ] + } + } + } + } +} +``` + +:::note + +ここに記載されている JSON の設定内容はすべて単なる「サンプル」であり、わかりやすくするために他の多くのフィールド項目は省略されています。 + +::: + +## 引数の追加 + +`args` 配列は、コマンドまたはサブコマンドによって受け入れられる引数のリストを表します。 + +{/* TODO: List available configuration */} + +### 位置引数 Positional Argument + +「位置引数」は、引数リスト内の位置によって識別が行なわれます。以下の設定では: + +```json title="src-tauri/tauri.conf.json" +{ + "args": [ + { + "name": "source", + "index": 1, + "takesValue": true + }, + { + "name": "destination", + "index": 2, + "takesValue": true + } + ] +} +``` + +ユーザーはアプリを `./app tauri.txt dest.txt` として実行でき、引数照合マップには `source` を `"tauri.txt"` として、`destination` を `"dest.txt"` として定義します。 + +### 名前付き引数 Named Arguments + +「名前付き引数」は[キーと値]のペアで、キーが値を表します。以下の設定では: + +```json title="tauri-src/tauri.conf.json" +{ + "args": [ + { + "name": "type", + "short": "t", + "takesValue": true, + "multiple": true, + "possibleValues": ["foo", "bar"] + } + ] +} +``` + +ユーザーはアプリを `./app --type foo bar`、`./app -t foo -t bar`、または `./app --type=foo,bar` として実行でき、引数照合マップには `type` を `["foo", "bar"]` として定義します。 + +### フラグ引数 Flag Arguments + +「フラグ引数」は、独立動作型(スタンドアロン)のキーで、その値の真偽によってアプリケーションに情報を提供します。以下の設定では: + +```json title="tauri-src/tauri.conf.json" +{ + "args": [ + { + "name": "verbose", + "short": "v" + } + ] +} +``` + +ユーザーはアプリを `./app -v -v -v`、`./app --verbose --verbose --verbose`、または `./app -vvv` として実行でき、引数照合マップには `verbose` を `true`、`occurrences = 3` として定義します。 + +## サブコマンド + +一部の CLI アプリケーションには、サブコマンドとしての追加インターフェースがあります。例えば、`git` CLI には `git branch`、`git commit`、`git push`があり、また、`subcommands` 配列を使用すれば、ネストされたインターフェースを追加定義できます: + +```json title="tauri-src/tauri.conf.json" +{ + "cli": { + ... + "subcommands": { + "branch": { + "args": [] + }, + "push": { + "args": [] + } + } + } +} +``` + +その構成はルート・アプリケーションの構成と同じで、`description`、`longDescription`、`args` などがあります。 + +## 使用法 + +「CLI(コマンドライン・インターフェイス)」プラグインは、JavaScript と Rust の両方で利用できます。 + + + + +```javascript +import { getMatches } from '@tauri-apps/plugin-cli'; +// `"withGlobalTauri": true` を使用する場合は、 +// const { getMatches } = window.__TAURI__.cli; を使用できます; + +const matches = await getMatches(); +if (matches.subcommand?.name === 'run') { + // `./your-app run $ARGS` が実行されました + const args = matches.subcommand.matches.args; + if (args.debug?.value === true) { + // `./your-app run --debug` が実行されました + } + if (args.release?.value === true) { + // `./your-app run --release` が実行されました + } +} +``` + + + + +```rust title="src-tauri/src/lib.rs" {1, 6-18} +use tauri_plugin_cli::CliExt; + +#[cfg_attr(mobile, tauri::mobile_entry_point)] +pub fn run() { + tauri::Builder::default() + .plugin(tauri_plugin_cli::init()) + .setup(|app| { + match app.cli().matches() { + // ここでの `matches` は { args, subcommand } を持つ構造体です。 + // 構造体のメンバー `args` は `HashMap` であり、`ArgData` は { value, occurrences } を持つ構造体です。 + // もう一方の構造体メンバー `subcommand` は `Option>` であり、`SubcommandMatches` は { name, matches } を持つ構造体です。 + Ok(matches) => { + println!("{:?}", matches) + } + Err(_) => {} + } + Ok(()) + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} +``` + + + + +## アクセス権の設定 + +デフォルトでは、潜在的に危険なプラグイン・コマンドとそのスコープ(有効範囲)はすべてブロックされており、アクセスできません。これらを有効にするには、`capabilities` 設定でアクセス権限を変更する必要があります。 + +詳細については「[セキュリティ・レベル Capabilities](/ja/security/capabilities/)」の章を参照してください。また、プラグインのアクセス権限を設定するには「[プライグン・アクセス権の使用](/ja/learn/security/using-plugin-permissions/)」の章のステップ・バイ・ステップ・ガイドを参照してください。 + +```json title="src-tauri/capabilities/default.json" ins={6} +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "main-capability", + "description": "Capability for the main window", + "windows": ["main"], + "permissions": ["cli:default"] +} +``` + + + +
+ 【※ この日本語版は、「Feb 22, 2025 英語版」に基づいています】 +
diff --git a/src/content/docs/ja/plugin/clipboard.mdx b/src/content/docs/ja/plugin/clipboard.mdx new file mode 100644 index 0000000000..9f925ce55a --- /dev/null +++ b/src/content/docs/ja/plugin/clipboard.mdx @@ -0,0 +1,129 @@ +--- +title: Clipboard(クリップボード) +description: システム・クリップボードの読み取りと書き込みを行ないます。 +plugin: clipboard-manager +i18nReady: true +--- + +import Stub from '@components/Stub.astro'; +import PluginLinks from '@components/PluginLinks.astro'; +import Compatibility from '@components/plugins/Compatibility.astro'; + +import { Tabs, TabItem, Steps } from '@astrojs/starlight/components'; +import CommandTabs from '@components/CommandTabs.astro'; +import PluginPermissions from '@components/PluginPermissions.astro'; +import TranslationNote from '@components/i18n/TranslationNote.astro'; + + + +**Plugin 説明内容の英語表記部分について** Plugin 関連の各章は、「Astro Web フレームワーク」により原文データからページ内容の一部が自動生成されているため、英語表記のままの部分があります。 + + + + + +「clipboard(クリップボード)」プラグインを使用してシステム・クリップボードの読み取りと書き込みを行ないます。 + +## 対応プラットフォーム + + + +## セットアップ + +はじめに、「clipboard(クリップボード)」プラグインをインストールしてください。 + + + + + 自分のプロジェクトのパッケージ・マネージャーを使用して依存関係を追加します: + + + + + + + + 1. `src-tauri` フォルダで次のコマンドを実行して、`Cargo.toml` 内のプロジェクトの依存関係にこのプラグインを追加します: + + ```sh frame=none + cargo add tauri-plugin-clipboard-manager + ``` + + 2. 追加したプラグインを初期化するために `lib.rs` を修正します: + + ```rust title="src-tauri/src/lib.rs" ins={4} + #[cfg_attr(mobile, tauri::mobile_entry_point)] + pub fn run() { + tauri::Builder::default() + .plugin(tauri_plugin_clipboard_manager::init()) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); + } + ``` + + 3. JavaScript でクリップボードを管理する場合には、npm パッケージもインストールします: + + + + + + + + +## 使用法 + +{/* TODO: Link to which language to use, frontend vs. backend guide when it's made */} + +「clipboard」プラグインは、JavaScript と Rust の両方で利用できます。 + + + + +```javascript +import { writeText, readText } from '@tauri-apps/plugin-clipboard-manager'; +// `"withGlobalTauri": true` を使用する場合は、 +// const { writeText, readText } = window.__TAURI__.clipboardManager; を使用できます; + +// コンテンツをクリップボードに書き込みます +await writeText('Tauri is awesome!'); + +// クリップボードからコンテンツを読み取ります +const content = await readText(); +console.log(content); +// コンソールにコンテンツの内容「Tauri is awesome!」を表示します +``` + + + + +```rust +use tauri_plugin_clipboard_manager::ClipboardExt; + +app.clipboard().write_text("Tauri is awesome!".to_string()).unwrap(); + +// クリップボードからコンテンツを読み取ります +let content = app.clipboard().read_text(); +println!("{:?}", content.unwrap()); +// ターミナルにコンテンツの内容「Tauri is awesome!」を表示します + +``` + + + + + + +
+ 【※ この日本語版は、「Feb 22, 2025 英語版」に基づいています】 +
diff --git a/src/content/docs/ja/plugin/index.mdx b/src/content/docs/ja/plugin/index.mdx new file mode 100644 index 0000000000..203d88ac55 --- /dev/null +++ b/src/content/docs/ja/plugin/index.mdx @@ -0,0 +1,52 @@ +--- +title: プラグイン: 機能と利用法 +i18nReady: true +sidebar: + label: 概要 +--- + +import { LinkCard } from '@astrojs/starlight/components'; +import FeaturesList from '@components/list/Features.astro'; +import CommunityList from '@components/list/Community.astro'; +import Search from '@components/CardGridSearch.astro'; +import AwesomeTauri from '@components/AwesomeTauri.astro'; +import TableCompatibility from '@components/plugins/TableCompatibility.astro'; +import TranslationNote from '@components/i18n/TranslationNote.astro'; + + + +**Plugin 説明内容の英語表記部分について** Plugin 関連の各章は、「Astro Web フレームワーク」により原文データからページ内容の一部が自動生成されているため、英語表記のままの部分があります。 + +また、「コミュニティ・リソース版」プラグインは、公式 Tauri 文書にないため、翻訳は行なわれません。各リンク先の説明内容(英語版)を参照してください。 + + + +Tauri は機能の拡張性を念頭に置いて設計されています。この章では以下のプラグインの内容ついてご覧いただけます: + +- **[Tauri 公式版](#Tauri-公式版)**: 組み込まれている Tauri の機能と特徴 +- **[コミュニティ・リソース版](#コミュニティ・リソース版)**: Tauri コミュニティによって作成された追加のプラグインとその利用法 + + + ## Tauri-公式版 + + ## コミュニティ・リソース版 + + ### プラグイン + + ### 統合化 + + + +## 対応プラットフォーム一覧表 + +"\*" 印にカーソルを合わせるとそのプラグインの「対応状況」が表示されます。詳細については各プラグインの説明をご覧ください。 + + + +
+ 【※ この日本語版は、「Sep 30, 2024 英語版」に基づいています】 +