Fix/untranslatable login register string#1901
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughModifies the registration link markup in Simple_Login to use a translatable sprintf template, and adds an existence check for $wpuf_field before invoking sanitize_field_data in FieldableTrait's prepare_meta_fields method. ChangesLogin link and field sanitization fixes
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Fix – "Don't have an account?" not translatable via Loco Translate / .po tools
Partially addresses #1797
Problem
Simple_Login::get_action_links()builds two similar auth links. The "login" linkcorrectly wraps its entire phrase in
__():The "register" link does not follow the same pattern — "Don't have an account? " is
a raw PHP string embedded directly in the
sprintf()template, never passed through__()/_e():Translation tools (Loco Translate, Poedit,
wp i18n make-pot) build their stringlists by scanning source for gettext function calls. A string outside one of those
calls is invisible to them regardless of
.po/.mostate — which matches thereport and what I found checking the shipped
languages/*.pofiles (the phraseisn't in any of them).
Fix
Wrap the full phrase in
__(), following the same pattern already used for thelogin link two branches above it, and add
esc_url()/esc_html()on the dynamicparts for consistency with that same sibling code:
Only whitespace placement changed cosmetically (the space between the question and
the closing
</span>now sits outside the span instead of inside it) — no visibleor functional change to markup structure or styling.
Scope note for reviewers
The report lists two untranslatable strings: "Enter" and "Don't have an account?".
This PR only fixes the latter. I searched the entire free plugin (PHP templates,
widgets, and all built JS bundles) for a user-facing "Enter" string anywhere in the
login flow and couldn't find one — the only occurrence of "Enter" in the codebase is
a keyboard-event key comparison in the User Directory admin screen, unrelated to
login. My best guess is that string belongs to WP User Frontend Pro's code, which
isn't in this repository, so I can't verify or fix it here. Flagging this so it
doesn't get lost — happy to take a look if someone can confirm where "Enter" is
rendered.
Testing
__(calls (whatLoco Translate's parser and
wp i18n make-potrely on).Already have an account? ...continues to renderunchanged — no behavior change to sibling code.
HTML structure.
Summary by CodeRabbit