Clean up formatters from prev PR (#5254)

This commit is contained in:
Prospector
2026-02-02 01:38:36 -08:00
committed by GitHub
parent a207daef0d
commit 11f00be606
8 changed files with 45 additions and 59 deletions

View File

@@ -2,7 +2,7 @@
import { computed } from 'vue'
import { useVIntl } from '../../composables'
import { getTagMessageOrDefault } from '../../utils/tag-messages.ts'
import { formatTag } from '../../utils/tag-messages.ts'
const { formatMessage } = useVIntl()
@@ -11,9 +11,9 @@ const props = defineProps<{
enforceType?: 'loader' | 'category'
}>()
const message = computed(() => getTagMessageOrDefault(props.tag, props.enforceType))
const message = computed(() => formatTag(formatMessage, props.tag, props.enforceType))
</script>
<template>
{{ typeof message === 'string' ? message : formatMessage(message) }}
{{ message }}
</template>

View File

@@ -3,7 +3,7 @@
<slot />
<span v-for="category in categories.filter((x) => !!x)" :key="category">
<component :is="getTagIcon(category)" v-if="getTagIcon(category)" />
{{ getFormattedMessage(category) }}
{{ formatTag(formatMessage, category) }}
</span>
</div>
</template>
@@ -11,18 +11,13 @@
import { getTagIcon } from '@modrinth/assets'
import { useVIntl } from '../../composables'
import { getTagMessageOrDefault } from '../../utils/tag-messages.ts'
import { formatTag } from '../../utils/tag-messages.ts'
const { formatMessage } = useVIntl()
defineProps<{
categories: string[]
}>()
const getFormattedMessage = (tag: string) => {
const message = getTagMessageOrDefault(tag)
return typeof message === 'string' ? message : formatMessage(message)
}
</script>
<style lang="scss" scoped>