fix(core-components): Add i18n support for LogViewer search control

Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
This commit is contained in:
Christoph Jerolimov
2025-11-12 16:10:46 +01:00
parent a2f8158cf7
commit 5d52dabbbd
4 changed files with 15 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-components': patch
---
Add i18n support for LogViewer search control
@@ -63,6 +63,7 @@ export const coreComponentsTranslationRef: TranslationRef<
readonly 'autoLogout.stillTherePrompt.buttonText': "Yes! Don't log me out";
readonly 'dependencyGraph.fullscreenTooltip': 'Toggle fullscreen';
readonly 'proxiedSignInPage.title': 'You do not appear to be signed in. Please try reloading the browser page.';
readonly 'logViewer.searchField.placeholder': 'Search';
}
>;
@@ -15,17 +15,20 @@
*/
import { KeyboardEvent } from 'react';
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
import IconButton from '@material-ui/core/IconButton';
import TextField from '@material-ui/core/TextField';
import Typography from '@material-ui/core/Typography';
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import FilterListIcon from '@material-ui/icons/FilterList';
import { coreComponentsTranslationRef } from '../../translation';
import { LogViewerSearch } from './useLogViewerSearch';
export interface LogViewerControlsProps extends LogViewerSearch {}
export function LogViewerControls(props: LogViewerControlsProps) {
const { t } = useTranslationRef(coreComponentsTranslationRef);
const { resultCount, resultIndexStep, toggleShouldFilter } = props;
const resultIndex = props.resultIndex ?? 0;
@@ -57,7 +60,7 @@ export function LogViewerControls(props: LogViewerControlsProps) {
<TextField
size="small"
variant="standard"
placeholder="Search"
placeholder={t('logViewer.searchField.placeholder')}
value={props.searchInput}
onKeyPress={handleKeyPress}
onChange={e => props.setSearchInput(e.target.value)}
@@ -127,5 +127,10 @@ export const coreComponentsTranslationRef = createTranslationRef({
title:
'You do not appear to be signed in. Please try reloading the browser page.',
},
logViewer: {
searchField: {
placeholder: 'Search',
},
},
},
});