mattermost-developer-documentation icon indicating copy to clipboard operation
mattermost-developer-documentation copied to clipboard

Help Wanted: Document how to use custom i18n translations in a webapp plugin

Open mm-cloud-bot opened this issue 2 years ago • 0 comments

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._

mm-cloud-bot avatar May 20 '22 18:05 mm-cloud-bot