Make numberOfItems translation singular/plural aware

This commit is contained in:
Tautvidas Sipavičius
2017-02-27 16:08:50 +02:00
parent c27446666e
commit 2b45d64695
5 changed files with 16 additions and 7 deletions

View File

@@ -164,11 +164,16 @@ define([
{ 'one-page': (this.props.count <= this.props.limit) } { 'one-page': (this.props.count <= this.props.limit) }
); );
var numberOfItemsLabel;
if (this.props.count == 1) {
numberOfItemsLabel = MailPoet.I18n.t('numberOfItemsSingular');
} else {
numberOfItemsLabel = MailPoet.I18n.t('numberOfItemsMultiple')
.replace('%$1d', this.props.count.toLocaleString());
}
return ( return (
<div className={ classes }> <div className={ classes }>
<span className="displaying-num">{ <span className="displaying-num">{ numberOfItemsLabel }</span>
MailPoet.I18n.t('numberOfItems').replace('%$1d', this.props.count.toLocaleString())
}</span>
{ pagination } { pagination }
</div> </div>
); );

View File

@@ -37,7 +37,8 @@
'lastPage': __('Last page'), 'lastPage': __('Last page'),
'currentPage': __('Current Page'), 'currentPage': __('Current Page'),
'pageOutOf': __('of'), 'pageOutOf': __('of'),
'numberOfItems': __('%$1d item(s)'), 'numberOfItemsSingular': __('1 item'),
'numberOfItemsMultiple': __('%$1d items'),
'formName': __('Name'), 'formName': __('Name'),
'segments': __('Lists'), 'segments': __('Lists'),

View File

@@ -50,7 +50,8 @@
'lastPage': __('Last page'), 'lastPage': __('Last page'),
'currentPage': __('Current page'), 'currentPage': __('Current page'),
'pageOutOf': __('of'), 'pageOutOf': __('of'),
'numberOfItems': __('%$1d item(s)'), 'numberOfItemsSingular': __('1 item'),
'numberOfItemsMultiple': __('%$1d items'),
'selectType': __('Select type'), 'selectType': __('Select type'),
'template': __('Template'), 'template': __('Template'),

View File

@@ -61,7 +61,8 @@
'lastPage': __('Last page'), 'lastPage': __('Last page'),
'currentPage': __('Current page'), 'currentPage': __('Current page'),
'pageOutOf': __('of'), 'pageOutOf': __('of'),
'numberOfItems': __('%$1d item(s)'), 'numberOfItemsSingular': __('1 item'),
'numberOfItemsMultiple': __('%$1d items'),
'segmentDescriptionTip': __('This text box is for your own use and is never shown to your subscribers.'), 'segmentDescriptionTip': __('This text box is for your own use and is never shown to your subscribers.'),
'backToList': __('Back') 'backToList': __('Back')

View File

@@ -42,7 +42,8 @@
'lastPage': __('Last page'), 'lastPage': __('Last page'),
'currentPage': __('Current Page'), 'currentPage': __('Current Page'),
'pageOutOf': __('of'), 'pageOutOf': __('of'),
'numberOfItems': __('%$1d item(s)'), 'numberOfItemsSingular': __('1 item'),
'numberOfItemsMultiple': __('%$1d items'),
'email': __('E-mail'), 'email': __('E-mail'),
'firstname': __('First name'), 'firstname': __('First name'),