diff --git a/CHANGELOG.txt b/CHANGELOG.txt index adb52e1a3f2b693310e478d310e55e64b6c954eb..ced6d5ead170837601d86f6350797227cb266cc7 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ Feeds 6.x 1.0 xxxxxxxxxxxxxxxxxxxx ---------------------------------- +- #776972 lyricnz: Messages use plural when describing single item. - #701390 frega, morningtime, Mixologic, alex_b et. al.: Fix RSS 1.0 parsing and add basic test framework for common_syndication_parser. - #781058 blakehall: Create teaser for imported nodes. NOTE: this may mean that diff --git a/feeds_defaults/tests/feeds_defaults.test b/feeds_defaults/tests/feeds_defaults.test index 17e0e4d52406697f4387bca18434ae8c5d945446..4c65b3b825225e2ae1946a31b89a200d5ba198f5 100644 --- a/feeds_defaults/tests/feeds_defaults.test +++ b/feeds_defaults/tests/feeds_defaults.test @@ -457,7 +457,7 @@ class FeedsDefaultsUserTestCase extends FeedsDefaultsTestCase { // Assert result. $this->assertText('Created 4 users.'); // 1 user has an invalid email address. - $this->assertText('There were 1 users that could not be imported because either their name or their email was empty or not valid. Check import data and mapping settings on User processor.'); + $this->assertText('There was 1 user that could not be imported because either their name or their email was empty or not valid. Check import data and mapping settings on User processor.'); $this->drupalGet('admin/user/user'); $this->assertText('Morticia'); $this->assertText('Fester'); diff --git a/plugins/FeedsDataProcessor.inc b/plugins/FeedsDataProcessor.inc index 3bad431357c21060f3d84d9cdf21ea2f42531121..2f1afcd4c6a0626a244d16691264895c2ceb9190 100644 --- a/plugins/FeedsDataProcessor.inc +++ b/plugins/FeedsDataProcessor.inc @@ -42,10 +42,10 @@ class FeedsDataProcessor extends FeedsProcessor { // Set messages. if ($inserted) { - drupal_set_message(t('Created !number items.', array('!number' => $inserted))); + drupal_set_message(format_plural($inserted, 'Created !number item.', 'Created !number items.', array('!number' => $inserted))); } elseif ($updated) { - drupal_set_message(t('Updated !number items.', array('!number' => $updated))); + drupal_set_message(format_plural($updated, 'Updated !number item.', 'Updated !number items.', array('!number' => $updated))); } else { drupal_set_message(t('There are no new items.')); @@ -64,7 +64,7 @@ class FeedsDataProcessor extends FeedsProcessor { 'feed_nid' => $source->feed_nid, ); $num = $this->handler()->delete($clause); - drupal_set_message(t('Deleted !number items.', array('!number' => $num))); + drupal_set_message(format_plural($num, 'Deleted !number item.', 'Deleted !number items.', array('!number' => $num))); return FEEDS_BATCH_COMPLETE; } @@ -85,7 +85,7 @@ class FeedsDataProcessor extends FeedsProcessor { ), ); $num = $this->handler()->delete($clause); - drupal_set_message(t('Expired !number records from !table.', array('!number' => $num, '!table' => $this->tableName()))); + drupal_set_message(format_plural($num, 'Expired !number record from !table.', 'Expired !number records from !table.', array('!number' => $num, '!table' => $this->tableName()))); return FEEDS_BATCH_COMPLETE; } diff --git a/plugins/FeedsFeedNodeProcessor.inc b/plugins/FeedsFeedNodeProcessor.inc index 32b441e199a42bcd035e13010c023e4757829afd..120bcba23f922fae12f91661899f68a69a2368bc 100644 --- a/plugins/FeedsFeedNodeProcessor.inc +++ b/plugins/FeedsFeedNodeProcessor.inc @@ -45,10 +45,10 @@ class FeedsFeedNodeProcessor extends FeedsProcessor { // Set messages. if ($batch->created) { - drupal_set_message(t('Created !number !type nodes.', array('!number' => $batch->created, '!type' => $this->config['content_type']))); + drupal_set_message(format_plural($batch->created, 'Created !number !type node.', 'Created !number !type nodes.', array('!number' => $batch->created, '!type' => $this->config['content_type']))); } elseif ($batch->updated) { - drupal_set_message(t('Updated !number !type nodes.', array('!number' => $batch->updated, '!type' => $this->config['content_type']))); + drupal_set_message(format_plural($batch->updated, 'Updated !number !type node.', 'Updated !number !type nodes.', array('!number' => $batch->updated, '!type' => $this->config['content_type']))); } else { drupal_set_message(t('There is no new content.')); diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc index 8c95253fc6765f5ac03176a3495457c756296a8a..3212827baf5fc43c5899e9666258cdf48cdce8df 100644 --- a/plugins/FeedsNodeProcessor.inc +++ b/plugins/FeedsNodeProcessor.inc @@ -81,10 +81,10 @@ class FeedsNodeProcessor extends FeedsProcessor { // Set messages. if ($batch->created) { - drupal_set_message(t('Created !number !type nodes.', array('!number' => $batch->created, '!type' => node_get_types('name', $this->config['content_type'])))); + drupal_set_message(format_plural($batch->created, 'Created !number !type node.', 'Created !number !type nodes.', array('!number' => $batch->created, '!type' => node_get_types('name', $this->config['content_type'])))); } elseif ($batch->updated) { - drupal_set_message(t('Updated !number !type nodes.', array('!number' => $batch->updated, '!type' => node_get_types('name', $this->config['content_type'])))); + drupal_set_message(format_plural($batch->updated, 'Updated !number !type node.', 'Updated !number !type nodes.', array('!number' => $batch->updated, '!type' => node_get_types('name', $this->config['content_type'])))); } else { drupal_set_message(t('There is no new content.')); @@ -112,7 +112,7 @@ class FeedsNodeProcessor extends FeedsProcessor { // Set message. drupal_get_messages('status'); if ($batch->deleted) { - drupal_set_message(t('Deleted !number nodes.', array('!number' => $batch->deleted))); + drupal_set_message(format_plural($batch->deleted, 'Deleted !number node.', 'Deleted !number nodes.', array('!number' => $batch->deleted))); } else { drupal_set_message(t('There is no content to be deleted.')); diff --git a/plugins/FeedsTermProcessor.inc b/plugins/FeedsTermProcessor.inc index 6f1dd539c80c6f0079f612d4e83175f486eae908..31ef7ee5c96c3336347920e47432d561a59ca497 100644 --- a/plugins/FeedsTermProcessor.inc +++ b/plugins/FeedsTermProcessor.inc @@ -58,13 +58,21 @@ class FeedsTermProcessor extends FeedsProcessor { $vocabularies = taxonomy_get_vocabularies(); $vocabulary = $vocabularies[$this->config['vocabulary']]; if ($no_name) { - drupal_set_message(t('There were !number terms that could not be imported because their name was empty. Check mapping settings on Taxomy term processor.', array('!number' => $no_name)), 'error'); + drupal_set_message( + format_plural( + $no_name, + 'There was !number term that could not be imported because their name was empty. Check mapping settings on Taxomy term processor.', + 'There were !number terms that could not be imported because their name was empty. Check mapping settings on Taxomy term processor.', + array('!number' => $no_name) + ), + 'error' + ); } if ($created) { - drupal_set_message(t('Created !number terms in !vocabulary.', array('!number' => $created, '!vocabulary' => $vocabulary->name))); + drupal_set_message(format_plural($created, 'Created !number term in !vocabulary.', 'Created !number terms in !vocabulary.', array('!number' => $created, '!vocabulary' => $vocabulary->name))); } elseif ($updated) { - drupal_set_message(t('Updated !number terms in !vocabulary.', array('!number' => $updated, '!vocabulary' => $vocabulary->name))); + drupal_set_message(format_plural($updated, 'Updated !number term in !vocabulary.', 'Updated !number terms in !vocabulary.', array('!number' => $updated, '!vocabulary' => $vocabulary->name))); } else { drupal_set_message(t('There are no new terms.')); @@ -90,7 +98,7 @@ class FeedsTermProcessor extends FeedsProcessor { $vocabularies = taxonomy_get_vocabularies(); $vocabulary = $vocabularies[$this->config['vocabulary']]; if ($deleted) { - drupal_set_message(t('Deleted !number terms from !vocabulary.', array('!number' => $deleted, '!vocabulary' => $vocabulary->name))); + drupal_set_message(format_plural($deleted, 'Deleted !number term from !vocabulary.', 'Deleted !number terms from !vocabulary.', array('!number' => $deleted, '!vocabulary' => $vocabulary->name))); } else { drupal_set_message(t('No terms to be deleted.')); diff --git a/plugins/FeedsUserProcessor.inc b/plugins/FeedsUserProcessor.inc index 9d3ae4ba1610dac9f9b1099b83ef05afcca42585..04afee0a661abba86415671c3067f5b02b88765c 100644 --- a/plugins/FeedsUserProcessor.inc +++ b/plugins/FeedsUserProcessor.inc @@ -61,13 +61,21 @@ class FeedsUserProcessor extends FeedsProcessor { // Set messages. if ($failed) { - drupal_set_message(t('There were !number users that could not be imported because either their name or their email was empty or not valid. Check import data and mapping settings on User processor.', array('!number' => $failed)), 'error'); + drupal_set_message( + format_plural( + $failed, + 'There was !number user that could not be imported because either their name or their email was empty or not valid. Check import data and mapping settings on User processor.', + 'There were !number users that could not be imported because either their name or their email was empty or not valid. Check import data and mapping settings on User processor.', + array('!number' => $failed) + ), + 'error' + ); } if ($created) { - drupal_set_message(t('Created !number users.', array('!number' => $created))); + drupal_set_message(format_plural($created, 'Created !number user.', 'Created !number users.', array('!number' => $created))); } elseif ($updated) { - drupal_set_message(t('Updated !number users.', array('!number' => $updated))); + drupal_set_message(format_plural($updated, 'Updated !number user.', 'Updated !number users.', array('!number' => $updated))); } else { drupal_set_message(t('There are no new users.')); diff --git a/tests/feeds.test b/tests/feeds.test index 925b2fd5411b0ded21f6fc426b82b7aafe09ff70..269bb58696b72c8721ad6f38ebafe62568743202 100644 --- a/tests/feeds.test +++ b/tests/feeds.test @@ -579,7 +579,7 @@ class FeedsCSVtoUsersTest extends FeedsWebTestCase { // Assert result. $this->assertText('Created 4 users.'); // 1 user has an invalid email address. - $this->assertText('There were 1 users that could not be imported because either their name or their email was empty or not valid. Check import data and mapping settings on User processor.'); + $this->assertText('There was 1 user that could not be imported because either their name or their email was empty or not valid. Check import data and mapping settings on User processor.'); $this->drupalGet('admin/user/user'); $this->assertText('Morticia'); $this->assertText('Fester');