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

Load all Locales #61

Open
andreoliveira56 opened this issue Jul 27, 2018 · 0 comments
Open

Load all Locales #61

andreoliveira56 opened this issue Jul 27, 2018 · 0 comments

Comments

@andreoliveira56
Copy link

andreoliveira56 commented Jul 27, 2018

Hi! How can I load all the locales?

I am in a project that expects to adapt to all languages/formats.

And in ll the example I can find, I need to do something like:

import likelySubtags from 'cldr-data/supplemental/likelySubtags.json';
import currencyData from'cldr-data/supplemental/currencyData.json';
import weekData from'cldr-data/supplemental/weekData.json';

import bgLocalCurrency from'cldr-data/main/bg/currencies.json';
import bgNumbers from'cldr-data/main/bg/numbers.json';
import bgCaGregorian from'cldr-data/main/bg/ca-gregorian.json';
import bgDateFields from'cldr-data/main/bg/dateFields.json';

import gbLocalCurrency from'cldr-data/main/en-GB/currencies.json';
import gbNumbers from'cldr-data/main/en-GB/numbers.json';
import gbCaGregorian from'cldr-data/main/en-GB/ca-gregorian.json';
import gbDateFields from'cldr-data/main/en-GB/dateFields.json';

import { IntlProvider, load } from '@progress/kendo-react-intl';
import { DateFormatter } from './DateFormatter.jsx';
import { CurrencyFormatter } from './CurrencyFormatter.jsx';
import { Chooser } from './Chooser.jsx';

load(
    likelySubtags,
    currencyData,
    weekData,
    bgLocalCurrency,
    bgNumbers,
    bgCaGregorian,
    bgDateFields,
    gbLocalCurrency,
    gbNumbers,
    gbCaGregorian,
    gbDateFields
);

Obviously, this is not great.

I tried to do import data from 'cldr-data' but webpack explodes.
Then I tried to do something like const caGregorian = require('cldr-data/main/' + name + '/ca-gregorian.json') but it explodes as well.

Is there a way to include all the locales? Is there a better way to handle this?

I really dont know and I would appreciate some help.

Thanks.


Update 1: I get the error when I try to require cldr-data
Module not found: Error: Can't resolve 'fs' in '....\node_modules\cldr-data'

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

1 participant