Shohel
Shohel

Reputation: 3934

Show key not values in reacti18next by configuration

We are using reacti18next for translating our app language. Every value is showing against keys. But we have a configuration in our app which is enable blank localizer. When the configuration is enabled then the translation will show only keys.

Suppose we have implemented the translation key as shown below which shows the value of the key. Now We need to show the key name which is member-management.members.form.fields.name. How could we do this? Any thought.

<Trans i18nKey="member-management.members.form.fields.name"/>

Upvotes: 3

Views: 3332

Answers (1)

felixmosh
felixmosh

Reputation: 35573

There is a special language called cimode, if you set / change your language to it, the t function will return keys instead of values.

So just invoke this whenever your app is in a special mode:

i18n.changeLanguage('cimode');

For more info checkout https://www.i18next.com/overview/api#changelanguage

Upvotes: 7

Related Questions