Search code examples
angularjsionic-frameworkangular-translate

angular-translate : sanitize strategies


in my ionic app, there's a tag where I need to use

$translateProvider.useSanitizeValueStrategy('sanitize');

because there is html in the translation field (translation-fr.js):

"recommendedboard": "Prefer a <span class=\"animateFUN\">SMALL-WAVE</span> board</span>"

But there are others spots where I need to use

$translateProvider.useSanitizeValueStrategy('escape');

because in the French translation, there accents on some letters, like :

 "31": "Modèle"

The only solution I found for now is to use the null strategy. Is there a way to use both strategies, or to specify the strategy for each translation ?

I have this in index.html:

<meta charset="utf-8">

and I checked the translation-fr.js file:

$ file -bi www/js/dicts/translation-fr.json 
text/plain; charset=utf-8

Thanks


Solution

  • I used

    $translateProvider.useSanitizeValueStrategy('sanitizeParameters');
    

    and now it seems to work for both case.