diff --git a/packages/grafana-runtime/src/unstable.ts b/packages/grafana-runtime/src/unstable.ts index bc7633502aa..84075dbb08a 100644 --- a/packages/grafana-runtime/src/unstable.ts +++ b/packages/grafana-runtime/src/unstable.ts @@ -9,4 +9,4 @@ * and be subject to the standard policies */ -export { useTranslate as useT, setUseTranslateHook } from './utils/i18n'; +export { useTranslate, setUseTranslateHook } from './utils/i18n'; diff --git a/packages/grafana-runtime/src/utils/i18n.ts b/packages/grafana-runtime/src/utils/i18n.ts index eb1160197ab..f67f63316e5 100644 --- a/packages/grafana-runtime/src/utils/i18n.ts +++ b/packages/grafana-runtime/src/utils/i18n.ts @@ -5,7 +5,7 @@ type UseTranslateHook = () => (id: string, defaultMessage: string, values?: Reco */ export let useTranslate: UseTranslateHook = () => { // Fallback implementation that should be overridden by setUseT - const errorMessage = 'useT is not set. useT must not be called before Grafana is initialized.'; + const errorMessage = 'useTranslate is not set. useTranslate must not be called before Grafana is initialized.'; if (process.env.NODE_ENV === 'development') { throw new Error(errorMessage); } @@ -16,6 +16,6 @@ export let useTranslate: UseTranslateHook = () => { }; }; -export function setUseTranslateHook(useTParam: UseTranslateHook) { - useTranslate = useTParam; +export function setUseTranslateHook(hook: UseTranslateHook) { + useTranslate = hook; } diff --git a/public/app/core/internationalization/index.tsx b/public/app/core/internationalization/index.tsx index 538a643b9af..4e541b170c6 100644 --- a/public/app/core/internationalization/index.tsx +++ b/public/app/core/internationalization/index.tsx @@ -73,7 +73,7 @@ export const Trans = (props: TransProps): ReactElement => { * Note: Don't use this in the top level module scope. This wrapper needs initialization, which is done during Grafana * startup, and it will throw if used before. * - * This will soon be deprecated in favor of useT() + * This will soon be deprecated in favor of useTranslate() * @param id ID of the translation string * @param defaultMessage Default message to use if the translation is missing * @param values Values to be interpolated into the string diff --git a/public/app/features/bookmarks/BookmarksPage.tsx b/public/app/features/bookmarks/BookmarksPage.tsx index 7d172b66d67..067b52e3d34 100644 --- a/public/app/features/bookmarks/BookmarksPage.tsx +++ b/public/app/features/bookmarks/BookmarksPage.tsx @@ -1,7 +1,7 @@ import { css } from '@emotion/css'; import { GrafanaTheme2, NavModelItem } from '@grafana/data'; -import { useT } from '@grafana/runtime/src/unstable'; +import { useTranslate } from '@grafana/runtime/src/unstable'; import { EmptyState, useStyles2 } from '@grafana/ui'; import { usePinnedItems } from 'app/core/components/AppChrome/MegaMenu/hooks'; import { findByUrl } from 'app/core/components/AppChrome/MegaMenu/utils'; @@ -11,7 +11,7 @@ import { Trans } from 'app/core/internationalization'; import { useSelector } from 'app/types'; export function BookmarksPage() { - const t = useT(); + const t = useTranslate(); const styles = useStyles2(getStyles); const pinnedItems = usePinnedItems(); const navTree = useSelector((state) => state.navBarTree);