mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
I18n: Add doc comment for t() (#99024)
* Add comment doc * Reorder information
This commit is contained in:
parent
d00592ffa0
commit
5d45af1110
@ -68,7 +68,14 @@ export const Trans = (props: TransProps): ReactElement => {
|
||||
return <I18NextTrans shouldUnescape ns={NAMESPACES} {...props} />;
|
||||
};
|
||||
|
||||
// Wrap t() to provide default namespaces and enforce a consistent API
|
||||
/**
|
||||
* This is a simple wrapper over i18n.t() to provide default namespaces and enforce a consistent API.
|
||||
* 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.
|
||||
* @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
|
||||
*/
|
||||
export const t = (id: string, defaultMessage: string, values?: Record<string, unknown>) => {
|
||||
if (!tFunc) {
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
|
Loading…
Reference in New Issue
Block a user