Skip to content

Conversation

@artulloss
Copy link

@artulloss artulloss commented Sep 26, 2025

Summary

This change updates the way integration names are translated to comply with WordPress 6.7’s stricter translation-loading rules.

Previously the class constructors used __() directly on the name property. That triggered _load_textdomain_just_in_time notices because it forced translations before init. WordPress 6.7+ logs these as warnings.

What Changed

  • Added a get_name() method that translates the stored source string lazily.
  • Constructors now assign the plain string (e.g. 'Twitter') instead of a translated one.
  • All UI should call $integration->get_name() so translations are loaded at the right time.

Why

These notices have been spamming my debug logs, and my marketer unfortunately uses this plugin. This solution keeps the strings translatable without triggering warnings in WordPress 6.7+.

Impact

  • Removes log spam.
  • Preserves localization support.
  • No functional change except that code must use get_name() rather than reading the protected $name property directly.

Summary by CodeRabbit

  • Bug Fixes

    • Integration names now consistently display in your selected language (Facebook, Google Ads, Twitter, Custom), resolving inconsistent or missing translations in some views.
  • Refactor

    • Centralized lazy translation to occur when names are retrieved, reducing early loading overhead and improving startup performance.
    • Simplified integration constructors by storing plain names while ensuring translation at display time.
  • Chores

    • Minor internal cleanups with no impact on settings or workflows.

@coderabbitai
Copy link

coderabbitai bot commented Sep 26, 2025

Walkthrough

The abstract integration’s get_name now returns a lazily translated string. Individual integration constructors (Custom, Facebook, Google Ads, Twitter) set $this->name to plain literals instead of localized strings. No method signatures changed; overall control flow remains the same.

Changes

Cohort / File(s) Summary of Changes
Abstract integration getter
includes/class-abstract-integration.php
get_name() updated to return a lazily translated string via __( $this->name, 'woocommerce-conversion-tracking' ); added comment about avoiding early textdomain load.
Integration naming standardization
includes/integrations/class-integration-custom.php, includes/integrations/class-integration-facebook.php, includes/integrations/class-integration-google.php, includes/integrations/class-integration-twitter.php
Constructors set $this->name to plain literals ('Custom', 'Facebook', 'Google Ads', 'Twitter') instead of calling __(); no other logic changes.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws—names tidy and clean,
Strings set plain, yet translated on-screen.
Hop-hop through code, no routes rearranged,
Just one small getter, subtly changed.
Carrots compiled, domains align—
Ship it swift, the naming’s fine. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly states the main change—making integration name translation lazy—and references the relevant issue, providing specific context without unnecessary detail or ambiguity. It concisely summarizes the core modification that will be apparent to reviewers and maintainers.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

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