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

Intl.js 404 Not Found #61

Closed
tkallevik opened this Issue Jan 26, 2016 · 11 comments

Comments

Projects
None yet
6 participants
@tkallevik

tkallevik commented Jan 26, 2016

Hi

When running the a bundled version of my application I get the following error in Safari:

[Debug] DEBUG [aurelia] – "Loading plugin aurelia-i18n." (example.com, line 9)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (Intl.js@0.1.4.js, line 0)

Here is some parts of my config.js (I have exluded the parts I meant to be irrelevant in this case):

map: {
    ...
    "npm:aurelia-i18n@0.4.6": {
      "Intl.js": "github:andyearnshaw/Intl.js@0.1.4",
      "aurelia-binding": "npm:aurelia-binding@1.0.0-beta.1.0.5",
      "aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-beta.1.0.1",
      "aurelia-event-aggregator": "npm:aurelia-event-aggregator@1.0.0-beta.1",
      "aurelia-loader-default": "npm:aurelia-loader-default@1.0.0-beta.1.0.2",
      "aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.0.2",
      "aurelia-templating": "npm:aurelia-templating@1.0.0-beta.1.0.3",
      "aurelia-templating-resources": "npm:aurelia-templating-resources@1.0.0-beta.1.0.4",
      "i18next": "github:i18next/i18next@1.11.2"
    },
    ...
},
bundles: {
    "aurelia": [
      "github:components/jquery@2.2.0",
      "github:components/jquery@2.2.0/jquery",
      "github:i18next/i18next@1.11.2",
      "github:i18next/i18next@1.11.2/i18next",
      "github:jspm/nodelibs-process@0.1.2",
      "github:jspm/nodelibs-process@0.1.2/index",
      "github:twbs/bootstrap@3.3.6",
      "github:twbs/bootstrap@3.3.6/css/bootstrap.css!github:systemjs/plugin-text@0.0.3",
      "github:twbs/bootstrap@3.3.6/js/bootstrap",
      ...
      "npm:aurelia-i18n@0.4.6",
      "npm:aurelia-i18n@0.4.6/aurelia-i18n",
      "npm:aurelia-i18n@0.4.6/base-i18n",
      "npm:aurelia-i18n@0.4.6/defaultTranslations/relative.time",
      "npm:aurelia-i18n@0.4.6/df",
      "npm:aurelia-i18n@0.4.6/i18n",
      "npm:aurelia-i18n@0.4.6/nf",
      "npm:aurelia-i18n@0.4.6/relativeTime",
      "npm:aurelia-i18n@0.4.6/rt",
      "npm:aurelia-i18n@0.4.6/t",
      "npm:aurelia-i18n@0.4.6/utils",
      ...
   ]
}

Can you help me solve this?

@EisenbergEffect

This comment has been minimized.

Show comment
Hide comment
@EisenbergEffect

EisenbergEffect Jan 26, 2016

Member

More than likely you need to actually add it to your bundle config so that it ends up in the distributable bundle.

Member

EisenbergEffect commented Jan 26, 2016

More than likely you need to actually add it to your bundle config so that it ends up in the distributable bundle.

@tkallevik

This comment has been minimized.

Show comment
Hide comment
@tkallevik

tkallevik Jan 26, 2016

Ok, I just thought that it would be added since it is a dependency for the aurelia-i18n plugin, which is added to the bundle. i18next is another example of a dependency for that plugin, and that is added without me explicitly saying so.

tkallevik commented Jan 26, 2016

Ok, I just thought that it would be added since it is a dependency for the aurelia-i18n plugin, which is added to the bundle. i18next is another example of a dependency for that plugin, and that is added without me explicitly saying so.

@EisenbergEffect

This comment has been minimized.

Show comment
Hide comment
@EisenbergEffect

EisenbergEffect Jan 26, 2016

Member

@zewa666 Can you provide input on this? Is the Intl.js library statically imported or is it dynamically imported? I'm assuming it is loaded based on need. If that is the case, can you identify which browsers need it and which don't? Also can you update the docs to indicate that if supporting browsers that need it, then the bundle config will need to be appended?

Member

EisenbergEffect commented Jan 26, 2016

@zewa666 Can you provide input on this? Is the Intl.js library statically imported or is it dynamically imported? I'm assuming it is loaded based on need. If that is the case, can you identify which browsers need it and which don't? Also can you update the docs to indicate that if supporting browsers that need it, then the bundle config will need to be appended?

@zewa666

This comment has been minimized.

Show comment
Hide comment
@zewa666

zewa666 Jan 27, 2016

Member

@EisenbergEffect yes the dependency on the i18n polyfill is a dynamic one. Browsers like Safari or IE < 11 and Node.JS do not provide a default implementation. Will create the README update.

Member

zewa666 commented Jan 27, 2016

