简体   繁体   中英

How to translate title text of component?

How can I translate the title text dynamically with i18n tools such as i18next .

Currently I am passing in the title like so:

Settings.options = {
  topBar: {
    title: {
      text: 'Settings',
    },
  },
};
// get t function somewhere, i.e.
const t = i18next.t:

Settings.options = {
  topBar: {
    title: {
      text: t('settings.title'),
    },
  },
};

On language change make sure this code part is executed again... so t() function can evaluate again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM