.strings ファイルを .strings.json ファイルに変換する

.strings ファイルを .strings.json ファイルに変換するには:

  1. 7.12 よりも前のバージョンの Looker を使用している場合は、ローカライズに必要なレガシー .strings ファイルのレガシー機能をオフにします。
  2. プロジェクト用の新しい .strings.json ファイルを作成します。そのためには、プロジェクト ファイルのリストの右上にある + アイコンをクリックし、[Create Locale Strings File] を選択します。
  3. 新しい .strings.json ファイルに名前を付けます。.strings ファイルのタイトルは、対象のロケールを使用しているユーザーまたはグループに割り当てられたロケールコードと一致する必要があります。また、デフォルトのロケールファイルのタイトルは、プロジェクトのマニフェスト ファイル内の default_locale の値と一致する必要があります。
  4. 新しい .strings.json ファイルに含まれるスニペットは、JSON 形式の例を示しています。この例を削除し、中かっこのペア {} に置き換えます。
  5. 古い .strings ファイルから Key-Value ペアをコピーして、中括弧内に貼り付けます。
  6. すべての等号をコロンに置き換えます。
  7. コメントを削除します。または、以下に示すように、それらを個々のコメントまたはコメントの配列として再フォーマットします。
  8. すべてのセミコロンをカンマに置き換えます。

一般的な Key-Value ペアの .strings.json の形式は次のようになります。

{
    "flight_info" : "Flight Info",
    "id" : "Identifier",
    "airline" : "Air Carrier"
}

コメントの形式を設定するには、次の形式を使用します。

{
    " My Comment": {
        "my_comment_array": [
        "The name of this file should be the associated locale code followed by '.strings.json'",
        "There is one .strings.json file per locale.",
        "Define your translated strings one key at a time demonstrated below",
        "Keys can be any string; choose whatever scheme helps you stay organized",
        "Then, set your Lookml label and description parameters to the desired key values.",
        "To choose this file as the master key list and as the one to validate against",
        "set its locale code ('test') as the default_locale in the manifest file"
        ],
        "value": "Translation for My Comment"
    },
    "My Key": {
        "value": "Translation for My Key",
        "comment": "Define your translated strings with a comment or array of comments as above"
    }
}