Clean up formatters from prev PR (#5254)
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user