From f5503c1161776c271efcf52309a8edd0b31c6119 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 17 Jan 2019 09:47:22 +0800 Subject: [PATCH] MDL-28445 mod_glossary: Use compound strings as opposed to anglicised * Use compound strings on buttons to help with proper translations * Updated behat tests --- mod/glossary/editcategories.php | 10 +++++----- mod/glossary/lang/en/glossary.php | 3 +++ mod/glossary/tests/behat/behat_mod_glossary.php | 2 +- mod/glossary/tests/behat/categories.feature | 6 +++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mod/glossary/editcategories.php b/mod/glossary/editcategories.php index 27b75da3fb3cf..7ffb5ce2e5eeb 100644 --- a/mod/glossary/editcategories.php +++ b/mod/glossary/editcategories.php @@ -72,7 +72,7 @@ $PAGE->navbar->add(get_string("categories","glossary"), new moodle_url('/mod/glossary/editcategories.php', array('id' => $cm->id,'mode' => 'cat'))); if (!empty($action)) { - $navaction = get_string($action). " " . core_text::strtolower(get_string("category","glossary")); + $navaction = get_string(core_text::strtolower($action."category"), 'glossary'); $PAGE->navbar->add($navaction); } $PAGE->set_title($glossary->name); @@ -118,7 +118,7 @@ } else { echo $OUTPUT->header(); echo $OUTPUT->heading(format_string($glossary->name), 2); - echo $OUTPUT->heading(format_string(get_string("edit"). " " . get_string("category","glossary")), 3); + echo $OUTPUT->heading(format_string(get_string("editcategory", "glossary")), 3); $name = $category->name; $usedynalink = $category->usedynalink; @@ -148,7 +148,7 @@ } else { echo $OUTPUT->header(); echo $OUTPUT->heading(format_string($glossary->name), 2); - echo $OUTPUT->heading(format_string(get_string("delete"). " " . get_string("category","glossary")), 3); + echo $OUTPUT->heading(format_string(get_string("deletecategory", "glossary")), 3); echo $OUTPUT->box_start('generalbox boxaligncenter errorboxcontent boxwidthnarrow'); echo "
".format_string($category->name, true, $fmtoptions)."
"; @@ -218,7 +218,7 @@ } else { echo $OUTPUT->header(); echo $OUTPUT->heading(format_string($glossary->name), 2); - echo "

" . get_string("add"). " " . get_string("category","glossary"). "

"; + echo "

" . get_string("addcategory", "glossary"). "

"; $name=""; require "editcategories.html"; } @@ -287,7 +287,7 @@ $options['action'] = "add"; echo "
"; - echo $OUTPUT->single_button(new moodle_url("editcategories.php", $options), get_string("add") . " " . get_string("category","glossary")); + echo $OUTPUT->single_button(new moodle_url("editcategories.php", $options), get_string("addcategory", "glossary")); echo ""; unset($options['action']); $options['mode'] = 'cat'; diff --git a/mod/glossary/lang/en/glossary.php b/mod/glossary/lang/en/glossary.php index 8a25a1ea6515b..30b268693ee12 100644 --- a/mod/glossary/lang/en/glossary.php +++ b/mod/glossary/lang/en/glossary.php @@ -24,6 +24,7 @@ */ $string['addcomment'] = 'Add comment'; +$string['addcategory'] = 'Add category'; $string['addentry'] = 'Add a new entry'; $string['addingcomment'] = 'Add a comment'; $string['alias'] = 'Keyword'; @@ -105,6 +106,7 @@ $string['definition'] = 'Definition'; $string['definitions'] = 'Definitions'; $string['deleteentry'] = 'Delete entry'; +$string['deletecategory'] = 'Delete category'; $string['deleteentrya'] = 'Delete entry: {$a}'; $string['deletenotenrolled'] = 'Delete entries by users not enrolled'; $string['deletingcomment'] = 'Deleting comment'; @@ -138,6 +140,7 @@ $string['editalways'] = 'Always allow editing'; $string['editalways_help'] = 'This setting specifies whether entries are always editable or whether students can only edit their entries during a configured editing time (usually 30 minutes).'; $string['editcategories'] = 'Edit categories'; +$string['editcategory'] = 'Edit category'; $string['editentry'] = 'Edit entry'; $string['editentrya'] = 'Edit entry: {$a}'; $string['editingcomment'] = 'Editing comment'; diff --git a/mod/glossary/tests/behat/behat_mod_glossary.php b/mod/glossary/tests/behat/behat_mod_glossary.php index 0f4b21fa58e59..bf84100a69956 100644 --- a/mod/glossary/tests/behat/behat_mod_glossary.php +++ b/mod/glossary/tests/behat/behat_mod_glossary.php @@ -65,7 +65,7 @@ public function i_add_a_glossary_entries_category_named($categoryname) { $this->execute("behat_forms::press_button", get_string('editcategories', 'mod_glossary')); - $this->execute("behat_forms::press_button", get_string('add').' '.get_string('category', 'glossary')); + $this->execute("behat_forms::press_button", get_string('addcategory', 'glossary')); $this->execute('behat_forms::i_set_the_field_to', array('name', $this->escape($categoryname))); diff --git a/mod/glossary/tests/behat/categories.feature b/mod/glossary/tests/behat/categories.feature index 665f2c707f2ca..193488dbc02f4 100644 --- a/mod/glossary/tests/behat/categories.feature +++ b/mod/glossary/tests/behat/categories.feature @@ -34,16 +34,16 @@ Feature: Glossary entries can be organised in categories And I follow "MyGlossary" And I follow "Browse by category" And I press "Edit categories" - And I press "Add Category" + And I press "Add category" And I set the field "name" to "CategoryNoLinks" And I press "Save changes" And I should see "0 Entries" in the "CategoryNoLinks" "table_row" - And I press "Add Category" + And I press "Add category" And I set the field "name" to "CategoryAutoLinks" And I set the field "usedynalink" to "Yes" And I press "Save changes" And I should see "0 Entries" in the "CategoryAutoLinks" "table_row" - And I press "Add Category" + And I press "Add category" And I set the field "name" to "Category2" And I press "Save changes" And I click on "Edit" "link" in the "Category2" "table_row"