Skip to content

feat: add --add-fuzzy flag and # ai-translated marker#3

Merged
AlexMost merged 1 commit intomainfrom
feat/add-fuzzy-and-ai-translated-comment
May 6, 2026
Merged

feat: add --add-fuzzy flag and # ai-translated marker#3
AlexMost merged 1 commit intomainfrom
feat/add-fuzzy-and-ai-translated-comment

Conversation

@AlexMost
Copy link
Copy Markdown
Owner

@AlexMost AlexMost commented May 6, 2026

Summary

  • Every entry that msgai translates now gets a # ai-translated translator comment so AI translations are visible in the .po file. Existing translator comments are preserved (marker is appended on a new line). Idempotent — re-running on the same entry does not duplicate the marker.
  • New --add-fuzzy CLI flag (also add-fuzzy / addFuzzy in msgai.config.yml) marks every newly translated entry with the gettext fuzzy flag — useful when you want a human reviewer in the loop before AI translations ship. Independent of the existing input-side --include-fuzzy.
  • Two new pure functions in src/po.ts: markEntriesAsAiTranslated and addFuzzyToEntries (mirror of clearFuzzyFromEntries). Both preserve other comment fields and flags (e.g. c-format).

Test plan

  • npm test — 99 passed (was 97); 6 new unit tests in test/po.test.ts (no-comments / preserve-existing / idempotent / msgctxt / preserve c-format / no-duplicate fuzzy), 2 CLI tests in test/cli/add-fuzzy.test.ts, 1 config test for addFuzzy
  • npm run lint — clean
  • npm run lint:format — clean
  • Integration snapshot updated for the new translator comment
  • Manual smoke on a real .po file

🤖 Generated with Claude Code

Every entry msgai translates now gets a "# ai-translated" translator
comment so AI translations are visible in the .po file. The new
--add-fuzzy flag additionally marks fresh translations with the gettext
fuzzy flag, forcing human review before they ship.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AlexMost AlexMost merged commit 28fb60a into main May 6, 2026
1 check passed
@AlexMost AlexMost deleted the feat/add-fuzzy-and-ai-translated-comment branch May 6, 2026 08:06
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.

1 participant