Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I18n: Make preview popup loader strings translateable #3301

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions editor/header/preview-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { connect } from 'react-redux';
*/
import { Component } from '@wordpress/element';
import { IconButton } from '@wordpress/components';
import { _x } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -76,8 +76,8 @@ export class PreviewButton extends Component {

const markup = `
<div>
<p>Please wait&hellip;</p>
<p>Generating preview.</p>
<p>${ __( 'Please wait&hellip;' ) }</p>
Copy link
Member

Choose a reason for hiding this comment

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

Unlike with React, we don't get string escaping for free here, so there is a potential risk with inserting this into raw markup.

https://codex.wordpress.org/I18n_for_WordPress_Developers#HTML

We may need to consider patterns for sanitization.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

We could also generate this with wp.element.renderToStaticMarkup as an element.

Or just Lodash _.escape

<p>${ __( 'Generating preview.' ) }</p>
</div>
<style>
div {
Expand Down