dvajs / dva-example-user-dashboard

👲 👬 👨‍👩‍👧 👨‍👩‍👦‍👦
446 stars 205 forks source link

Locale provider #8

Closed lobosan closed 7 years ago

lobosan commented 7 years ago

Hi, I'm following this tutorial and I was wondering how can I change the default language to spanish?.

I've seen this documentation https://ant.design/components/locale-provider but it doesn't show where should I do the changes so it's not very helpful, maybe that section of the documentation could be more explicit.

Thanks in advance for your help

paranoidjk commented 7 years ago

I think the document is very clear. https://ant.design/components/locale-provider

import esES from 'antd/lib/locale-provider/en_US';

<LocaleProvider locale={esES}>
  <App />
</LocaleProvider>
lobosan commented 7 years ago

Hi @paranoidjk I mentioned this because I've been following the dva examples and there's no <App /> but instead src/router.js where I'm importing the locale provider and returning the router as follows:

import {LocaleProvider} from 'antd';
import enUS from 'antd/lib/locale-provider/en_US';

...

return (
    <LocaleProvider locale={enUS}>
      <Router history={history} routes={routes} />
    </LocaleProvider>
  );

If this is the right approach, I think it would be worth mention it in the documentation as well ;)