0

I'm working with Angular 7. I need to translate texts with variables. Let's say I want to translate it to German. The words(variables) needs to change positions because of the language properties.

Example:

EN: Logged in as Robert.

DE: Als Robert angemeldet.

Can't decide how can i deal with the situation properly. Can somebody answer for me with an easy example? Thank you for your feedback.

Usually, I'm dealing with translations like this:

In component:

{{'Dashboard' | translate}}

i18n DE.json:

"Dashboard": "Armaturenbrett"

I need to translate strings like these:

description: "{{example.asd@qwe.com}} user uploads {{fileType}}{{fileName}} for {{company}} via {{deviceType}}."

summary: "days: {{daysNumber}}; distance: {{distanceCount}}"

1 Answers1

5

I am not sure if I understood your question properly. Is this what you intended?

En.json:

"description" : "{{email}} user uploads {{fileType}}{{fileName}} for {{company}} via {{deviceType}}"

Ko.json:

"description" : "{{email}} 사용자가 {{deviceType}}을 통해 {{company}}에 대한 {{fileType}} {{fileName}}을 업로드합니다"

Html:

<span>{{'description' | translate : {email : 'example@example.com', deviceType: 'exampleDevice', company: 'exampleCompany', fileType: '.exe', fileName: 'exampleName' } }}</span>
Paige
  • 99
  • 1
  • 6