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

Globalize So What'cha Want #494

Closed
johnnyreilly opened this issue Aug 27, 2015 · 7 comments
Closed

Globalize So What'cha Want #494

johnnyreilly opened this issue Aug 27, 2015 · 7 comments

Comments

@johnnyreilly
Copy link
Contributor

Hi,

To make my own usage of Globalize 1.x a little easier I've written this little tool called "Globalize So What'cha Want". You tell it what modules you want to use and it tells you the files / json you're going to need and in the order they are required.

It's pretty simple and I'm thinking of publishing it as a package on npm so I can re-use it elsewhere. I've got a vague notion I might use it to build a yeoman scaffolder or similar.

For now though I've contented myself with knocking up a simple UI which allows the user to select the modules they are interested in and have the requirements displayed on screen. You can see it here:

http://johnnyreilly.github.io/globalize-so-what-cha-want/

The source code is here:

https://github.com/johnnyreilly/globalize-so-what-cha-want

The actual guts of the code are in this file: https://github.com/johnnyreilly/globalize-so-what-cha-want/blob/master/index.js

And there's some rudimentary tests here: https://github.com/johnnyreilly/globalize-so-what-cha-want/blob/master/test/index.tests.js

Before I take this project any further I wanted to make you aware of it. It doesn't actually have any dependency on Globalize but it exists to make getting going with Globalize more straightforward.

You may have objections / criticisms or ideas for how this could be made better. All are welcome!

@rxaviers
Copy link
Member

Can you create an example using your scaffold engine, get it integrated into the examples section and submit a PR please?

@rxaviers
Copy link
Member

Firstly, thanks for pulling this together.

@rxaviers
Copy link
Member

By the way, I am thinking we should somehow link our documentation to your tool. Perhaps adding the link under Requirements (1. Dependencies and 2. CLDR content) could work. I'm open to ideas.

@johnnyreilly
Copy link
Contributor Author

Hi @rxaviers,

I haven't written the scaffolder yet - but when I do I'd be happy to put something together for the examples section.

In the meantime, I'd be happy to have a link from your documentation to the tool. I can submit a docs PR for that if you like and see if we can come up with something that works? I'm also pondering making the demo a little more sophisticated. It wouldn't take a great deal of work to make the tool demonstrate dynamic code samples a little like this:

<script src="cldrjs/cldr.js"></script>
<script src="cldrjs/cldr/event.js"></script>
<script src="cldrjs/cldr/supplemental.js"></script>
<script src="globalize.js"></script>
<script src="globalize/number.js"></script>
<script src="globalize/date.js"></script>
<script>
$.when(
  $.get( "cldr/supplemental/likelySubtags" ),
  $.get( "cldr/main/{locale}/numbers.json" ),
  $.get( "cldr/supplemental/numberingSystems.json" ),
  $.get( "cldr/main/en/ca-gregorian.json" ),
  $.get( "cldr/main/{locale}/timeZoneNames.json" ),
  $.get( "cldr/supplemental/timeData.json" ),
  $.get( "cldr/supplemental/weekData.json" )
).then(function() {

  // Normalize $.get results, we only need the JSON, not the request statuses.
  return [].slice.apply( arguments, [ 0 ] ).map(function( result ) {
      return result[ 0 ];
  });

}).then( Globalize.load ).then(function() {

  // Your code goes here.

});
</script>

BTW If you'd like the repo to be owned by Globalize I'd be happy to hand it over.

@rxaviers
Copy link
Member

In the meantime, I'd be happy to have a link from your documentation to the tool. I can submit a docs PR for that if you like and see if we can come up with something that works?

Sounds good. I am all in for different means to get things here clarified and made easier for developers/users.

I'm also pondering making the demo a little more sophisticated. It wouldn't take a great deal of work to make the tool demonstrate dynamic code samples a little like this:

Sounds good to me. My only reservation is giving one only example. Note that using ajax to fetch CLDR is only one of many different ways of using Globalize.

BTW If you'd like the repo to be owned by Globalize I'd be happy to hand it over.

Not a problem. I think it's fine the way it is.

@johnnyreilly
Copy link
Contributor Author

Sounds good. I am all in for different means to get things here clarified and made easier for developers/users.

Great - will put a PR together.

Sounds good to me. My only reservation is giving one only example. Note that using ajax to fetch CLDR is only one of many different ways of using Globalize.

Agreed - if I do this then I'll plan to provide more than a single example.

@rxaviers
Copy link
Member

👍

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

2 participants