question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$translate.refresh() does not cause $translate(...) to wait for network requests to complete.

See original GitHub issue

When using the partial loader, we are adding a part and then calling $translate.refresh() like the documentation recommends. However, we also need to use the $translate service immediately following that.

$translatePartialLoader.addPart('part1');
$translate.refresh();

$translate('ID').then(function(translation) {
  $scope.variable = translation;
});

When used like this, the $translate service does not wait for the partial loader to fetch the data and refresh the system.

This is most evident when the connection getting the translation data is slow.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
0x-r4bbitcommented, Aug 5, 2014

Actually sending events is blocking. When $broadcasting events, the code execution goes on, once the broadcast ist done. However, $translate.refresh() returns a promise. @devonhumes you can actually do something like:

$translate.refresh().then(function () {
   $translate('ID').then(function (translation) {
     // do some stuff here
   });
});

Or you can react on $translateRefreshEnd event.

$rootScope.$on('$translateRefreshEnd', function () {
    // do something
});
0reactions
tspaethcommented, Aug 28, 2014

closed due to inactivity. Feel free to reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

$translateChangeSuccess not fired after pageload #1449
The reason I register this event inside a controller is because I get untranslated translation key names back from the $translate() constructor ...
Read more >
Translate service not working on load page - Stack Overflow
When I do a refresh I have in title of my page seo.home.title so the translation is not done, after that if I...
Read more >
Continuously translate speech in near real-time.
Continuously translate speech in near real-time. · Speak to the world · Always with you · Speak, snap, write or type. The choice...
Read more >
Batch requests (Advanced) | Cloud Translation
Batch translation allows you to translate large amounts of text (with a limit of 100 files per batch), and to up to 10...
Read more >
RFC 5245: Interactive Connectivity Establishment (ICE)
Note that ICE is not intended for NAT traversal for SIP, which is assumed to be ... The Refresh requests will also refresh...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found