MDL-62497 js: Pass strings through get_string
authorAndrew Nicols <andrew@nicols.co.uk>
Sun, 21 Jul 2019 04:39:22 +0000 (12:39 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Sun, 21 Jul 2019 07:06:25 +0000 (15:06 +0800)
lib/amd/build/str.min.js
lib/amd/build/str.min.js.map
lib/amd/src/str.js

index 45da245..fc1e1a0 100644 (file)
Binary files a/lib/amd/build/str.min.js and b/lib/amd/build/str.min.js differ
index 48670ed..40e3262 100644 (file)
Binary files a/lib/amd/build/str.min.js.map and b/lib/amd/build/str.min.js.map differ
index e0ce6ea..7f46e2c 100644 (file)
@@ -63,7 +63,7 @@ export const get_strings = (requests) => {
 
     const stringPromises = requests.map((request) => {
         const cacheKey = getCacheKey(request);
-        const {component, key, lang} = request;
+        const {component, key, param, lang} = request;
         // Helper function to add the promise to cache.
         const buildReturn = (promise) => {
             // Make sure the promise cache contains our promise.
@@ -74,7 +74,7 @@ export const get_strings = (requests) => {
         // Check if we can serve the string straight from M.str.
         if (component in M.str && key in M.str[component]) {
             return buildReturn(new Promise((resolve) => {
-                resolve(M.str[component][key]);
+                resolve(M.util.get_string(key, component, param, lang));
             }));
         }
 
@@ -83,7 +83,7 @@ export const get_strings = (requests) => {
         if (cached) {
             M.str[component] = {...M.str[component], [key]: cached};
             return buildReturn(new Promise((resolve) => {
-                resolve(M.str[component][key]);
+                resolve(M.util.get_string(key, component, param, lang));
             }));
         }
 
@@ -108,7 +108,7 @@ export const get_strings = (requests) => {
                         // local storage before resolving this promise.
                         M.str[component] = {...M.str[component], [key]: str};
                         LocalStorage.set(cacheKey, str);
-                        resolve(str);
+                        resolve(M.util.get_string(key, component, param, lang));
                     },
                     fail: reject
                 });