Class: LocaleConsumer

LocaleConsumer(Component)

A higher order component utilizing messaging context to the component it wraps. Using LocaleConsumer and getMessage function directly should be avoided. Using oskari-ui/Message component instead is encouraged. The context provides bundleKey string and getMessage function. The getMessage function may be used when an element can't use a ReactNode as a prop. (e.g. placeholder in TextInput)

Constructor

new LocaleConsumer(Component)

Parameters:
Name Type Description
Component ReactElement The component to pass localizations to
Source:
See:
Example

Modified TextInput

import { TextInput } from 'oskari-ui';
import { LocaleConsumer } from 'oskari-ui/util';

const NameInput = LocaleConsumer(({ getMessage }) => (
    <TextInput placeholder={getMessage('placeholders.name')} />
));