Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

$missingTranslationHandlerFactory does not work well with angular-translate-loader-url #74

Closed
jamesandres opened this issue Jun 20, 2013 · 7 comments
Labels

Comments

@jamesandres
Copy link
Contributor

Hi @PascalPrecht ,

I am working at integrating the angular-translate-loader-url project into my codebase but it isn't playing nice with $missingTranslationHandlerFactory. The behaviour I'm seeing looks like this.

  1. Page loads
  2. $missingTranslationHandlerFactory is immediately called for every string on the page, but $uses is currently undefined
  3. The translations finally finish loading via $http service
  4. Some other page content loads via XHR (eg: a list of content for a sidebar on the page)
  5. $missingTranslationHandlerFactory is called for any untranslatable strings in this newly loaded content. Now $uses is correctly set to the current page language

How I wish it would behave:

  1. Page loads
  2. The translate filter / directive does not run until the translations are fetched from $http service
  3. Once finished loading the translate filter / directive is invoked and $missingTranslationHandlerFactory is called as needed

Your thoughts?

@0x-r4bbit
Copy link
Member

Hey @jamesandres could you please set up a plunk? Cause this should actually work properly.

@jamesandres
Copy link
Contributor Author

Sure thing

@jamesandres
Copy link
Contributor Author

@0x-r4bbit
Copy link
Member

@jamesandres Damn it. you're right. I'll label this issue as a bug and hope to get it fixed as soon as possible!

0x-r4bbit added a commit that referenced this issue Jun 21, 2013
this fix makes sure that missingTranslationHandlerFactory only gets
called when there is no pending loader to laod translations asynchronously.

Closes #74
@0x-r4bbit
Copy link
Member

Hey @jamesandres I pushed a patch to canary would you like to check against that code? Landed right here: 525b353

@jamesandres
Copy link
Contributor Author

Yep that's working for me. Thanks!

@0x-r4bbit
Copy link
Member

Landed in master as 0.9.4

Do $ bower cache-clean and $ bower install angular-translate

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants