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

Get wordcount type from translation #12586

Merged
merged 3 commits into from
Dec 9, 2018
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
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ This list is manually curated to include valuable contributions by volunteers th
| @jakeparis | @jakeparis |
| @designsimply | @designsimply |
| @aldavigdis | @aldavigdis |

| @miya0001 | @miyauchi |
10 changes: 9 additions & 1 deletion packages/editor/src/components/word-count/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
* WordPress dependencies
*/
import { withSelect } from '@wordpress/data';
import { _x } from '@wordpress/i18n';
import { count as wordCount } from '@wordpress/wordcount';

function WordCount( { content } ) {
/*
* translators: If your word count is based on single characters (e.g. East Asian characters),
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
* Do not translate into your own language.
*/
const wordCountType = _x( 'words', 'Word count type. Do not translate!' );

return (
<span className="word-count">{ wordCount( content, 'words' ) }</span>
<span className="word-count">{ wordCount( content, wordCountType ) }</span>
);
}

Expand Down