Deduplicate common strings in translation (#5085)

* deduplicate common strings, part 1

* deduplicate common strings, part 2

* typo and general import mess fixes

* detail common string

* fix lint

* fix lint TWO

* adress review concerns + lint

* app lint too

* actually leave privateLabel untouched

* lint fix THREE

* fix: broken msg

* fix: lint

---------

Co-authored-by: Calum H. <contact@cal.engineer>
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
lumiscosity
2026-01-28 19:10:50 +01:00
committed by GitHub
parent 400c571fe6
commit 6d68d50699
31 changed files with 279 additions and 624 deletions
@@ -9,13 +9,13 @@
<ButtonStyled color="brand">
<button class="brand-button" @click="acceptInvite()">
<CheckIcon />
{{ getFormattedMessage(messages.accept) }}
{{ getFormattedMessage(commonMessages.acceptButton) }}
</button>
</ButtonStyled>
<ButtonStyled color="red">
<button @click="declineInvite">
<XIcon />
{{ getFormattedMessage(messages.decline) }}
{{ getFormattedMessage(commonMessages.declineButton) }}
</button>
</ButtonStyled>
</div>
@@ -26,6 +26,7 @@
import { CheckIcon, XIcon } from '@modrinth/assets'
import {
ButtonStyled,
commonMessages,
defineMessages,
injectNotificationManager,
type MessageDescriptor,
@@ -81,14 +82,6 @@ const messages = defineMessages({
defaultMessage:
"You've been invited to join this project. Please accept or decline the invitation.",
},
accept: {
id: 'project-member-header.accept',
defaultMessage: 'Accept',
},
decline: {
id: 'project-member-header.decline',
defaultMessage: 'Decline',
},
successJoin: {
id: 'project-member-header.success-join',
defaultMessage: 'You have joined the project team',
@@ -105,14 +98,6 @@ const messages = defineMessages({
id: 'project-member-header.error-decline',
defaultMessage: 'Failed to decline team invitation',
},
success: {
id: 'project-member-header.success',
defaultMessage: 'Success',
},
error: {
id: 'project-member-header.error',
defaultMessage: 'Error',
},
})
const { formatMessage } = useVIntl()
@@ -171,13 +156,13 @@ async function acceptInvite(): Promise<void> {
await acceptTeamInvite(props.project.team)
await handleUpdateMembers()
addNotification({
title: formatMessage(messages.success),
title: formatMessage(commonMessages.successLabel),
text: formatMessage(messages.successJoin),
type: 'success',
})
} catch {
addNotification({
title: formatMessage(messages.error),
title: formatMessage(commonMessages.errorLabel),
text: formatMessage(messages.errorJoin),
type: 'error',
})
@@ -192,13 +177,13 @@ async function declineInvite(): Promise<void> {
await removeTeamMember(props.project.team, props.auth.user.id)
await handleUpdateMembers()
addNotification({
title: formatMessage(messages.success),
title: formatMessage(commonMessages.successLabel),
text: formatMessage(messages.successDecline),
type: 'success',
})
} catch {
addNotification({
title: formatMessage(messages.error),
title: formatMessage(commonMessages.errorLabel),
text: formatMessage(messages.errorDecline),
type: 'error',
})