i18n: removes useTranslate hook (#106556)

* i18n: removes useTranslate hook

* chore: fix duplicate imports

* chore: fix import sorting and hook dependencies
This commit is contained in:
Hugo Häggmark
2025-06-12 11:03:52 +02:00
committed by GitHub
parent e73530da09
commit 2b8c74de2e
1134 changed files with 1605 additions and 2663 deletions
+2 -4
View File
@@ -75,9 +75,8 @@ const ErrorMessage = ({ id, message }) => <Trans i18nKey={`errors.${id}`}>There
Sometimes you may need to translate a string cannot be represented in JSX, such as `placeholder` props. Use the `t` macro for this.
```jsx
import { useTranslate } from "@grafana/i18n"
import { t } from "@grafana/i18n"
const { t } = useTranslate();
const placeholder = t('form.username-placeholder','Username');
return <input type="value" placeholder={placeholder}>
@@ -211,9 +210,8 @@ import { Trans } from '@grafana/i18n';
```
```js
import { useTranslate } from '@grafana/i18n';
import { t } from '@grafana/i18n';
const { t } = useTranslate();
const translatedString = t('inbox.heading', 'You got {{count}} messages', { count: messages.length });
```