Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to apply localization to children? #350

Open
nvtin opened this issue Nov 18, 2020 · 0 comments
Open

How to apply localization to children? #350

nvtin opened this issue Nov 18, 2020 · 0 comments

Comments

@nvtin
Copy link

nvtin commented Nov 18, 2020

{({ getInputProps, suggestions, getSuggestionItemProps, loading }) => (
          <div>
            <input
              {...getInputProps({
                placeholder: 'Search Places ...',
                className: 'location-search-input',
              })}
            />

As above children, I want to translate place holder based on current language.
I am using const { t: translate } = useTranslation();
How can I use translate('inputPlaceholder') instead of 'Search Places ...'

{({ getInputProps, suggestions, getSuggestionItemProps, loading }) => (
          <div>
            <input
              {...getInputProps({
                placeholder: translate('inputPlaceholder'),
                className: 'location-search-input',
              })}
            />

Error I got: Uncaught TypeError: translate is not a function
Because translate is not available in children scope.
Any help? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant