Skip to content

Commit

Permalink
MDL-28445 mod_glossary: Use compound strings as opposed to anglicised
Browse files Browse the repository at this point in the history
* Use compound strings on buttons to help with proper translations
* Updated behat tests
  • Loading branch information
Peter committed Jan 17, 2019
1 parent dfd6053 commit 68e6a93
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
10 changes: 5 additions & 5 deletions mod/glossary/editcategories.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 "<div class=\"boxaligncenter deletecatconfirm\">".format_string($category->name, true, $fmtoptions)."<br/>";
Expand Down Expand Up @@ -218,7 +218,7 @@
} else {
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($glossary->name), 2);
echo "<h3 class=\"main\">" . get_string("add"). " " . get_string("category","glossary"). "</h3>";
echo "<h3 class=\"main\">" . get_string("addcategory", "glossary"). "</h3>";
$name="";
require "editcategories.html";
}
Expand Down Expand Up @@ -287,7 +287,7 @@
$options['action'] = "add";

echo "<table class=\"editbuttons\" border=\"0\"><tr><td align=\"$rightalignment\">";
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 "</td><td align=\"$leftalignment\">";
unset($options['action']);
$options['mode'] = 'cat';
Expand Down
3 changes: 3 additions & 0 deletions mod/glossary/lang/en/glossary.php
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion mod/glossary/tests/behat/behat_mod_glossary.php
Expand Up @@ -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)));

Expand Down
6 changes: 3 additions & 3 deletions mod/glossary/tests/behat/categories.feature
Expand Up @@ -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"
Expand Down

0 comments on commit 68e6a93

Please sign in to comment.