diff --git a/contribute/internationalization.md b/contribute/internationalization.md index 9f0aa1bba75..900573d5bc8 100644 --- a/contribute/internationalization.md +++ b/contribute/internationalization.md @@ -30,7 +30,7 @@ const SearchTitle = ({ term }) => ( Prefer using `` for JSX children, and `t()` for props and other javascript usage. -When translating in grafana-ui, import `` and `t()` from `src/utils/i18n`. +When translating in grafana-ui, use a relative path to import `` and `t()` from `src/utils/i18n`. Note that our tooling must be able to statically analyse the code to extract the phrase, so the `i18nKey` can not be dynamic. e.g. the following will not work: diff --git a/packages/grafana-ui/src/components/DateTimePickers/RelativeTimeRangePicker/RelativeTimeRangePicker.tsx b/packages/grafana-ui/src/components/DateTimePickers/RelativeTimeRangePicker/RelativeTimeRangePicker.tsx index 37af429b70d..77c08d13510 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/RelativeTimeRangePicker/RelativeTimeRangePicker.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/RelativeTimeRangePicker/RelativeTimeRangePicker.tsx @@ -4,6 +4,7 @@ import React, { FormEvent, useCallback, useState } from 'react'; import { RelativeTimeRange, GrafanaTheme2, TimeOption } from '@grafana/data'; import { useStyles2 } from '../../../themes'; +import { Trans, t } from '../../../utils/i18n'; import { Button } from '../../Button'; import { ClickOutsideWrapper } from '../../ClickOutsideWrapper/ClickOutsideWrapper'; import CustomScrollbar from '../../CustomScrollbar/CustomScrollbar'; @@ -111,7 +112,7 @@ export function RelativeTimeRangePicker(props: RelativeTimeRangePickerProps) {
} placement="bottom" theme="info">
- Specify time range + + Specify time range +
diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/CalendarHeader.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/CalendarHeader.tsx index e8ea6d9a0cf..08782cbd493 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/CalendarHeader.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/CalendarHeader.tsx @@ -5,6 +5,7 @@ import { GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { useStyles2 } from '../../../themes'; +import { Trans } from '../../../utils/i18n'; import { Button } from '../../Button'; import { TimePickerCalendarProps } from './TimePickerCalendar'; @@ -15,7 +16,9 @@ export function Header({ onClose }: TimePickerCalendarProps) { return (
- Select a time range + + Select a time range +