From dc468ac5231705950f7fd15eccd19bfca4764298 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Tue, 7 May 2019 19:32:44 +0800 Subject: [PATCH] MDL-65509 javascript: Make core dialogues translatable --- lang/en/debug.php | 3 +++ lib/outputrequirementslib.php | 9 +++++++++ ...oodle-core-notification-ajaxexception-debug.js | 15 +++++++++------ .../moodle-core-notification-ajaxexception-min.js | 2 +- .../moodle-core-notification-ajaxexception.js | 15 +++++++++------ .../moodle-core-notification-exception-debug.js | 13 ++++++++----- .../moodle-core-notification-exception-min.js | 2 +- .../moodle-core-notification-exception.js | 13 ++++++++----- lib/yui/src/notification/js/ajaxexception.js | 15 +++++++++------ lib/yui/src/notification/js/exception.js | 13 ++++++++----- 10 files changed, 65 insertions(+), 35 deletions(-) diff --git a/lang/en/debug.php b/lang/en/debug.php index 86d813cfa45..4159047419e 100644 --- a/lang/en/debug.php +++ b/lang/en/debug.php @@ -31,11 +31,13 @@ $string['cannotinitpage'] = 'Cannot fully initialize page: invalid {$a->name} id $string['cannotsetuptable'] = '{$a} tables could NOT be set up successfully!'; $string['codingerror'] = 'Coding error detected, it must be fixed by a programmer: {$a}'; $string['configmoodle'] = 'Moodle has not been configured yet. You need to edit config.php first.'; +$string['debuginfo'] = 'Debug info'; $string['erroroccur'] = 'An error has occurred during this process'; $string['invalidarraysize'] = 'Incorrect size of arrays in params of {$a}'; $string['invalideventdata'] = 'Incorrect event data submitted: {$a}'; $string['invalidparameter'] = 'Invalid parameter value detected'; $string['invalidresponse'] = 'Invalid response value detected'; +$string['line'] = 'Line'; $string['missingconfigversion'] = 'Config table does not contain version, can not continue, sorry.'; $string['modulenotexist'] = '{$a} module doesn\'t exist'; $string['morethanonerecordinfetch'] = 'Found more than one record in fetch() !'; @@ -51,5 +53,6 @@ $string['phpvaroff'] = 'The PHP server variable \'{$a->name}\' should be Off - { $string['phpvaron'] = 'The PHP server variable \'{$a->name}\' is not turned On - {$a->link}'; $string['sessionmissing'] = '{$a} object missing from session'; $string['sqlrelyonobsoletetable'] = 'This SQL relies on obsolete table(s): {$a}! Your code must be fixed by a developer.'; +$string['stacktrace'] = 'Stack trace'; $string['withoutversion'] = 'Main version.php file is missing, not readable or broken.'; $string['xmlizeunavailable'] = 'xmlize functions are not available'; diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index c7c0aa14070..19d686d1371 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -1638,7 +1638,16 @@ class page_requirements_manager { 'areyousure', 'closebuttontitle', 'unknownerror', + 'error', + 'file', + 'url', ), 'moodle'); + $this->strings_for_js(array( + 'debuginfo', + 'line', + 'stacktrace', + ), 'debug'); + $this->string_for_js('labelsep', 'langconfig'); if (!empty($this->stringsforjs)) { $strings = array(); foreach ($this->stringsforjs as $component=>$v) { diff --git a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js index be34b855669..3c96571bf87 100644 --- a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js +++ b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js @@ -50,7 +50,7 @@ var AJAXEXCEPTION_NAME = 'Moodle AJAX exception', * @extends M.core.dialogue */ AJAXEXCEPTION = function(config) { - config.name = config.name || 'Error'; + config.name = config.name || M.util.get_string('error', 'moodle'); config.closeButton = true; AJAXEXCEPTION.superclass.constructor.apply(this, [config]); }; @@ -59,19 +59,22 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, { initializer: function(config) { var content, self = this, - delay = this.get('hideTimeoutDelay'); + delay = this.get('hideTimeoutDelay'), + labelsep = M.util.get_string('labelsep', 'langconfig'); this.get(BASE).addClass('moodle-dialogue-exception'); this.setStdModContent(Y.WidgetStdMod.HEADER, '

' + Y.Escape.html(config.name) + '

', Y.WidgetStdMod.REPLACE); content = Y.Node.create('
') .append(Y.Node.create('
' + Y.Escape.html(this.get('error')) + '
')) - .append(Y.Node.create('