useI18n
useI18n lets you read localized text inside custom components using the configured source. For setup details, see config.i18nSource.
Rspress provides the useI18n hook to get the internationalized text, the usage is as follows:
If you are using i18n.json, you can configure paths in tsconfig.json for better type hinting:
Then use it like this in the component:
This way you get type hints for all text keys defined in i18n.json.