google-maps-react
google-maps-react copied to clipboard
Language not working
I tested it in the example and the language did not change at all.
export default GoogleApiWrapper({
apiKey: "AIzaSyAyesbQMyKVVbBgKVi2g6VX7mop2z96jBo",
v: "3.30",
language: "ja"
})(MapContainer);
Are you using the npm package? Or just following the tutorial?
If you're following the tutorial, you must see this merge: https://github.com/fullstackreact/google-maps-react/pull/40/commits/e638ca84e874561321d4e6c01a058880d00d61da
If you're using the npm package, you need to put your api-key inside (). Example: apiKey: ("your-api-key")
Still not working ...
Is it maybe because I use it with Redux?
const MapWrappedContainer = connect(
(state) => (
{
content: state.contentReducer,
center: state.locationReducer.center,
lang: state.contentReducer.lang,
country: state.contentReducer.country,
routingData: state.contentReducer.routingData
}
),
(dispatch) => (
{
setLocationsShown: (ids) => dispatch(actions.setLocationsShown(ids)),
setLocationsCenter: (ids) => dispatch(actions.setLocationsCenter(ids)),
getRoutingData: (language) => dispatch(actions.getRoutingData(language))
}
)
)(MyMapContainer);
export default GoogleApiWrapper(
(props) => ({
apiKey: ('API_KEY'),
language: 'fr'
}
))(MapWrappedContainer);
It seems like a problem with Redux, i've never worked with it, so I cant help you there... Sorry, hope you find the solution.
I got it working, that the language chagnes, but not if I do it with this:
export default GoogleApiWrapper(
(props) => ({
apiKey: props.apiKey,
language: props.lang
})
)(MapComponent);
If I do it like this:
export default GoogleApiWrapper({
apiKey: ('API_KEY'),
language: 'de'
})(MapComponent);
it works
but even this does not work:
export default GoogleApiWrapper(
(props) => ({
apiKey: (API_KEY),
language: 'de'
})
)(Component);
Anyone known how solve this issue? I saw that the problem is that the first time loads the google script https://maps.googleapis.com/maps/api/js?key=API_KEY&callback=loaderCB01612358397367&libraries=geometry,drawing,places&v=3&language=pt&onerror=ERROR_FUNCTION but then never change the language so it is loaded only the first time.
Thanks