XCode String Catalogs

The String Catalog (.xcstrings) format is Apple's modern localization system, introduced to streamline the internationalization of iOS, macOS, watchOS, and tvOS applications.

It utilizes a JSON-based file format (.xcstrings) that is both human-readable and easily parsed by development tools.
Xcode's built-in localization features provide robust support for managing and editing these string catalogs.

This format can be seen as a replacement for Apple iOS

Format

  • The JSON format is used.
  • Valid file extension is .xcstrings
  • Information about placeholders can be found here: String Format Specifiers
  • It is a multi-language file. So, it holds information and has translations for several languages.
  • An essential concept of this format is variations to separate translation information for
    • plurals
    • devices like PC, Phone, Tablet, ...
      • Please keep in mind that Lingohub does not fully support devices yet. If a deviceInformation is given, the device default is stored.
  • The XCode String catalog state will be mapped accordingly to Lingohub segment states:
    • newNEW
    • staleDRAFT
    • needs_reviewTRANSLATED
    • translatedAPPROVED

Lingohints can be used by being included in a comment:

"Accessibility" : {
      "comment" : "Show Accessiblity Settings <lh>{\"status\": \"DRAFT\",\"qc\": {\"min\": \"3\",\"max\": \"20\"},\"labels\": [\"q3-2024\"],\"not_translatable\": false}</lh>",
      "localizations" : {
        "de" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "Barrierefreiheit"
          }
        }
      }
    }

Examples

{
  "sourceLanguage": "en",
  "strings": {
    "photos.count": {
      "extractionState": "manual",
      "localizations": {
        "de": {
          "state": "translated",
          "variations": {
            "plural": {
              "zero": "Keine Fotos",
              "one": "Ein Foto",
              "other": "%lld Fotos"
            }
          }
        },
        "en": {
          "state": "verified",
          "variations": {
            "plural": {
              "zero": "No photos",
              "one": "One photo",
              "other": "%lld photos"
            }
          }
        }
      }
    },
    "welcome.message": {
      "extractionState": "manual",
      "localizations": {
        "de": {
          "state": "translated",
          "variations": {
            "device": {
              "ipad": "Willkommen auf deinem iPad",
              "iphone": "Willkommen auf deinem iPhone",
              "mac": "Willkommen auf deinem Mac",
              "other": "Willkommen"
            }
          }
        },
        "en": {
          "state": "needs_review",
          "variations": {
            "device": {
              "ipad": "Welcome to your iPad",
              "iphone": "Welcome to your iPhone",
              "mac": "Welcome to your Mac",
              "other": "Welcome"
            }
          }
        }
      }
    }
  },
  "version": "1.0"
}

References