88
99<script setup lang="ts">
1010import { computed } from " vue" ;
11+ import { useI18n } from " vue-i18n" ;
1112import MtBadge from " ../mt-badge/mt-badge.vue" ;
1213
1314const props = withDefaults (
@@ -21,17 +22,40 @@ const props = withDefaults(
2122 },
2223);
2324
25+ const { t } = useI18n ({
26+ messages: {
27+ en: {
28+ " mt-promo-badge" : {
29+ new: " New" ,
30+ beta: " Beta" ,
31+ shopwareAi: " Shopware AI" ,
32+ },
33+ },
34+ de: {
35+ " mt-promo-badge" : {
36+ new: " Neu" ,
37+ beta: " Beta" ,
38+ shopwareAi: " Shopware AI" ,
39+ },
40+ },
41+ },
42+ });
43+
2444const size = computed (() => {
25- const normalizedSize = String (props .size ?? " s" ).toLowerCase ();
26- return [ " s" , " m " , " l " ]. includes ( normalizedSize ) ? normalizedSize : " s" ;
45+ const n = String (props .size ?? " s" ).toLowerCase ();
46+ return n === " s" ? " s " : n === " m " ? " m " : n === " l " ? " l " : " s" ;
2747});
2848
2949const badgeVariant = computed (() =>
3050 props .variant === " shopware-ai" ? " neutral" : props .variant === " beta" ? " info" : " positive" ,
3151);
3252
3353const promoText = computed (() =>
34- props .variant === " shopware-ai" ? " Shopware AI" : props .variant === " new" ? " New" : " Beta" ,
54+ props .variant === " shopware-ai"
55+ ? t (" mt-promo-badge.shopwareAi" )
56+ : props .variant === " new"
57+ ? t (" mt-promo-badge.new" )
58+ : t (" mt-promo-badge.beta" ),
3559);
3660
3761const badgeIcon = computed (() =>
0 commit comments