Skip to content

Conversation

@CHANDRAHARSHIT
Copy link

Introduces a new 'review' block in i18n.json and CLI commands for capturing context manifests linking localized JSX scopes to DOM markers. The compiler now supports injecting a stable data attribute (default 'data-lingo-id') for each scope, with configurable attribute name and manifest output. Updates include schema, config, tests, and core compiler logic to support context marker injection and manifest generation for improved translator review workflows.

Introduces a new 'review' block in i18n.json and CLI commands for capturing context manifests linking localized JSX scopes to DOM markers. The compiler now supports injecting a stable data attribute (default 'data-lingo-id') for each scope, with configurable attribute name and manifest output. Updates include schema, config, tests, and core compiler logic to support context marker injection and manifest generation for improved translator review workflows.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces context snapshot tooling to help translators review localized strings with visual context. It adds a new review configuration block in i18n.json (v1.11), enables the compiler to inject stable DOM data attributes (data-lingo-id) on localized JSX scopes, and provides a CLI command to generate context manifests that link compiler scopes to DOM markers.

Key changes:

  • New v1.11 config schema with review block for capturing routes and marker settings
  • Compiler injects configurable data attributes on JSX elements when exposeContextAttribute is enabled
  • New lingo.dev review capture CLI command generates manifest files from compiled metadata

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/spec/src/config.ts Adds v1.11 config with review schema including routes, compiler paths, and marker attribute settings
packages/spec/src/config.spec.ts Updates tests to verify review config is present in upgraded configs
packages/compiler/src/utils/context-marker.ts New utility for validating and resolving context attribute names with data- prefix requirement
packages/compiler/src/lib/lcp/schema.ts Extends LCP scope schema to include optional marker field with attribute and value
packages/compiler/src/lib/lcp/index.ts Adds setScopeMarker method to store marker metadata for each scope
packages/compiler/src/jsx-scopes-export.ts Computes and stores marker values for each JSX scope during export phase
packages/compiler/src/jsx-scopes-export.spec.ts Tests that marker metadata is correctly saved to LCP
packages/compiler/src/jsx-scope-inject.ts Injects context attribute into transformed JSX when exposeContextAttribute is enabled
packages/compiler/src/jsx-scope-inject.spec.ts Tests context marker injection and existing value preservation
packages/compiler/src/_base.ts Adds exposeContextAttribute and contextAttributeName compiler parameters
packages/cli/src/cli/index.ts Registers new review command in CLI
packages/cli/src/cli/cmd/review/index.ts Defines review command with capture subcommand
packages/cli/src/cli/cmd/review/capture.ts Implements manifest generation from meta.json and dictionary.js
packages/cli/README.md Documents new review capture command and workflow
i18n.json Upgrades config to v1.11 with review block

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/**
* The name of the DOM data attribute that will be injected when
* `exposeContextAttribute` is enabled. Use a `data-*` attribute to avoid
* interfering with user props. Values that do not start with `data-` fall
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc comment line has inconsistent indentation. It should start with a space after the asterisk like line 76, but it's missing that leading space.

Suggested change
* interfering with user props. Values that do not start with `data-` fall
* interfering with user props. Values that do not start with `data-` fall

Copilot uses AI. Check for mistakes.
---

### 🔄 Lingo.dev CI/CD
### �️ Context Snapshot Manifest
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The emoji appears to be corrupted or not rendering properly. Consider using a properly encoded emoji or a text-based icon.

Suggested change
### �️ Context Snapshot Manifest
### 📸 Context Snapshot Manifest

Copilot uses AI. Check for mistakes.

---

### �🔄 Lingo.dev CI/CD
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The emoji appears to be corrupted or not rendering properly. Consider using a properly encoded emoji or a text-based icon.

Suggested change
### 🔄 Lingo.dev CI/CD
### 🔄 Lingo.dev CI/CD

Copilot uses AI. Check for mistakes.
Replaces placeholder emojis with appropriate ones in the CLI README for improved clarity. Refactors the extraction of 'data-lingo-override-' attributes in jsx-scopes-export.ts to use native Object methods instead of lodash chaining, simplifying the code and removing lodash dependency for this logic.
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