Skip to content

Use 'gettext' to replace text instead of JS in RTC post list#76466

Merged
pkevan merged 1 commit intopkevan/fix-grid-layout-resizefrom
fix/use-gettext-for-post-text-fix
Mar 13, 2026
Merged

Use 'gettext' to replace text instead of JS in RTC post list#76466
pkevan merged 1 commit intopkevan/fix-grid-layout-resizefrom
fix/use-gettext-for-post-text-fix

Conversation

@alecgeatches
Copy link
Copy Markdown
Contributor

What?

Proposed change to #76322 to avoid a flash of the old text:

flash-of-old-text.mov

Note that "admin is currently editing" briefly flashes on page load.

Why?

The solution currently in #76322 uses admin_footer to change the text after the page has loaded, but even on a quick localhost load there's still a delay between DOM rendering and the text being replaced.

How?

Instead of changing the screen client-side, use a classic gettext filter to change it on the server instead:

gettext-instead.mov

I'd argue this is roughly as hacky as using client-side JS to make a string change, but this avoids a flash of old content on load.

@alecgeatches alecgeatches self-assigned this Mar 12, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 12, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: alecgeatches <alecgeatches@git.wordpress.org>
Co-authored-by: pkevan <paulkevan@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@alecgeatches alecgeatches requested a review from pkevan March 12, 2026 19:20
@alecgeatches alecgeatches added [Type] Feature New feature to highlight in changelogs. [Feature] Real-time Collaboration Phase 3 of the Gutenberg roadmap around real-time collaboration labels Mar 12, 2026
Copy link
Copy Markdown
Contributor

@pkevan pkevan left a comment

Choose a reason for hiding this comment

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

Nice - thanks for the improvement

@pkevan pkevan merged commit 7915e48 into pkevan/fix-grid-layout-resize Mar 13, 2026
48 of 50 checks passed
@pkevan pkevan deleted the fix/use-gettext-for-post-text-fix branch March 13, 2026 09:38
maxschmeling pushed a commit that referenced this pull request Mar 17, 2026
…76322)

* RTC: Remove post list lock icon and replace user-specific lock text

When real-time collaboration is enabled, the post list should not show an
exclusive lock icon or user-specific lock text since multiple users can
collaboratively edit the same post.

Changes:
- Filter heartbeat response (priority 20) to replace user-specific lock data
  with generic "Currently being edited" message before reaching the client
- Inject CSS to hide lock icon and avatar on initial page render
- Inject JS to replace initial page render lock text with generic message
- Filter row actions to change "Edit" link text to "Join" for locked posts
- Re-enable checkboxes and inline edit actions for locked rows (RTC allows
  collaborative editing, so the post is not exclusively locked)

Fixes #75313

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* Add backport changelog

* Add backport changelog entry for RTC post list lock changes

Links to wordpress-develop#11234 which backports the post list lock
icon and text changes when real-time collaboration is enabled.

* Revert "Add backport changelog entry for RTC post list lock changes"

This reverts commit 83c65b1.

* Fix backport changelog formatting: remove extra space

The CI grep pattern expects `* URL` (one space) but the file had
`*  URL` (two spaces), causing the backport changelog check to fail.

* Use 'gettext' to replace text instead of JS action to avoid flash of previous string (#76466)

---------

Co-authored-by: pkevan <paulkevan@git.wordpress.org>
Co-authored-by: maxschmeling <maxschmeling@git.wordpress.org>
Co-authored-by: alecgeatches <alecgeatches@git.wordpress.org>
Co-authored-by: chriszarate <czarate@git.wordpress.org>
Co-authored-by: dabowman <davidabowman@git.wordpress.org>
gutenbergplugin pushed a commit that referenced this pull request Mar 17, 2026
…76322)

* RTC: Remove post list lock icon and replace user-specific lock text

When real-time collaboration is enabled, the post list should not show an
exclusive lock icon or user-specific lock text since multiple users can
collaboratively edit the same post.

Changes:
- Filter heartbeat response (priority 20) to replace user-specific lock data
  with generic "Currently being edited" message before reaching the client
- Inject CSS to hide lock icon and avatar on initial page render
- Inject JS to replace initial page render lock text with generic message
- Filter row actions to change "Edit" link text to "Join" for locked posts
- Re-enable checkboxes and inline edit actions for locked rows (RTC allows
  collaborative editing, so the post is not exclusively locked)

Fixes #75313

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* Add backport changelog

* Add backport changelog entry for RTC post list lock changes

Links to wordpress-develop#11234 which backports the post list lock
icon and text changes when real-time collaboration is enabled.

* Revert "Add backport changelog entry for RTC post list lock changes"

This reverts commit 83c65b1.

* Fix backport changelog formatting: remove extra space

The CI grep pattern expects `* URL` (one space) but the file had
`*  URL` (two spaces), causing the backport changelog check to fail.

* Use 'gettext' to replace text instead of JS action to avoid flash of previous string (#76466)

---------

Co-authored-by: pkevan <paulkevan@git.wordpress.org>
Co-authored-by: maxschmeling <maxschmeling@git.wordpress.org>
Co-authored-by: alecgeatches <alecgeatches@git.wordpress.org>
Co-authored-by: chriszarate <czarate@git.wordpress.org>
Co-authored-by: dabowman <davidabowman@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Real-time Collaboration Phase 3 of the Gutenberg roadmap around real-time collaboration [Type] Feature New feature to highlight in changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants