Andy88
Andy88

Reputation: 757

Angular/localize: How to vary string based on value from server?

I have an angular application that manage many domains: "LEGAL", "ARCHITECTURE", "GENERAL". I'm also using @angular/localize package. Now I'm in trouble with a problem. I have a server response that tells me the domain, if the domain is "LEGAL" all the tags html that contain the string "folder" have to be replaced by the value "job".

Now, if the domain is "GENERAL" (the standard domain) I have in the template HTML this case:

<div i18n="@@folder">folder</div>

but if domain will be "LEGAL" the value of folder must change. Is it possible to find a solution with angular/localize? This value has to be changed not only in html but also in every function where I need to create strings or also in matTooltip attributes.

Upvotes: 0

Views: 110

Answers (1)

mahdi nezhadasad
mahdi nezhadasad

Reputation: 86

Maybe this link can help you to understand.

https://angular.io/guide/i18n-common-translation-files

and also try this part of code:

<trans-unit id="folder">
<source>folder</source>
<target>{VAR_SELECT, select, job {job} other {folder}}</target>
</trans-unit>

Upvotes: 0

Related Questions