Nemo64 / meteor-translator

a feature rich internationalization (i18n) package for meteor with usage of the Unicode Common Locale Data Repository
MIT License
15 stars 4 forks source link

Error on client when used together with gadicohen:headers #10

Closed tanis2000 closed 9 years ago

tanis2000 commented 9 years ago

It looks like using other packages that use inject-inital together with Translator causes the following error on the client:

TypeError: Cannot read property 'hasOwnProperty' of undefined Namespace-client.js:25
_.extend._init Namespace-client.js:25
Namespace Namespace.js:15
Namespace.instance Namespace.js:32
(anonymous function) Translator.js:140
Tracker.nonreactive tracker.js:469
_.extend.use Translator.js:139
(anonymous function) main.js?84fa75065d85ea2ced5adc92ed26582c2b8b17a2:27runStartupCallbacks startup_client.js:30
ready

It might have something to do with issue https://github.com/Nemo64/meteor-translator/issues/8

I don't get if this is a problem of inject-initial or the way it's used. Any clue?

gadicc commented 9 years ago

I don't see any references to inject-initial in there, but could still be our fault; we gave up waiting for rename/redirect support from the Meteor Package Server and re-released as meteorhacks:inject-initial. gadicohen:inject-initial is actually setup to pull that package in, but only in v1.0.2, and since meteor-translator is specifying an older release, perhaps Meteor isn't automatically upgrading and hence the conflict.

@Nemo64 should be fine if you upgrade to meteorhacks:inject-initial@1.0.2 which has another small fix anyways.

Nemo64 commented 9 years ago

Well the problem is here: https://github.com/Nemo64/meteor-translator/blob/master/src/Namespace-client.js#L25 And the content gets injected here: https://github.com/Nemo64/meteor-translator/blob/master/src/inject/namespaces-server.js#L3

I don't know what i could have gotten wrong there. The object is always injected and if it doesn't come out, there is a problem.

Does this always occur or just sometimes? Is the json injected in the html? Do you use appcache?

@gadicc I'll see if I find time to update ;)

tanis2000 commented 9 years ago

@nemo64 I'll try upgrading to the version of inject-initial mentioned by @gadicc and let you know.

I'm not in front of my dev box at the moment do I cannot answer your questions yet. I'll keep you updated later. Thanks to both!

tanis2000 commented 9 years ago

The problem was exactly the one pointed out by @gadicc. I've submitted a PR for that: https://github.com/Nemo64/meteor-translator/pull/11

gadicc commented 9 years ago

I'm glad you referenced #8, because I never would have guessed that otherwise :) Go team :>

Nemo64 commented 9 years ago

so, i'm guessing this is fixed now with #11 . Thanks for identifying the issue ;)