@EisenbergEffect yes the dependency on the i18n polyfill is a dynamic one. Browsers like Safari or IE < 11 and Node.JS do not provide a default implementation. Will create the README update.

@doktordirk

This comment has been minimized.

Show comment
Hide comment
@doktordirk

doktordirk Feb 2, 2016

Contributor

@zewa666 stupid question: other than in the tests i don't find a dependency on Intl.js anywhere. in that case moving it to devDependency would remove some problems

Contributor

doktordirk commented Feb 2, 2016

@zewa666 stupid question: other than in the tests i don't find a dependency on Intl.js anywhere. in that case moving it to devDependency would remove some problems

@zewa666

This comment has been minimized.

Show comment
Hide comment
@zewa666

zewa666 Feb 3, 2016

Member

Intl.js is loaded on demand if needed. Means if the browser or environment does not fully or at all support the Javascript Internationalization API, the plugin will load the polyfill.

So no, moving it to a devDependency thus is no option

Member

zewa666 commented Feb 3, 2016

Intl.js is loaded on demand if needed. Means if the browser or environment does not fully or at all support the Javascript Internationalization API, the plugin will load the polyfill.

So no, moving it to a devDependency thus is no option

zewa666 added a commit that referenced this issue Feb 3, 2016

docs(intl.js): document intl polyfill
document how the intl polyfill is used and that manual bundling
configuration is needed

fixes issue #61 (comment)

@zewa666 zewa666 closed this Feb 3, 2016

@don-bluelinegrid

This comment has been minimized.

Show comment
Hide comment
@don-bluelinegrid

don-bluelinegrid Jul 29, 2016

Where is the documentation on how to bundle the polyfill?

This is working fine on Chrome, but on Safari I see:

"Intl API is not available. Trying to load the polyfill."

This occurs even when running in live dev mode (npm start, in the typescript-webpack skeleton).

How do we get the polyfill to be included?

Thanks,
Don

don-bluelinegrid commented Jul 29, 2016

Where is the documentation on how to bundle the polyfill?

This is working fine on Chrome, but on Safari I see:

"Intl API is not available. Trying to load the polyfill."

This occurs even when running in live dev mode (npm start, in the typescript-webpack skeleton).

How do we get the polyfill to be included?

Thanks,
Don

@don-bluelinegrid

This comment has been minimized.

Show comment
Hide comment
@don-bluelinegrid

don-bluelinegrid Jul 29, 2016

OK, I do see the README information about the polyfill, but it is referring to modifying the aurelia bootstrap() function.
https://github.com/aurelia/i18n#internationalization-api-polyfill

However, in the typescript-webpack skeleton, there is no bootstrap() function - it uses the configure() function in main.js. Can we also get documentation on how to adjust the aurelia configure() function for this?

Thanks,
Don

don-bluelinegrid commented Jul 29, 2016

OK, I do see the README information about the polyfill, but it is referring to modifying the aurelia bootstrap() function.
https://github.com/aurelia/i18n#internationalization-api-polyfill

However, in the typescript-webpack skeleton, there is no bootstrap() function - it uses the configure() function in main.js. Can we also get documentation on how to adjust the aurelia configure() function for this?

Thanks,
Don

@ben-girardet

This comment has been minimized.

Show comment
Hide comment
@ben-girardet

ben-girardet Aug 19, 2016

I'm having the same issue. Any documentation on how to include the polyfill when using Aurelia with aurelia-cli ?

ben-girardet commented Aug 19, 2016

I'm having the same issue. Any documentation on how to include the polyfill when using Aurelia with aurelia-cli ?

@zewa666

This comment has been minimized.

Show comment
Hide comment
@zewa666

zewa666 Aug 19, 2016

Member

@ben-girardet the best thing is to follow this guide on how to install the plugin with AureliaCLI. http://pragmatic-coder.net/installing-the-aurelia-i18n-plugin-in-a-cli-app/

on top of that in order to install the Polyfill, you'd additionally run
npm install intl
and add the following to the dependencies in aurelia.json

{
            "name": "intl",
            "path": "../node_modules/intl/dist",
            "main": "Intl.min"  <--- or Intl.complete
          },
Member

zewa666 commented Aug 19, 2016

@ben-girardet the best thing is to follow this guide on how to install the plugin with AureliaCLI. http://pragmatic-coder.net/installing-the-aurelia-i18n-plugin-in-a-cli-app/

on top of that in order to install the Polyfill, you'd additionally run
npm install intl
and add the following to the dependencies in aurelia.json

{
            "name": "intl",
            "path": "../node_modules/intl/dist",
            "main": "Intl.min"  <--- or Intl.complete
          },
@ben-girardet

This comment has been minimized.

Show comment
Hide comment
@ben-girardet

ben-girardet Aug 19, 2016

Thanks @zewa666 I was missing the part in the aurelia.json

ben-girardet commented Aug 19, 2016

Thanks @zewa666 I was missing the part in the aurelia.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment