Comments (10)
Some of the files do have code, actually. They are the ones which require specialized date conversion due to a non-gregorian calendar. Take a look at the AR ones for example.
If the only benefit to making them plain JSON is that they don't depend on a particular namespace, I'm not sure it's worth the added complexity of requiring a new API to load them and being unable to include them statically like (I think) you'd expect to. Also note that the files aren't really stand alone -- they only contain the difference between that culture and the default culture. Doing that really reduces the redundancy since a lot of cultures only differ slightly. To go with JSON files, they'd either need to drop that and be fully self describing, and therefore larger, or they'd require 'processing' by the host library to merge them.
from globalize.
Hmm, I don't see how the merging would be any different. The merges are basically JSON object merges as it is now, anyways. The only real extra step would be having to load files instead of including them statically, which is also the only major drawback. I agree that it would add extra complexity that perhaps isn't needed, though.
But anyways, I now see that there are in fact functions stored within the language definitions, so as it is now it would be impossible to implement the same thing in JSON. There must be a better way of starting out the definition blocks, though, instead of having to do this in every one:
var cultures = $.cultures,
en = cultures.en,
standard = en.calendars.standard,
culture = cultures["ar-AE"] = $.extend(true, {}, en, {
You could just extend the cultures object with an object with the key of the culture as a wrapper around the information (thus creating the namespace within cultures) like:
{ "ar-AE": { ... } }
Perhaps not that big of a deal, though... just looks a bit clunky as is.
from globalize.
That code is caching a few references for better minification. It can't just assign the object to the culture, it has to $.extend it with the standard culture, since it is only a diff of it. It also has to assign the current calendar after they are all defined.
There could be an API in glob.js that it called instead, but this would mean exposing a new public API for just this purpose.
from globalize.
I see. What would be the downside to exposing a public function such as:
Globalization.addCulture({ ... });
that would automatically handle merging definitions into the default (en) and assigning the current calendar for you?
from globalize.
As Globalization it isn't an issue. But in the jQuery dependent version that'd be jQuery.addCulture - a new top level jQuery function. jQuery likes to keep it clean :)
from globalize.
As it should, I think this plugin is already polluting a bit too much for jQuery's liking. Why can't everything just be namespaced under jQuery.global (or "glob")? (jQuery.global.cultures, jQuery.global.localize, etc)
from globalize.
It could. Some have suggested that. On the other hand, it makes it pretty verbose, and you could think of this as a horizontal feature that aught to appear more integrated. Either way it will likely change...
from globalize.
I suppose. Yeah can't think of any other way to do it at the moment, but if it becomes more integrated into jQuery I guess it would work itself out. After a quick glimpse through the code, the whole jQuery integration aspect still needs quite a bit of work. It looks like it was developed as a framework independent project and then quickly patched to make it fit under the jQuery namespace as an afterthought (which seemed a bit odd to me considering it now resides under the jQuery repository).
Anyways, I understand this is still a very young project, just thought I would give my two cents. Oh, and thanks for the civil conversation! Appreciated.
from globalize.
Just the opposite actually. It was exclusively jQuery, but in the end, it didn't really depend on jQuery for much of anything. Many felt it should be stand-alone, so we added that as an option.
As for deeper integration, there are lots of things we can do. Young project, yes :) Thanks for your feedback.
from globalize.
Closing this ticket as there's really no reason to change the file formats.
from globalize.
Related Issues (20)
- Webpack error: E_MISSING_MESSAGE_BUNDLE: Missing message bundle for locale `en` HOT 1
- Bug: Globalize number formatter is incorrect for numeric digits in supplemental plane HOT 4
- Migrate from JSF CLA bot to OpenJS Foundation EasyCLA HOT 2
- numberParser not returning the expected value for locale "sh" or serbian language HOT 1
- api.globalizejs.com status? HOT 1
- `"short"` date skeleton parses single-digit years HOT 1
- Unit Formatter Returning Internal Error with CLDR v40.0.0 HOT 5
- Force positive sign HOT 1
- Unit formatting megabyte in Polish short form failed because [email protected] has inconsistent data HOT 1
- Cannot get timezone names or the abbreviations from globalizer
- unitFormatter throw exception for locale "pl" with cldr-data 35 HOT 3
- Extend number format to use string instead of number HOT 4
- skeleton: "Bhm" is not supported HOT 1
- parseDate sets the time forward by an hour for non DST date time HOT 2
- Potential security issue HOT 1
- index.html
- Percent format and parsing HOT 2
- Module not found: Error: Cannot resolve module 'cldr' - in cypress tests
- Active development status check ???? HOT 1
- new Func() in globalize dist folder HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from globalize.