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.
// 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));
}));
}
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));
}));
}
// 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
});