digitalascetic / iron-router-i18n

Meteor iron router support for i18n
MIT License
36 stars 5 forks source link

TypeError: this.getLanguage is not a function #57

Closed richarddewit closed 9 years ago

richarddewit commented 9 years ago
Exception in defer callback: TypeError: this.getLanguage is not a function
    at Function.Router.go (http://localhost:4000/packages/martino_iron-router-i18n.js?8b6f38469e9df07c010efddd15081a3cf9179fe3:535:62)
    at Function.initi18n._i18n.hooks.missingLangCodeAction (http://localhost:4000/packages/martino_iron-router-i18n.js?8b6f38469e9df07c010efddd15081a3cf9179fe3:497:18)
    at Function.Router.dispatch (http://localhost:4000/packages/martino_iron-router-i18n.js?8b6f38469e9df07c010efddd15081a3cf9179fe3:418:61)
    at onLocationChange (http://localhost:4000/packages/iron_router.js?a427868585af16bb88b7c9996b2449aebb8dbf51:1772:25)
    at Tracker.Computation._compute (http://localhost:4000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:327:36)
    at new Tracker.Computation (http://localhost:4000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:243:10)
    at Object.Tracker.autorun (http://localhost:4000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:566:11)
    at Function.Router.start (http://localhost:4000/packages/iron_router.js?a427868585af16bb88b7c9996b2449aebb8dbf51:1765:36)
    at http://localhost:4000/packages/iron_router.js?a427868585af16bb88b7c9996b2449aebb8dbf51:968:16
    at _.extend.withValue (http://localhost:4000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:955:17)

in packages/martino:iron-router-i18n/lib/router_client.js on line 58:

var lang = options && options.lang ? options.lang : this.getLanguage();

Steps to reproduce:

  1. use URL with locale (http://localhost:4000**/en**/example)
  2. use URL without locale (http://localhost:4000/example)
  3. Error in console

Only appears without locale in URL.

martinopic commented 9 years ago

This should fix it. Unfortunately I still haven't thought about a good way to test this part of the code. Will be available in next bugfix release (will wait a couple of days to see if other bugs come up).