i18n
Five locales are built in: en, es, fr, pt, nl. Set locale prop to switch.
To override individual strings, pass messages with only the keys you want to change. The rest fall back to the built-in locale strings.
vue
<script setup lang="ts">
import type { MessagesOverride, Locale } from "@dazzadev/vue-sheet-mapper";
const locale = ref<Locale>("es");
const messages: MessagesOverride = {
dropzone: {
title: "Sube aquí tu archivo de contactos",
button: "Seleccionar archivo",
},
confirm: "Importar contactos",
};
</script>
<template>
<SheetMapper :fields="fields" :locale="locale" :messages="messages" />
</template>Per-locale overrides
If your app supports multiple languages, define overrides per locale and pass the active one:
typescript
import type { MessagesOverride, Locale } from "@dazzadev/vue-sheet-mapper";
const customMessages: Partial<Record<Locale, MessagesOverride>> = {
es: {
dropzone: { title: "Sube tu archivo de contactos" },
confirm: "Importar contactos",
},
en: {
dropzone: { title: "Upload your contacts file" },
confirm: "Import contacts",
},
};vue
<SheetMapper :locale="locale" :messages="customMessages[locale]" />All overridable strings
typescript
interface MessagesOverride {
dropzone?: Partial<{
title: string; // "Upload a file to import"
subtitle: string; // "Drag and drop a CSV, XLS or XLSX file here"
button: string; // "Choose a file"
changeFile: string; // "Choose another file"
}>;
columns?: Partial<{
toggleHasHeaders: string; // "This file does not include headers"
toggleNoHeaders: string; // "This file includes headers"
unassigned: string; // "Choose a column"
ignored: string; // "Ignored"
changeColumn: string; // "Change this column"
ignoreColumn: string; // "Ignore this column"
columnLabel: string; // "Data in column"
selectPlaceholder: string; // "Select a field..."
ignoreOption: string; // "Ignore"
columnFallback: string; // "Column {n}" — used when file has no headers
}>;
confirm?: string; // "Confirm"
loading?: string; // "Loading…"
errors?: Partial<{
title: string; // "Error"
noFile: string;
invalidFileType: string;
fileReadError: string;
noWorksheet: string;
emptyWorksheet: string;
unassignedColumns: string;
missingRequiredFields: string;
fileTooLarge: string; // supports {size} placeholder
tooManyRows: string; // supports {max} placeholder
dismiss: string; // aria-label for the error dismiss button
}>;
}