Commit 8253ec74 authored by Eloy Lafuente's avatar Eloy Lafuente
Browse files

Merge branch 'MDL-63244-master' of git://github.com/lameze/moodle

parents bd1c9645 545e2abb
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -146,7 +146,8 @@ define([
args: {
component: component,
template: name,
themename: theme
themename: theme,
lang: $('html').attr('lang').replace(/-/g, '_')
}
});
// Remember the index in the requests list for this template so that
......
......@@ -104,7 +104,8 @@ class external extends external_api {
'component' => new external_value(PARAM_COMPONENT, 'component containing the template'),
'template' => new external_value(PARAM_ALPHANUMEXT, 'name of the template'),
'themename' => new external_value(PARAM_ALPHANUMEXT, 'The current theme.'),
'includecomments' => new external_value(PARAM_BOOL, 'Include comments or not', VALUE_DEFAULT, false)
'includecomments' => new external_value(PARAM_BOOL, 'Include comments or not', VALUE_DEFAULT, false),
'lang' => new external_value(PARAM_LANG, 'lang', VALUE_DEFAULT, null),
]);
}
......@@ -115,13 +116,15 @@ class external extends external_api {
* @param string $template The name of the template.
* @param string $themename The name of the current theme.
* @param bool $includecomments Whether to strip comments from the template source.
* @param string $lang moodle translation language, null means use current.
* @return string the template
*/
public static function load_template_with_dependencies(
string $component,
string $template,
string $themename,
bool $includecomments = false
bool $includecomments = false,
string $lang = null
) {
global $DB, $CFG, $PAGE;
......@@ -131,7 +134,8 @@ class external extends external_api {
'component' => $component,
'template' => $template,
'themename' => $themename,
'includecomments' => $includecomments
'includecomments' => $includecomments,
'lang' => $lang
]
);
......@@ -141,7 +145,10 @@ class external extends external_api {
$params['component'],
$params['template'],
$params['themename'],
$params['includecomments']
$params['includecomments'],
[],
[],
$params['lang']
);
$formatdependencies = function($dependency) {
$results = [];
......
......@@ -138,6 +138,7 @@ class mustache_template_source_loader {
* @param bool $includecomments If the comments should be stripped from the source before returning
* @param array $seentemplates List of templates already processed / to be skipped.
* @param array $seenstrings List of strings already processed / to be skipped.
* @param string|null $lang moodle translation language, null means use current.
* @return array
*/
public function load_with_dependencies(
......@@ -146,7 +147,8 @@ class mustache_template_source_loader {
string $themename,
bool $includecomments = false,
array $seentemplates = [],
array $seenstrings = []
array $seenstrings = [],
string $lang = null
) : array {
// Initialise the return values.
$templates = [];
......@@ -200,8 +202,8 @@ class mustache_template_source_loader {
$seenstrings,
// Include $strings and $seenstrings by reference so that their values can be updated
// outside of this anonymous function.
function($component, $id) use ($save, &$strings, &$seenstrings) {
$string = get_string($id, $component);
function($component, $id) use ($save, &$strings, &$seenstrings, $lang) {
$string = get_string_manager()->get_string($id, $component, null, $lang);
// Save the string in the $strings results array.
list($strings, $seenstrings) = $save($strings, $seenstrings, $component, $id, $string);
}
......
......@@ -17,6 +17,8 @@ attribute on forms to avoid collisions in forms loaded in AJAX requests.
This will allow queries to remain backwards-compatible with older versions of Moodle but will have significantly better performance in version supporting the innerjoin parameter.
* /message/defaultoutputs.php file and admin_page_defaultmessageoutputs class have been deprecated
and all their settings moved to admin/message.php (see MDL-64495). Please use admin_page_managemessageoutputs class instead.
* A new parameter $lang has been added to mustache_template_source_loader->load_with_dependencies() method
so it is possible for Mustache to request string in a specific language.
=== 3.6 ===
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment