---
title: "ウォークスルー:Business Toolsユーザーインターフェースに新しい言語を追加する"
slug: "walkthrough--adding-a-new-language-to-the-business-tools-user-interface"
abstract: "Sitecoreに言語を追加して、英語、ドイツ語、日本語以外の言語でXC Business Toolsユーザーインターフェースを表示できるようにする方法。"
---
# ウォークスルー:Business Toolsユーザーインターフェースに新しい言語を追加する

Sitecore XC Business Toolsのユーザーインターフェースのデフォルト言語は英語ですが、Business Tools設定でお好みの言語でインターフェースを表示することができます。商業Business Toolsを事前に設定された言語以外の言語で表示するには(デンマーク語、日本語、ドイツ語の翻訳ファイル [をダウンロード](https://dev.sitecore.net/Downloads/Sitecore_Commerce.aspx) できます)、このウォークスルーの手順に従ってください。

> !注Business Toolsはデンマーク語、日本語、ドイツ語のIDとロケーションをサポートするよう事前に設定されています。Business Toolsのインターフェースをこれらの言語のいずれかで表示するには、適切な言語ファイル [をダウンロードしてインストール](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/install-a-translation-file-for-the-xc-business-tools.html "Install a translation file for the XC Business Tools") するだけで済みます。このウォークスルーの手順に従う必要はありません。
> 
> その他の言語サポートの場合は、このウォークスルーを実行する前にXML翻訳ファイルを提供し、Sitecoreに [アップロード](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/install-a-translation-file-for-the-xc-business-tools.html "Install a translation file for the XC Business Tools") する必要があります。Business Toolsで選択した言語の翻訳ファイルがインストールされていない場合、Business Toolsのユーザーインターフェースはデフォルトで英語になります。

このウォークスルーでは、以下の方法を説明します:

-   [Sitecore設定に新しい言語を追加する](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/walkthrough--adding-a-new-language-to-the-business-tools-user-interface.html#UUID-86d7c34a-634d-6606-6dd6-46e64a48ebd3_section-idm4479625703592031645852718634 "Add a new language to the Sitecore system settings")
-   [コマースコントロールパネルに新しい言語を追加する](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/walkthrough--adding-a-new-language-to-the-business-tools-user-interface.html#UUID-86d7c34a-634d-6606-6dd6-46e64a48ebd3_section-idm4540676706457631645896629276 "Add a new language to the Commerce Control Panel")
-   [コンテンツパスの同期](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/walkthrough--adding-a-new-language-to-the-business-tools-user-interface.html#UUID-86d7c34a-634d-6606-6dd6-46e64a48ebd3_section-idm4550549033332831645926685878 "Synchronize content path")
-   [Commerce Engine GlobalEnvironmentポリシーに文言を追加](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/walkthrough--adding-a-new-language-to-the-business-tools-user-interface.html#UUID-86d7c34a-634d-6606-6dd6-46e64a48ebd3_section-idm231858525113129 "Add the language to the Commerce Engine GlobalEnvironment policy")
-   [.を作成してください。JSON言語ファイル](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/walkthrough--adding-a-new-language-to-the-business-tools-user-interface.html#UUID-86d7c34a-634d-6606-6dd6-46e64a48ebd3_section-idm231747867988757 "Create a .JSON language file")
-   [新しい言語IDを登録し、Business Toolsアプリケーションを再コンパイルします](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/walkthrough--adding-a-new-language-to-the-business-tools-user-interface.html#UUID-86d7c34a-634d-6606-6dd6-46e64a48ebd3_section-idm231752917697329 "Register a new language ID and recompile the Business Tools application")

このウォークスルーの最後にSitecore XC Business Toolsを開き、言語セレクターを使って新たにインストールされた言語でユーザーインターフェースを表示できます。

## Sitecoreシステム設定に新しい言語を追加する

新しい言語はSitecoreシステム設定で追加し、新しい言語コードと関連する国・地域コードがSitecore内で設定可能になるようにしてください。

Sitecoreのシステム設定に言語を追加するには:

1.  コンテンツエディターで */sitecore/System/Languages*へ行ってください。
    
2.  右クリックしてから **「挿入」、言語**をクリック。
    
3.  「 **新しい言語を追加」** ダイアログボックスの「 **Predefined language code選択** 」フィールドで、使用したい言語コードを選択し、残りのフィールドを必要に応じて入力し、「 **次」** をクリックしてウィザードの残りのページを進みます。完了したら「 **閉じる**」をクリックします。
    
    ![The Add a New Language dialog box in Sitecore Content Editor.](https://doc.sitecore.com/api/markdown-image/xp/ja/developers/101/sitecore-experience-commerce/images/XMC_CE_language.png)
    
    新しい言語はコンテンツツリーに追加されます。
    
4.  変更を保存するには「 **保存** 」をクリックしてください。
    

## コマースコントロールパネルに新しい言語を追加する

新しい言語をCommerce Control Panelに追加し、その言語がSitecore Experience Commerceで利用可能になるようにします。

コマースコントロールパネルに新しい言語を追加するには:

1.  コンテンツエディターで*/sitecore/Commerce/Commerce コントロールパネル/共有設定/言語セット/デフォルト設定*へ行ってください。
    
2.  **コマースコントロールパネル**のセクションで、新しく追加した言語をダブルクリックして「**選択**済み」欄に移動します。
    
    ![The language selector in the Commerce Control Panel.](https://doc.sitecore.com/api/markdown-image/xp/ja/developers/101/sitecore-experience-commerce/images/XC_Commerce_Language_Sets.png)
    
3.  変更を保存するには「保存」をクリックしてください。
    

## コンテンツパスの同期

新しい言語がコマースコントロールパネルで利用可能になった結果、新しいコンテンツ項目がSitecoreで作成されました。これらの新しいアイテムをコマースエンジン、ひいてはBusiness Toolsで表示するためには、PostmanのSync content pathサンプルリクエストを使ってコンテンツを同期させる必要があります。

コンテンツパスを同期させるには:

1.  Postmanで[Syncコンテンツパスサンプルリクエストを実行します](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/synchronize-content-items.html "Synchronize content items")。
    
    > !注アイテム同期操作が完了した後は、必ずRedisキャッシュをクリアしてください。
    
2.  Microsoft IIS ManagerでCommerce Engineアプリケーションを再起動します。
    
3.  Microsoft IIS ManagerでBusiness Toolsアプリケーションを再起動します。
    

## Commerce Engine GlobalEnvironmentポリシーに文言を追加

Commerce Engineが新しい言語を認識するには、言語コードをSitecore.Commerce.Core.GlobalEnvironmentPolicyポリシーファイルに追加し、Commerce Engineをブートストラップする必要があります。

コマースエンジンに言語を追加するには:

1.  \\inetpub\\wwwroot\\CommerceAuthoring\_Sc\\wwwroot\\data\\Environmentsに行け。
    
2.  PlugIn.<catalog name>.CommerceAuthoring-1.0.0.jsonファイルを開け。
    
3.  Sitecore.Commerce.Core.GlobalEnvironmentPolicyセクションの言語セクションで、新しい言語を言語セットに追加し、ファイルを保存します。
    
    {
     "$type": "Sitecore.Commerce.Core.GlobalEnvironmentPolicy, Sitecore.Commerce.Core",
     "Languages": {
     "$type": "System.Collections.Generic.List\`1System.String, mscorlib, mscorlib",
     "$values": 
     "en",
     "de-DE",
     "ja-JP",
     "fr-FR"
     
     },
    
4.  Postmanを使って、Commerce Engineを [ブートストラップします](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/bootstrap-the-commerce-engine.html "Bootstrap the Commerce Engine") 。
    
5.  Postmanを使って 、Shops環境キャッシュをクリアします。
    
6.  コンテンツエディターで「 **Commerce** 」タブをクリックし、「 **Commerce Cacheを更新**」をクリックします。
    
7.  ブラウザのキャッシュをクリアしてください。
    
8.  IISマネージャーを開き、Commerce Engine Authoringを再起動してください。
    

## .を作成してください。JSON言語ファイル

Business Toolsインターフェースラベルの翻訳を含むXMLファイル(ユーザーインターフェースラベルの大部分を含む)に加え、.JSON言語ファイルでさらにいくつかのラベルや検証エラーメッセージ(合計9つの追加文字列)を翻訳します。Business Toolsのユーザーインターフェース全体を翻訳したい場合は、必要な言語の.JSONファイルを作成し、追加のラベルを翻訳する必要があります。

> !注オプションで、ローカリゼーションの簡素化のためにこの手順を省略することもできます。新しい言語用のJSONファイルを作成していない場合、Business Toolsはこれら追加の9つの文字列を英語で表示します。
> 
> 言語内で翻訳された他のすべてのラベル(インターフェースの大部分を表す)は追加の手順を要せず、新たに設定された言語で表示されます。

以下は英語の言語JSONファイル( en.jsonファイル)の内容のサンプルで、追加のラベル文字列を示しています。

{
 "ValidationErrors": {
 "IsRequired": "{{DisplayName}} is required.",
 "IncorrectDecimalValue": "{{DisplayName}} has an incorrect decimal value.",
 "IncorrectDateValue": "{{DisplayName}} has an incorrect date value."
 },
 "ActionExecuted": "{{DisplayName}} executed.",
 "Back": "Back",
 "Logout": "Log out",
 "LanguageSelector": "Language displayed",
 "NoSearchResults": "No results matching your search were found.",
 "Searching": "Searching..."
}

> !注Sitecore XCには以下の言語の.JSONファイルが含まれています:英語(en.json)、ドイツ語(de-DE.json)、フランス語(fr-FR.json)、日本語(ja-JP.json)。

.別の言語用のJSON言語ファイルを作成するには:

1.  Business Toolsがインストールされているサーバーで、 c:/inetpub/wwwroot/SitecoreBizFxSite\\assets\\i18nに移動して既存のファイル(例えば en.json ファイル)をコピーし、必要な言語名(例えばスペイン語の場合は es-ES.json )にファイル名を変更します。
2.  ファイルを開いて、英語の文字列を翻訳された文字列に置き換えます。
3.  ファイルを保存してください。

## 新しい言語IDを登録し、Business Toolsアプリケーションを再コンパイルします

[前のステップ](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/walkthrough--adding-a-new-language-to-the-business-tools-user-interface.html#UUID-86d7c34a-634d-6606-6dd6-46e64a48ebd3_section-idm231747867988757 "Create a .JSON language file")で新しいJSONファイルを作成した場合は、新しい言語を登録し、アプリケーションを再コンパイルする必要があります。JSON言語ファイルで翻訳されたXC Business Toolsユーザーインターフェースの部分は、[Angularのローカリゼーションフレームワーク](https://angular.io/guide/i18n)に依存してユーザーインターフェース上で正しく表示されます。

> !注この手順は、[あなたがSitecoreをセットアップし展開していることを前提としています。BizFX。開発](https://doc.sitecore.com/xp/ja/developers/101/sitecore-experience-commerce/walkthrough--getting-started-with-business-tools-customization.html "Walkthrough: Getting started with Business Tools customization") 環境でのSDK。

Business Toolsアプリケーションで新しい言語IDとロケートを登録するには:

1.  開発環境でSitecore.BizFX.SDKフォルダを開き、次にsrc/app/app.module.tsファイルを開いてください。
    
2.  ファイルの /\* Locales \*/というセクションに、追加の言語を追加します。
    
    以下の例は、スペイン語のID(es)とローカレ(ES)のサポートが追加されたことを示しています。
    
    /\* Locales \*/
    import localeFr from '@angular/common/locales/fr';
    import localeFrExtra from '@angular/common/locales/extra/fr';
    import localeJa from '@angular/common/locales/ja';
    import localeJaExtra from '@angular/common/locales/extra/ja';
    import localeDe from '@angular/common/locales/de';
    import localeDeExtra from '@angular/common/locales/extra/de';
    import localeEs from '@angular/common/locales/es';
    import localeEsExtra from '@angular/common/locales/extra/Es';
    
    registerLocaleData(localeFr, 'fr-FR', localeFrExtra);
    registerLocaleData(localeJa, 'Ja-JP', localeJaExtra);
    registerLocaleData(localeDe, 'de-DE', localeDeExtra);
    registerLocaleData(localeEs, 'es-Es', localeEsExtra);
    /\*\*
    
3.  変更を保存してAngularのimportとregisterLocaleData(...) 関数を呼び出してください。
    
4.  Business Tools(BizFx)アプリケーションを再コンパイルしてください。