Skip to content

Test translation context Danger plugin#15539

Open
iangmaia wants to merge 15 commits intotrunkfrom
test/translation-context-plugin
Open

Test translation context Danger plugin#15539
iangmaia wants to merge 15 commits intotrunkfrom
test/translation-context-plugin

Conversation

@iangmaia
Copy link
Contributor

@iangmaia iangmaia commented Mar 13, 2026

Summary

This is a test PR for the translation_context_checker Dangermattic plugin implemented in Automattic/dangermattic#112 .

What's being tested

  • 6 new test strings added to strings.xml with intentionally short/ambiguous values (Save, Processing, Settings, Add a note, Close, Draft) that should trigger context suggestions from the plugin.
  • A Kotlin source file (TranslationContextTestFragment.kt) that references all the test strings, giving the plugin source-level context to analyze.
  • Dangerfile updated to import the translation_context_checker plugin directly from the dangermattic feature branch and run check_context_suggestions against the Android project structure.
  • txcontext gem added to Gemfile (sourced from https://github.com/iangmaia/txcontext.git).

Expected behavior

When Danger runs on this PR, the translation_context_checker plugin should:

  1. Detect the new/modified strings in strings.xml
  2. Analyze surrounding code context from the Kotlin source file
  3. Produce warnings suggesting improved translation context descriptions for the ambiguous strings

Note

This PR is for testing purposes only and should not be merged.

🤖 Generated with Claude Code

@iangmaia iangmaia added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Mar 13, 2026
@dangermattic
Copy link
Collaborator

dangermattic commented Mar 13, 2026

2 Errors
🚫 This PR is tagged with status: do not merge label(s).
🚫 PR is not assigned to a milestone.

Generated by 🚫 Danger

@iangmaia iangmaia added category: i18n Related to localization/internationalization. category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. and removed category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. labels Mar 16, 2026
@iangmaia iangmaia force-pushed the test/translation-context-plugin branch from 1844eef to 91846d0 Compare March 17, 2026 16:45
@woocommerce woocommerce deleted a comment from dangermattic Mar 17, 2026
@woocommerce woocommerce deleted a comment from dangermattic Mar 17, 2026
@woocommerce woocommerce deleted a comment from dangermattic Mar 17, 2026
@woocommerce woocommerce deleted a comment from dangermattic Mar 17, 2026
@woocommerce woocommerce deleted a comment from dangermattic Mar 17, 2026
@woocommerce woocommerce deleted a comment from dangermattic Mar 17, 2026
@iangmaia iangmaia added the category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. label Mar 17, 2026
@iangmaia iangmaia force-pushed the test/translation-context-plugin branch from 91846d0 to f544109 Compare March 17, 2026 17:46
@woocommerce woocommerce deleted a comment from dangermattic Mar 18, 2026
@woocommerce woocommerce deleted a comment from dangermattic Mar 18, 2026
iangmaia and others added 12 commits March 18, 2026 17:35
Add test strings with minimal/no context and a Kotlin file that uses them.
The Dangerfile loads the translation_context_checker plugin from the
dangermattic branch to suggest improved context for translations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CI uses a minimal Gemfile that doesn't include repo gems.
Clone and install txcontext at runtime instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
After gem install, clear Gem paths and inject all gem load paths
into $LOAD_PATH so require 'txcontext' works under bundle exec.
Install txcontext in unbundled env, then expand GEM_PATH to include
system gem dir and scan filesystem for lib paths. Bundler restricts
GEM_PATH to the bundle directory, so Gem::Specification.each can't
see system-installed gems.
Use ENV.fetch('GEM_PATH', nil) instead of ENV['GEM_PATH'].
@iangmaia iangmaia force-pushed the test/translation-context-plugin branch from a7ae528 to d56b0b2 Compare March 18, 2026 16:35
@iangmaia iangmaia removed the category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. label Mar 18, 2026
Comment on lines +4513 to +4514
<!-- Screen title -->
<string name="test_store_settings_title">Settings</string>
Copy link
Collaborator

@dangermattic dangermattic Mar 18, 2026

Choose a reason for hiding this comment

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

Suggested change
<!-- Screen title -->
<string name="test_store_settings_title">Settings</string>
<!-- This is the title displayed on a Store Settings screen, shown as a text label in the screen's title area. -->
<string name="test_store_settings_title">Settings</string>

Comment on lines +4510 to +4511
<!-- Translation Context Plugin Test Strings -->
<string name="test_order_action_save">Save</string>
Copy link
Collaborator

@dangermattic dangermattic Mar 18, 2026

Choose a reason for hiding this comment

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

Suggested change
<!-- Translation Context Plugin Test Strings -->
<string name="test_order_action_save">Save</string>
<!-- Label for a save button used in an order-related screen. Tapping this button saves the current action or data in the order flow. -->
<string name="test_order_action_save">Save</string>

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting that it suggests a max length here (presumably in order for the text to fit the design)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, it can return the length if it figures it out somehow based on the context. Though I tweaked the system prompt related to that a little bit, so it adds it only when it has a higher certainty.

@woocommerce woocommerce deleted a comment from dangermattic Mar 18, 2026
@woocommerce woocommerce deleted a comment from dangermattic Mar 18, 2026
@iangmaia iangmaia added category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. and removed category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. labels Mar 19, 2026

<!-- Translation Context Plugin Test Strings -->
<string name="test_order_action_save">Save</string>
<string name="test_order_status_processing">Processing</string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<string name="test_order_status_processing">Processing</string>
<!-- Displays the 'Processing' status of an order in a status label field. This text indicates that an order is currently being processed. -->
<string name="test_order_status_processing">Processing</string>

Generated by 🚫 Danger

<string name="test_order_status_processing">Processing</string>
<!-- Screen title -->
<string name="test_store_settings_title">Settings</string>
<string name="test_product_note_placeholder">Add a note</string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<string name="test_product_note_placeholder">Add a note</string>
<!-- Placeholder text displayed inside a note input field, prompting the user to enter a note for a product. The text disappears when the user begins typing. -->
<string name="test_product_note_placeholder">Add a note</string>

Generated by 🚫 Danger

<!-- Screen title -->
<string name="test_store_settings_title">Settings</string>
<string name="test_product_note_placeholder">Add a note</string>
<string name="test_shipping_label_close">Close</string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<string name="test_shipping_label_close">Close</string>
<!-- Accessibility label (contentDescription) for a close button in a shipping label screen. This text is read by screen readers to describe the button's action to visually impaired users. -->
<string name="test_shipping_label_close">Close</string>

Generated by 🚫 Danger

<string name="test_store_settings_title">Settings</string>
<string name="test_product_note_placeholder">Add a note</string>
<string name="test_shipping_label_close">Close</string>
<string name="test_order_draft_status">Draft</string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<string name="test_order_draft_status">Draft</string>
<!-- A badge label displayed on an order to indicate its 'Draft' status. This text appears as a status badge on an order screen. -->
<string name="test_order_draft_status">Draft</string>

Generated by 🚫 Danger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: i18n Related to localization/internationalization. status: do not merge Dependent on another PR, ready for review but not ready for merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants