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

Question: How to load locale based on browser locale #208

Open
Cyberboss opened this issue Sep 7, 2024 · 1 comment
Open

Question: How to load locale based on browser locale #208

Cyberboss opened this issue Sep 7, 2024 · 1 comment

Comments

@Cyberboss
Copy link

Maybe I'm missing something but it seems like the locale needs to be explicitly imported at build time. Is there a way to select the locale at runtime without exhaustively importing all of them?

@nmn
Copy link
Owner

nmn commented Sep 9, 2024

This package is for supporting older browsers where you should ideally know the locale on the server side. For modern browsers, the best solution would be to create a custom "locale" the uses the built-in Intl package.

Here's a reference:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat

I'm looking to add a built-in option to use this if I can find a good way to pass in the locale as an argument.

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