Clarify widget save translation action
This commit is contained in:
+27
-1
@@ -493,7 +493,18 @@ function widgetCopyForAdmin(settings, language) {
|
||||
placeholder: settings.placeholder?.[lang],
|
||||
sendLabel: settings.sendLabel?.[lang]
|
||||
};
|
||||
return { ...defaultWidgetCopy(lang), ...legacy, ...copy };
|
||||
return normalizeWidgetCopyForAdmin({ ...defaultWidgetCopy(lang), ...legacy, ...copy }, lang);
|
||||
}
|
||||
|
||||
function normalizeWidgetCopyForAdmin(copy, language) {
|
||||
if (language !== "cs") return copy;
|
||||
const defaults = defaultWidgetCopy("cs");
|
||||
const legacy = legacyCzechWidgetCopy();
|
||||
const normalized = { ...copy };
|
||||
for (const field of Object.keys(legacy)) {
|
||||
if (normalized[field] === legacy[field]) normalized[field] = defaults[field];
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
function defaultWidgetCopy(language) {
|
||||
@@ -525,6 +536,21 @@ function defaultWidgetCopy(language) {
|
||||
};
|
||||
}
|
||||
|
||||
function legacyCzechWidgetCopy() {
|
||||
return {
|
||||
title: "Potrebujete poradit?",
|
||||
intro: "Napiste nam. Odpovime co nejdrive.",
|
||||
offlineIntro: "Ted nejsme online, ale zpravu nam muzete nechat.",
|
||||
placeholder: "Napiste zpravu...",
|
||||
sendLabel: "Odeslat",
|
||||
dropzoneLabel: "Pridat fotku nebo pretahnout",
|
||||
onlineLabel: "Jsme online",
|
||||
newReplyLabel: "Nova odpoved",
|
||||
infoText: "Zpravu a technicke udaje relace zpracujeme jen pro odpoved na vas dotaz.",
|
||||
operatorReplyLabel: "odpovida"
|
||||
};
|
||||
}
|
||||
|
||||
function syncLegacyWidgetCopy(settings) {
|
||||
settings.title = settings.title || {};
|
||||
settings.intro = settings.intro || {};
|
||||
|
||||
Reference in New Issue
Block a user