diff --git a/profile.php b/profile.php index 8f1105b..531f5c6 100644 --- a/profile.php +++ b/profile.php @@ -196,7 +196,9 @@ $data['lockreason'] = format_text($data['lockreason']); $tabs = new tabs($url); -$data['lang'] = get_config('core', 'lang'); +// JavaScript locale string. Arguably "localecldr/langconfig" would be a better +// choice, but it's not present in Totara langpacks. +$data['locale'] = get_string('iso6391', 'langconfig'); $data['course'] = helper::course_display_link($data['courseid']); diff --git a/templates/flamegraph.mustache b/templates/flamegraph.mustache index 988e344..cb733f4 100644 --- a/templates/flamegraph.mustache +++ b/templates/flamegraph.mustache @@ -27,12 +27,12 @@ Context variables required for this template: * id - The id of the profile - * lang - Language setting + * locale - Language setting (a BCP 47 language tag) Example context (json): { "id" : 3, - "lang" : "en" + "locale" : "en" } }} @@ -73,7 +73,7 @@ function displaysamplestats(d) { } const percentage = ((d.x1 - d.x0) * 100).toFixed(3); - const samplecount = d.value.toLocaleString("{{lang}}"); + const samplecount = d.value.toLocaleString("{{locale}}"); return d.data.name + ` (${percentage}%, ${samplecount} {{#str}} samples, tool_excimer {{/str}}, {{#str}} duration, tool_excimer {{/str}} ~ ${durationstr}})`; } diff --git a/templates/memoryusagegraph.mustache b/templates/memoryusagegraph.mustache index 766c41d..8eb2894 100644 --- a/templates/memoryusagegraph.mustache +++ b/templates/memoryusagegraph.mustache @@ -27,10 +27,12 @@ Context variables required for this template: * id - The id of the profile + * locale - Language setting (a BCP 47 language tag) Example context (json): { - "id" : 3 + "id" : 3, + "locale": "en" } }} @@ -177,7 +179,7 @@ function processGraph(id, data) { .attr("cx", function(d) { return x(d.sampleindex); }) .attr("cy", function(d) { return y(d.value); }) .on("mouseover", function(event, d) { - const sampleindex = d.sampleindex.toLocaleString('{{lang}}'); + const sampleindex = d.sampleindex.toLocaleString('{{locale}}'); div.transition() .duration(200) .style("opacity", .9);