diff --git a/ayanova/src/api/translation.js b/ayanova/src/api/translation.js index 25c9366e..7684c066 100644 --- a/ayanova/src/api/translation.js +++ b/ayanova/src/api/translation.js @@ -27,16 +27,21 @@ export default { }); } else { //gather up the keys that are cached and fetch the latest and then replace them - console.log("STUB:translation:updateCache"); + let needIt = []; + window.$gz._.forOwn(window.$gz.store.state.translationText, function( + cacheval, + cachekey + ) { + needIt.push(cachekey); + }); + //fetch these keys + let transData = await window.$gz.api.upsert("translation/subset", needIt); + transData.data.forEach(function commitFetchedTranslationItemToStore( + item + ) { + window.$gz.store.commit("setTranslationText", item); + }); } - - //if editedTranslation is empty that means just fetch the existing ones freshly again - //refetch all the keys and update - //if edited translation is not empty that means update cache from the editedTranslation if it's the same one as is currently in use - //check if current translation is the same one passed in - //if it is, update all the currently cached local keys with the copy passed - - //TODO: call this from translation editor if same (add fetch for in use translation for editor initform) and from local settings on change of translation }, get(key) { //no translation for Wiki