mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-05 04:59:15 +02:00
update to new i18n components
This commit is contained in:
@@ -36,20 +36,20 @@ components
|
||||
|
||||
- import react-i18next
|
||||
```javascript
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
```
|
||||
|
||||
- declare the translation method `t: string => string` as property
|
||||
```javascript
|
||||
type Props = {
|
||||
t: string => string
|
||||
type Props = WithTranslation & {
|
||||
***your props***
|
||||
}
|
||||
```
|
||||
|
||||
- wrap the react component with the translate method and give the json
|
||||
translation file name \"plugins\"
|
||||
```javascript
|
||||
export default translate("plugins")(MyPluginComponent);
|
||||
export default withTranslation("plugins")(MyPluginComponent);
|
||||
```
|
||||
|
||||
- use the translation keys like this:
|
||||
|
||||
Reference in New Issue
Block a user