Reputation: 445
I am using angular-translate
for translating English to French but the issue is it converts single quote to double quote. I want to replace translated double quotes with single quote. I have a filter but its not applying on translated text.
Code snippet:
<div class="no-text" ng-if="question.length == 0" translate="msg.site_is_not_applicable" translate-default="This site is not applicable"></div>
e.g. msg.site_is_not_applicable(EN) = This site is not applicable
After translated in French = le site n''est pas applicable
Want to replace double quoted with single quote. Can someone help how I can do this using angular-translate.js.
<div class="no-text" ng-if="question.length == 0" translate="msg.site_is_not_applicable | quoteSingle" translate-default="This site is not applicable"></div>
filter.js
app.module('app.filters', []).filter('quoteSingle', function() {
return function(text) {
return text.replace(/"/g, "'");
};
});
Upvotes: 0
Views: 1243
Reputation: 3513
Instead of translate
directive make use of translate
filter. And then you can chain multiple filters on same binding property. So you can add your custom filter after translate filter. Your template code can be:
<div class="no-text" ng-if="question.length == 0">
{{msg.site_is_not_applicable | translate | quoteSingle}}
</div>
Upvotes: 2