# Fix Xcode XLIFF export failing on missing translations

## TL;DR

Xcode refuses to export when the development language has untranslated strings, so fill the gaps or mark what is intentionally untranslated. The exporter needs every string to have at least the dev-language value. Run the export from the command line to see the exact missing keys, fix them, and export again.

## The error

```text
xcodebuild -exportLocalizations failed: missing translations for development language
export produces no XLIFF or a partial one
```

## Fix it

### Step 1: Run the export verbosely to list the gaps

```bash
xcodebuild -exportLocalizations -localizationPath /tmp/xliff -project App.xcodeproj | grep -i "missing\|untranslated" | head -10
```

Expected: You see which strings lack translations.

### Step 2: Check for strings missing even in the development language

```bash
node -e "console.log('every NSLocalizedString key needs a value in Localizable.strings for the dev language')"
```

Expected: You know whether the gap is in dev or a secondary language.

### Step 3: Add the missing values or mark them non-localized

```bash
node -e "console.log('fill the strings file, or remove the NSLocalizedString wrapper for strings that should never translate')"
```

Expected: No string is left without a value.

### Step 4: Re-run the export

```bash
xcodebuild -exportLocalizations -localizationPath /tmp/xliff -project App.xcodeproj | tail -3
```

Expected: The export completes and XLIFF files appear for each language.

## When to use this

- xcodebuild -exportLocalizations fails or produces partial XLIFF
- The error mentions missing translations

## When NOT to use this

- The export works but a language is absent, check the project localizations list
- Import fails instead, that is an XLIFF import problem

## Tool and version compatibility

- Xcode 14/15/16, xcodebuild -exportLocalizations
- String Catalogs (.xcstrings) or legacy strings files

## Variant phrasings

### export fails on string catalogs

Same idea. Open the .xcstrings file and fill the empty states, or set them to not translate.

### only one language fails

That language is missing values the dev language has. Copy the dev values as a starting point, then translate.

## Why it happens

The exporter builds the XLIFF from the development language outward. A string with no dev-language value has nothing to export as the source, so Xcode aborts rather than ship a broken file.

## Edge cases

- New strings added in code need a strings file entry before export sees them
- String catalogs sync automatically, legacy strings files do not
- Export to a clean folder each time, stale files mask new failures

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_5pFibVXNdN-0FocKjzmQJw
