This commit is contained in:
@@ -438,7 +438,7 @@ export default {
|
||||
return (
|
||||
!!obj &&
|
||||
(keyParts.length > 1
|
||||
? has(obj[key.split(".")[0]], keyParts.slice(1).join("."))
|
||||
? this.has(obj[key.split(".")[0]], keyParts.slice(1).join("."))
|
||||
: hasOwnProperty.call(obj, key))
|
||||
);
|
||||
},
|
||||
|
||||
@@ -12,33 +12,52 @@ export default {
|
||||
|
||||
if (editedTranslation) {
|
||||
//iterate the keys that are cached and set them from whatever is in editedTranslation for that key
|
||||
window.$gz._.forOwn(window.$gz.store.state.translationText, function(
|
||||
cacheval,
|
||||
cachekey
|
||||
) {
|
||||
//find match
|
||||
//de-lodash
|
||||
// let display = window.$gz. _.find(editedTranslation.translationItems, {
|
||||
// key: cachekey
|
||||
// }).display;
|
||||
let display = editedTranslation.translationItems.find(
|
||||
z => z.key == cachekey
|
||||
).display;
|
||||
|
||||
//de-lodash
|
||||
// window.$gz._.forOwn(window.$gz.store.state.translationText, function(
|
||||
// cacheval,
|
||||
// cachekey
|
||||
// ) {
|
||||
// //find match
|
||||
// //de-lodash
|
||||
// // let display = window.$gz. _.find(editedTranslation.translationItems, {
|
||||
// // key: cachekey
|
||||
// // }).display;
|
||||
// let display = editedTranslation.translationItems.find(
|
||||
// z => z.key == cachekey
|
||||
// ).display;
|
||||
|
||||
// window.$gz.store.commit("setTranslationText", {
|
||||
// key: cachekey,
|
||||
// value: display
|
||||
// });
|
||||
// });
|
||||
|
||||
for (const [key, value] of Object.entries(window.$gz.type)) {
|
||||
let display = editedTranslation.translationItems.find(z => z.key == key)
|
||||
.display;
|
||||
|
||||
window.$gz.store.commit("setTranslationText", {
|
||||
key: cachekey,
|
||||
value: display
|
||||
key: key,
|
||||
value: value
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
//gather up the keys that are cached and fetch the latest and then replace them
|
||||
let needIt = [];
|
||||
window.$gz._.forOwn(window.$gz.store.state.translationText, function(
|
||||
cacheval,
|
||||
cachekey
|
||||
) {
|
||||
needIt.push(cachekey);
|
||||
|
||||
//de-lodash
|
||||
// window.$gz._.forOwn(window.$gz.store.state.translationText, function(
|
||||
// cacheval,
|
||||
// cachekey
|
||||
// ) {
|
||||
// needIt.push(cachekey);
|
||||
// });
|
||||
|
||||
Object.keys(window.$gz.store.state.translationText).forEach(z => {
|
||||
needIt.push(z);
|
||||
});
|
||||
|
||||
//fetch these keys
|
||||
let transData = await window.$gz.api.upsert("translation/subset", needIt);
|
||||
transData.data.forEach(function commitFetchedTranslationItemToStore(
|
||||
|
||||
Reference in New Issue
Block a user