@@ -73,56 +73,81 @@ class SomeComponent extends React.Component<Props> {
7373export default withTranslation (SomeComponent )
7474```
7575
76- ## Translation Method t(path, params)
76+ ## Auto update functions
7777
78- Params | Type | Description
79- ------ | ------ | ------------------------------------------------------------------------------------
80- path | string | translation path that identifies the text
81- params | object | {'param': 'value', ...} each param will be set on the string in its correct location
78+ ### useTranslation(basePath)
79+
80+ React hook that returns the t function
81+
82+ Params | Type | Description | Required
83+ ---- | ---- | ---- | ----
84+ basePath | string | translation base path used to identify all the next requested translations | no
85+
86+ ### withTranslation(component, basePath)
87+
88+ HOC that injects the translation function into the component
89+
90+ Params | Type | Description | Required
91+ ---- | ---- | ---- | ----
92+ component | React Component | React component that requires the translation function | yes
93+ basePath | string | translation base path used to identify all the next requested translations | no
94+
95+ ## Translation Method
96+
97+ t(path, params)
98+
99+ Returns the translation for the requested path
100+
101+ Params | Type | Description | Required
102+ ---- | ---- | ---- | ----
103+ path | string | translation path that identifies the text | yes
104+ params | object | {'param': 'value', ...} each parameter will be set on the string in its correct location | no
82105
83106## Exported Methods
84107
85108### setDefaultTranslations(translations)
86109
87110Sets the translations
88111
89- Params | Type | Description
90- ------------ | ------ | ------------------------ ----
91- translations | object | {'key': 'translations', ...}
112+ Params | Type | Description | Required
113+ ---- | ---- | ---- | ----
114+ translations | object | {'key': 'translations', ...} | yes
92115
93116### setTranslations(translations)
94117
95118Same as setDefaultTranslations, but this will update all components using translations
96119
97- Params | Type | Description
98- ------------ | ------ | ------------------------ ----
99- translations | object | {'key': 'translations', ...}
120+ Params | Type | Description | Required
121+ ---- | ---- | ---- | ----
122+ translations | object | {'key': 'translations', ...} | yes
100123
101124### setDefaultLanguage(key)
102125
103126Sets the default application language
104127
105- Params | Type | Description
106- ------ | ------ | ----------------------------------------- ----
107- key | string | translation key, in this example 'en' or 'pt'
128+ Params | Type | Description | Required
129+ ---- | ---- | ---- | ----
130+ key | string | translation key, in this example 'en' or 'pt' | yes
108131
109132### setLanguage(key)
110133
111134Same as setDefaultLanguage, but this will update all components using translations
112135
113- Params | Type | Description
114- ------ | ------ | ----------------------------------------- ----
115- key | string | translation key, in this example 'en' or 'pt'
136+ Params | Type | Description | Required
137+ ---- | ---- | ---- | ----
138+ key | string | translation key, in this example 'en' or 'pt' | yes
116139
117140### getLanguage()
118141
119142Returns the current selected language
120143
121144### t(key, params)
122145
123- Get text function, will return the translated string
146+ t(path, params)
147+
148+ Returns the translation for the requested path
124149
125- Params | Type | Description
126- ------ | ------ | -------------------------------------------------------------------------------- ----
127- key | string | translation key that identifies the text
128- params | object | {'param': 'value', ...} each param will be set on the string in its correct location
150+ Params | Type | Description | Required
151+ ---- | ---- | ---- | ----
152+ path | string | translation path that identifies the text | yes
153+ params | object | {'param': 'value', ...} each parameter will be set on the string in its correct location | no
0 commit comments