From aafa1150d86332b08f887a1456c0085a1318df86 Mon Sep 17 00:00:00 2001 From: Dries Date: Thu, 14 Feb 2013 21:53:23 -0500 Subject: [PATCH] Issue #1785012 by beltofte, hass, YesCT: Standardize capitalization on actions for node operations: 'revert', 'view', 'edit', 'translate', 'delete'. --- .../lib/Drupal/node/Plugin/views/field/RevisionLink.php | 2 +- .../Drupal/node/Plugin/views/field/RevisionLinkDelete.php | 2 +- .../Drupal/node/Plugin/views/field/RevisionLinkRevert.php | 2 +- .../node/lib/Drupal/node/Tests/NodeTranslationUITest.php | 2 +- core/modules/node/node.admin.inc | 6 +++--- core/modules/node/node.pages.inc | 4 ++-- .../path/lib/Drupal/path/Tests/PathLanguageTest.php | 2 +- .../text/lib/Drupal/text/Tests/TextTranslationTest.php | 4 ++-- core/modules/translation/translation.pages.inc | 2 +- .../Tests/EntityTranslationWorkflowsTest.php | 7 ++++--- .../translation_entity/translation_entity.pages.inc | 8 ++++---- 11 files changed, 21 insertions(+), 20 deletions(-) diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php index aa50d43a1de..649c78a1d56 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php @@ -53,7 +53,7 @@ class RevisionLink extends Link { $this->options['alter']['path'] = $path; $this->options['alter']['query'] = drupal_get_destination(); - return !empty($this->options['text']) ? $this->options['text'] : t('view'); + return !empty($this->options['text']) ? $this->options['text'] : t('View'); } /** diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkDelete.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkDelete.php index 2bb53f1a3df..cdf3f824836 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkDelete.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkDelete.php @@ -41,7 +41,7 @@ class RevisionLinkDelete extends RevisionLink { $this->options['alter']['path'] = 'node/' . $node->nid . "/revisions/$vid/delete"; $this->options['alter']['query'] = drupal_get_destination(); - return !empty($this->options['text']) ? $this->options['text'] : t('delete'); + return !empty($this->options['text']) ? $this->options['text'] : t('Delete'); } } diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkRevert.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkRevert.php index 11e66ffc54a..55a5c408276 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkRevert.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkRevert.php @@ -41,7 +41,7 @@ class RevisionLinkRevert extends RevisionLink { $this->options['alter']['path'] = 'node/' . $node->nid . "/revisions/$vid/revert"; $this->options['alter']['query'] = drupal_get_destination(); - return !empty($this->options['text']) ? $this->options['text'] : t('revert'); + return !empty($this->options['text']) ? $this->options['text'] : t('Revert'); } } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php index 083c00e12d1..44b56f5c5af 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php @@ -168,7 +168,7 @@ class NodeTranslationUITest extends EntityTranslationUITest { // Visit translation page. $this->drupalGet('node/' . $article->nid . '/translations'); - $this->assertRaw('no translatable fields'); + $this->assertRaw('No translatable fields'); } /** diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc index 7c360a4d3d4..139b2d214f8 100644 --- a/core/modules/node/node.admin.inc +++ b/core/modules/node/node.admin.inc @@ -556,21 +556,21 @@ function node_admin_nodes() { $operations = array(); if (node_access('update', $node)) { $operations['edit'] = array( - 'title' => t('edit'), + 'title' => t('Edit'), 'href' => 'node/' . $node->nid . '/edit', 'query' => $destination, ); } if (node_access('delete', $node)) { $operations['delete'] = array( - 'title' => t('delete'), + 'title' => t('Delete'), 'href' => 'node/' . $node->nid . '/delete', 'query' => $destination, ); } if (module_invoke('translation_entity', 'enabled', 'node', $node->bundle())) { $operations['translate'] = array( - 'title' => t('translate'), + 'title' => t('Translate'), 'href' => 'node/' . $node->nid . '/translations', 'query' => $destination, ); diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index 245fef79392..008ef76bac9 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -275,13 +275,13 @@ function node_revision_overview($node) { . (($revision->log != '') ? '

' . filter_xss($revision->log) . '

