Skip to content

Commit

Permalink
MDL-53700 competency: Migrating language strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Apr 18, 2016
1 parent 4aa6acb commit e6dc03d
Show file tree
Hide file tree
Showing 66 changed files with 267 additions and 262 deletions.
151 changes: 19 additions & 132 deletions admin/tool/lp/lang/en/tool_lp.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/tool/lp/template_plans.php
Expand Up @@ -44,7 +44,7 @@
'pagecontextid' => $pagecontextid
));
list($title, $subtitle) = \tool_lp\page_helper::setup_for_template($pagecontextid, $url, $template,
get_string('userplans', 'tool_lp'));
get_string('userplans', 'core_competency'));

// Capture the form submission.
$form = new \tool_lp\form\template_plans($url->out(false));
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/templates/manage_templates_page.mustache
Expand Up @@ -44,7 +44,7 @@
<th scope="col">{{#str}}templatename, tool_lp{{/str}}</th>
<th scope="col">{{#str}}category, tool_lp{{/str}}</th>
<th scope="col">{{#str}}cohorts, core_cohort{{/str}}</th>
<th scope="col">{{#str}}userplans, tool_lp{{/str}}</th>
<th scope="col">{{#str}}userplans, core_competency{{/str}}</th>
{{#canmanage}}
<th scope="col">{{#str}}actions, tool_lp{{/str}}</th>
{{/canmanage}}
Expand Down
20 changes: 10 additions & 10 deletions competency/classes/api.php
Expand Up @@ -580,7 +580,7 @@ public static function duplicate_framework($id) {
$idnumber = competency_framework::get_unused_idnumber($framework->get_idnumber());
$framework->set_idnumber($idnumber);
// Adding the suffix copy to the shortname.
$framework->set_shortname(get_string('duplicateditemname', 'tool_lp', $framework->get_shortname()));
$framework->set_shortname(get_string('duplicateditemname', 'core_competency', $framework->get_shortname()));
$framework->set_id(0);
$framework = $framework->create();

Expand Down Expand Up @@ -1739,7 +1739,7 @@ public static function duplicate_template($id) {
$competencies = template_competency::list_competencies($id, false);

// Adding the suffix copy.
$template->set_shortname(get_string('duplicateditemname', 'tool_lp', $template->get_shortname()));
$template->set_shortname(get_string('duplicateditemname', 'core_competency', $template->get_shortname()));
$template->set_id(0);

$duplicatedtemplate = $template->create();
Expand Down Expand Up @@ -3829,7 +3829,7 @@ public static function create_user_evidence_competency($userevidenceorid, $compe
$userevidence->get_context(),
evidence::ACTION_LOG,
'evidence_evidenceofpriorlearninglinked',
'tool_lp',
'core_competency',
$userevidence->get_name(),
false,
$link->out(false),
Expand Down Expand Up @@ -3877,7 +3877,7 @@ public static function delete_user_evidence_competency($userevidenceorid, $compe
$userevidence->get_context(),
evidence::ACTION_LOG,
'evidence_evidenceofpriorlearningunlinked',
'tool_lp',
'core_competency',
$userevidence->get_name(),
false,
null,
Expand Down Expand Up @@ -4487,7 +4487,7 @@ protected static function apply_competency_rules_from_usercompetency(user_compet
$parent->get_context()->id,
$action,
'evidence_competencyrule',
'tool_lp',
'core_competency',
null,
$recommend
);
Expand Down Expand Up @@ -4545,7 +4545,7 @@ public static function observe_course_module_completion_updated(\core\event\cour
$event->contextid,
$action,
$strdesc,
'tool_lp',
'core_competency',
$cmname,
$recommend,
$url
Expand Down Expand Up @@ -4605,7 +4605,7 @@ public static function observe_course_completed(\core\event\course_completed $ev
$event->contextid,
$action,
$strdesc,
'tool_lp',
'core_competency',
$courseshortname,
$recommend,
$event->get_url()
Expand Down Expand Up @@ -4647,7 +4647,7 @@ public static function grade_competency($userid, $competencyid, $grade, $note =
$context->id,
$action,
$desckey,
'tool_lp',
'core_competency',
null,
false,
null,
Expand Down Expand Up @@ -4700,7 +4700,7 @@ public static function grade_competency_in_plan($planorid, $competencyid, $grade
$context->id,
$action,
$desckey,
'tool_lp',
'core_competency',
$plan->get_name(),
false,
null,
Expand Down Expand Up @@ -4768,7 +4768,7 @@ public static function grade_competency_in_course($courseorid, $userid, $compete
$context->id,
$action,
$desckey,
'tool_lp',
'core_competency',
$context->get_context_name(),
false,
null,
Expand Down
6 changes: 3 additions & 3 deletions competency/classes/competency.php
Expand Up @@ -617,7 +617,7 @@ protected function validate_scaleid($value) {
// Validate that we can only change the scale when it is not used yet.
if ($this->beforeupdate->get_scaleid() != $value) {
if ($this->has_user_competencies()) {
return new lang_string('errorscalealreadyused', 'tool_lp');
return new lang_string('errorscalealreadyused', 'core_competency');
}
}

Expand Down Expand Up @@ -650,7 +650,7 @@ protected function validate_scaleconfiguration($value) {
$scaleinfo = array_shift($scaleconfigurations);
if (empty($scaleinfo) || !isset($scaleinfo->scaleid) || $scaleinfo->scaleid != $scaleid) {
// This should never happen.
return new lang_string('errorscaleconfiguration', 'tool_lp');
return new lang_string('errorscaleconfiguration', 'core_competency');
}

// Walk through the array to find proficient and default values.
Expand All @@ -665,7 +665,7 @@ protected function validate_scaleconfiguration($value) {
}

if (!$scaledefaultselected || !$proficientselected) {
return new lang_string('errorscaleconfiguration', 'tool_lp');
return new lang_string('errorscaleconfiguration', 'core_competency');
}

return true;
Expand Down
30 changes: 15 additions & 15 deletions competency/classes/competency_framework.php
Expand Up @@ -279,7 +279,7 @@ protected function validate_scaleid($value) {
// Validate that we can only change the scale when it is not used yet.
if ($this->beforeupdate->get_scaleid() != $value) {
if ($this->beforeupdate->has_user_competencies()) {
return new lang_string('errorscalealreadyused', 'tool_lp');
return new lang_string('errorscalealreadyused', 'core_competency');
}
}

Expand All @@ -305,7 +305,7 @@ protected function validate_scaleconfiguration($value) {
$scaleinfo = array_shift($scaleconfigurations);
if (empty($scaleinfo) || !isset($scaleinfo->scaleid) || $scaleinfo->scaleid != $this->get('scaleid')) {
// This should never happen.
return new lang_string('errorscaleconfiguration', 'tool_lp');
return new lang_string('errorscaleconfiguration', 'core_competency');
}

// Walk through the array to find proficient and default values.
Expand All @@ -320,7 +320,7 @@ protected function validate_scaleconfiguration($value) {
}

if (!$scaledefaultselected || !$proficientselected) {
return new lang_string('errorscaleconfiguration', 'tool_lp');
return new lang_string('errorscaleconfiguration', 'core_competency');
}

return true;
Expand All @@ -341,7 +341,7 @@ protected function validate_taxonomies($value) {

foreach ($terms as $term) {
if (!empty($term) && !array_key_exists($term, self::get_taxonomies_list())) {
return new lang_string('invalidtaxonomy', 'tool_lp', $term);
return new lang_string('invalidtaxonomy', 'core_competency', $term);
}
}

Expand Down Expand Up @@ -434,17 +434,17 @@ public static function get_taxonomies_list() {
// decide to allow more taxonomies to be added dynamically from a CFG variable for instance.
if ($list === null) {
$list = array(
self::TAXONOMY_BEHAVIOUR => new lang_string('taxonomy_' . self::TAXONOMY_BEHAVIOUR, 'tool_lp'),
self::TAXONOMY_COMPETENCY => new lang_string('taxonomy_' . self::TAXONOMY_COMPETENCY, 'tool_lp'),
self::TAXONOMY_CONCEPT => new lang_string('taxonomy_' . self::TAXONOMY_CONCEPT, 'tool_lp'),
self::TAXONOMY_DOMAIN => new lang_string('taxonomy_' . self::TAXONOMY_DOMAIN, 'tool_lp'),
self::TAXONOMY_INDICATOR => new lang_string('taxonomy_' . self::TAXONOMY_INDICATOR, 'tool_lp'),
self::TAXONOMY_LEVEL => new lang_string('taxonomy_' . self::TAXONOMY_LEVEL, 'tool_lp'),
self::TAXONOMY_OUTCOME => new lang_string('taxonomy_' . self::TAXONOMY_OUTCOME, 'tool_lp'),
self::TAXONOMY_PRACTICE => new lang_string('taxonomy_' . self::TAXONOMY_PRACTICE, 'tool_lp'),
self::TAXONOMY_PROFICIENCY => new lang_string('taxonomy_' . self::TAXONOMY_PROFICIENCY, 'tool_lp'),
self::TAXONOMY_SKILL => new lang_string('taxonomy_' . self::TAXONOMY_SKILL, 'tool_lp'),
self::TAXONOMY_VALUE => new lang_string('taxonomy_' . self::TAXONOMY_VALUE, 'tool_lp'),
self::TAXONOMY_BEHAVIOUR => new lang_string('taxonomy_' . self::TAXONOMY_BEHAVIOUR, 'core_competency'),
self::TAXONOMY_COMPETENCY => new lang_string('taxonomy_' . self::TAXONOMY_COMPETENCY, 'core_competency'),
self::TAXONOMY_CONCEPT => new lang_string('taxonomy_' . self::TAXONOMY_CONCEPT, 'core_competency'),
self::TAXONOMY_DOMAIN => new lang_string('taxonomy_' . self::TAXONOMY_DOMAIN, 'core_competency'),
self::TAXONOMY_INDICATOR => new lang_string('taxonomy_' . self::TAXONOMY_INDICATOR, 'core_competency'),
self::TAXONOMY_LEVEL => new lang_string('taxonomy_' . self::TAXONOMY_LEVEL, 'core_competency'),
self::TAXONOMY_OUTCOME => new lang_string('taxonomy_' . self::TAXONOMY_OUTCOME, 'core_competency'),
self::TAXONOMY_PRACTICE => new lang_string('taxonomy_' . self::TAXONOMY_PRACTICE, 'core_competency'),
self::TAXONOMY_PROFICIENCY => new lang_string('taxonomy_' . self::TAXONOMY_PROFICIENCY, 'core_competency'),
self::TAXONOMY_SKILL => new lang_string('taxonomy_' . self::TAXONOMY_SKILL, 'core_competency'),
self::TAXONOMY_VALUE => new lang_string('taxonomy_' . self::TAXONOMY_VALUE, 'core_competency'),
);
}

Expand Down
2 changes: 1 addition & 1 deletion competency/classes/competency_rule_all.php
Expand Up @@ -96,6 +96,6 @@ public static function get_amd_module() {
* @return lang_string
*/
public static function get_name() {
return new lang_string('allchildrenarecomplete', 'tool_lp');
return new lang_string('allchildrenarecomplete', 'core_competency');
}
}
2 changes: 1 addition & 1 deletion competency/classes/competency_rule_points.php
Expand Up @@ -197,7 +197,7 @@ public static function get_amd_module() {
* @return lang_string
*/
public static function get_name() {
return new lang_string('pointsrequiredaremet', 'tool_lp');
return new lang_string('pointsrequiredaremet', 'core_competency');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions competency/classes/course_competency.php
Expand Up @@ -180,11 +180,11 @@ public static function get_ruleoutcome_name($ruleoutcome) {
$strname = 'complete';
break;
default:
throw new \moodle_exception('errorcoursecompetencyrule', 'tool_lp', '', $ruleoutcome);
throw new \moodle_exception('errorcoursecompetencyrule', 'core_competency', '', $ruleoutcome);
break;
}

return new lang_string('coursecompetencyoutcome_' . $strname, 'tool_lp');
return new lang_string('coursecompetencyoutcome_' . $strname, 'core_competency');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions competency/classes/course_module_competency.php
Expand Up @@ -126,11 +126,11 @@ public static function get_ruleoutcome_name($ruleoutcome) {
$strname = 'complete';
break;
default:
throw new \moodle_exception('errorcompetencyrule', 'tool_lp', '', $ruleoutcome);
throw new \moodle_exception('errorcompetencyrule', 'core_competency', '', $ruleoutcome);
break;
}

return new lang_string('coursemodulecompetencyoutcome_' . $strname, 'tool_lp');
return new lang_string('coursemodulecompetencyoutcome_' . $strname, 'core_competency');
}

/**
Expand Down
10 changes: 5 additions & 5 deletions competency/classes/evidence.php
Expand Up @@ -220,7 +220,7 @@ protected function validate_desca($value) {
*/
protected function validate_descidentifier($value) {
if (!$this->get_id() && !get_string_manager()->string_exists($value, $this->get('desccomponent'))) {
return new lang_string('invalidevidencedesc', 'tool_lp');
return new lang_string('invalidevidencedesc', 'core_competency');
}

return true;
Expand All @@ -237,23 +237,23 @@ protected function validate_descidentifier($value) {
*/
protected function validate_grade($value) {
if ($value !== null && $value <= 0) {
return new lang_string('invalidgrade', 'tool_lp');
return new lang_string('invalidgrade', 'core_competency');
}

$action = $this->get('action');
if ($value === null && $action == self::ACTION_COMPLETE) {
return new lang_string('invalidgrade', 'tool_lp');
return new lang_string('invalidgrade', 'core_competency');

} else if ($value !== null && $action == self::ACTION_LOG) {
return new lang_string('invalidgrade', 'tool_lp');
return new lang_string('invalidgrade', 'core_competency');
}

if ($value !== null) {
// TODO MDL-52243 Use a core method to validate the grade_scale item.
// Check if grade exist in the scale item values.
$competency = $this->get_competency();
if (!array_key_exists($value - 1, $competency->get_scale()->scale_items)) {
return new lang_string('invalidgrade', 'tool_lp');
return new lang_string('invalidgrade', 'core_competency');
}
}

Expand Down
12 changes: 6 additions & 6 deletions competency/classes/plan.php
Expand Up @@ -284,11 +284,11 @@ public function get_statusname() {
$strname = 'complete';
break;
default:
throw new \moodle_exception('errorplanstatus', 'tool_lp', '', $status);
throw new \moodle_exception('errorplanstatus', 'core_competency', '', $status);
break;
}

return get_string('planstatus' . $strname, 'tool_lp');
return get_string('planstatus' . $strname, 'core_competency');
}

/**
Expand Down Expand Up @@ -560,10 +560,10 @@ public static function get_recordset_for_due_and_incomplete() {
public static function get_status_list($userid) {
$status = array();
if (self::can_manage_user_draft($userid)) {
$status[self::STATUS_DRAFT] = get_string('planstatusdraft', 'tool_lp');
$status[self::STATUS_DRAFT] = get_string('planstatusdraft', 'core_competency');
}
if (self::can_manage_user($userid)) {
$status[self::STATUS_ACTIVE] = get_string('planstatusactive', 'tool_lp');
$status[self::STATUS_ACTIVE] = get_string('planstatusactive', 'core_competency');
}
return $status;
}
Expand Down Expand Up @@ -653,12 +653,12 @@ protected function validate_duedate($value) {

if ($value <= time()) {
// We cannot set the date in the past.
return new lang_string('errorcannotsetduedateinthepast', 'tool_lp');
return new lang_string('errorcannotsetduedateinthepast', 'core_competency');
}

if ($value <= time() + self::DUEDATE_THRESHOLD) {
// We cannot set the date too soon, but we can leave it empty.
return new lang_string('errorcannotsetduedatetoosoon', 'tool_lp');
return new lang_string('errorcannotsetduedatetoosoon', 'core_competency');
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion competency/classes/template.php
Expand Up @@ -187,7 +187,7 @@ protected function validate_duedate($value) {
if (!empty($value) && $value <= time() - 600) {
// We cannot set the date in the past. But we allow for 10 minutes of margin so that
// a user can set the due date to "now" without risking to hit a validation error.
return new lang_string('errorcannotsetduedateinthepast', 'tool_lp');
return new lang_string('errorcannotsetduedateinthepast', 'core_competency');
}

return true;
Expand Down
10 changes: 5 additions & 5 deletions competency/classes/user_competency.php
Expand Up @@ -154,11 +154,11 @@ public static function get_status_name($status) {
$strname = 'inreview';
break;
default:
throw new \moodle_exception('errorcomptencystatus', 'tool_lp', '', $status);
throw new \moodle_exception('errorusercomptencystatus', 'core_competency', '', $status);
break;
}

return new lang_string('usercompetencystatus_' . $strname, 'tool_lp');
return new lang_string('usercompetencystatus_' . $strname, 'core_competency');
}

/**
Expand Down Expand Up @@ -260,7 +260,7 @@ protected function validate_userid($value) {
*/
protected function validate_competencyid($value) {
if (!competency::record_exists($value)) {
return new lang_string('errornocompetency', 'tool_lp', $value);
return new lang_string('errornocompetency', 'core_competency', $value);
}

return true;
Expand Down Expand Up @@ -312,14 +312,14 @@ protected function validate_reviewerid($value) {
protected function validate_grade($value) {
if ($value !== null) {
if ($value <= 0) {
return new lang_string('invalidgrade', 'tool_lp');
return new lang_string('invalidgrade', 'core_competency');
}

// TODO MDL-52243 Use a core method to validate the grade_scale item.
// Check if grade exist in the scale item values.
$competency = $this->get_competency();
if (!array_key_exists($value - 1 , $competency->get_scale()->scale_items)) {
return new lang_string('invalidgrade', 'tool_lp');
return new lang_string('invalidgrade', 'core_competency');
}
}

Expand Down

0 comments on commit e6dc03d

Please sign in to comment.