Lingo.dev + .xcstrings (Xcode)

Lingo.dev CLIはXcodeの.xcstringsファイルを複数形ルール、デバイスバリエーション、およびiOS固有のメタデータを保持しながら翻訳します。CLIはXcodeのローカリゼーションワークフローと直接連携し、コードからアクセス可能な文字列定数を生成し、複雑なiOSの複数形ルールを自動的に処理し、プラットフォーム固有の文字列バリエーションをサポートし、Xcodeビルドプロセスとシームレスに統合します。

クイックセットアップ

Xcodeのモダンな文字列カタログ形式用に設定します:

{
  "locale": {
    "source": "en",
    "targets": ["es", "fr", "de", "ja"]
  },
  "buckets": {
    "xcode-xcstrings": {
      "include": ["Resources/Localizable.xcstrings"]
    }
  }
}

文字列カタログの翻訳

npx lingo.dev@latest i18n

複数形、デバイスバリエーション、およびXcode固有のメタデータをiOSの規則を保持しながら自動的に処理します。

文字列カタログの機能

基本的なローカリゼーション

{
  "sourceLanguage": "en",
  "strings": {
    "welcome_message": {
      "localizations": {
        "en": {
          "stringUnit": {
            "state": "translated",
            "value": "Welcome to our app!"
          }
        }
      }
    }
  }
}

複数形バリエーション

{
  "item_count": {
    "localizations": {
      "en": {
        "variations": {
          "plural": {
            "zero": {
              "stringUnit": {
                "state": "translated",
                "value": "No items"
              }
            },
            "one": {
              "stringUnit": {
                "state": "translated",
                "value": "%d item"
              }
            },
            "other": {
              "stringUnit": {
                "state": "translated",
                "value": "%d items"
              }
            }
          }
        }
      }
    }
  }
}

デバイスバリエーション

iPhone、iPad、Apple Watch、その他のAppleプラットフォーム向けのデバイス固有の文字列をサポートします。

フォーマットの保持

  • メタデータの保持: 状態、コメント、抽出状態が保持されます
  • バリエーションの安全性: すべての複数形とデバイスバリエーションが維持されます
  • 構造の保持: JSON階層とXcode固有のキーが変更されません
  • プレースホルダーの安全性: %@%dなどのiOSフォーマット指定子が維持されます

高度な設定

複数のカタログ

"xcode-xcstrings": {
  "include": [
    "Resources/Localizable.xcstrings",
    "Resources/InfoPlist.xcstrings"
  ]
}

システムキーのロック

"xcode-xcstrings": {
  "include": ["Resources/Localizable.xcstrings"],
  "lockedKeys": ["CFBundleName", "NSHumanReadableCopyright"]
}

翻訳者メモ

Xcodeの.xcstringsファイルは、文字列エントリのcommentフィールドを通じて翻訳者メモをサポートしています。これらのメモは翻訳中にAIモデルに重要なコンテキストを提供し、各文字列の意図と使用法を理解するのに役立ちます。

{
  "strings": {
    "light_mode": {
      "comment": "UI theme setting - refers to brightness, not weight",
      "localizations": {
        "en": {
          "stringUnit": {
            "state": "translated",
            "value": "Light Mode"
          }
        }
      }
    },
    "records_label": {
      "comment": "Medical context: patient health records, not audio recordings",
      "localizations": {
        "en": {
          "stringUnit": {
            "state": "translated",
            "value": "View Records"
          }
        }
      }
    }
  }
}

詳細については、翻訳者メモをご覧ください。