Use a default/fallback value if the translation is not available in Lingui, React

27 Views Asked by At

I have the following code:

  const message = msg({
    context: "test",
    id: "username",
    message: t`Your name is: ${name}`,
  });

The problem is that when I run npm run messages:extract if the translation is not available for the selected langugae it only returns the id instead of using message as some sort of default value.

Also, how should I render message?

<>{i18n._(tesztuzenet)}</>

or

<>{message.message}</>

Are there any differences?

0

There are 0 best solutions below