' : ''); if ($revert_permission) { $links['revert'] = array( - 'title' => t('revert'), + 'title' => t('Revert'), 'href' => "node/$node->nid/revisions/$revision->vid/revert", ); } if ($delete_permission) { $links['delete'] = array( - 'title' => t('delete'), + 'title' => t('Delete'), 'href' => "node/$node->nid/revisions/$revision->vid/delete", ); } diff --git a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php index b3e2fcf4535..455a3f696aa 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php @@ -72,7 +72,7 @@ class PathLanguageTest extends PathTestBase { // Translate the node into French. $this->drupalGet('node/' . $english_node->nid . '/translate'); - $this->clickLink(t('add translation')); + $this->clickLink(t('Add translation')); $edit = array(); $langcode = LANGUAGE_NOT_SPECIFIED; $edit["title"] = $this->randomName(); diff --git a/core/modules/text/lib/Drupal/text/Tests/TextTranslationTest.php b/core/modules/text/lib/Drupal/text/Tests/TextTranslationTest.php index 742ec1f0de2..634d7e84c7f 100644 --- a/core/modules/text/lib/Drupal/text/Tests/TextTranslationTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/TextTranslationTest.php @@ -81,7 +81,7 @@ class TextTranslationTest extends WebTestBase { $this->drupalPost('node/add/article', $edit, t('Save')); $node = $this->drupalGetNodeByTitle($edit['title']); $this->drupalGet("node/$node->nid/translate"); - $this->clickLink(t('add translation')); + $this->clickLink(t('Add translation')); $this->assertFieldByXPath("//textarea[@name='body[$langcode][0][value]']", $body, 'The textfield widget is populated.'); } @@ -128,7 +128,7 @@ class TextTranslationTest extends WebTestBase { // Translate the article in french. $node = $this->drupalGetNodeByTitle($title); $this->drupalGet("node/$node->nid/translate"); - $this->clickLink(t('add translation')); + $this->clickLink(t('Add translation')); $this->assertNoText($body[0], t('The body field with delta @delta is hidden.', array('@delta' => 0))); $this->assertText($body[1], t('The body field with delta @delta is shown.', array('@delta' => 1))); } diff --git a/core/modules/translation/translation.pages.inc b/core/modules/translation/translation.pages.inc index 53b91c89035..181b6c8603c 100644 --- a/core/modules/translation/translation.pages.inc +++ b/core/modules/translation/translation.pages.inc @@ -70,7 +70,7 @@ function translation_node_overview(Node $node) { $query = array('query' => array('translation' => $node->nid, 'target' => $langcode)); if (!empty($links->links[$langcode]['href'])) { $options['add'] = array( - 'title' => t('add translation'), + 'title' => t('Add translation'), ) + $links->links[$langcode]; $options['add'] = NestedArray::mergeDeep($options['add'], $query); } diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationWorkflowsTest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationWorkflowsTest.php index 7ffe6c08d5c..99575523085 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationWorkflowsTest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationWorkflowsTest.php @@ -86,7 +86,7 @@ class EntityTranslationWorkflowsTest extends EntityTranslationTestBase { $this->assertWorkflows($this->administrator, $expected_status); // Check that translation permissions governate the associated operations. - $ops = array('create' => t('add'), 'update' => t('edit'), 'delete' => t('delete')); + $ops = array('create' => t('Add'), 'update' => t('Edit'), 'delete' => t('Delete')); $translations_path = $this->controller->getBasePath($this->entity) . "/translations"; foreach ($ops as $current_op => $label) { $user = $this->drupalCreateUser(array($this->getTranslatePermission(), "$current_op entity translations")); @@ -135,7 +135,7 @@ class EntityTranslationWorkflowsTest extends EntityTranslationTestBase { // Check whether the user is allowed to create a translation. $add_translation_path = $translations_path . "/add/$default_langcode/$langcode"; if ($expected_status['add_translation'] == 200) { - $this->clickLink('add'); + $this->clickLink('Add'); $this->assertUrl($add_translation_path, $options, 'The translation overview points to the translation form when creating translations.'); // Check that the translation form does not contain shared elements for // translators. @@ -155,13 +155,14 @@ class EntityTranslationWorkflowsTest extends EntityTranslationTestBase { if ($expected_status['edit_translation'] == 200) { $this->drupalGet($translations_path, $options); $editor = $expected_status['edit'] == 200; - $this->clickLink('edit', intval($editor)); if ($editor) { + $this->clickLink('Edit', 2); // An editor should be pointed to the entity form in multilingual mode. $this->assertUrl($edit_path, $options, 'The translation overview points to the edit form for editors when editing translations.'); } else { + $this->clickLink('Edit'); // While a translator should be pointed to the translation form. $this->assertUrl($edit_translation_path, $options, 'The translation overview points to the translation form for translators when editing translations.'); // Check that the translation form does not contain shared elements. diff --git a/core/modules/translation_entity/translation_entity.pages.inc b/core/modules/translation_entity/translation_entity.pages.inc index b6c327cbe69..b64fbcb96eb 100644 --- a/core/modules/translation_entity/translation_entity.pages.inc +++ b/core/modules/translation_entity/translation_entity.pages.inc @@ -93,7 +93,7 @@ function translation_entity_overview(EntityInterface $entity) { } if (isset($links['edit'])) { - $links['edit']['title'] = t('edit'); + $links['edit']['title'] = t('Edit'); } $translation = $entity->translation[$langcode]; @@ -109,7 +109,7 @@ function translation_entity_overview(EntityInterface $entity) { $source_name = isset($languages[$source]) ? $languages[$source]->name : t('n/a'); if ($controller->getTranslationAccess($entity, 'delete')) { $links['delete'] = isset($delete_links->links[$langcode]['href']) ? $delete_links->links[$langcode] : array('href' => $delete_links, 'language' => $language); - $links['delete']['title'] = t('delete'); + $links['delete']['title'] = t('Delete'); } } } @@ -121,14 +121,14 @@ function translation_entity_overview(EntityInterface $entity) { if ($source != $langcode && $controller->getTranslationAccess($entity, 'create')) { if ($translatable) { $links['add'] = isset($add_links->links[$langcode]['href']) ? $add_links->links[$langcode] : array('href' => $add_path, 'language' => $language); - $links['add']['title'] = t('add'); + $links['add']['title'] = t('Add'); } elseif ($field_ui) { $entity_path = field_ui_bundle_admin_path($entity->entityType(), $entity->bundle()); // Link directly to the fields tab to make it easier to find the // setting to enable translation on fields. $path = $entity_path . '/fields'; - $links['nofields'] = array('title' => t('no translatable fields'), 'href' => $path, 'language' => $language); + $links['nofields'] = array('title' => t('No translatable fields'), 'href' => $path, 'language' => $language); } }