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

Why globalize NuGet package does not include likelySubtags.json? #507

Closed
leniel opened this Issue Sep 11, 2015 · 10 comments

Comments

Projects
None yet
5 participants
@leniel
Copy link

leniel commented Sep 11, 2015

Without this file I get

Uncaught Error: E_MISSING_CLDR: Missing required CLDR content `supplemental/likelySubtags

when trying to set a locale.

I thought it would be included in the package automatically.

@rxaviers

This comment has been minimized.

Copy link
Member

rxaviers commented Sep 11, 2015

Hi @leniel, thanks for submitting this issue. Globalize itself doesn't include CLDR data. Please, read on https://github.com/jquery/globalize#where-does-the-data-come-from.

If you think there's anything we could do to make this information more clear, let me know and I'll be happy to reopen this issue.

Thanks

@rxaviers rxaviers closed this Sep 11, 2015

@leniel

This comment has been minimized.

Copy link
Author

leniel commented Sep 11, 2015

Hi @rxaviers ... I tried to execute the command:

npm install cldr-data

but it did not install... can you please tell me what's the problem by looking the the npm-debug.log file?
https://gist.github.com/leniel/22f2efda33175020047a

It tells it can be an error with the package itself. I'm not sure.

By the way... I used the old jQuery Globalize and it was much simpler. Now with this new version things are a bit difficult to start. :)

@johnnyreilly

This comment has been minimized.

Copy link
Contributor

johnnyreilly commented Sep 11, 2015

Hi @leniel,

If it helps you could take a look at my blog post that walks through the upgrade path from old Globalize to new Globalize. Best of luck!

http://blog.icanmakethiswork.io/2015/07/upgrading-to-globalize-1x-for-dummies.html

@rxaviers

This comment has been minimized.

Copy link
Member

rxaviers commented Sep 11, 2015

@leniel let's continue to investigate what's wrong with your npm installation in rxaviers/cldr-data-npm#19.

About your 1.x experience, can you give me a short description of your use case? Are you using it on a web application, or on backend on Node.js? If web application, do you use any tools to generate the final minified bundles for your application?

@leniel

This comment has been minimized.

Copy link
Author

leniel commented Sep 11, 2015

Well... I have an ASP.NET MVC 5 app using .NET Framework 4.6. I currently use NuGet as the package manager. I installed the Globalize Nuget package which pulled the cldr package as well as a dependency. That's fine but then I got the problem about it not finding the cldr-data likelySubtags.json.

With ASP.NET MVC I'm using the default bundling that comes with it like this:

 // jQuery Globalize
 bundles.Add(new ScriptBundle("~/bundles/globalize").Include(
                                         "~/Scripts/cldr.js",
                                         "~/Scripts/cldr/event.js",
                                         "~/Scripts/cldr/supplemental.js",
                                         "~/Scripts/globalize.js",
                                         "~/Scripts/globalize/number.js",
                                         "~/Scripts/globalize/plural.js",
                                         "~/Scripts/globalize/currency.js",
                                         "~/Scripts/globalize/date.js"));

it takes care of minifying CSS and JS but again... I'm not sure how to get the cldr-data files and include in my project. It would be awesome if there was a NuGet package for that too. :)

That's why I tried to run the npm command but it failed.

I then tried with bower :) following the directions that @johnnyreilly gave in his great post. Guess what: it fails with:

bower                                      postinstall node ./node_modules/cldr-data-downloader/bin/download.js -i bower_components/cldr-data/index.json -o bower_components/cldr-data/
bower                                          ECMDERR Failed to execute "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\node.CMD ./node_modules/cldr-data-downloader/bin/download.js -i bower_components/cldr-data/index.json -o bower_components/cldr-data/", exit code of #8

Oh... I'm using Visual Studio 2015 which has built in support for NuGet, npm and bower.
http://webtooling.visualstudio.com/package-managers/npm/

The point is: I just wouldn't like to mix package managers... but if that's viable I'd try.

@rxaviers

This comment has been minimized.

Copy link
Member

rxaviers commented Jul 20, 2016

How do I get CLDR data? https://github.com/jquery/globalize/blob/master/doc/cldr.md

The thing about CLDR is that it's JSON data files. Globalize can interpret it during runtime, or you can precompile it all at build time and serve precompiled JS files (no JSON) via globalize-compiler. Globalize doesn't embed these JSON data within its modules because of two problems: (a) CLDR changes quickly than Globalize, so embedding would cause serving outdated content, (b) Globalize would embed a bunch of stuff you don't necessarily need in your app (it'd cause your app an awful load performance).

More about globalize-compiler can be found at:

What's my suggestion?

In your application, use Globalize as you don't need to load any CLDR. On development, let a helper tooling load the JSON for you dynamically. On production, let a helper tooling build the precompiled files, so you can bundle the smallest and fastest JS files in your produciton. Sounds crazy? It's exactly what this example do:

@CodeDog451

This comment has been minimized.

Copy link

CodeDog451 commented Mar 10, 2017

Everyone is just going back to 0.1.3 since it works out of the box.

@trueqbit

This comment has been minimized.

Copy link

trueqbit commented Apr 3, 2017

I am not going back to 0.1.3, but I think it would be helpful to have the CLDR json data available via CDN (github isn't one).
Back in 2014 there weren't any plans according to this post, but the post is 3 years old - right now it's not even possible to write showcase examples e.g. on jsfiddle.net, which would be very helpful.

BTW I've just found cdnjs issue 10160 by Mottie, which addresses exactly the need to have CLDR available via a CDN.

@rxaviers

This comment has been minimized.

Copy link
Member

rxaviers commented Apr 3, 2017

Hi @TrejGun, not an answer, but this may be of your interest cdnjs/cdnjs#10160

@rxaviers

This comment has been minimized.

Copy link
Member

rxaviers commented Apr 3, 2017

PS: I just noticed you found this link already :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.