feat(i18n): update product filtering on language change
- Enhance Content and ProductFilters components to re-filter products when the language changes or the translation function updates. - Implement logic in componentDidUpdate to regenerate availability values and filter products accordingly, improving internationalization support.
This commit is contained in:
@@ -224,6 +224,14 @@ class Content extends Component {
|
||||
this.fetchSearchData(this.props.searchParams?.get('q'));
|
||||
})
|
||||
}
|
||||
|
||||
// Re-filter products when language changes to update translated filter names
|
||||
const languageChanged = this.props.i18n && prevProps.i18n && this.props.i18n.language !== prevProps.i18n.language;
|
||||
const tFunctionChanged = this.props.t !== prevProps.t;
|
||||
|
||||
if(languageChanged || tFunctionChanged) {
|
||||
this.filterProducts();
|
||||
}
|
||||
}
|
||||
|
||||
processData(response) {
|
||||
|
||||
Reference in New Issue
Block a user