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> <template>
<ModalComponent> <ModalComponent>
<div class="min-w-max flex flex-col"> <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> <form>
<div> <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"> <select id="export-format" v-model="exportAs" class="select">
<option <option
v-for="option in exportOptions" v-for="option in exportOptions"
@ -27,7 +27,7 @@
</label> </label>
</div> </div>
</form> </form>
<button class="btn mt-4" @click="handleExport">Export</button> <button class="btn mt-4" @click="handleExport" v-text="$t('actions.export_history')" />
</div> </div>
</ModalComponent> </ModalComponent>
</template> </template>

View File

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

View File

@ -1,28 +1,34 @@
<template> <template>
<ModalComponent> <ModalComponent>
<div class="text-center"> <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> <form>
<br /> <br />
<div> <div>
<input ref="fileSelector" class="btn mb-2 ml-2" type="file" @change="fileChange" /> <input ref="fileSelector" class="btn mb-2 ml-2" type="file" @change="fileChange" />
</div> </div>
<div> <div>
<strong v-text="`Found ${itemsLength} items`" /> <strong
><i18n-t keypath="info.found_n_items">{{ itemsLength }}</i18n-t></strong
>
</div> </div>
<div> <div>
<strong class="flex items-center justify-center gap-2"> <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> </strong>
</div> </div>
<br /> <br />
<div> <div>
<progress :value="index" :max="itemsLength" /> <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> </div>
<br /> <br />
<div> <div>
<a class="btn w-auto" @click="handleImport">Import</a> <a class="btn w-auto" @click="handleImport" v-text="$t('actions.import_history')" />
</div> </div>
</form> </form>
</div> </div>

View File

@ -163,7 +163,11 @@
"creator_liked": "Creator liked", "creator_liked": "Creator liked",
"playback_speed": "Playback speed", "playback_speed": "Playback speed",
"invalid_input": "Invalid input", "invalid_input": "Invalid input",
"prefer_hls": "Prefer HLS over DASH" "prefer_hls": "Prefer HLS over DASH",
"export_history": "Export history",
"import_history": "Import history",
"file_format": "File format",
"override": "Override"
}, },
"comment": { "comment": {
"pinned_by": "Pinned by {author}", "pinned_by": "Pinned by {author}",
@ -232,6 +236,10 @@
"weeks": "{amount} week(s)", "weeks": "{amount} week(s)",
"months": "{amount} month(s)", "months": "{amount} month(s)",
"register_note": "Register an account for this Piped instance. This will allow you to sync your subscriptions and playlists with your account, so they're stored on the server side. You can use all features without an account, but all data will be stored in your browser's local cache. Please make sure you do NOT use an email address as your username and choose a secure password that you do not use elsewhere.", "register_note": "Register an account for this Piped instance. This will allow you to sync your subscriptions and playlists with your account, so they're stored on the server side. You can use all features without an account, but all data will be stored in your browser's local cache. Please make sure you do NOT use an email address as your username and choose a secure password that you do not use elsewhere.",
"login_note": "Log in with an account created on this instance." "login_note": "Log in with an account created on this instance.",
"found_n_items": "Found {0} items",
"success": "Success",
"error": "Error",
"skipped": "Skipped"
} }
} }