File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,13 @@ https://github.com/eclipsesource/jsonforms/issues/1826
17
17
The translate functionality of JSON Forms is integrated into the core component.
18
18
In order to translate JSON Forms, you need to set a translation function and provide it to the JSON Forms component:
19
19
``` ts
20
- const translator = (key , defaultMessage ) => {
21
- console .log (` Key: ${key }, Default Message: ${defaultMessage } ` );
20
+ const createTranslator = ( locale ) => (key , defaultMessage ) => {
21
+ console .log (` Locale: ${ locale }, Key: ${key }, Default Message: ${defaultMessage }` );
22
22
return defaultMessage ;
23
23
};
24
24
25
25
const [locale, setLocale] = useState <' de' | ' en' >(' de' );
26
- const translation = useMemo (() => translator (locale ), [locale ]);
26
+ const translation = useMemo (() => createTranslator (locale ), [locale ]);
27
27
28
28
< JsonForms
29
29
i18n = {{locale : locale , translate : translation }}
You can’t perform that action at this time.
0 commit comments