Conversation
Import msgctxt as part of the key name using the GNU gettext standard EOT separator (\u0004), store the raw value in custom key metadata for reliable round-trip export. Display context visually in the translations UI with a pipe separator. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR implements support for storing and handling the Changes
Sequence Diagram(s)sequenceDiagram
participant PO as PO File
participant Parser as PoParser
participant Model as PoParsedTranslation
participant Processor as PoFileProcessor
participant Storage as Translation<br/>Storage
PO->>Parser: Read msgctxt field
Parser->>Parser: Set expectMsgCtxt flag
Parser->>Model: Append to msgctxt StringBuilder
PO->>Parser: Read msgid field
Parser->>Model: Store msgid
PO->>Parser: Read msgstr field
Parser->>Model: Store msgstr
Processor->>Model: Retrieve msgctxt & msgid
Processor->>Processor: buildKeyName()<br/>Result: msgctxt\u0004msgid
Processor->>Storage: Store key with<br/>msgctxt metadata
Storage->>Storage: msgctxt field =<br/>PO_FILE_MSG_CTXT_CUSTOM_KEY
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
Q: Why do you store it also in the meta field? |
Summary
msgctxtfrom PO files instead of ignoring it with a warningmsgctxt+\u0004(EOT) separator +msgidas the key name, following the GNU gettext standardmsgctxtin key custom metadata (_poFileMsgCtxt)msgctxtline beforemsgidwhen the custom value is present|separatorCloses #3053
Summary by CodeRabbit
New Features