-
Notifications
You must be signed in to change notification settings - Fork 1.1k
$translate.instant do interpolation event when translation id is not found #1846
Comments
This is partly issued by #1101 Short story: You have to choose a strategy wisely depending on your need. You can use #1101 (comment) as a help. |
Note/reminder: It looks like your environment is using an old or older release of AngularJS and/or angular-translate. After updating your dependencies, please check and verify your issue again. |
I confirm that there's an issue. I'm using the latest AngularJS version 1.7.2 and the latest angular-translate version 2.18.1. |
@RostVY Thank you digging for some info :) Maybe you want to make a contribution fixing this issue? |
@knalli I wish I could, but I really don't want to - I'm on vacation without access to computer and without any wish to see computers, source codes and so on. If noone fixes during next month, I may rethink my decision. |
@RostVY lol, I can relate to "without any wish to see computers, sources codes and so on." Did you ever solve your issue with angular-translate? |
@ericnewton76 nope :(. I have not tried and I am unsure how it is supposed to work. Using |
Subject of the issue
Using $translate.instant('Hello<br>world') I receive the string "Hello<br>Hello2" instead of the original string.
If I use $translate('Hello<br>world').then(...) in the callback function I receive the original string.
Debugging code I've found that in the instant function call defaultInterpolator.interpolate that transform and sanitize the string from html chars.
Using the promise interpolation isn't called if translationId isn't found.
Your environment
Steps to reproduce
var title = 'Hello';
var message = 'Hello<br>world!';
$q.all({
translateTitle: $translate(title),
translateMessage: $translate(message)
}).then(function successCallback(translations) {
var instantMessage = $translate.instant(message);
title = translations.translateTitle;
message = translations.translateMessage;
toastr['info'](message, title);
toastr['info'](instantMessage, title);
});
The text was updated successfully, but these errors were encountered: