MCPcopy
hub / github.com/grafana/grafana / t

Function t

packages/grafana-i18n/src/i18n.tsx:201–218  ·  view source on GitHub ↗
(id: string, defaultMessage: string, values?: Record<string, unknown>)

Source from the content-addressed store, hash-verified

199}
200
201export const t: TFunction = (id: string, defaultMessage: string, values?: Record<string, unknown>) => {
202 initDefaultI18nInstance();
203 if (!tFunc) {
204 if (process.env.NODE_ENV !== 'test') {
205 console.warn(
206 't() was called before i18n was initialized. This is probably caused by calling t() in the root module scope, instead of lazily on render'
207 );
208 }
209
210 if (process.env.NODE_ENV === 'development') {
211 throw new Error('t() was called before i18n was initialized');
212 }
213
214 tFunc = getI18nInstance().t;
215 }
216
217 return tFunc(id, defaultMessage, values);
218};
219
220export function Trans(props: TransProps): React.ReactElement {
221 initDefaultI18nInstance();

Callers 15

VerifyEmailFunction · 0.90
SignupPageFunction · 0.90
OrgPickerFunction · 0.90
MetricSelectFunction · 0.90
TeamPickerFunction · 0.90
UserPickerFunction · 0.90
SortPickerFunction · 0.90
ServiceAccountPickerFunction · 0.90
FolderFilterFunction · 0.90
ColorValueEditorFunction · 0.90
FieldColorEditorFunction · 0.90
getAllOptionEditorsFunction · 0.90

Calls 2

initDefaultI18nInstanceFunction · 0.85
getI18nInstanceFunction · 0.85

Tested by

no test coverage detected