Dynamic translation, Angular and PHP

Solution for Dynamic translation, Angular and PHP
is Given Below:

I am working on an existing project assigned to me by a client. What I have a problem with are dynamic translations.


  morning: Good morning %name%


  morning: Dobro jutro %name%

So for every language, there is the translation for it, this %name% need to be sent from the frontend because that is user input, and I have issue how to pass it to the backend



<em>{{ trans.table.morning | translate }}</em>


morning : translate('trans.table.morning '),

So the issue is that the user can insert a name from the code from names.omponent.html, but my issue is how to pass dynamic value to the backend, any help?

As I understand, you want to send to the backend the translated sentence with the placeholder (%name%) filled with the user input ?

You can use the TranslateService (see doc) in your component to get the full sentence then send it to the backend using HttpClient with a REST API for example.