-
Notifications
You must be signed in to change notification settings - Fork 215
Consider making file names lower case? #116
Comments
@ollym this is very tricky. adding a lowercase will not help much because I could set my system preferences to use a very specific locale value like essentially I believe that a validation and normalization should happen before you make a network request because you have no way to recover for a failure to load the locale data. Essentially, every app will have a set of locales that the app is suitable to function, that's a whitelist of locales that can be manually maintained, and should be a subset of what is available thru Intl. Under normal conditions, can computation happens on the server side per request, producing either the polyfill url, or a url to load what is needed for the app to function, but it could be done on the client side as well. Makes sense? |
@caridy Is it outside the scope of this library provide some utility methods for parsing and normalising language tags then? |
This is not a library @ollym, this is a polyfill, which means it implements what is in the specs, nothing more. That being said, we have been discussing some modifications to the specs to expose low level operations like this one you're asking for, here are the details: tc39/ecma402#5. Now, what you're asking here is a way to prepare the polyfill based on the system locale information, which I think is not a good option, what if you have this in your code: Another issue with this approach is performance. You will have to wait until after the page is loaded and the JS code executed to decide what locale data to load, which will take a while to do, and until that happen, you can't really format numbers or dates. That will be far from optimal. |
@ollym we are working on the specification to provide access to existing abstract operations that will allow you to normalize a locale, more details here: tc39/ecma402#46 I will keep this open until that spec lands, and we can provide a method in Intl.js polyfill. |
This polyfill now implements ECMA402 getCanonicalLocales:
fixed by #171 |
great, thanks! |
I'm having real issues with dynamic loading the locale files. Consider the below (in CoffeeScript):
Problem is some browsers will return
navigator.language
with something like "en-us". Am I expected to parse that and work out what it should be with capitals?I think it would be easier to just lowercase every file name?
The text was updated successfully, but these errors were encountered: