Creation:2024-08-11Last update:2026-03-31

    Intlayer CLI - 多言語サイトのためのすべてのIntlayer CLIコマンド


    目次


    パッケージのインストール

    npmを使用して必要なパッケージをインストールします:

    bash
    npm install intlayer-cli -g
    intlayer パッケージがすでにインストールされている場合、CLIは自動的にインストールされます。このステップはスキップできます。

    intlayer-cli パッケージ

    intlayer-cli パッケージは、Intlayer宣言をディクショナリにトランスパイルするためのものです。

    このパッケージは、src/**/*.content.{ts|js|mjs|cjs|json|tsx|jsx|md|mdx|yaml|yml} などのすべてのIntlayerファイルをトランスパイルします。Intlayer宣言ファイルの宣言方法を参照してください

    Intlayerディクショナリを解釈するには、react-intlayernext-intlayer などのインタープリターを使用できます。

    設定ファイルのサポート

    Intlayerは、複数の設定ファイル形式をサポートしています:

    • intlayer.config.ts
    • intlayer.config.js
    • intlayer.config.json
    • intlayer.config.cjs
    • intlayer.config.mjs
    • .intlayerrc

    利用可能な言語やその他のパラメータの設定方法については、こちらから設定ドキュメントを参照してください。

    Intlayerコマンドの実行

    認証

    • Login - Intlayer CMSで認証し、アクセス資格情報を取得します。

    コアコマンド

    • Build Dictionaries - コンテンツ宣言ファイルからディクショナリをビルドします。
    • Watch Dictionaries - 変更を監視し、ディクショナリを自動的に再ビルドします。
    • Create Standalone Bundle - Intlayerと指定したパッケージを含むスタンドアロンJavaScriptバンドルを作成します。
    • Check CLI Version - インストールされているIntlayer CLIのバージョンを確認します。
    • List Projects - ディレクトリまたはGitリポジトリ内のすべてのIntlayerプロジェクトを一覧表示します。

    ディクショナリ管理

    コンポーネント管理

    • Extract Strings - コンポーネントから文字列を抽出し、コンポーネントの近くの .content ファイルに保存します。

    設定

    ドキュメント管理

    • Translate Document - AIを使用してドキュメントファイルを自動的に翻訳します。
    • Review Document - ドキュメントファイルの品質と一貫性をレビューします。

    エディターとライブ同期

    • Editor Commands - Intlayerエディターのコマンドを使用します。
    • Live Sync Commands - Live Syncを使用して、CMSからのコンテンツ変更を実行時に反映させます。

    CI/CDと自動化

    • CI Command - CI/CDパイプライン用に自動的に資格情報を挿入してIntlayerコマンドを実行します。

    開発ツール

    • CLI SDK - 独自のコード内でIntlayer CLI SDKを使用します。
    • Debug Intlayer Command - Intlayer CLIの問題をデバッグして修正します。

    package.json での Intlayer コマンドの使用

    package.json
    "scripts": {  "intlayer:init": "npx intlayer init",  "intlayer:login": "npx intlayer login",  "intlayer:build": "npx intlayer build",  "intlayer:watch": "npx intlayer build --watch",  "intlayer:standalone": "npx intlayer standalone --packages intlayer vanilla-intlayer",  "intlayer:push": "npx intlayer push",  "intlayer:pull": "npx intlayer pull",  "intlayer:fill": "npx intlayer fill",  "intlayer:list": "npx intlayer content list",  "intlayer:test": "npx intlayer content test",  "intlayer:extract": "npx intlayer extract",  "intlayer:projects": "npx intlayer projects list",  "intlayer:doc:translate": "npx intlayer doc translate",  "intlayer:doc:review": "npx intlayer doc review"}

    注意: 以下の短いエイリアスも使用できます:

    • npx intlayer list: npx intlayer content list の代わり
    • npx intlayer test: npx intlayer content test の代わり
    • npx intlayer projects-list または npx intlayer pl: npx intlayer projects list の代わり