Skip to content

Commit

Permalink
feat: add i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
caro3801 committed Jul 26, 2024
1 parent 521b0a0 commit cb90c54
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 16 deletions.
85 changes: 70 additions & 15 deletions src/components/Document/DocumentUserActions/DocumentUserActions.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
<template>
<b-button-group class="document-user-actions">
<document-user-actions-entry v-if="showTags" :hide-label="hideLabels" icon="tag" label="Tags" value="3+" />
<document-user-actions-entry
v-if="showComments"
v-for="action in actionsDisplayed"
:key="action.name"
:hide-label="hideLabels"
icon="chats-teardrop"
label="Comments"
value="3+"
:icon="action.icon"
:label="action.label"
:value="action.value"
/>
<document-user-actions-entry
v-if="showRecommended"
:hide-label="hideLabels"
icon="user-gear"
label="Recommended by"
value="3+"
/>
<document-user-actions-entry v-if="showFolders" :hide-label="hideLabels" icon="folder" label="Folder" value="3+" />
<document-user-actions-entry v-if="showNotes" :hide-label="hideLabels" icon="note-blank" label="Notes" value="3+" />
</b-button-group>
</template>
<script setup>
import { useI18n } from 'vue-i18n'
import { computed } from 'vue'
import DocumentUserActionsEntry from '@/components/Document/DocumentUserActions/DocumentUserActionsEntry'
defineOptions({ name: 'DocumentUserActions' })
defineProps({
const props = defineProps({
showTags: {
type: Boolean,
default: true
Expand All @@ -46,6 +40,67 @@ defineProps({
hideLabels: {
type: Boolean,
default: false
},
tags: {
type: Number,
default: 0
},
comments: {
type: Number,
default: 0
},
recommended: {
type: Number,
default: 0
},
folders: {
type: Number,
default: 0
},
notes: {
type: Number,
default: 0
}
})
const { t } = useI18n()
const actions = [
{
name: 'tags',
show: props.showTags,
label: t('documentUserActions.tags'),
value: props.tags.toString(),
icon: 'tag'
},
{
name: 'comments',
show: props.showComments,
label: t('documentUserActions.comments'),
value: props.comments.toString(),
icon: 'chats-teardrop'
},
{
name: 'recommended',
show: props.showRecommended,
label: t('documentUserActions.recommended'),
value: props.recommended.toString(),
icon: 'user-gear'
},
{
name: 'folders',
show: props.showFolders,
label: t('documentUserActions.folders'),
value: props.folders.toString(),
icon: 'folder'
},
{
name: 'notes',
show: props.showNotes,
label: t('documentUserActions.notes'),
value: props.notes.toString(),
icon: 'note-blank'
}
]
const actionsDisplayed = computed(() => {
return actions.filter((action) => action.show === true)
})
</script>
7 changes: 7 additions & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@
"previous": "Previous",
"next": "Next"
},
"documentUserActions": {
"tags":"Tags",
"comments":"Comments",
"recommended":"Recommended by",
"folders":"Folders",
"notes":"Notes"
},
"documentMetadataActions": {
"copy": "Copy this metadata value",
"search": "Search this metadata value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export const Complete = {
showComments: true,
showRecommended: true,
showFolders: true,
showNotes: true
showNotes: true,
tags: '3',
comments: '4',
recommended: '0',
folders: '5',
notes: '3'
}
}

0 comments on commit cb90c54

Please sign in to comment.