1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-02 20:15:24 +02:00

chore: make vue global components and layouts localizable (#1565)

This commit is contained in:
Philipp Fischbeck 2022-08-15 23:55:51 +02:00 committed by GitHub
parent 7af48d51be
commit ba15006bb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 193 additions and 153 deletions

View file

@ -28,7 +28,7 @@
:prepend-inner-icon="$globals.icons.search"
background-color="primary lighten-1"
color="white"
placeholder="Press '/'"
:placeholder="$t('search.search-hint')"
>
</v-text-field>
</div>

View file

@ -8,7 +8,9 @@
<v-list-item-content>
<v-list-item-title> {{ $auth.user.fullName }}</v-list-item-title>
<v-list-item-subtitle>
<NuxtLink class="favorites-link" :to="`/user/${$auth.user.id}/favorites`"> Favorite Recipes </NuxtLink>
<NuxtLink class="favorites-link" :to="`/user/${$auth.user.id}/favorites`">
{{ $t("user.favorite-recipes") }}
</NuxtLink>
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>

View file

@ -22,14 +22,14 @@
@blur="on.blur"
>
<v-icon>{{ $globals.icons.contentCopy }}</v-icon>
{{ icon ? "" : "Copy" }}
{{ icon ? "" : $t("general.copy") }}
</v-btn>
</template>
<span>
<v-icon left dark>
{{ $globals.icons.clipboardCheck }}
</v-icon>
<slot> {{ $t("general.copied") }}! </slot>
<slot> {{ $t("general.copied_message") }} </slot>
</span>
</v-tooltip>
</template>
@ -42,7 +42,7 @@ export default defineComponent({
props: {
copyText: {
type: String,
default: "Default Copy Text",
required: true,
},
color: {
type: String,
@ -81,10 +81,9 @@ export default defineComponent({
show,
copyToolTip,
textToClipboard,
}
};
},
});
</script>
<style lang="scss" scoped>
</style>
<style lang="scss" scoped></style>

View file

@ -129,7 +129,9 @@
</div>
<v-card-actions>
<v-spacer />
<BaseButton small @click="value[inputField.varName].push(getTemplate(inputField.items))"> New </BaseButton>
<BaseButton small @click="value[inputField.varName].push(getTemplate(inputField.items))">
{{ $t("general.new") }}
</BaseButton>
</v-card-actions>
</div>
</v-col>

View file

@ -1,14 +1,13 @@
<template>
<v-alert border="left" colored-border type="warning" elevation="2" :icon="$globals.icons.alert">
<b>Experimental Feature</b>
<div>This page contains experimental or still-baking features. Please excuse the mess.</div>
<b>{{ $t("banner-experimental.title") }}</b>
<div>{{ $t("banner-experimental.description") }}</div>
<div v-if="issue != ''" class="py-2">
<a :href="issue" target="_blank"> Track our progress here</a>
<a :href="issue" target="_blank">{{ $t("banner-experimental.issue-link-text") }}</a>
</div>
</v-alert>
</template>
<script lang="ts">
export default {
props: {
@ -19,4 +18,4 @@ export default {
},
},
};
</script>
</script>

View file

@ -109,40 +109,40 @@ export default defineComponent({
},
},
setup(props) {
const { $globals } = useContext();
const { $globals, i18n } = useContext();
const buttonOptions = {
create: {
text: "Create",
text: i18n.t("general.create"),
icon: $globals.icons.createAlt,
color: "success",
},
update: {
text: "Update",
text: i18n.t("general.update"),
icon: $globals.icons.edit,
color: "success",
},
save: {
text: "Save",
text: i18n.t("general.save"),
icon: $globals.icons.save,
color: "success",
},
edit: {
text: "Edit",
text: i18n.t("general.edit"),
icon: $globals.icons.edit,
color: "info",
},
delete: {
text: "Delete",
text: i18n.t("general.delete"),
icon: $globals.icons.delete,
color: "error",
},
cancel: {
text: "Cancel",
text: i18n.t("general.cancel"),
icon: $globals.icons.close,
color: "grey",
},
download: {
text: "Download",
text: i18n.t("general.download"),
icon: $globals.icons.download,
color: "info",
},
@ -189,13 +189,11 @@ export default defineComponent({
return buttonStyles.defaults;
});
const api = useUserApi();
function downloadFile() {
api.utils.download(props.downloadUrl);
}
return {
btnAttrs,
btnStyle,

View file

@ -1,4 +1,3 @@
<template>
<v-card
color="background"
@ -30,7 +29,7 @@ export default defineComponent({
props: {
title: {
type: String,
default: "Place Holder",
required: true,
},
icon: {
type: String,

View file

@ -102,6 +102,7 @@ export default defineComponent({
},
submitText: {
type: String,
// TODO Figure out how to localize this default value
default: () => "Create",
},
keepOpen: {

View file

@ -1,4 +1,4 @@
<template>
<template>
<v-menu offset-y>
<template #activator="{ on, attrs }">
<v-btn color="primary" v-bind="{ ...attrs, ...$attrs }" :class="btnClass" :disabled="disabled" v-on="on">
@ -94,6 +94,7 @@ export default defineComponent({
btnText: {
type: String,
required: false,
// TODO Figure out how to localize this default value
default: "Actions",
},
},
@ -115,7 +116,7 @@ export default defineComponent({
function setValue(v: MenuItem) {
context.emit(INPUT_EVENT, v.value);
activeObj.value = v;
activeObj.value = v;
}
return {
@ -127,6 +128,3 @@ export default defineComponent({
},
});
</script>

View file

@ -20,7 +20,7 @@ export default defineComponent({
},
text: {
type: String,
default: "Link",
required: true,
},
icon: {
type: String,
@ -28,4 +28,4 @@ export default defineComponent({
},
},
});
</script>
</script>

View file

@ -37,7 +37,7 @@
<slot name="button-row"> </slot>
</v-card-actions>
<div class="mx-2 clip-width">
<v-text-field v-model="search" :label="$tc('search.search')"></v-text-field>
<v-text-field v-model="search" :label="$t('search.search')"></v-text-field>
</div>
<v-data-table
v-model="selected"
@ -57,12 +57,12 @@
:buttons="[
{
icon: $globals.icons.edit,
text: 'Edit',
text: $t('general.edit'),
event: 'edit',
},
{
icon: $globals.icons.delete,
text: 'Delete',
text: $t('general.delete'),
event: 'delete',
},
]"
@ -77,7 +77,7 @@
<template #icon>
{{ $globals.icons.download }}
</template>
{{ $tc("general.download") }}
{{ $t("general.download") }}
</BaseButton>
</v-card-actions>
</div>

View file

@ -1,5 +1,5 @@
<template>
<v-text-field v-model="inputVal" label="Color">
<v-text-field v-model="inputVal" :label="$t('general.color')">
<template #prepend>
<v-btn class="elevation-0" small height="30px" width="30px" :color="inputVal || 'grey'" @click="setRandomHex">
<v-icon color="white">
@ -63,4 +63,4 @@ export default defineComponent({
};
},
});
</script>
</script>

View file

@ -3,7 +3,7 @@
<v-text-field
v-model.number="quantity"
hide-details
label="Qty"
:label="$t('form.quantity-label-abbreviated')"
:min="min"
:max="max"
type="number"
@ -21,10 +21,6 @@ import { computed, defineComponent } from "@nuxtjs/composition-api";
export default defineComponent({
name: "VInputNumber",
props: {
label: {
type: String,
default: "Qty",
},
min: {
type: Number,
default: 0,
@ -61,4 +57,4 @@ export default defineComponent({
};
},
});
</script>
</script>

View file

@ -5,7 +5,7 @@
:buttons="[
{
icon: previewState ? $globals.icons.edit : $globals.icons.eye,
text: previewState ? $tc('general.edit') : 'Preview Markdown',
text: previewState ? $t('general.edit') : $t('markdown-editor.preview-markdown-button-label'),
event: 'toggle',
},
]"

View file

@ -25,7 +25,7 @@
</template>
<script lang="ts">
import { defineComponent, useRouter } from "@nuxtjs/composition-api";
import { defineComponent, useContext, useRouter } from "@nuxtjs/composition-api";
import { ReportSummary } from "~/types/api-types/reports";
export default defineComponent({
@ -38,13 +38,14 @@ export default defineComponent({
setup(_, context) {
const router = useRouter();
const { i18n } = useContext();
const headers = [
{ text: "Category", value: "category" },
{ text: "Name", value: "name" },
{ text: "Timestamp", value: "timestamp" },
{ text: "Status", value: "status" },
{ text: "Delete", value: "actions" },
{ text: i18n.t("category.category"), value: "category" },
{ text: i18n.t("general.name"), value: "name" },
{ text: i18n.t("general.timestamp"), value: "timestamp" },
{ text: i18n.t("general.status"), value: "status" },
{ text: i18n.t("general.delete"), value: "actions" },
];
function handleRowClick(item: ReportSummary) {