ngx-translate / core

The internationalization (i18n) library for Angular
MIT License
4.51k stars 575 forks source link

Specifying translation namespace on the component level #1196

Open appimpact opened 4 years ago

appimpact commented 4 years ago

Hello,

We are currently using ngx-translate the way we specify namespace together with the translation key for each line:

<p>{{'Admin_Member_EditForm.FirstName' | translate}}</p>
<p [translate]="'Admin_Member_EditForm.LastName'"></p>

Back in the past when we were working with AngularJS, angular-translate plugin would allow us to do to this:

<div [translate-namespace]="'Admin_Member_EditForm'">
  <p>{{'FirstName' | translate}}</p>
  <p [translate]="'LastName'"></p>
</div>

Above is the pseudo-code how it might look with ngx-translate.

The goal is to eliminate specifying namespace in every directive/pipe, but instead to specify it once on the component level (actually on the parent HTML element).

Is this supported by ngx-translate? If not, are there any plans for this / any workarounds that we could do to make this happen?

ReschAndr commented 3 years ago

1284 not exactly implemented as you suggested but basically this pr should provide you the feature you wanted.