@@ -23,13 +23,64 @@ export interface FacetInfoWithLabels extends Omit<FacetInfo, 'id'> {
2323export function useFacetSelection ( queryParam = 'facets' ) {
2424 const { t } = useI18n ( )
2525
26+ const facetLabels = computed ( ( ) => ( {
27+ downloads : {
28+ label : t ( `compare.facets.items.downloads.label` ) ,
29+ description : t ( `compare.facets.items.downloads.description` ) ,
30+ } ,
31+ packageSize : {
32+ label : t ( `compare.facets.items.packageSize.label` ) ,
33+ description : t ( `compare.facets.items.packageSize.description` ) ,
34+ } ,
35+ installSize : {
36+ label : t ( `compare.facets.items.installSize.label` ) ,
37+ description : t ( `compare.facets.items.installSize.description` ) ,
38+ } ,
39+ moduleFormat : {
40+ label : t ( `compare.facets.items.moduleFormat.label` ) ,
41+ description : t ( `compare.facets.items.moduleFormat.description` ) ,
42+ } ,
43+ types : {
44+ label : t ( `compare.facets.items.types.label` ) ,
45+ description : t ( `compare.facets.items.types.description` ) ,
46+ } ,
47+ engines : {
48+ label : t ( `compare.facets.items.engines.label` ) ,
49+ description : t ( `compare.facets.items.engines.description` ) ,
50+ } ,
51+ vulnerabilities : {
52+ label : t ( `compare.facets.items.vulnerabilities.label` ) ,
53+ description : t ( `compare.facets.items.vulnerabilities.description` ) ,
54+ } ,
55+ lastUpdated : {
56+ label : t ( `compare.facets.items.lastUpdated.label` ) ,
57+ description : t ( `compare.facets.items.lastUpdated.description` ) ,
58+ } ,
59+ license : {
60+ label : t ( `compare.facets.items.license.label` ) ,
61+ description : t ( `compare.facets.items.license.description` ) ,
62+ } ,
63+ dependencies : {
64+ label : t ( `compare.facets.items.dependencies.label` ) ,
65+ description : t ( `compare.facets.items.dependencies.description` ) ,
66+ } ,
67+ totalDependencies : {
68+ label : t ( `compare.facets.items.totalDependencies.label` ) ,
69+ description : t ( `compare.facets.items.totalDependencies.description` ) ,
70+ } ,
71+ deprecated : {
72+ label : t ( `compare.facets.items.deprecated.label` ) ,
73+ description : t ( `compare.facets.items.deprecated.description` ) ,
74+ } ,
75+ } ) )
76+
2677 // Helper to build facet info with i18n labels
2778 function buildFacetInfo ( facet : ComparisonFacet ) : FacetInfoWithLabels {
2879 return {
2980 id : facet ,
3081 ...FACET_INFO [ facet ] ,
31- label : t ( `compare.facets.items. ${ facet } .label` ) ,
32- description : t ( `compare.facets.items. ${ facet } .description` ) ,
82+ label : facetLabels . value [ facet ] . label ,
83+ description : facetLabels . value [ facet ] . description ,
3384 }
3485 }
3586
@@ -130,9 +181,16 @@ export function useFacetSelection(queryParam = 'facets') {
130181 // Check if only one facet is selected (minimum)
131182 const isNoneSelected = computed ( ( ) => selectedFacetIds . value . length === 1 )
132183
184+ const facetCategories = {
185+ performance : t ( `compare.facets.categories.performance` ) ,
186+ health : t ( `compare.facets.categories.health` ) ,
187+ compatibility : t ( `compare.facets.categories.compatibility` ) ,
188+ security : t ( `compare.facets.categories.security` ) ,
189+ }
190+
133191 // Get translated category name
134192 function getCategoryLabel ( category : FacetInfo [ 'category' ] ) : string {
135- return t ( `compare.facets.categories. ${ category } ` )
193+ return facetCategories [ category ]
136194 }
137195
138196 // All facets with their info and i18n labels, grouped by category
0 commit comments