@@ -244,7 +244,7 @@ export function usePackageComparison(packageNames: MaybeRefOrGetter<string[]>) {
244244function computeFacetValue (
245245 facet : ComparisonFacet ,
246246 data : PackageComparisonData ,
247- t : ( key : string ) => string ,
247+ t : ( key : string , params ?: Record < string , unknown > ) => string ,
248248) : FacetValue | null {
249249 switch ( facet ) {
250250 case 'downloads' :
@@ -294,13 +294,19 @@ function computeFacetValue(
294294 return {
295295 raw : types . kind ,
296296 display :
297- types . kind === 'included' ? 'Included' : types . kind === '@types' ? '@types' : 'None' ,
297+ types . kind === 'included'
298+ ? t ( 'compare.facets.values.types_included' )
299+ : types . kind === '@types'
300+ ? '@types'
301+ : t ( 'compare.facets.values.types_none' ) ,
298302 status : types . kind === 'included' ? 'good' : types . kind === '@types' ? 'info' : 'bad' ,
299303 }
300304
301305 case 'engines' :
302306 const engines = data . metadata ?. engines
303- if ( ! engines ?. node ) return { raw : null , display : 'Any' , status : 'neutral' }
307+ if ( ! engines ?. node ) {
308+ return { raw : null , display : t ( 'compare.facets.values.any' ) , status : 'neutral' }
309+ }
304310 return {
305311 raw : engines . node ,
306312 display : `Node ${ engines . node } ` ,
@@ -313,7 +319,14 @@ function computeFacetValue(
313319 const sev = data . vulnerabilities . severity
314320 return {
315321 raw : count ,
316- display : count === 0 ? 'None' : `${ count } (${ sev . critical } C/${ sev . high } H)` ,
322+ display :
323+ count === 0
324+ ? t ( 'compare.facets.values.none' )
325+ : t ( 'compare.facets.values.vulnerabilities_summary' , {
326+ count,
327+ critical : sev . critical ,
328+ high : sev . high ,
329+ } ) ,
317330 status : count === 0 ? 'good' : sev . critical > 0 || sev . high > 0 ? 'bad' : 'warning' ,
318331 }
319332
@@ -329,7 +342,9 @@ function computeFacetValue(
329342
330343 case 'license' :
331344 const license = data . metadata ?. license
332- if ( ! license ) return { raw : null , display : 'Unknown' , status : 'warning' }
345+ if ( ! license ) {
346+ return { raw : null , display : t ( 'compare.facets.values.unknown' ) , status : 'warning' }
347+ }
333348 return {
334349 raw : license ,
335350 display : license ,
@@ -349,7 +364,9 @@ function computeFacetValue(
349364 const isDeprecated = ! ! data . metadata ?. deprecated
350365 return {
351366 raw : isDeprecated ,
352- display : isDeprecated ? 'Deprecated' : 'No' ,
367+ display : isDeprecated
368+ ? t ( 'compare.facets.values.deprecated' )
369+ : t ( 'compare.facets.values.not_deprecated' ) ,
353370 status : isDeprecated ? 'bad' : 'good' ,
354371 }
355372
0 commit comments