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

Commit

Permalink
fix(service): correctly iterate in fallback languages (fixes #690)
Browse files Browse the repository at this point in the history
  • Loading branch information
tspaeth authored and knalli committed Sep 17, 2014
1 parent 7fd89d9 commit ac2f35c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/service/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -804,9 +804,13 @@ angular.module('pascalprecht.translate').provider('$translate', ['$STORAGE_KEY',
// maybe the language from storage is also defined as fallback language
// we increase the fallback language index to not search in that language
// as fallback, since it's probably the first used language
fallbackIndex = (index > -1) ? index+=1 : 0;
// in that case the index starts after the first element
fallbackIndex = (index === 0) ? 1 : 0;

// but we can make sure to ALWAYS fallback to preferred language at least
$fallbackLanguage.push($preferredLanguage);
if (indexOf($fallbackLanguage, $preferredLanguage) < 0) {
$fallbackLanguage.push($preferredLanguage);
}
}
}
return promise;
Expand Down

0 comments on commit ac2f35c

Please sign in to comment.