diff --git a/web/client/components/I18N/Localized.jsx b/web/client/components/I18N/Localized.jsx index 6b194d08af..12eecf448e 100644 --- a/web/client/components/I18N/Localized.jsx +++ b/web/client/components/I18N/Localized.jsx @@ -30,6 +30,16 @@ class Localized extends React.Component { }; } + componentDidMount() { + this.updateDocumentLangAttribute(); + } + + componentDidUpdate(prevProps) { + if (this.props.locale !== prevProps.locale) { + this.updateDocumentLangAttribute(); + } + } + render() { let { children } = this.props; @@ -37,7 +47,6 @@ class Localized extends React.Component { if (typeof children === 'function') { children = children(); } - document.documentElement.setAttribute("lang", this.props.locale); return (