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

use default interpolator instead of return original translationId #730

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/service/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1666,8 +1666,8 @@ angular.module('pascalprecht.translate').provider('$translate', ['$STORAGE_KEY',
}

if (!result && result !== '') {
// Return translation if not found anything.
result = translationId;
// Return translation of default interpolator if not found anything.
result = defaultInterpolator.interpolate(translationId, interpolateParams);
if ($missingTranslationHandlerFactory && !pendingLoader) {
result = translateByHandler(translationId);
}
Expand Down
4 changes: 4 additions & 0 deletions test/unit/service/translate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1639,5 +1639,9 @@ describe('pascalprecht.translate', function () {
it('should return translation id if translation id nost exist', function () {
expect($translate.instant('FOO3')).toEqual('FOO3');
});

it('should return translation id with default interpolator if translation id nost exist', function () {
expect($translate.instant('FOO4 {{value}}', {'value': 'PARAM'})).toEqual('FOO4 PARAM');
});
});
});