Skip to content

I18N: Add translator context to all 'Preview' strings#11700

Open
wppoland wants to merge 16 commits intoWordPress:trunkfrom
wppoland:trac/64986
Open

I18N: Add translator context to all 'Preview' strings#11700
wppoland wants to merge 16 commits intoWordPress:trunkfrom
wppoland:trac/64986

Conversation

@wppoland
Copy link
Copy Markdown

@wppoland wppoland commented May 3, 2026

Trac ticket: https://core.trac.wordpress.org/ticket/64986

Preview is a single English token that lands in translations as a verb (button labels), a noun (preview panes, table headers), or an iframe title. Without translator context, all 14 in-tree occurrences collapsed onto one entry in default.po, forcing translators to choose a single rendering that fit poorly somewhere.

This PR gives each occurrence a context that names both the part of speech and the surface it appears on:

  • Post row action and post-lock dialog button (verb, ...)
  • Submit meta box preview button (verb, action button to preview the post)
  • Theme install list-table action and theme-install template buttons (verb, ...)
  • Theme preview iframe title (noun, ...)
  • Customizer toggle and takeover dialog (verb/noun, ...)
  • Header image and background image preview rows (noun, ...)
  • Classic-editor (TinyMCE) toolbar button (verb, ...)

Extends the scope of GH-11407 and GH-11408, which only covered four of these spots and used less specific context strings.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props motylanogha, wildworks, jorbin, sergeybiryukov.

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

`Preview` is a single English token that lands in translations as a verb (button labels), a noun (preview panes, table headers), or an iframe title. Without a translator context, all 14 in-tree occurrences collapsed onto one entry in `default.po`, forcing translators to choose a single rendering that fit poorly somewhere.

This commit gives each occurrence a context that names both the part of speech and the surface it appears on, covering:

* Post row action and post-lock dialog button (`verb, ...`).
* Submit meta box preview button (`verb, action button to preview the post`).
* Theme install list-table action and theme-install template buttons (`verb, ...`).
* Theme preview iframe title (`noun, ...`).
* Customizer toggle and takeover dialog (`verb`/`noun`, ...).
* Header image and background image preview rows (`noun, ...`).
* Classic-editor (TinyMCE) toolbar button (`verb, ...`).

Extends the scope of WordPressGH-11407 and WordPressGH-11408, which only covered four of these spots.

See #64986.
@SergeyBiryukov
Copy link
Copy Markdown
Member

Thanks for the PR! There might be some confusion here, we don't really need a separate context for each of these strings, that would be redundant and increase the workload for translators.

As noted on the ticket already, just _x( 'Preview', 'noun' ) or _x( 'Preview', 'verb' ) would be enough here.

Copy link
Copy Markdown
Member

@aaronjorbin aaronjorbin left a comment

Choose a reason for hiding this comment

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

Simplifying the context

Comment thread src/wp-admin/includes/class-custom-background.php Outdated
Comment thread src/wp-admin/includes/class-custom-image-header.php Outdated
Comment thread src/wp-admin/includes/class-wp-posts-list-table.php Outdated
Comment thread src/wp-admin/includes/class-wp-theme-install-list-table.php Outdated
Comment thread src/wp-admin/includes/meta-boxes.php Outdated
Comment thread src/wp-admin/theme-install.php Outdated
Comment thread src/wp-admin/theme-install.php Outdated
Comment thread src/wp-admin/theme-install.php Outdated
Comment thread src/wp-includes/class-wp-customize-manager.php Outdated
Comment thread src/wp-includes/class-wp-editor.php Outdated
t-hamano and others added 14 commits May 8, 2026 23:36
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Co-authored-by: Aaron Jorbin <aaronjorbin@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

I have applied all of @aaronjorbin's suggestions. The changes look good.

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.

4 participants