From 08e4aad52ac5465af31dbc265e2b0ea849a955c2 Mon Sep 17 00:00:00 2001 From: Siju Moncy <72241997+sijumoncy@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:01:04 +0530 Subject: [PATCH] fix for localized name remove on edit (#291) --- renderer/src/core/burrito/createTranslationSB.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/renderer/src/core/burrito/createTranslationSB.js b/renderer/src/core/burrito/createTranslationSB.js index d48680539..3fe19c45c 100644 --- a/renderer/src/core/burrito/createTranslationSB.js +++ b/renderer/src/core/burrito/createTranslationSB.js @@ -18,7 +18,7 @@ call, update, ) => { logger.debug('createTranslationSB.js', 'In createTranslationSB'); - const localizedNames = {}; + let localizedNames = {}; return new Promise((resolve) => { let json = {}; if (call === 'edit') { @@ -54,9 +54,19 @@ update, } else { json.copyright.licenses[0].ingredient = 'license.md'; } + + if (call === 'edit') { + localizedNames = JSON.parse(JSON.stringify(json.localizedNames)); + Object.keys(json.type.flavorType.currentScope).forEach((scope) => { + if (!localizedNames[scope]) { + localizedNames[scope] = burrito.localizedNames[scope]; + } + }); + } + selectedScope.forEach((scope) => { json.type.flavorType.currentScope[scope] = []; - localizedNames[scope] = json.localizedNames[scope]; + localizedNames[scope] = burrito.localizedNames[scope]; }); json.localizedNames = localizedNames; logger.debug('createTranslationSB.js', 'Created the Translation SB');