lingo.dev/react/client should provides helper functions for custom LocaleSwitcher
Today i updated my codebase from 0.109 to 0.110 and it breaks because of https://github.com/lingodotdev/lingo.dev/commit/e898c1eeb34e4dd3e74df26465802b520018acf9
For avoid such situation, could we export them from the lingo.dev/react/client as it described here https://github.com/lingodotdev/lingo.dev/blob/main/packages/react/src/client/utils.ts#L18 ?
Without that a developer must re-implement setLocaleInCookies and getLocaleFromCookies functions for custom LocaleSwitcher implemention and it creates risks for breaking changes.
Yes, the helper function get/set locale in cookies is not intended to be consumed externally at the moment.
We are currently discussing this here on Discord. I think we will go forward and export the helper method under a proper name for custom locale switcher implementations.
Hi, could you please assign this issue to me? I’ve reviewed the project’s Code of Conduct and Contribution Guidelines, and I have the required skills and understanding of the tech stack to work on this effectively. I’ve already started analyzing the codebase and begun initial work toward resolving the issue. I’m confident I can implement a clean, optimized, and maintainable solution that aligns with the project’s standards. Looking forward to contributing!
@shbhmexe how would you approach this?
Hi @maxprilutskiy, happy to take this on.
My proposed approach:
Export Helpers: Explicitly export getLocaleFromCookies and setLocaleInCookies from the lingo.dev/react/client entry point.
Consistency: Keep the internal logic identical to ensure backward compatibility and a seamless transition for users like @galkin who were previously relying on internal paths.
DX: Add basic TSDoc comments to these helpers since they will now be part of the public API.
Does that alignment work for you? If so, I’ll get a PR opened shortly.
@maxprilutskiy Can someone from the lingo.dev team take a look aswell?