mirror of
https://github.com/directus/directus.git
synced 2026-01-30 14:58:07 -05:00
Prevent vue-i18n special characters causing error (#11287)
This commit is contained in:
@@ -75,10 +75,13 @@ export const useFieldsStore = defineStore({
|
||||
for (let i = 0; i < field.meta.translations.length; i++) {
|
||||
const { language, translation } = field.meta.translations[i];
|
||||
|
||||
// Interpolate special characters in vue-i18n to prevent parsing error. Ref #11287
|
||||
const literalInterpolatedTranslation = translation.replace(/([{}@$|])/g, "{'$1'}");
|
||||
|
||||
i18n.global.mergeLocaleMessage(language, {
|
||||
fields: {
|
||||
[field.collection]: {
|
||||
[field.field]: translation,
|
||||
[field.field]: literalInterpolatedTranslation,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user