GithubHelp home page GithubHelp logo

ecma402's People

Contributors

ahmedmustafa avatar ccmitchellusa avatar cjolif avatar clmath avatar jcemmons avatar wkeese avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ecma402's Issues

IntlShim.js always loads Intl.js

From looking at the code and tracing in the debugger, IntlShim.js always loads Intl.js, whereas the goal is to only load it conditionally.

IntlShim.js has this code:

define(["./features!intl-api?:./Intl"]

as though features were a plugin. But it is not.

Also, there is no test file that just loads IntlShim.js, which makes it hard to see whether or not Intl.js is getting loaded unnecessarily or not.

invalid-meta?

I did a git clone and then bower install and saw the following messages. Not sure if they are fatal errors or not, but "invalid-meta" has a bad sound to it.

bower not-cached    git://github.com/jrburke/requirejs-bower.git#>=2.1.14
bower resolve       git://github.com/jrburke/requirejs-bower.git#>=2.1.14
bower not-cached    git://github.com/requirejs/text.git#>=2.0.12
bower resolve       git://github.com/requirejs/text.git#>=2.0.12
bower not-cached    git://github.com/ibm-js/requirejs-dplugins.git#>=0.2.2-dev
bower resolve       git://github.com/ibm-js/requirejs-dplugins.git#>=0.2.2-dev
bower download      https://github.com/jrburke/requirejs-bower/archive/2.1.14.tar.gz
bower download      https://github.com/ibm-js/requirejs-dplugins/archive/0.2.2-dev.tar.gz
bower download      https://github.com/requirejs/text/archive/2.0.12.tar.gz
bower extract       requirejs-text#>=2.0.12 archive.tar.gz
bower extract       requirejs#>=2.1.14 archive.tar.gz
bower invalid-meta  requirejs-text is missing "main" entry in bower.json
bower invalid-meta  requirejs-text is missing "ignore" entry in bower.json
bower extract       requirejs-dplugins#>=0.2.2-dev archive.tar.gz
bower resolved      git://github.com/requirejs/text.git#2.0.12
bower invalid-meta  requirejs is missing "ignore" entry in bower.json
bower resolved      git://github.com/jrburke/requirejs-bower.git#2.1.14
bower invalid-meta  requirejs-dplugins is missing "main" entry in bower.json
bower resolved      git://github.com/ibm-js/requirejs-dplugins.git#0.2.2-dev
bower install       requirejs-text#2.0.12
bower install       requirejs#2.1.14
bower install       requirejs-dplugins#0.2.2-dev

requirejs-text#2.0.12 ../requirejs-text

requirejs#2.1.14 ../requirejs

requirejs-dplugins#0.2.2-dev ../requirejs-dplugins

locale preload doesn't work

The goal of this the locale preload feature is that the application code below (specifically the ... section) doesn't run until the specified locales have been loaded:

require.config({
      baseUrl: '/ecma402',
      config: { 'locales' : /^(ar-(TN|SA)|en|es|hi|ja|de)$/ }
});
require([ "Intl", "IntlShim"], function(Intl,IntlShim) {
          ...

Unfortunately, it doesn't work correctly. In locales.js you just fire off a require() call and don't wait for it to complete. As I've said before, to get this to work correctly you'll need to write a plugin, specifically locales.js needs to be a plugin.

bower.json and package.json version and release version are not the same.

bower.json and package.json still have version: 0.2.1-dev while the latest release is 0.2.2-dev.

To solve this situation you can either:

  • delete the 0.2.2-dev tag, update bower.json and package.json to 0.2.2-dev, then re-tag 0.2.2-dev
  • update bower.json and package.json to 0.2.3-dev and tag a new 0.2.3-dev release.

EDIT: I will wait until this is solve to publish ecma402-build as I don't want to propagate the issue to another repo.

Specifying require dependencies

Currently the dependency on require in locales.js and preload.js are not correct.
Indeed, require is a special keyword as module and export.

The correct way to use require inside a module is:

define(["require"], function (require) {
    require([....]);
});

Enhancement of tests/intl_sample.html

Currently the script tags are direct children of the html tag instead of being under body or head.

Also, I think the variables could have names more significant than the current x, x1, y or y1.

And to be consistent with the other projects of ibm-js the samples should be in a /samples directory.

Workaround for tests that alter Object.prototype

The current ECMA402 test suite has a number of tests that alter Object.prototype and then try to do something. This type of test, such as test 12.2.2.b, are hanging on some platforms, while giving us very little value other than a red herring to chase. Dissussed with @cjolif and we agreed to comment out this test for now.

cluttered root directory

The root directory contains a lot of implementation classes not meant to be used by the application developer. Those classes should probably be moved to a "utils" (or any better name) directory so that root contains what is directly usable (Intl, IntlShim?). This would avoid people looking at the source and wondering what to use in there.

Specifying requirejs-text dependencies

Since the package requirejs-text is not bundled with ibm-js/ecma402, its path cannot be hardcoded on the dependency list (as in ../requirejs-text/...).

Instead the dependency should be specified with just the package name (requirejs-text/...) and the user will specify where to find this package using require.config().

See http://requirejs.org/docs/api.html#packages for more information on packages.

Docs: how to run tests?

It would be good if README had a section explaining how to run the tests.

I've assumed it's:

npm install
grunt test

But, a few hitters I got were:

  • test:local fails with ECONNREFUSED.
  • test:remote fails asking for Sauce username or access key.

[enhancement] Add missing bower.json.

Hey, maintainer(s) of ibm-dojo/g11n4js!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library ibm-dojo/g11n4js is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "ibm-dojo/g11n4js",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

Work as a node.js module?

I didn't investigate this much, but it looks like the library can't load under node (define is not defined). Is it possible?

Requirejs expect module config to be an object.

As you can see in the code here (https://github.com/jrburke/requirejs/blob/master/require.js#L588), the default for a module config is an object.

Also I think it will be more future proof to use an object instead of the regexp directly as it will allow to add more options without breaking the backward compatibility.

I would suggest using something like this:

requirejs.config({
    config: {
        "ecma402/locales": {
            locales: /^(ar-(TN|SA)|en|es|hi|ja|de)$/
        }
    }
})

lots of unneeded calendar code downloaded

Calendars.js loads the modules for every single calendar type (japan, hebrew, islamic, arabic, roc, etc.). This is bad because it downloads lots of unnecessary code to the browser, slowing down page load/render time.

Can you change the API so it only loads the calendar it needs? Or is this something you are stuck with to match the spec's API?
Just in AhmedMustafa@d0d69a3 I see 10 pages of unneeded code being downloaded.

PS: The switch() statement in calendars.js is also a red flag; in OO programming that's typically done by having various subclasses (one for each case in the switch statement), and calling the method directly on the subclass.

Could you enhance load.js to just load the appropriate Calendar module(s)?

Some minor problems with README.md

The README.md doc should have a couple of changes made:

1). The link to MDN should point to the English version, not the French version.
2). It should also mention that if you want to force the IBM implementation, you can just require ecma402/Intl instead of ecma402/IntlShim, instead of having to set

config: {
"requirejs-dplugins/has": {
"intl-api": false
}

IntlShim loads Intl in all cases

After the latest check in of IntlShim.js I see multiple issues.

First, this line needs to execute the function, not just define the function. As you have it now __globalObject points to a function:

var __globalObject = (function(){return this;});

Thusly, this if condition is always true:

if (__globalObject.Intl === undefined) {
    dependencies.push("./Intl");
}

Finally, most importantly, the way to load modules conditionally is with the has! plugin. See requirejs doc for details. This method is non-standard and will break builds and cause other bad things to happen:

define(dependencies, ...

Add support for Hebrew numerals in Hebrew calendar

Full Hebrew calendar support requires algorithmic formatting of numbers (especially the year) into Hebrew instead of using regular digits. Will probably need to leverage RBNF data from CLDR for a generalized solution, or else write a formatter specifically for the Hebrew calendar.

Update CLDR data to release 26

The CLDR project has just released version 26, which is a major new release. Need to update the JSON data in the ECMA-402 package to the newly released CLDR 26.

Regex pattern used for region tag in CanonicalizeLanguageTag

In CanonicalizeLanguageTag:

[https://github.com/ibm-js/ecma402/blob/master/impl/common.js#L183]

var regionTag = /(?:-)([a-z]{2})(?=(-|$))/g;

This regex pattern would not be sufficient to parse a region subtag with 3 letter numeric code (such as 419).

Load Intl.js on node.js.

Trying to access navigator without checking first if it's defined will fail on node.js.
This is (at least) done in ecma402/common.js l.165,167,169,171.

can't use require.config() in modules

Intl.sh and IntlShim.js are calling require.config(). As mentioned multiple times before, this is not allowed. Only the application can call that.

Improved handling of date/time patterns that have both a date and time portion

Here are two examples of date format for which the shim does not returns the same string than a native implementation:

{weekday: 'long'}

=> The native implementation returns "Monday" (if the date is a monday), while the shim returns "14 Mon" (if the date is a monday 14th)

{year: 'numeric', month: 'numeric', day: 'numeric', hour:'numeric', minute: 'numeric', second:'numeric', hour12: false}

=> The native implementation returns "10/21/2014, 14:18:34" while the shim returns "Tue, Oct 21, 2014 at 14:18:34"

IntlShim and Intl names may be exchanged.

I think it is more natural to require Intl if you want to pick any available Intl implementation (ie: the one from the browser or the polyfill) and to require IntlShim if you specifically want the polyfill.

Improved matching for date patterns

Right now, our implementation will only match date skeletons that are an exact match of what's in CLDR. We should at least do the somewhat "safe" extension of including a MMMM format ( long month name ) whenever we find a MMM format ( abbreviated month name ) in the CLDR data, assuming that an explicit MMMM format does not exist. There are some locales in CLDR where it does indeed exist.

Test are failing on Safari MacOS (and probably iOS?)

[Error] FAIL: Test_9_2_1_4 (0ms)
    /test/fail (console.js, line 40)
[Error] TypeError: function () {
                if (!(this instanceof Number)) {
                    throw new TypeError("not a valid Number");
                }
                var x = Number(this);
                var locales;
                var options;
                if (arguments.length > 0) {
                    locales = arguments[0];
                }
                if (arguments.length > 1) {
                    options = arguments[1];
                }
                var numberFormat = {};
                _initializeNumberFormat(numberFormat, locales, options);
                return _formatNumber(numberFormat, x);
            } must be a string or an object. (Testing with NumberFormat.)
CanonicalizeLocaleList@http://localhost/~cjolif/Dojo2/ecma402/common.js:201:70
value@http://localhost/~cjolif/Dojo2/ecma402/Intl.js:1000:58
http://localhost/~cjolif/Dojo2/ecma402/tests/intl402/suite/ch09/9.2.js:136:63
http://localhost/~cjolif/Dojo2/ecma402/tests/intl402/harness/testIntl.js:66:17
every@[native code]
testWithIntlConstructors@http://localhost/~cjolif/Dojo2/ecma402/tests/intl402/harness/testIntl.js:62:30
Test_9_2_1_4@http://localhost/~cjolif/Dojo2/ecma402/tests/intl402/suite/ch09/9.2.js:115:37
run@http://localhost/~cjolif/Dojo2/ecma402/node_modules/intern//lib/Test.js:154:23
http://localhost/~cjolif/Dojo2/ecma402/node_modules/intern//lib/Suite.js:211:16
signalListener@http://localhost/~cjolif/Dojo2/ecma402/node_modules/intern//node_modules/dojo/Deferred.js:37:25
then@http://localhost/~cjolif/Dojo2/ecma402/node_modules/intern//node_modules/dojo/Deferred.js:258:19
http://localhost/~cjolif/Dojo2/ecma402/node_modules/intern//lib/Suite.js:210:50
    logError (util.js, line 136)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.