Skip to content

Add "extractionState": "manual" to every key by default#6

Open
adrianrl wants to merge 1 commit into
masterfrom
fix/manual-extration-state
Open

Add "extractionState": "manual" to every key by default#6
adrianrl wants to merge 1 commit into
masterfrom
fix/manual-extration-state

Conversation

@adrianrl

Copy link
Copy Markdown
Contributor

Summary

When managing strings outside the project (our keys are generated and live in a .xcstrings that isn't extracted from source), Xcode raised a warning on every key:

References to this key could not be found in source code. To re-use existing translations, copy and paste them into a different string using Paste Translations.

The fix is to set "extractionState" : "manual" on each key. POEditor doesn't add this on export, so poe now does it.

Changes

  • download — marks every key as manual after normalizing placeholders. Done on the raw JSON tree (adds one field per entry, touches nothing else), so it's lossless: plurals and device variations survive untouched.
  • StringCatalog serialization — defaults extractionState to manual when a key doesn't already carry one. This means distribute, filter and remove also guarantee manual on write, so .xcstrings files already committed to a project get fixed the next time any command rewrites them — no full re-download required. An explicit extractionState coming from the input is still respected.

Both paths are covered because our filter flow merges the working tree onto a baseline (the catalog already in the repo, which predates this behaviour); relying on download alone would leave the non-matching baseline keys warning forever.

Tests

  • markingManualExtractionState marks every key and preserves plural variations; returns the input unchanged on invalid JSON.
  • Serialization fixtures updated to reflect the new default.

@adrianrl adrianrl self-assigned this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants