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

Commit

Permalink
fix(service): allow instant function to also take care of post proces…
Browse files Browse the repository at this point in the history
…s configuration
  • Loading branch information
tspaeth authored and knalli committed Jun 5, 2016
1 parent 4679609 commit b7d7907
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/service/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,7 @@ function $translate($STORAGE_KEY, $windowProvider, $translateSanitizationProvide
if (translationTable && Object.prototype.hasOwnProperty.call(translationTable, translationId)) {
Interpolator.setLocale(langKey);
result = Interpolator.interpolate(translationTable[translationId], interpolateParams);
result = applyPostProcessing(translationId, translationTable[translationId], result, interpolateParams, langKey);
if (result.substr(0, 2) === '@:') {
return getFallbackTranslationInstant(langKey, result.substr(2), interpolateParams, Interpolator);
}
Expand Down Expand Up @@ -1617,6 +1618,7 @@ function $translate($STORAGE_KEY, $windowProvider, $translateSanitizationProvide
result = determineTranslationInstant(translation.substr(2), interpolateParams, interpolationId, uses);
} else {
result = Interpolator.interpolate(translation, interpolateParams);
result = applyPostProcessing(translationId, translation, result, interpolateParams, uses);
}
} else {
var missingTranslationHandlerTranslation;
Expand Down
5 changes: 5 additions & 0 deletions test/unit/service/translate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2809,6 +2809,11 @@ describe('pascalprecht.translate', function () {
$rootScope.$digest();
expect(value).toEqual('BOTH,de_DE,BOTH_DE');
});
it('should return a formatted postprocessed string on preferred language with instant', function () {
var value;
value = $translate.instant('BOTH');
expect(value).toEqual('BOTH,de_DE,BOTH_DE');
});
});
});

Expand Down

0 comments on commit b7d7907

Please sign in to comment.