Skip to content

Fix minimal format decoding using key instead of value for defaultMessage#3

Open
yourlow wants to merge 6 commits into
deecewan:masterfrom
TandaHQ:fix/minimal-format-default-message
Open

Fix minimal format decoding using key instead of value for defaultMessage#3
yourlow wants to merge 6 commits into
deecewan:masterfrom
TandaHQ:fix/minimal-format-default-message

Conversation

@yourlow

@yourlow yourlow commented Jan 7, 2026

Copy link
Copy Markdown

Summary

  • Fixed a bug in the minimal format extraction where defaultMessage was incorrectly set to the key instead of the value
  • Changed from Object.keys to Object.entries to properly access both the key (for id) and value (for defaultMessage)

Test plan

  • Verify minimal format translations are extracted with correct defaultMessage values
  • Run existing tests to ensure no regressions

🤖 Generated with Claude Code

builtbyproxy and others added 6 commits January 12, 2021 09:36
Lingui v3+ renamed the 'defaults' field to 'message' in catalog JSON output.
This caused the sync to silently fall back to using the key name as the
source text, which then overwrote correct translations on translation.io.

The issue manifested as a "flip-flop" where:
1. Sync reads `parsed[key].defaults` → undefined (field doesn't exist)
2. Falls back to `key` (e.g., "camera.errorUnknown")
3. Sends key name as source text to translation.io
4. Translation.io records this as a source edit
5. Next sync sees the edit, warns, but pushes key names again
6. Translations alternate between real text and key names

Fix: Check for `message` field first (lingui v3+), then `defaults` (lingui v2),
then fall back to key name.

This maintains backward compatibility with lingui v2 while adding support
for lingui v3, v4, and v5.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add lingui v5 compatibility by reading 'message' field
…sage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

3 participants