Reputation: 197
I am developing a web application with NodeJS+Express+AngularJS and I am trying to show it in different languages. I have been able to translate correctly static text with "Angular-translate" very easily but the problem is that I don't know to do it with the data that I get dinamically from the database.
I have a column per language (description_es, description_en), so the thing is that I would like to change this statement that I have in the HTML depeding on the selected language.
{{restaurant.description_es}}
or
{{restaurant.description_en}}
Any help would be appreciated!
Thank you very much.
Upvotes: 0
Views: 928
Reputation: 41264
This should work:
$scope.lang = yourActiveLanguage;
....
{{ restaurant['description_' + lang] }}
Upvotes: 1