AngularJS translate dynamic string

angular-translate, angularjs, angularjs-directive, angularjs-scope

Solution

You must not have the translationProvider configured correctly. You should have something like this in your config:

$translateProvider.translations({
    'TRANSLATEME': 'Here is the translation'
});

and data.foo needs to equal `TRANSLATEME`.

Here's a Plunker showing it working.

Problem

I'm using angular-translate module for translation, but i have dynamic string which doesn't get translated. I have tried this ways: ``` {{ data.foo | translate }} ``` This didn't work. And i tried using his own directive: ``` <span translate>{{ data.foo }}</span> ``` Using this method i get in output result of data.foo without translation. What is the best way to do this? Thanks :)

Original source