GithubHelp home page GithubHelp logo

Comments (4)

KevinVandy avatar KevinVandy commented on June 1, 2024

As long as the object that you pass to localization is the correct shape, it should work.

There is some code under the hood like this:

localization = useMemo(
  () => ({
    ...MRT_Localization_EN,
    ...localization,
  }),
  [localization],
);

Just make sure that the reference to localization is updated in any values inside of it have changed.

from material-react-table.

AliceCengal avatar AliceCengal commented on June 1, 2024

Right, object merging like that wouldn't work with a Proxy object, since the proxy doesn't have any real field (not the "right shape"). You could maintain the current behaviour while adding compatibility with next-translate by doing the merge like this:

localization = useMemo(
  () =>
    Object.fromEntries(
      Object.keys(MRT_Localization_EN).map((k) => [
        k,
        localization?.[k] ?? MRT_Localization_EN[k],
      ]),
    ),
  [localization],
)

from material-react-table.

KevinVandy avatar KevinVandy commented on June 1, 2024

why can't you do the above in your own code before passing it to MRT?

from material-react-table.

AliceCengal avatar AliceCengal commented on June 1, 2024

I can, and I am currently doing this. Just wondering if you are open to adding compatibility with function-based translation instead of dictionary object. If not, feel free to close this issue, let this issue be documentation for how to use next-translate with MRT.

from material-react-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.