Skip to content

Commit

Permalink
Blaze: Fix translations of "Blaze this %s" labels (#36466)
Browse files Browse the repository at this point in the history
  • Loading branch information
jornp authored Apr 29, 2024
1 parent 58844e1 commit d6bf167
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
4 changes: 4 additions & 0 deletions projects/packages/blaze/changelog/fix-blaze-this-translations
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Blaze: Fix translations of "Blaze this %s" labels
2 changes: 1 addition & 1 deletion projects/packages/blaze/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-blaze",
"version": "0.21.1",
"version": "0.21.2-alpha",
"description": "Attract high-quality traffic to your site using Blaze. Using this service, you can advertise a post or page on some of the millions of pages across WordPress.com and Tumblr from just $5 per day.",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/blaze/#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/blaze/src/class-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Dashboard {
*
* @var string
*/
const PACKAGE_VERSION = '0.21.1';
const PACKAGE_VERSION = '0.21.2-alpha';

/**
* List of dependencies needed to render the dashboard in wp-admin.
Expand Down
25 changes: 13 additions & 12 deletions projects/packages/blaze/src/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useSelect } from '@wordpress/data';
import { PluginPostPublishPanel } from '@wordpress/edit-post';
import { store as editorStore } from '@wordpress/editor';
import { useCallback, useEffect } from '@wordpress/element';
import { __, _x, sprintf } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import { external, Icon } from '@wordpress/icons';
import { getPlugin, registerPlugin } from '@wordpress/plugins';
import './editor.scss';
Expand All @@ -21,17 +21,15 @@ const BlazePostPublishPanel = () => {
[ tracks ]
);

const { isPostPublished, isPublishingPost, postId, postType, postTypeLabel, postVisibility } =
useSelect( selector => ( {
const { isPostPublished, isPublishingPost, postId, postType, postVisibility } = useSelect(
selector => ( {
isPostPublished: selector( editorStore ).isCurrentPostPublished(),
isPublishingPost: selector( editorStore ).isPublishingPost(),
postId: selector( editorStore ).getCurrentPostId(),
postType: selector( editorStore ).getCurrentPostType(),
postTypeLabel:
// Translators: default post type label.
selector( editorStore ).getPostTypeLabel() || _x( 'Post', 'noun', 'jetpack-blaze' ),
postVisibility: selector( editorStore ).getEditedPostVisibility(),
} ) );
} )
);
const wasPublishing = usePrevious( isPublishingPost );

const panelBodyProps = {
Expand Down Expand Up @@ -80,6 +78,13 @@ const BlazePostPublishPanel = () => {
return null;
}

const blazeThisLabel =
{
page: __( 'Blaze this page', 'jetpack-blaze' ),
post: __( 'Blaze this post', 'jetpack-blaze' ),
product: __( 'Blaze this product', 'jetpack-blaze' ),
}[ postType ] ?? __( 'Blaze this post', 'jetpack-blaze' );

return (
<PluginPostPublishPanel { ...panelBodyProps }>
<PanelRow>
Expand All @@ -98,11 +103,7 @@ const BlazePostPublishPanel = () => {
onKeyDown={ trackClick }
>
<Button variant="secondary" href={ blazeUrl } target="_top">
{ sprintf(
/* translators: %s is the post type (e.g. Post, Page, Product). */
__( 'Blaze this %s', 'jetpack-blaze' ),
postTypeLabel.toLowerCase()
) }
{ blazeThisLabel }
{ blazeUrlTemplate.external && (
<Icon icon={ external } className="blaze-panel-outbound-link__external_icon" />
) }
Expand Down

0 comments on commit d6bf167

Please sign in to comment.