Get translation for two keys in ng2-translate with pipe

355 views Asked by At

I have this situation where I interpolate error variable which contains dynamic values.

{{ errorMsg | translate }}

I feed errorMsg a key everytime there is an error of any kind. Like

this.errorMsg = "error.loading.results"
this.errorMsg = "server.error"

those are my keys which are translated by the pipe and it works well.

But I want to translate two keys at the same time. How do I do that? Something like:

{{ ['error.loading.result', 'server.error'] | translate }}

which should result in

"Error loading result. Server Error" 

where the key value pair in en-US.json is:

"error.loading.result": "Error loading result.",
"server.error": "Server Error"

Is this doable?

0

There are 0 answers