Golden mole
Golden mole

Reputation: 503

error using Aurelia i18n

I am trying to use Aurelia-i18n but I am kind of stuck at the initial configuration step. I did up to this point (https://github.com/aurelia/i18n#how-to-install-this-plugin) but I am getting this error when I ran my application:

frameworkConfig.globalResources is not a function

main.js

import {I18N} from 'aurelia-i18n';

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .developmentLogging()
    .plugin('aurelia-validation')
    .plugin('aurelia-i18n', (instance) => {
      instance.setup({
        resGetPath : 'locale/__lng__/__ns__.json',
        lng : 'en',
        attributes : ['t','i18n'],
        getAsync : true,
        sendMissing : false,
        fallbackLng : 'en',
        debug : false
      });
    });

  aurelia.start().then(a => a.setRoot());
}

locale/en/translation.json

{
  "hello": "hello"
}

What am I doing wrong?

Upvotes: 3

Views: 621

Answers (1)

Jeremy Danyow
Jeremy Danyow

Reputation: 26406

You might be using an old version of the Aurelia framework.

To determine if you're out of date, open your package.json and locate this line:

"aurelia-framework": "github:aurelia/framework@^[some version]"

And compare the version you see there with the latest release here: https://github.com/aurelia/framework/releases

You can use jspm to install the latest versions of the Aurelia modules- this command will do it (you may want to remove some of the modules you aren't using from the command):

jspm install aurelia-animator-css aurelia-binding aurelia-bootstrapper aurelia-dependency-injection aurelia-framework aurelia-http-client aurelia-router aurelia-event-aggregator aurelia-history-browser aurelia-loader-default aurelia-loader aurelia-metadata aurelia-route-recognizer aurelia-templating-binding aurelia-templating-resources aurelia-templating-router aurelia-templating aurelia-logging aurelia-task-queue aurelia-history aurelia-path

Follow http://blog.durandal.io/ to keep up to date with the breaking changes and latest releases as Aurelia approaches beta / v1.0.0.

This release is where the change from globalizeResources to globalResources was announced: http://blog.durandal.io/2015/03/25/aurelia-0-10-0-release-status/

Upvotes: 4

Related Questions