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

Multi-language support with i18n #231

Open
favger opened this issue Feb 10, 2021 · 2 comments
Open

Multi-language support with i18n #231

favger opened this issue Feb 10, 2021 · 2 comments

Comments

@favger
Copy link

favger commented Feb 10, 2021

Hello,

Is there a performancey way to bring Bootstrap daterangepicker multilingual support?

@favger
Copy link
Author

favger commented Feb 10, 2021

I found a solution;

    const { i18n } = useTranslation();
    const dateRangePickerRef = useRef();

    // i18n Listener: if change language then reRender dateRangePicker
    useEffect(() => {
        if(!dateRangePickerRef.current) return;
        dateRangePickerRef.current.componentWillUnmount();
        dateRangePickerRef.current.componentDidMount();
    }, [i18n.language]);

    return (
        <DateRangePicker
            ref={dateRangePickerRef}
    ...

@Daniel-Raz-Supersmart
Copy link

How do you set the current language to the DateRangePicker?

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

2 participants