# Translate app string files without breaking keys or placeholders

Translates localization files (.strings, JSON, XML, .po) while preserving keys, placeholders, comments, and syntax exactly.

- Topic: Software Development
- Framework: Few-Shot
- Level: Standard
- Tags: Language, Translate, Fill-in Template
- Source: https://www.thinkwithprompt.com/prompts/translate-app-string-files-without-breaking-keys-or-placeholders

## Prompt

```text
Translate my app's localization file into another language without breaking the code.

**File format:** [e.g. iOS .strings, Android strings.xml, JSON i18n, .po, .arb]
**Target language and region:** [e.g. "German (Germany)", "Spanish (Mexico)", "Brazilian Portuguese"]
**App type and audience:** [e.g. "budgeting app for young adults"]
**Tone:** [formal / informal - e.g. "du" vs. "Sie", "tu" vs. "usted"]
**Glossary or terms not to translate:** [brand names, feature names]
**UI length limits:** [e.g. "button labels must stay short"]
**File content:** [PASTE]

Rules:
- Keys, identifiers, and attribute names stay exactly as they are. Translate only the user-facing values.
- Placeholders must stay character-for-character identical: %@, %d, %1$s, {name}, {{count}}, \n, HTML tags, and escape sequences. You may move a placeholder within the sentence when the grammar requires it, and use positional placeholders if the format supports them.
- Keep comments, ordering, quotes, semicolons, and file syntax exactly as in the original.
- Handle plurals the way the target language and file format require; flag strings that need plural rules but don't have them.
- Keep button and label text concise; flag any translation likely to be much longer than the source.

Return:
1. The complete translated file in one code block, ready to save.
2. A short notes table: Key | Issue | Suggestion, covering ambiguous strings where you lacked context, likely truncation, and plural or gender problems.

Recommend a native-speaker review before release.
```

## What to fill in

- e.g. iOS .strings, Android strings.xml, JSON i18n, .po, .arb
- e.g. "budgeting app for young adults"
- formal / informal - e.g. "du" vs. "Sie", "tu" vs. "usted"
- brand names, feature names
- e.g. "button labels must stay short"
- PASTE
- count

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
