@@ -3,6 +3,7 @@ import React, { useMemo, useState, useEffect, useCallback } from 'react';
33
44import { GrafanaTheme2 , SelectableValue } from '@grafana/data' ;
55import { TabsBar , Tab , Input , Icon , IconButton , useStyles2 , Badge , Checkbox , Button , useTheme2 } from '@grafana/ui' ;
6+ import { t , Trans } from '@grafana/i18n' ;
67import { RESOURCE_ATTR , SPAN_ATTR , ignoredAttributes } from 'utils/shared' ;
78import { getFiltersVariable } from 'utils/utils' ;
89import { SceneObject } from '@grafana/scenes' ;
@@ -300,13 +301,13 @@ export function AttributesSidebar({
300301 } ;
301302
302303 const scopeButtons = [
303- { label : ' All', value : 'All' as ScopeType } ,
304- { label : ' Resource', value : 'Resource' as ScopeType } ,
305- { label : ' Span', value : 'Span' as ScopeType } ,
304+ { label : t ( 'attributes-sidebar.scope.all' , ' All') , value : 'All' as ScopeType } ,
305+ { label : t ( 'attributes-sidebar.scope.resource' , ' Resource') , value : 'Resource' as ScopeType } ,
306+ { label : t ( 'attributes-sidebar.scope.span' , ' Span') , value : 'Span' as ScopeType } ,
306307 ] ;
307308
308309 if ( showFavorites ) {
309- scopeButtons . unshift ( { label : ' Favorites', value : 'Favorites' as ScopeType } ) ;
310+ scopeButtons . unshift ( { label : t ( 'attributes-sidebar.scope.favorites' , ' Favorites') , value : 'Favorites' as ScopeType } ) ;
310311 }
311312
312313 return (
@@ -319,18 +320,18 @@ export function AttributesSidebar({
319320 < div className = { styles . selectedAttributeLabel } >
320321 { isMulti ? (
321322 < >
322- < strong > Selected ({ getSelectedAttributes ( ) . length } ): </ strong > { ' ' }
323- { getSelectedAttributes ( ) . length > 0 ? getSelectedAttributes ( ) . join ( ', ' ) : ' None'}
323+ < strong > { t ( 'attributes-sidebar.selected-count' , ' Selected ({{count}}):' , { count : getSelectedAttributes ( ) . length } ) } </ strong > { ' ' }
324+ { getSelectedAttributes ( ) . length > 0 ? getSelectedAttributes ( ) . join ( ', ' ) : t ( 'attributes-sidebar.none' , ' None') }
324325 </ >
325326 ) : (
326327 < >
327- < strong > Selected:</ strong > { selected }
328+ < strong > < Trans i18nKey = "attributes-sidebar.selected" > Selected:</ Trans > </ strong > { selected }
328329 </ >
329330 ) }
330331 </ div >
331332 { allowAllOption && selected !== 'All' && (
332333 < Button variant = "secondary" size = "sm" onClick = { ( ) => handleAttributeSelect ( 'All' ) } >
333- All
334+ < Trans i18nKey = "attributes-sidebar.all-button" > All</ Trans >
334335 </ Button >
335336 ) }
336337 </ div >
@@ -340,7 +341,7 @@ export function AttributesSidebar({
340341 < Input
341342 className = { styles . searchInput }
342343 prefix = { < Icon name = "search" /> }
343- placeholder = " Search attributes..."
344+ placeholder = { t ( 'attributes-sidebar.search-placeholder' , ' Search attributes...' ) }
344345 value = { searchValue }
345346 onChange = { ( e ) => setSearchValue ( e . currentTarget . value ) }
346347 onKeyDown = { handleSearchKeyDown }
@@ -349,7 +350,7 @@ export function AttributesSidebar({
349350 < IconButton
350351 name = "times"
351352 variant = "secondary"
352- tooltip = " Clear search"
353+ tooltip = { t ( 'attributes-sidebar.clear-search' , ' Clear search' ) }
353354 onClick = { ( ) => setSearchValue ( '' ) }
354355 />
355356 )
@@ -377,7 +378,7 @@ export function AttributesSidebar({
377378 < ul className = { styles . attributesList } onDragOver = { handleListDragOver } onDragLeave = { handleListDragLeave } >
378379 { filteredAttributes . length === 0 ? (
379380 < div className = { styles . emptyState } >
380- { searchValue || selectedScope !== 'All' ? ' No attributes match your criteria' : ' No attributes available'}
381+ { searchValue || selectedScope !== 'All' ? t ( 'attributes-sidebar.no-match' , ' No attributes match your criteria') : t ( 'attributes-sidebar.no-available' , ' No attributes available') }
381382 </ div >
382383 ) : (
383384 filteredAttributes . map ( ( attribute , index ) => {
@@ -394,7 +395,7 @@ export function AttributesSidebar({
394395 { /* Ghost element above */ }
395396 { showGhostAbove && (
396397 < li className = { styles . ghostElement } onDrop = { ( ) => handleDrop ( index ) } >
397- < div className = { styles . ghostContent } > Drop here</ div >
398+ < div className = { styles . ghostContent } > < Trans i18nKey = "attributes-sidebar.drop-here" > Drop here</ Trans > </ div >
398399 </ li >
399400 ) }
400401
@@ -436,7 +437,7 @@ export function AttributesSidebar({
436437 variant = "secondary"
437438 size = "sm"
438439 className = { `${ styles . starButton } ${ isFavorites ? styles . starButtonActive : '' } ` }
439- tooltip = { isFavorites ? ' Remove from favorites' : ' Add to favorites'}
440+ tooltip = { isFavorites ? t ( 'attributes-sidebar.remove-from-favorites' , ' Remove from favorites') : t ( 'attributes-sidebar.add-to-favorites' , ' Add to favorites') }
440441 onClick = { ( event ) => toggleStar ( attribute . value , event ) }
441442 />
442443 ) }
@@ -445,7 +446,7 @@ export function AttributesSidebar({
445446 { /* Ghost element below */ }
446447 { showGhostBelow && (
447448 < li className = { styles . ghostElement } onDrop = { ( ) => handleDrop ( index ) } >
448- < div className = { styles . ghostContent } > Drop here</ div >
449+ < div className = { styles . ghostContent } > < Trans i18nKey = "attributes-sidebar.drop-here-below" > Drop here</ Trans > </ div >
449450 </ li >
450451 ) }
451452 </ React . Fragment >
0 commit comments