Changed Localization to JSON String
This commit is contained in:
@@ -7,14 +7,16 @@ import {
|
||||
getLanguageName,
|
||||
normalizeColor,
|
||||
formatDuration,
|
||||
parseLocalizedString,
|
||||
serializeLocalizedString,
|
||||
} from "./melodyUtils";
|
||||
|
||||
const MELODY_TYPES = ["orthodox", "catholic", "all"];
|
||||
const MELODY_TONES = ["normal", "festive", "cheerful", "lamentation"];
|
||||
|
||||
const defaultInfo = {
|
||||
name: {},
|
||||
description: {},
|
||||
name: "",
|
||||
description: "",
|
||||
melodyTone: "normal",
|
||||
customTags: [],
|
||||
minSpeed: 0,
|
||||
@@ -155,7 +157,9 @@ export default function MelodyForm() {
|
||||
|
||||
// Update a localized field for the current edit language
|
||||
const updateLocalizedField = (fieldKey, text) => {
|
||||
updateInfo(fieldKey, { ...information[fieldKey], [editLang]: text });
|
||||
const dict = parseLocalizedString(information[fieldKey]);
|
||||
dict[editLang] = text;
|
||||
updateInfo(fieldKey, serializeLocalizedString(dict));
|
||||
};
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
@@ -836,8 +840,8 @@ export default function MelodyForm() {
|
||||
setTranslationModal((prev) => ({ ...prev, open: false }))
|
||||
}
|
||||
field={translationModal.field}
|
||||
value={information[translationModal.fieldKey] || {}}
|
||||
onChange={(updated) => updateInfo(translationModal.fieldKey, updated)}
|
||||
value={parseLocalizedString(information[translationModal.fieldKey])}
|
||||
onChange={(updated) => updateInfo(translationModal.fieldKey, serializeLocalizedString(updated))}
|
||||
languages={languages}
|
||||
multiline={translationModal.multiline}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user