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

Commit

Permalink
fix(service): avoid possible doubled requested on refresh()
Browse files Browse the repository at this point in the history
  • Loading branch information
knalli committed Sep 18, 2014
1 parent 8613bef commit 98d429d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/service/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1553,17 +1553,18 @@ angular.module('pascalprecht.translate').provider('$translate', ['$STORAGE_KEY',

if (!langKey) {
// if there's no language key specified we refresh ALL THE THINGS!
var tables = [];
var tables = [], loadingKeys = {};

// reload registered fallback languages
if ($fallbackLanguage && $fallbackLanguage.length) {
for (var i = 0, len = $fallbackLanguage.length; i < len; i++) {
tables.push(loadAsync($fallbackLanguage[i]));
loadingKeys[$fallbackLanguage[i]] = true;
}
}

// reload currently used language
if ($uses) {
if ($uses && !loadingKeys[$uses]) {
tables.push(loadAsync($uses));
}

Expand Down

0 comments on commit 98d429d

Please sign in to comment.