Skip to content

Commit e5f3d8a

Browse files
authored
[Angular] Replace SharedModule import with only TranslateDirective/TranslateModule import (#31698)
1 parent 9dc4164 commit e5f3d8a

File tree

7 files changed

+35
-14
lines changed

7 files changed

+35
-14
lines changed

generators/angular/templates/src/main/webapp/app/account/password-reset/finish/password-reset-finish.ts.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ import { Component, inject, OnInit, AfterViewInit, ElementRef, signal, viewChild
2020
import { FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
2121
import { ActivatedRoute, RouterLink } from '@angular/router';
2222
import PasswordStrengthBar from 'app/account/password/password-strength-bar/password-strength-bar';
23-
import SharedModule from 'app/shared/shared.module';
23+
<%_ if (enableTranslation) { _%>
24+
import { TranslateDirective } from 'app/shared/language';
25+
import { TranslateModule } from '@ngx-translate/core';
26+
<%_ } _%>
2427

2528
import { PasswordResetFinishService } from './password-reset-finish.service';
2629

2730
@Component({
2831
selector: '<%= jhiPrefixDashed %>-password-reset-finish',
29-
imports: [SharedModule, RouterLink, ReactiveFormsModule, PasswordStrengthBar],
32+
imports: [<%_ if (enableTranslation) { _%>TranslateDirective, TranslateModule, <%_ } _%>RouterLink, ReactiveFormsModule, PasswordStrengthBar],
3033
templateUrl: './password-reset-finish.html',
3134
})
3235
export default class PasswordResetFinish implements OnInit, AfterViewInit {

generators/angular/templates/src/main/webapp/app/account/password/password.ts.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ import { Component, Injector, OnInit, Signal, inject, signal } from '@angular/co
2020
import { FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
2121
import { toSignal } from '@angular/core/rxjs-interop';
2222

23-
import SharedModule from 'app/shared/shared.module';
23+
<%_ if (enableTranslation) { _%>
24+
import { TranslateDirective } from 'app/shared/language';
25+
import { TranslateModule } from '@ngx-translate/core';
26+
<%_ } _%>
2427
import { AccountService } from 'app/core/auth/account.service';
2528
import { Account } from 'app/core/auth/account.model';
2629
import { PasswordService } from './password.service';
2730
import PasswordStrengthBar from './password-strength-bar/password-strength-bar';
2831

2932
@Component({
3033
selector: '<%= jhiPrefixDashed %>-password',
31-
imports: [SharedModule, ReactiveFormsModule, PasswordStrengthBar],
34+
imports: [<%_ if (enableTranslation) { _%>TranslateDirective, TranslateModule, <%_ } _%>ReactiveFormsModule, PasswordStrengthBar],
3235
templateUrl: './password.html',
3336
})
3437
export default class Password implements OnInit {

generators/angular/templates/src/main/webapp/app/account/register/register.ts.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ import { TranslateService } from '@ngx-translate/core';
2626

2727
import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from 'app/config/error.constants';
2828
import { RegisterService } from './register.service';
29-
import SharedModule from 'app/shared/shared.module';
29+
<%_ if (enableTranslation) { _%>
30+
import { TranslateDirective } from 'app/shared/language';
31+
import { TranslateModule } from '@ngx-translate/core';
32+
<%_ } _%>
3033
import PasswordStrengthBar from '../password/password-strength-bar/password-strength-bar';
3134

3235
@Component({
3336
selector: '<%= jhiPrefixDashed %>-register',
34-
imports: [SharedModule, RouterLink, ReactiveFormsModule, PasswordStrengthBar],
37+
imports: [<%_ if (enableTranslation) { _%>TranslateDirective, TranslateModule, <%_ } _%>RouterLink, ReactiveFormsModule, PasswordStrengthBar],
3538
templateUrl: './register.html',
3639
})
3740
export default class Register implements AfterViewInit {

generators/angular/templates/src/main/webapp/app/admin/health/modal/health-modal.ts.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ import { Component, inject } from '@angular/core';
2020
import { KeyValuePipe } from '@angular/common';
2121
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
2222

23-
import SharedModule from 'app/shared/shared.module';
23+
<%_ if (enableTranslation) { _%>
24+
import { TranslateDirective } from 'app/shared/language';
25+
import { TranslateModule } from '@ngx-translate/core';
26+
<%_ } _%>
2427
import { HealthKey, HealthDetails } from '../health.model';
2528

2629
@Component({
2730
selector: '<%= jhiPrefixDashed %>-health-modal',
2831
templateUrl: './health-modal.html',
29-
imports: [SharedModule, KeyValuePipe],
32+
imports: [<%_ if (enableTranslation) { _%>TranslateDirective, TranslateModule, <%_ } _%>KeyValuePipe],
3033
})
3134
export default class HealthModal {
3235
health?: { key: HealthKey; value: HealthDetails };

generators/angular/templates/src/main/webapp/app/home/home.ts.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ import { Subject } from 'rxjs';
3232
import { takeUntil } from 'rxjs/operators';
3333
<%_ } _%>
3434

35-
import SharedModule from 'app/shared/shared.module';
35+
<%_ if (enableTranslation) { _%>
36+
import { TranslateDirective } from 'app/shared/language';
37+
import { TranslateModule } from '@ngx-translate/core';
38+
<%_ } _%>
3639
<%_ if (authenticationTypeOauth2) { _%>
3740
import { LoginService } from 'app/login/login.service';
3841
<%_ } _%>
@@ -43,7 +46,7 @@ import { Account } from 'app/core/auth/account.model';
4346
selector: '<%= jhiPrefixDashed %>-home',
4447
templateUrl: './home.html',
4548
styleUrl: './home.scss',
46-
imports: [SharedModule<%_ if (generateUserManagement) { _%>, RouterLink<%_ } _%>],
49+
imports: [<%_ if (enableTranslation) { _%>TranslateDirective, TranslateModule, <%_ } _%><%_ if (generateUserManagement) { _%>RouterLink<%_ } _%>],
4750
})
4851
export default class Home implements OnInit<% if (!authenticationTypeOauth2) { %>, OnDestroy<% } %> {
4952
account = signal<Account | null>(null);

generators/angular/templates/src/main/webapp/app/layouts/profiles/page-ribbon.ts.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ import { Observable } from 'rxjs';
2121
import { map } from 'rxjs/operators';
2222
import { toSignal } from '@angular/core/rxjs-interop';
2323

24-
import SharedModule from 'app/shared/shared.module';
24+
<%_ if (enableTranslation) { _%>
25+
import { TranslateDirective } from 'app/shared/language';
26+
import { TranslateModule } from '@ngx-translate/core';
27+
<%_ } _%>
2528
import { ProfileService } from './profile.service';
2629

2730
@Component({
@@ -34,7 +37,7 @@ import { ProfileService } from './profile.service';
3437
}
3538
`,
3639
styleUrl: './page-ribbon.scss',
37-
imports: [SharedModule],
40+
<%_ if (enableTranslation) { _%>imports: [TranslateDirective, TranslateModule],<%_ } _%>
3841
})
3942
export default class PageRibbon implements OnInit {
4043
ribbonEnvSignal?: Signal<string | undefined>;

generators/angular/templates/src/main/webapp/app/login/login.ts.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ import { Component, OnInit, AfterViewInit, ElementRef, inject, signal, viewChild
2020
import { FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
2121
import { Router<% if (generateUserManagement) { %>, RouterLink<% } %> } from '@angular/router';
2222

23-
import SharedModule from 'app/shared/shared.module';
23+
<%_ if (enableTranslation) { _%>
24+
import { TranslateDirective } from 'app/shared/language';
25+
import { TranslateModule } from '@ngx-translate/core';
26+
<%_ } _%>
2427
import { LoginService } from 'app/login/login.service';
2528
import { AccountService } from 'app/core/auth/account.service';
2629

2730
@Component({
2831
selector: '<%= jhiPrefixDashed %>-login',
29-
imports: [SharedModule, ReactiveFormsModule<% if (generateUserManagement) { %>, RouterLink<% } %>],
32+
imports: [<%_ if (enableTranslation) { _%>TranslateDirective, TranslateModule, <%_ } _%>ReactiveFormsModule<% if (generateUserManagement) { %>, RouterLink<% } %>],
3033
templateUrl: './login.html',
3134
})
3235
export default class LoginComponent implements OnInit, AfterViewInit {

0 commit comments

Comments
 (0)