feat: add i18n to history import and export

This commit is contained in:
Bnyro
2025-01-09 14:22:27 +01:00
parent 9dbe6c557b
commit 9352e96d9c
4 changed files with 26 additions and 12 deletions

View File

@@ -1,10 +1,10 @@
<template>
<ModalComponent>
<div class="min-w-max flex flex-col">
<h2 class="mb-4 text-center text-xl font-bold">Export History</h2>
<h2 v-t="'actions.export_history'" class="mb-4 text-center text-xl font-bold" />
<form>
<div>
<label class="mr-2" for="export-format">Export as:</label>
<label v-t="'actions.file_format'" class="mr-2" for="export-format" />
<select id="export-format" v-model="exportAs" class="select">
<option
v-for="option in exportOptions"
@@ -27,7 +27,7 @@
</label>
</div>
</form>
<button class="btn mt-4" @click="handleExport">Export</button>
<button class="btn mt-4" @click="handleExport" v-text="$t('actions.export_history')" />
</div>
</ModalComponent>
</template>

View File

@@ -5,8 +5,8 @@
<div class="flex flex-col gap-2 md:flex-row md:items-center">
<button v-t="'actions.clear_history'" class="btn" @click="clearHistory" />
<button v-t="'actions.export_to_json'" class="btn" @click="showExportModal = !showExportModal" />
<button v-t="'actions.import_from_json'" class="btn" @click="showImportModal = !showImportModal" />
<button v-t="'actions.export_history'" class="btn" @click="showExportModal = !showExportModal" />
<button v-t="'actions.import_history'" class="btn" @click="showImportModal = !showImportModal" />
</div>
<div class="flex items-center gap-1">

View File

@@ -1,28 +1,34 @@
<template>
<ModalComponent>
<div class="text-center">
<h2 class="mb-4 text-center text-xl font-bold">Import History</h2>
<h2 v-t="'actions.import_history'" class="mb-4 text-center text-xl font-bold" />
<form>
<br />
<div>
<input ref="fileSelector" class="btn mb-2 ml-2" type="file" @change="fileChange" />
</div>
<div>
<strong v-text="`Found ${itemsLength} items`" />
<strong
><i18n-t keypath="info.found_n_items">{{ itemsLength }}</i18n-t></strong
>
</div>
<div>
<strong class="flex items-center justify-center gap-2">
Override: <input v-model="override" class="checkbox" type="checkbox" />
<span v-t="'actions.override'" />: <input v-model="override" class="checkbox" type="checkbox" />
</strong>
</div>
<br />
<div>
<progress :value="index" :max="itemsLength" />
<div v-text="`Success: ${success} Error: ${error} Skipped: ${skipped}`" />
<div
v-text="
`${$t('info.success')}: ${success} ${$t('info.error')}: ${error} ${$t('info.skipped')}: ${skipped}`
"
/>
</div>
<br />
<div>
<a class="btn w-auto" @click="handleImport">Import</a>
<a class="btn w-auto" @click="handleImport" v-text="$t('actions.import_history')" />
</div>
</form>
</div>