ngx-translate / core

The internationalization (i18n) library for Angular
MIT License
4.52k stars 578 forks source link

Dynamically construct translation keys #850

Open taiducnguyen opened 6 years ago

taiducnguyen commented 6 years ago

Hi all,

How can I fallback to a default key if the dynamic translation key is not found?

This is in my case: [innerHTML]="'Commons.HttpStatus.' + statusError || ' Commons.HttpStatus.Default' | translate"

Could you please help me invest this?

Thanks!!

taiducnguyen commented 6 years ago

Hi,

I found a solution here to handle error: https://github.com/ngx-translate/core/issues/160

Do you have any better solution for this one?

Thanks

nicholasgcoles commented 6 years ago

Hi @taiducnguyen did you manage to solve this without using a function?

It would be great if one could parse in default text as an argument to the translate pipe