Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 10 additions & 4 deletions packages/editor/src/store/private-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { addQueryArgs } from '@wordpress/url';
import apiFetch from '@wordpress/api-fetch';
import { parse, __unstableSerializeAndClean } from '@wordpress/blocks';
import { decodeEntities } from '@wordpress/html-entities';
import { dateI18n, getSettings as getDateSettings } from '@wordpress/date';

/**
* Internal dependencies
Expand Down Expand Up @@ -638,12 +639,17 @@ export const restoreRevision =
await dispatch.savePost();

// Show success notice.
registry
.dispatch( noticesStore )
.createSuccessNotice( __( 'Revision restored.' ), {
registry.dispatch( noticesStore ).createSuccessNotice(
sprintf(
/* translators: %s: Date and time of the revision. */
__( 'Restored to revision from %s.' ),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Would "dated" be better than "from"? I'm undecided.
  • The main difficulty here is that the date format isn't known, so we can't let translators know what to expect, and that information could influence the choice of translation. But there's not much we can do.
  • The string combined with the translators note don't give translators a lot of context: what is "restored"? It's a past participle and not a simple past form. It refers to a post/page. It is a success notice. All that could be useful to understand. So, e.g., translators: Success notice after a user has restored a post/page to a specific revision. %s: date and time of the revision.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The string is taken from the core and has been there for years. See: https://github.com/WordPress/wordpress-develop/blob/81885a9ff64f3902d4f3162c011745a35b46e6ba/src/wp-admin/edit-form-advanced.php#L180.

When I tried to translate this in Georgian, it worked. But it might be a different story for other languages.

cc @ocean90

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@mcsf, should I merge since the text isn't much different from what's already used in core?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Mamaduka: go for it :)

dateI18n( getDateSettings().formats.datetime, revision.date )
),
{
type: 'snackbar',
id: 'editor-revision-restored',
} );
}
);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/various/revisions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ test.describe( 'Revisions', () => {
await expect(
page
.getByRole( 'button', { name: 'Dismiss this notice' } )
.filter( { hasText: 'Revision restored' } )
.filter( { hasText: 'Restored to revision' } )
).toBeVisible();

// Verify the original content is restored.
Expand Down
Loading