question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

enUS locale is exported, but as an empty object

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

import { enUS } from '@material-ui/core/locale'

This import gives me an empty object.

Expected Behavior 🤔

To be able to import enUS (default) locale.

Steps to Reproduce 🕹

These steps are most likely not needed, because the locale is commented in the module: https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/locale/index.ts#L300

Context 🔦

I need to support dynamic language change, which seems not to be supported by current MUI localization. Therefore I’d like to import default locale, so I could use it with e.g. react-i18next.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
niklas-heeroscommented, May 18, 2020

As mentioned, the issue is when you need to support dynamic language change.

Context 🔦 I need to support dynamic language change, which seems not to be supported by current MUI localization. Therefore I’d like to import default locale, so I could use it with e.g. react-i18next.

If, for example, I set the pagination labels like this:

<TablePagination
  // `t` is from `react-i18next` and has MUI locales imported into `material-ui` namespace
  labelRowsPerPage={t('material-ui:MuiTablePagination.labelRowsPerPage')}
  labelDisplayedRows={t('material-ui:MuiTablePagination.labelDisplayedRows')}
  nextIconButtonText={t('material-ui:MuiTablePagination.nextIconButtonText')}
  backIconButtonText={t('material-ui:MuiTablePagination.backIconButtonText')}
/>

Is there something I’m missing? If there’s out-of-the-box way for doing this in MUI, I would definitely use that.

0reactions
o-dubrovskyicommented, Apr 28, 2022

I believe the question is rhetorical )

As far as I understand the root of the problem is how to use the localization of the mui along with the localization of the application that uses the mui.

I don’t see any problem with this. We can use a separate provider (like https://react.i18next.com/latest/i18nextprovider) to localize application components as SomeOtherComponent.

Also, to customize the enUS locale of the mui components, in the end, it is needed to create a separate localization object. So I think that uncommenting the enUS locale is not necessary

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why this is an empty object when module.exports is assigned ...
The exports variable is available within a module's file-level scope, and is assigned the value of module.exports before the module is ...
Read more >
Taleo Enterprise Taleo Web Services User Guide - Oracle
This type is a Taleo object very similar to the String type, but further allows to retrieve multilingual exported values. Multilingual values are...
Read more >
The new Workfront experience | Export data
Whether you export a list of objects or a report, your exported file will have a file name and a title. You can...
Read more >
Exporting Terrain, object data, and others! - The Hive Workshop
Ladik's MPQ Editor There are 5 Kinds of stuff you can export from a map. ... folder called enUS, and you got your...
Read more >
certutil - Microsoft Learn
localename - CA locale name ... SubCA publishes the CA certificate to the DS CA object. ... CRL creates an empty CRL.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found