aurelia / i18n

A plugin that provides i18n support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

plugin.load is not a function - TypeScript & Aurelia CLI

alexsaare opened this issue · comments

I'm submitting a bug report

  • Library Version:
    2.0.0

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    6.6.0

  • NPM Version:
    3.10.3

  • JSPM OR Webpack AND Version
    Aurelia CLI 0.32.0

  • Browser:
    all

  • Language:
    TypeScript 2.5.3

Current behavior:
Create a new application with TypeScript - au new
Follow tutorial here with default loader - http://aurelia.io/docs/plugins/i18n

Run application - au run-- watch

Application will not load.

vendor-bundle.js:14111 DEBUG [aurelia] Loading plugin aurelia-templating-binding.
vendor-bundle.js:14111 DEBUG [aurelia] Configured plugin aurelia-templating-binding.
vendor-bundle.js:14111 DEBUG [aurelia] Loading plugin aurelia-templating-resources.
vendor-bundle.js:14111 DEBUG [aurelia] Configured plugin aurelia-templating-resources.
vendor-bundle.js:14111 DEBUG [aurelia] Loading plugin aurelia-event-aggregator.
vendor-bundle.js:14111 DEBUG [aurelia] Configured plugin aurelia-event-aggregator.
vendor-bundle.js:14111 DEBUG [aurelia] Loading plugin aurelia-history-browser.
vendor-bundle.js:14111 DEBUG [aurelia] Configured plugin aurelia-history-browser.
vendor-bundle.js:14111 DEBUG [aurelia] Loading plugin aurelia-templating-router.
vendor-bundle.js:14111 DEBUG [aurelia] Configured plugin aurelia-templating-router.
vendor-bundle.js:14111 DEBUG [aurelia] Loading plugin resources/index.
vendor-bundle.js:14111 DEBUG [aurelia] Configured plugin resources/index.
vendor-bundle.js:14111 DEBUG [aurelia] Loading plugin aurelia-i18n.

Uncaught TypeError: plugin.load is not a function
at Module. (vendor-bundle.js:4883)
at vendor-bundle.js:3922
at on (vendor-bundle.js:4305)
at Module.callPlugin (vendor-bundle.js:4743)
at Module.fetch (vendor-bundle.js:4612)
at Module.check (vendor-bundle.js:4644)
at Module.enable (vendor-bundle.js:4964)
at Module. (vendor-bundle.js:4787)
at vendor-bundle.js:3922
at vendor-bundle.js:4977
at each (vendor-bundle.js:3847)
at Module.emit (vendor-bundle.js:4976)
at Module.check (vendor-bundle.js:4726)
at Module.enable (vendor-bundle.js:4964)
at Object.enable (vendor-bundle.js:5345)
at Module.callPlugin (vendor-bundle.js:4886)

Uncaught TypeError: plugin.load is not a function
at Module. (vendor-bundle.js:4883)
at vendor-bundle.js:3922
at on (vendor-bundle.js:4305)
at Module.callPlugin (vendor-bundle.js:4743)
at Module.fetch (vendor-bundle.js:4612)
at Module.check (vendor-bundle.js:4644)
at Module.enable (vendor-bundle.js:4964)
at Object.enable (vendor-bundle.js:5345)
at Module. (vendor-bundle.js:4949)
at vendor-bundle.js:3922
at each (vendor-bundle.js:3847)
at Module.enable (vendor-bundle.js:4901)
at Module.init (vendor-bundle.js:4576)
at vendor-bundle.js:5248

Expected/desired behaviour:
Application should run and load text from locale translation file.

Application - (excluding node_modules so run npm install)
app-3.zip

Could you try switching the stub property in your aurelia.json File?

Thank you for you quick response.

This helped me get things working!

In addition to changing stub to false in aurelia.json I also had to make the following changes to get this to work with the tutorial.

1 - change loadPath from './locales/{{lng}}/{{ns}}.json' to '../locales/{{lng}}/{{ns}}.json' in main.ts - (otherwise it's relative to the src directory)
2 - change source to 'locales/**/*.json' in the localesProcessor section of aurelia.json

Hope this helps someone in the future.

Here is a zip of the working app -
app-3.zip

Thanks again @zewa666