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

feat: add language localization support for converting numbers to loc… #1359

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from

Conversation

fredericbahr
Copy link
Contributor

@fredericbahr fredericbahr commented Jan 9, 2025

…al string

This explicitly tells the toLocaleString function which language to use based on the provided localization instead of relying on the browser language. This allows a correct formatting of numbers within a multi language app.

This is a Proof of Concept implementation of #1331.
If you are confirm with it, i am more than happy to apply the language property to all locales and add proper documentation.

Thanks in advance, i am really looking forward for this feature

Copy link

vercel bot commented Jan 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
material-react-table ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 12, 2025 4:30pm
material-react-table-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 12, 2025 4:30pm

@@ -1,6 +1,7 @@
import { type MRT_Localization } from '..';

export const MRT_Localization_EN: MRT_Localization = {
language: 'en',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we would need to add this to every single locale, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this would be the implication. I have some capacity to do this on the weekend.

If we make the property optional and do not specify it the formatting would default to the browser language

…al string

This explicitly tells the `toLocaleString` function which language to use based on the provided localization instead of relying on the browser language. This allows a correct formatting of numbers within a multi language app.
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

Successfully merging this pull request may close these issues.

2 participants