mattermost-developer-documentation
mattermost-developer-documentation copied to clipboard
Help Wanted: Document how to use custom i18n translations in a webapp plugin
Mattermost user michael.kochell
from https://community-daily.mattermost.com has requested the following be documented:
We should have this documented somewhere, but you will need to do two things to get webapp plugin translations working:
- Call [registerTranslations](https://developers.mattermost.com/integrate/plugins/webapp/reference/#registerTranslations) to register your translation strings
- Use webpack externals to make sure the plugin uses the same instance of `react-intl`
[mattermost/mattermost-plugin-playbooks/webapp/webpack.config.js](https://github.com/mattermost/mattermost-plugin-playbooks/blob/136d62f9278d31f9f1223771a655490c8360ef92/webapp/webpack.config.js#L127)
```js
'prop-types': 'PropTypes',
'react-bootstrap': 'ReactBootstrap',
'react-router-dom': 'ReactRouterDom',
'react-intl': 'ReactIntl',
},
See the original post [here](https://community-daily.mattermost.com/_redirect/pl/4xcqiwsppbnzzn8p38ad5iuhio).
_This issue was generated from [Mattermost](https://mattermost.com) using the [Doc Up](https://github.com/jwilander/mattermost-plugin-docup) plugin._