MDL-52486 JavaScript: Make sure lang codes use underscores.
authorCameron Ball <cameron@moodle.com>
Mon, 11 Jan 2016 07:23:29 +0000 (15:23 +0800)
committerCameron Ball <cameron@moodle.com>
Mon, 11 Jan 2016 07:23:29 +0000 (15:23 +0800)
In some cases, underscores in lang codes get replaced with dashes
which causes some JavaScript to be unhappy. This patch simply reverse
the underscore to dash replacement on the JS side.

lib/amd/build/str.min.js
lib/amd/src/str.js

index 33d26c9..d1e7660 100644 (file)
Binary files a/lib/amd/build/str.min.js and b/lib/amd/build/str.min.js differ
index 76830d3..c62ca7c 100644 (file)
@@ -96,7 +96,7 @@ define(['jquery', 'core/ajax', 'core/localstorage'], function($, ajax, storage)
             for (i = 0; i < requests.length; i++) {
                 request = requests[i];
                 if (typeof request.lang === "undefined") {
-                    request.lang = $('html').attr('lang');
+                    request.lang = $('html').attr('lang').replace('-', '_');
                 }
                 if (typeof M.str[request.component] === "undefined" ||
                         typeof M.str[request.component][request.key] === "undefined") {