diff --git a/komga-webui/src/components/dialogs/EditBooksDialog.vue b/komga-webui/src/components/dialogs/EditBooksDialog.vue index 167e59ac..b8e043c5 100644 --- a/komga-webui/src/components/dialogs/EditBooksDialog.vue +++ b/komga-webui/src/components/dialogs/EditBooksDialog.vue @@ -176,8 +176,8 @@ :key="i" > - {{ $_.capitalize(role.plural) }} - {{ $_.capitalize(role.name) }} + { - x.plural = this.$t(`author_roles.${x.role}`) - return x - }) + authorRoles(): NameValue[] { + return authorRoles.map((x: string) => ({ + name: this.$t(`author_roles.${x}`).toString(), + value: x, + })) }, single(): boolean { return !Array.isArray(this.books) diff --git a/komga-webui/src/functions/authors.ts b/komga-webui/src/functions/authors.ts index eb40717f..8094b224 100644 --- a/komga-webui/src/functions/authors.ts +++ b/komga-webui/src/functions/authors.ts @@ -9,15 +9,15 @@ export function groupAuthorsByRole (authors: AuthorDto[]): any { authors => authors.map((author: AuthorDto) => author.name)) } -// return an object where keys are roles (plural form), and values are string[] -export function groupAuthorsByRolePlural (authors: AuthorDto[]): any { +// return an object where keys are roles (i18n translated), and values are string[] +export function groupAuthorsByRoleI18n (authors: AuthorDto[]): any { const r = mapKeys(groupAuthorsByRole(authors), (v, k) => i18n.t(`author_roles.${k}`), ) // sort object keys according to the order of keys in authorRoles // push unknown keys to the end of the array - const roles = authorRoles.map(x => i18n.t(`author_roles.${x.role}`)) + const roles = authorRoles.map(x => i18n.t(`author_roles.${x}`)) const o = {} as any Object.keys(r) .sort((a, b) => { diff --git a/komga-webui/src/types/author-roles.ts b/komga-webui/src/types/author-roles.ts index db5bbd3e..6caa0eb9 100644 --- a/komga-webui/src/types/author-roles.ts +++ b/komga-webui/src/types/author-roles.ts @@ -1,9 +1,9 @@ export const authorRoles = [ - { role: 'writer'}, - { role: 'penciller'}, - { role: 'inker'}, - { role: 'colorist'}, - { role: 'letterer'}, - { role: 'cover'}, - { role: 'editor'}, + 'writer', + 'penciller', + 'inker', + 'colorist', + 'letterer', + 'cover', + 'editor', ] diff --git a/komga-webui/src/views/BrowseBook.vue b/komga-webui/src/views/BrowseBook.vue index 4f2130e1..8fcabba4 100644 --- a/komga-webui/src/views/BrowseBook.vue +++ b/komga-webui/src/views/BrowseBook.vue @@ -216,7 +216,7 @@ import BookActionsMenu from '@/components/menus/BookActionsMenu.vue' import ItemCard from '@/components/ItemCard.vue' import ToolbarSticky from '@/components/bars/ToolbarSticky.vue' -import {groupAuthorsByRolePlural} from '@/functions/authors' +import {groupAuthorsByRoleI18n} from '@/functions/authors' import {getBookFormatFromMediaType} from '@/functions/book-format' import {getReadProgress, getReadProgressPercentage} from '@/functions/book-progress' import {getBookTitleCompact} from '@/functions/book-title' @@ -287,7 +287,7 @@ export default Vue.extend({ return getBookFormatFromMediaType(this.book.media.mediaType) }, authorsByRole (): any { - return groupAuthorsByRolePlural(this.book.metadata.authors) + return groupAuthorsByRoleI18n(this.book.metadata.authors) }, isRead (): boolean { return getReadProgress(this.book) === ReadStatus.READ diff --git a/komga-webui/src/views/BrowseSeries.vue b/komga-webui/src/views/BrowseSeries.vue index e5317a4e..2ee7bcf2 100644 --- a/komga-webui/src/views/BrowseSeries.vue +++ b/komga-webui/src/views/BrowseSeries.vue @@ -291,7 +291,7 @@ import SortList from '@/components/SortList.vue' import {mergeFilterParams, sortOrFilterActive, toNameValue} from '@/functions/filter' import FilterPanels from '@/components/FilterPanels.vue' import {SeriesDto} from "@/types/komga-series"; -import {groupAuthorsByRolePlural} from "@/functions/authors"; +import {groupAuthorsByRoleI18n} from "@/functions/authors"; import ReadMore from "@/components/ReadMore.vue"; const tags = require('language-tags') @@ -398,7 +398,7 @@ export default Vue.extend({ return sortOrFilterActive(this.sortActive, this.sortDefault, this.filters) }, authorsByRole(): any { - return groupAuthorsByRolePlural(this.series.booksMetadata.authors) + return groupAuthorsByRoleI18n(this.series.booksMetadata.authors) }, }, props: {