From 6c2ffe9e4b823a0e9f1cfb43386e9da9537c84b6 Mon Sep 17 00:00:00 2001 From: MaxKey Date: Thu, 2 Jun 2022 22:33:12 +0800 Subject: [PATCH] i18n --- .../access/sessions/sessions.component.ts | 17 +++--- .../config/accouts/accouts.component.ts | 21 ++++--- .../config/password/password.component.ts | 17 +++--- .../config/profile/profile.component.html | 58 +++++++++---------- .../config/profile/profile.component.ts | 17 ++++-- .../socials-associate.component.ts | 17 +++--- .../socials-provider.component.ts | 22 +++---- .../maxkey-web-app/src/assets/i18n/en-US.json | 19 ++++++ .../maxkey-web-app/src/assets/i18n/zh-CN.json | 18 ++++++ .../maxkey-web-app/src/assets/i18n/zh-TW.json | 18 ++++++ .../src/app/entity/BaseEntity.ts | 2 + .../group-members-editer.component.ts | 17 +++--- .../group-members/group-members.component.ts | 14 +++-- .../member-groups-editer.component.ts | 17 +++--- .../group-editer/group-editer.component.ts | 17 +++--- .../routes/access/groups/groups.component.ts | 21 +++---- .../privileges-editer.component.ts | 17 +++--- .../access/privileges/privileges.component.ts | 21 +++---- .../access/sessions/sessions.component.ts | 17 +++--- .../account-editer.component.ts | 10 ++-- .../app/routes/accounts/accounts.component.ts | 18 +++--- .../app-basic-details-editer.component.ts | 10 ++-- .../app-cas-details-editer.component.ts | 10 ++-- ...app-extend-api-details-editer.component.ts | 10 ++-- ...app-form-based-details-editer.component.ts | 10 ++-- .../app-jwt-details-editer.component.ts | 10 ++-- .../app-oauth20-details-editer.component.ts | 10 ++-- .../app-saml20-details-editer.component.ts | 10 ++-- ...pp-token-based-details-editer.component.ts | 10 ++-- .../src/app/routes/apps/apps.component.ts | 21 +++---- .../accounts-strategy-editer.component.ts | 17 +++--- .../accounts-strategy.component.ts | 24 ++++---- .../config/adapters/adapters.component.ts | 24 ++++---- .../email-senders/email-senders.component.ts | 20 +++---- .../institutions/institutions.component.ts | 16 ++--- .../ldap-context/ldap-context.component.ts | 17 +++--- .../password-policy.component.ts | 17 +++--- .../sms-provider/sms-provider.component.ts | 17 +++--- .../socials-provider-editer.component.ts | 17 +++--- .../socials-provider.component.ts | 21 +++---- .../synchronizer-editer.component.ts | 17 +++--- .../synchronizers/synchronizers.component.ts | 25 ++++---- .../organization-editer.component.ts | 24 ++++---- .../organizations/organizations.component.ts | 21 +++---- .../privileges/privileges.component.ts | 27 ++++++--- .../resource-editer.component.ts | 17 +++--- .../resources/resources.component.ts | 14 +++-- .../member-roles-editer.component.ts | 17 +++--- .../role-members-editer.component.ts | 17 +++--- .../role-members/role-members.component.ts | 14 +++-- .../role-editer/role-editer.component.ts | 17 +++--- .../permissions/roles/roles.component.ts | 21 +++---- .../users/password/password.component.ts | 16 ++--- .../user-editer/user-editer.component.ts | 10 ++-- .../src/app/routes/users/users.component.html | 21 +++++-- .../src/app/routes/users/users.component.ts | 18 +++--- .../src/assets/i18n/en-US.json | 19 ++++++ .../src/assets/i18n/zh-CN.json | 18 ++++++ .../src/assets/i18n/zh-TW.json | 18 ++++++ 59 files changed, 621 insertions(+), 416 deletions(-) diff --git a/maxkey-web-frontend/maxkey-web-app/src/app/routes/access/sessions/sessions.component.ts b/maxkey-web-frontend/maxkey-web-app/src/app/routes/access/sessions/sessions.component.ts index 36d72c52a..391dfe582 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/app/routes/access/sessions/sessions.component.ts +++ b/maxkey-web-frontend/maxkey-web-app/src/app/routes/access/sessions/sessions.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -84,6 +84,7 @@ export class SessionsComponent implements OnInit { private fb: FormBuilder, private sessionsService: SessionsService, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -108,10 +109,10 @@ export class SessionsComponent implements OnInit { this.sessionsService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/accouts/accouts.component.ts b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/accouts/accouts.component.ts index efbfcb02f..df925f107 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/accouts/accouts.component.ts +++ b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/accouts/accouts.component.ts @@ -1,29 +1,31 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { Component, ChangeDetectorRef, OnInit, Input } from '@angular/core'; +import { Component, ChangeDetectorRef, OnInit, Input, Inject } from '@angular/core'; import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Router, ActivatedRoute } from '@angular/router'; +import { I18NService } from '@core'; +import { ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { environment } from '@env/environment'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; import { Accounts } from '../../../entity/Accounts'; import { AccountsService } from '../../../service/accounts.service'; + @Component({ selector: 'app-accouts', templateUrl: './accouts.component.html', @@ -53,6 +55,7 @@ export class AccoutsComponent implements OnInit { private modalRef: NzModalRef, private accountsService: AccountsService, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -78,18 +81,14 @@ export class AccoutsComponent implements OnInit { this.accountsService.update(this.form.model).subscribe(res => { if (res.code == 0) { this.form.model.init(res.data); - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); if (this.redirect_uri) { window.location.href = `${environment.api.baseUrl}${this.redirect_uri}`; } } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } }); - // } else { - // this.formGroup.updateValueAndValidity({ onlySelf: true }); - // this.msg.success(`提交失败`); - //} this.form.submitting = false; this.cdr.detectChanges(); } diff --git a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/password/password.component.ts b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/password/password.component.ts index 3f37bbe69..eda385d1c 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/password/password.component.ts +++ b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/password/password.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient, SettingsService, User } from '@delon/theme'; +import { I18NService } from '@core'; +import { SettingsService, User, ALAIN_I18N_TOKEN } from '@delon/theme'; import { NzMessageService } from 'ng-zorro-antd/message'; import { ChangePassword } from '../../../entity/ChangePassword'; @@ -48,6 +48,7 @@ export class PasswordComponent implements OnInit { private settingsService: SettingsService, private passwordService: PasswordService, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -74,9 +75,9 @@ export class PasswordComponent implements OnInit { this.passwordService.changePassword(this.form.model).subscribe(res => { if (res.code == 0) { this.form.model.init(res.data); - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } }); // } else { diff --git a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.html b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.html index af4673251..73eea2561 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.html +++ b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.html @@ -31,7 +31,7 @@ - @@ -74,7 +74,7 @@ - @@ -82,8 +82,8 @@ {{ 'mxk.users.windowsAccount' | i18n }} - + @@ -92,16 +92,16 @@ {{ 'mxk.users.mobile' | i18n }} - + {{ 'mxk.users.email' | i18n }} - + @@ -112,8 +112,8 @@ - + @@ -132,7 +132,7 @@ - @@ -150,7 +150,7 @@ - @@ -159,8 +159,8 @@ - + @@ -297,8 +297,8 @@ - + @@ -306,7 +306,7 @@ - @@ -317,8 +317,8 @@ - + @@ -326,7 +326,7 @@ - @@ -337,7 +337,7 @@ - @@ -346,7 +346,7 @@ - @@ -357,7 +357,7 @@ - @@ -365,7 +365,7 @@ {{ 'mxk.users.manager' | i18n }} - @@ -376,7 +376,7 @@ - @@ -385,8 +385,8 @@ - + @@ -396,7 +396,7 @@ - @@ -405,7 +405,7 @@ - diff --git a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.ts b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.ts index 15ce78c28..8cbc254c7 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.ts +++ b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { environment } from '@env/environment'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -95,7 +96,13 @@ export class ProfileComponent implements OnInit { } } - constructor(private usersService: UsersService, private fb: FormBuilder, private msg: NzMessageService, private cdr: ChangeDetectorRef) { } + constructor( + private usersService: UsersService, + private fb: FormBuilder, + private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, + private cdr: ChangeDetectorRef + ) { } ngOnInit(): void { this.usersService.getProfile().subscribe(res => { @@ -123,9 +130,9 @@ export class ProfileComponent implements OnInit { this.form.model.trans(); this.usersService.updateProfile(this.form.model).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.form.submitting = false; this.cdr.detectChanges(); diff --git a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/socials-associate/socials-associate.component.ts b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/socials-associate/socials-associate.component.ts index 1d9616975..2b189e781 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/socials-associate/socials-associate.component.ts +++ b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/socials-associate/socials-associate.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -92,6 +92,7 @@ export class SocialsAssociateComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -123,10 +124,10 @@ export class SocialsAssociateComponent implements OnInit { e.preventDefault(); this.socialsAssociateService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/socials-provider/socials-provider.component.ts b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/socials-provider/socials-provider.component.ts index 6e00f7349..bb10939d3 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/socials-provider/socials-provider.component.ts +++ b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/socials-provider/socials-provider.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -26,6 +26,7 @@ import { NzTableQueryParams } from 'ng-zorro-antd/table'; import { SocialsProviderService } from '../../../service/socials-provider.service'; import { set2String } from '../../../shared/index'; + @Component({ selector: 'app-socials-provider', templateUrl: './socials-provider.component.html', @@ -86,6 +87,7 @@ export class SocialsProviderComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -109,10 +111,10 @@ export class SocialsProviderComponent implements OnInit { e.preventDefault(); this.socialsProviderService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -161,10 +163,10 @@ export class SocialsProviderComponent implements OnInit { e.preventDefault(); this.socialsProviderService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/en-US.json b/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/en-US.json index e4125be07..b99bf26d9 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/en-US.json +++ b/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/en-US.json @@ -643,6 +643,25 @@ "connector.syncTime": "SyncTime", "connector.result": "Result" }, + "alert": { + "add":{ + "success":"Add Success!", + "error":"Add Error!" + }, + "update":{ + "success":"Update Success!", + "error":"Update Error!" + }, + "delete":{ + "success":"Delete Success!", + "error":"Delete Error!" + }, + "operate":{ + "success":"Operate Success!", + "error":"Operate Error!" + } + + }, "text": { "action": "Action", "query": "Query", diff --git a/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/zh-CN.json b/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/zh-CN.json index 6b3f41b11..ce6c78c71 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/zh-CN.json +++ b/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/zh-CN.json @@ -647,6 +647,24 @@ "connector.syncTime": "时间", "connector.result": "结果" }, + "alert": { + "add":{ + "success":"新增成功!", + "error":"新增失败!" + }, + "update":{ + "success":"更新成功!", + "error":"更新失败!" + }, + "delete":{ + "success":"删除成功!", + "error":"删除失败!" + }, + "operate":{ + "success":"操作成功!", + "error":"操作失败!" + } + }, "text": { "action": "操作", "query": "查询", diff --git a/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/zh-TW.json b/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/zh-TW.json index ea8de7984..28fd393eb 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/zh-TW.json +++ b/maxkey-web-frontend/maxkey-web-app/src/assets/i18n/zh-TW.json @@ -647,6 +647,24 @@ "connector.syncTime": "時間", "connector.result": "結果" }, + "alert": { + "add":{ + "success":"新增成功!", + "error":"新增失敗!" + }, + "update":{ + "success":"更新成功!", + "error":"更新失敗!" + }, + "delete":{ + "success":"删除成功!", + "error":"删除失敗!" + }, + "operate":{ + "success":"操作成功!", + "error":"操作失敗!" + } + }, "text": { "action": "操作", "query": "查詢", diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/entity/BaseEntity.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/entity/BaseEntity.ts index 13582c6c8..a8daf916f 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/entity/BaseEntity.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/entity/BaseEntity.ts @@ -26,6 +26,8 @@ export class BaseEntity { constructor() { this.status = 1; + this.sortIndex = 1; + this.switch_status = true; } init(data: any): void { Object.assign(this, data); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/group-members-editer/group-members-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/group-members-editer/group-members-editer.component.ts index 8004d6749..59df0e6c5 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/group-members-editer/group-members-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/group-members-editer/group-members-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, Input, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, Input, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -91,6 +91,7 @@ export class GroupMembersEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -176,10 +177,10 @@ export class GroupMembersEditerComponent implements OnInit { this.query.submitLoading = false; this.query.tableLoading = false; if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/group-members.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/group-members.component.ts index 3a8db04e3..18a54f428 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/group-members.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/group-members.component.ts @@ -14,10 +14,11 @@ * limitations under the License. */ -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; @@ -100,6 +101,7 @@ export class GroupMembersComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private route: ActivatedRoute, private cdr: ChangeDetectorRef ) { } @@ -134,10 +136,10 @@ export class GroupMembersComponent implements OnInit { e.preventDefault(); this.groupMembersService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -206,10 +208,10 @@ export class GroupMembersComponent implements OnInit { e.preventDefault(); this.groupMembersService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/member-groups-editer/member-groups-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/member-groups-editer/member-groups-editer.component.ts index 6d23d0b7f..6ab56a95f 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/member-groups-editer/member-groups-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/group-members/member-groups-editer/member-groups-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Input } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Input, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -87,6 +87,7 @@ export class MemberGroupsEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -172,10 +173,10 @@ export class MemberGroupsEditerComponent implements OnInit { this.query.submitLoading = false; this.query.tableLoading = false; if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/groups/group-editer/group-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/groups/group-editer/group-editer.component.ts index 678482333..8c96e1c8f 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/groups/group-editer/group-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/groups/group-editer/group-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { Component, ChangeDetectorRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -56,6 +56,7 @@ export class GroupEditerComponent implements OnInit { private groupsService: GroupsService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -79,9 +80,9 @@ export class GroupEditerComponent implements OnInit { this.form.model.trans(); (this.isEdit ? this.groupsService.update(this.form.model) : this.groupsService.add(this.form.model)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/groups/groups.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/groups/groups.component.ts index a4f712228..30de03e53 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/groups/groups.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/groups/groups.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -88,6 +88,7 @@ export class GroupsComponent implements OnInit { private groupsService: GroupsService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -111,10 +112,10 @@ export class GroupsComponent implements OnInit { e.preventDefault(); this.groupsService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -163,10 +164,10 @@ export class GroupsComponent implements OnInit { e.preventDefault(); this.groupsService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/privileges/privileges-editer/privileges-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/privileges/privileges-editer/privileges-editer.component.ts index 422510d61..cd31277f3 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/privileges/privileges-editer/privileges-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/privileges/privileges-editer/privileges-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, Input, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, Input, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -90,6 +90,7 @@ export class PrivilegesEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -175,10 +176,10 @@ export class PrivilegesEditerComponent implements OnInit { this.query.submitLoading = false; this.query.tableLoading = false; if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.add.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.add.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/privileges/privileges.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/privileges/privileges.component.ts index e14aa8463..b6ff1443e 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/privileges/privileges.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/privileges/privileges.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; @@ -101,6 +101,7 @@ export class PrivilegesComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef, private http: _HttpClient ) { } @@ -127,10 +128,10 @@ export class PrivilegesComponent implements OnInit { e.preventDefault(); this.groupPrivilegesService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -180,10 +181,10 @@ export class PrivilegesComponent implements OnInit { e.preventDefault(); this.groupPrivilegesService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/sessions/sessions.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/sessions/sessions.component.ts index 36d72c52a..391dfe582 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/sessions/sessions.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/access/sessions/sessions.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -84,6 +84,7 @@ export class SessionsComponent implements OnInit { private fb: FormBuilder, private sessionsService: SessionsService, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -108,10 +109,10 @@ export class SessionsComponent implements OnInit { this.sessionsService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/accounts/account-editer/account-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/accounts/account-editer/account-editer.component.ts index 890fd292a..859f9a7b5 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/accounts/account-editer/account-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/accounts/account-editer/account-editer.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -64,6 +65,7 @@ export class AccountEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -153,9 +155,9 @@ export class AccountEditerComponent implements OnInit { this.form.model.trans(); (this.isEdit ? this.accountsService.update(this.form.model) : this.accountsService.add(this.form.model)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/accounts/accounts.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/accounts/accounts.component.ts index cfd54af5f..b55eafde6 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/accounts/accounts.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/accounts/accounts.component.ts @@ -14,10 +14,11 @@ * limitations under the License. */ -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -92,6 +93,7 @@ export class AccountsComponent implements OnInit { private accountsService: AccountsService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private route: ActivatedRoute, private cdr: ChangeDetectorRef ) { } @@ -143,10 +145,10 @@ export class AccountsComponent implements OnInit { e.preventDefault(); this.accountsService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -196,10 +198,10 @@ export class AccountsComponent implements OnInit { e.preventDefault(); this.accountsService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -209,10 +211,10 @@ export class AccountsComponent implements OnInit { e.preventDefault(); this.accountsService.updateStatus({ id: accountId, status: status }).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-basic-details-editer/app-basic-details-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-basic-details-editer/app-basic-details-editer.component.ts index d238f0750..a66f5eae1 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-basic-details-editer/app-basic-details-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-basic-details-editer/app-basic-details-editer.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -76,6 +77,7 @@ export class AppBasicDetailsEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -162,9 +164,9 @@ export class AppBasicDetailsEditerComponent implements OnInit { this.form.model.trans(); (this.isEdit ? this.appsService.update(this.form.model) : this.appsService.add(this.form.model)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modal.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-cas-details-editer/app-cas-details-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-cas-details-editer/app-cas-details-editer.component.ts index 93d8e12ec..ca6b2cc4e 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-cas-details-editer/app-cas-details-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-cas-details-editer/app-cas-details-editer.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -77,6 +78,7 @@ export class AppCasDetailsEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -163,9 +165,9 @@ export class AppCasDetailsEditerComponent implements OnInit { this.form.model.trans(); (this.isEdit ? this.appsCasDetailsService.update(this.form.model) : this.appsCasDetailsService.add(this.form.model)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modal.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-extend-api-details-editer/app-extend-api-details-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-extend-api-details-editer/app-extend-api-details-editer.component.ts index 52159702b..de75091c0 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-extend-api-details-editer/app-extend-api-details-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-extend-api-details-editer/app-extend-api-details-editer.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -77,6 +78,7 @@ export class AppExtendApiDetailsEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -162,9 +164,9 @@ export class AppExtendApiDetailsEditerComponent implements OnInit { : this.appsExtendApiDetailsService.add(this.form.model) ).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-form-based-details-editer/app-form-based-details-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-form-based-details-editer/app-form-based-details-editer.component.ts index ba4598733..df74c014d 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-form-based-details-editer/app-form-based-details-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-form-based-details-editer/app-form-based-details-editer.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -77,6 +78,7 @@ export class AppFormBasedDetailsEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -162,9 +164,9 @@ export class AppFormBasedDetailsEditerComponent implements OnInit { : this.appsFormBasedDetailsService.add(this.form.model) ).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-jwt-details-editer/app-jwt-details-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-jwt-details-editer/app-jwt-details-editer.component.ts index aeeb96249..afadc04cc 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-jwt-details-editer/app-jwt-details-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-jwt-details-editer/app-jwt-details-editer.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -78,6 +79,7 @@ export class AppJwtDetailsEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -172,9 +174,9 @@ export class AppJwtDetailsEditerComponent implements OnInit { this.form.model.trans(); (this.isEdit ? this.appsJwtDetailsService.update(this.form.model) : this.appsJwtDetailsService.add(this.form.model)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-oauth20-details-editer/app-oauth20-details-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-oauth20-details-editer/app-oauth20-details-editer.component.ts index 8d9a8f60a..f1b77f479 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-oauth20-details-editer/app-oauth20-details-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-oauth20-details-editer/app-oauth20-details-editer.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -77,6 +78,7 @@ export class AppOauth20DetailsEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -179,9 +181,9 @@ export class AppOauth20DetailsEditerComponent implements OnInit { (this.isEdit ? this.appsOauth20DetailsService.update(this.form.model) : this.appsOauth20DetailsService.add(this.form.model)).subscribe( res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modal.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-saml20-details-editer/app-saml20-details-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-saml20-details-editer/app-saml20-details-editer.component.ts index e2c10df8f..72db26cf0 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-saml20-details-editer/app-saml20-details-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-saml20-details-editer/app-saml20-details-editer.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -77,6 +78,7 @@ export class AppSaml20DetailsEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -171,9 +173,9 @@ export class AppSaml20DetailsEditerComponent implements OnInit { (this.isEdit ? this.appsSamlDetailsService.update(this.form.model) : this.appsSamlDetailsService.add(this.form.model)).subscribe( res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modal.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-token-based-details-editer/app-token-based-details-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-token-based-details-editer/app-token-based-details-editer.component.ts index 509944340..fcb467328 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-token-based-details-editer/app-token-based-details-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/app-token-based-details-editer/app-token-based-details-editer.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -78,6 +79,7 @@ export class AppTokenBasedDetailsEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -171,9 +173,9 @@ export class AppTokenBasedDetailsEditerComponent implements OnInit { : this.appsTokenBasedDetailsService.add(this.form.model) ).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/apps.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/apps.component.ts index 3e8bd4b21..04610b884 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/apps.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/apps/apps.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -95,6 +95,7 @@ export class AppsComponent implements OnInit { private appsService: AppsService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -118,10 +119,10 @@ export class AppsComponent implements OnInit { e.preventDefault(); this.appsService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -221,10 +222,10 @@ export class AppsComponent implements OnInit { e.preventDefault(); this.appsService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/accounts-strategy/accounts-strategy-editer/accounts-strategy-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/accounts-strategy/accounts-strategy-editer/accounts-strategy-editer.component.ts index eb926a21a..df732a65a 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/accounts-strategy/accounts-strategy-editer/accounts-strategy-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/accounts-strategy/accounts-strategy-editer/accounts-strategy-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, ViewContainerRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -59,6 +59,7 @@ export class AccountsStrategyEditerComponent implements OnInit { private modalService: NzModalService, private viewContainerRef: ViewContainerRef, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -102,9 +103,9 @@ export class AccountsStrategyEditerComponent implements OnInit { (this.isEdit ? this.accountsStrategyService.update(this.form.model) : this.accountsStrategyService.add(this.form.model)).subscribe( res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modal.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/accounts-strategy/accounts-strategy.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/accounts-strategy/accounts-strategy.component.ts index f413e6448..b20bed3b7 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/accounts-strategy/accounts-strategy.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/accounts-strategy/accounts-strategy.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -88,8 +88,8 @@ export class AccountsStrategyComponent implements OnInit { private accountsStrategyService: AccountsStrategyService, private fb: FormBuilder, private msg: NzMessageService, - private cdr: ChangeDetectorRef, - private http: _HttpClient + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, + private cdr: ChangeDetectorRef ) { } ngOnInit(): void { @@ -112,10 +112,10 @@ export class AccountsStrategyComponent implements OnInit { e.preventDefault(); this.accountsStrategyService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -164,10 +164,10 @@ export class AccountsStrategyComponent implements OnInit { e.preventDefault(); this.accountsStrategyService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/adapters/adapters.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/adapters/adapters.component.ts index 592a1bce4..f749c1939 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/adapters/adapters.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/adapters/adapters.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -88,8 +88,8 @@ export class AdaptersComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, - private cdr: ChangeDetectorRef, - private http: _HttpClient + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, + private cdr: ChangeDetectorRef ) { } ngOnInit(): void { @@ -112,10 +112,10 @@ export class AdaptersComponent implements OnInit { e.preventDefault(); this.adaptersService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -164,10 +164,10 @@ export class AdaptersComponent implements OnInit { e.preventDefault(); this.adaptersService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/email-senders/email-senders.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/email-senders/email-senders.component.ts index b1f0f9ebf..28b1cc62d 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/email-senders/email-senders.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/email-senders/email-senders.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { NzMessageService } from 'ng-zorro-antd/message'; import { EmailSenders } from '../../../entity/EmailSenders'; @@ -54,8 +54,8 @@ export class EmailSendersComponent implements OnInit { private fb: FormBuilder, private emailSendersService: EmailSendersService, private msg: NzMessageService, - private cdr: ChangeDetectorRef, - private http: _HttpClient + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, + private cdr: ChangeDetectorRef ) { } ngOnInit(): void { @@ -70,9 +70,9 @@ export class EmailSendersComponent implements OnInit { this.form.model.trans(); this.emailSendersService.update(this.form.model).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.form.submitting = false; this.cdr.detectChanges(); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/institutions/institutions.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/institutions/institutions.component.ts index b38a5d4de..b76affa18 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/institutions/institutions.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/institutions/institutions.component.ts @@ -1,22 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { I18NService } from '@core'; +import { ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { NzMessageService } from 'ng-zorro-antd/message'; import { Institutions } from '../../../entity/Institutions'; @@ -53,6 +54,7 @@ export class InstitutionsComponent implements OnInit { private fb: FormBuilder, private institutionsService: InstitutionsService, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -68,9 +70,9 @@ export class InstitutionsComponent implements OnInit { this.form.model.trans(); this.institutionsService.update(this.form.model).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.form.submitting = false; this.cdr.detectChanges(); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/ldap-context/ldap-context.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/ldap-context/ldap-context.component.ts index 08baf1dff..c73ac67c8 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/ldap-context/ldap-context.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/ldap-context/ldap-context.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { NzMessageService } from 'ng-zorro-antd/message'; import { LdapContext } from '../../../entity/LdapContext'; @@ -54,6 +54,7 @@ export class LdapContextComponent implements OnInit { private fb: FormBuilder, private ldapContextService: LdapContextService, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -69,9 +70,9 @@ export class LdapContextComponent implements OnInit { this.form.model.trans(); this.ldapContextService.update(this.form.model).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.form.submitting = false; this.cdr.detectChanges(); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/password-policy/password-policy.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/password-policy/password-policy.component.ts index 77fb15a81..4e8d8902e 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/password-policy/password-policy.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/password-policy/password-policy.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { NzMessageService } from 'ng-zorro-antd/message'; import { PasswordPolicy } from '../../../entity/PasswordPolicy'; @@ -55,6 +55,7 @@ export class PasswordPolicyComponent implements OnInit { private fb: FormBuilder, private passwordPolicyService: PasswordPolicyService, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -81,9 +82,9 @@ export class PasswordPolicyComponent implements OnInit { this.form.model.trans(); this.passwordPolicyService.update(this.form.model).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.form.submitting = false; this.cdr.detectChanges(); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/sms-provider/sms-provider.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/sms-provider/sms-provider.component.ts index 4962bed08..de405d031 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/sms-provider/sms-provider.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/sms-provider/sms-provider.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { NzMessageService } from 'ng-zorro-antd/message'; import { SmsProvider } from '../../../entity/SmsProvider'; @@ -54,6 +54,7 @@ export class SmsProviderComponent implements OnInit { private fb: FormBuilder, private smsProviderService: SmsProviderService, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -69,9 +70,9 @@ export class SmsProviderComponent implements OnInit { this.form.model.trans(); this.smsProviderService.update(this.form.model).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.form.submitting = false; this.cdr.detectChanges(); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/socials-provider/socials-provider-editer/socials-provider-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/socials-provider/socials-provider-editer/socials-provider-editer.component.ts index 24efef4b0..280614e5f 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/socials-provider/socials-provider-editer/socials-provider-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/socials-provider/socials-provider-editer/socials-provider-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { Component, ChangeDetectorRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -56,6 +56,7 @@ export class SocialsProviderEditerComponent implements OnInit { private socialsProviderService: SocialsProviderService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -80,9 +81,9 @@ export class SocialsProviderEditerComponent implements OnInit { (this.isEdit ? this.socialsProviderService.update(this.form.model) : this.socialsProviderService.add(this.form.model)).subscribe( res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/socials-provider/socials-provider.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/socials-provider/socials-provider.component.ts index f31e8f39f..601be2cbe 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/socials-provider/socials-provider.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/socials-provider/socials-provider.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -87,6 +87,7 @@ export class SocialsProviderComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -110,10 +111,10 @@ export class SocialsProviderComponent implements OnInit { e.preventDefault(); this.socialsProviderService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -162,10 +163,10 @@ export class SocialsProviderComponent implements OnInit { e.preventDefault(); this.socialsProviderService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/synchronizers/synchronizer-editer/synchronizer-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/synchronizers/synchronizer-editer/synchronizer-editer.component.ts index 3220c6b13..e9b3a5186 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/synchronizers/synchronizer-editer/synchronizer-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/synchronizers/synchronizer-editer/synchronizer-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { Component, ChangeDetectorRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -56,6 +56,7 @@ export class SynchronizerEditerComponent implements OnInit { private synchronizersService: SynchronizersService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -79,9 +80,9 @@ export class SynchronizerEditerComponent implements OnInit { this.form.model.trans(); (this.isEdit ? this.synchronizersService.update(this.form.model) : this.synchronizersService.add(this.form.model)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/synchronizers/synchronizers.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/synchronizers/synchronizers.component.ts index 46c652d46..f1d74153c 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/synchronizers/synchronizers.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/config/synchronizers/synchronizers.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -87,6 +87,7 @@ export class SynchronizersComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -110,10 +111,10 @@ export class SynchronizersComponent implements OnInit { e.preventDefault(); this.synchronizersService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -122,9 +123,9 @@ export class SynchronizersComponent implements OnInit { onSynchr(e: MouseEvent, synchrId: String): void { this.synchronizersService.synchr(synchrId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); @@ -172,10 +173,10 @@ export class SynchronizersComponent implements OnInit { e.preventDefault(); this.synchronizersService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/organizations/organization-editer/organization-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/organizations/organization-editer/organization-editer.component.ts index 7f73fedeb..cd28ef9e4 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/organizations/organization-editer/organization-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/organizations/organization-editer/organization-editer.component.ts @@ -1,24 +1,26 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - - -import { Component, ChangeDetectorRef, Input, OnInit } from '@angular/core'; +import { I18nPluralPipe } from '@angular/common'; +import { LocalizedString } from '@angular/compiler'; +import { Component, ChangeDetectorRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; +import { NzI18nService } from 'ng-zorro-antd/i18n'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; import { NzFormatEmitEvent, NzTreeNode, NzTreeNodeOptions } from 'ng-zorro-antd/tree'; @@ -59,6 +61,7 @@ export class OrganizationEditerComponent implements OnInit { private orgsService: OrganizationsService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -70,8 +73,9 @@ export class OrganizationEditerComponent implements OnInit { }); } else { if (this.parentNode) { - this.form.model.parentCode = this.parentNode?.key; + this.form.model.parentId = this.parentNode?.key; this.form.model.parentName = this.parentNode?.title; + this.cdr.detectChanges(); } } } @@ -88,9 +92,9 @@ export class OrganizationEditerComponent implements OnInit { (this.isEdit ? this.orgsService.update(this.form.model) : this.orgsService.add(this.form.model)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/organizations/organizations.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/organizations/organizations.component.ts index 7f8c6d27f..d43b741eb 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/organizations/organizations.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/organizations/organizations.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; @@ -120,6 +120,7 @@ export class OrganizationsComponent implements OnInit { private orgsService: OrganizationsService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -144,10 +145,10 @@ export class OrganizationsComponent implements OnInit { e.preventDefault(); this.orgsService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -197,10 +198,10 @@ export class OrganizationsComponent implements OnInit { e.preventDefault(); this.orgsService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/privileges/privileges.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/privileges/privileges.component.ts index dec8eea6d..c7dfb4a60 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/privileges/privileges.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/privileges/privileges.component.ts @@ -1,23 +1,32 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, AfterViewInit, ViewChild } from '@angular/core'; +import { + ChangeDetectionStrategy, + ViewContainerRef, + ChangeDetectorRef, + Component, + OnInit, + AfterViewInit, + ViewChild, + Inject +} from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; @@ -102,6 +111,7 @@ export class PrivilegesComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef, private http: _HttpClient ) { } @@ -149,9 +159,10 @@ export class PrivilegesComponent implements OnInit { this.query.submitLoading = false; this.query.tableLoading = false; if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); + this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/resources/resource-editer/resource-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/resources/resource-editer/resource-editer.component.ts index cf727dcaa..fc1eeb7b9 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/resources/resource-editer/resource-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/resources/resource-editer/resource-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { Component, ChangeDetectorRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -59,6 +59,7 @@ export class ResourceEditerComponent implements OnInit { private resourcesService: ResourcesService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -87,9 +88,9 @@ export class ResourceEditerComponent implements OnInit { this.form.model.trans(); (this.isEdit ? this.resourcesService.update(this.form.model) : this.resourcesService.add(this.form.model)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/resources/resources.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/resources/resources.component.ts index 71148023f..74cba3367 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/resources/resources.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/resources/resources.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; @@ -98,6 +99,7 @@ export class ResourcesComponent implements OnInit { private resourcesService: ResourcesService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -121,10 +123,10 @@ export class ResourcesComponent implements OnInit { e.preventDefault(); this.resourcesService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -196,10 +198,10 @@ export class ResourcesComponent implements OnInit { e.preventDefault(); this.resourcesService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/member-roles-editer/member-roles-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/member-roles-editer/member-roles-editer.component.ts index 070d60b19..1a3864ff3 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/member-roles-editer/member-roles-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/member-roles-editer/member-roles-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Input } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Input, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -86,6 +86,7 @@ export class MemberRolesEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -171,10 +172,10 @@ export class MemberRolesEditerComponent implements OnInit { this.query.submitLoading = false; this.query.tableLoading = false; if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/role-members-editer/role-members-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/role-members-editer/role-members-editer.component.ts index d71e32dac..3ca5c84ff 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/role-members-editer/role-members-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/role-members-editer/role-members-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, Input, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, Input, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -91,6 +91,7 @@ export class RoleMembersEditerComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -176,10 +177,10 @@ export class RoleMembersEditerComponent implements OnInit { this.query.submitLoading = false; this.query.tableLoading = false; if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/role-members.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/role-members.component.ts index 7e0eb313a..b69c4f865 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/role-members.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/role-members/role-members.component.ts @@ -14,10 +14,11 @@ * limitations under the License. */ -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; @@ -102,6 +103,7 @@ export class RoleMembersComponent implements OnInit { private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private route: ActivatedRoute, private cdr: ChangeDetectorRef ) { } @@ -137,10 +139,10 @@ export class RoleMembersComponent implements OnInit { e.preventDefault(); this.roleMembersService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -208,10 +210,10 @@ export class RoleMembersComponent implements OnInit { e.preventDefault(); this.roleMembersService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/roles/role-editer/role-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/roles/role-editer/role-editer.component.ts index 4dd8c978a..eebecde09 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/roles/role-editer/role-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/roles/role-editer/role-editer.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { Component, ChangeDetectorRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -55,6 +55,7 @@ export class RoleEditerComponent implements OnInit { private rolesService: RolesService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -78,9 +79,9 @@ export class RoleEditerComponent implements OnInit { this.form.model.trans(); (this.isEdit ? this.rolesService.update(this.form.model) : this.rolesService.add(this.form.model)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/roles/roles.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/roles/roles.component.ts index a8e459b8c..00819caf8 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/roles/roles.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/permissions/roles/roles.component.ts @@ -1,23 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -88,6 +88,7 @@ export class RolesComponent implements OnInit { private rolesService: RolesService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -111,10 +112,10 @@ export class RolesComponent implements OnInit { e.preventDefault(); this.rolesService.delete(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -163,10 +164,10 @@ export class RolesComponent implements OnInit { e.preventDefault(); this.rolesService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/password/password.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/password/password.component.ts index c558603de..02c82ab84 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/password/password.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/password/password.component.ts @@ -1,22 +1,23 @@ /* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - -import { Component, ChangeDetectorRef, OnInit, Input } from '@angular/core'; +import { Component, ChangeDetectorRef, OnInit, Input, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { I18NService } from '@core'; +import { ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @@ -52,6 +53,7 @@ export class PasswordComponent implements OnInit { private modalRef: NzModalRef, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -81,9 +83,9 @@ export class PasswordComponent implements OnInit { this.form.submitting = true; this.passwordService.changePassword(this.form.model).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.modalRef.destroy({ refresh: true }); this.cdr.detectChanges(); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/user-editer/user-editer.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/user-editer/user-editer.component.ts index 79cb4cf78..edbca9d2a 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/user-editer/user-editer.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/user-editer/user-editer.component.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import { Component, ChangeDetectorRef, Input, OnInit } from '@angular/core'; +import { Component, ChangeDetectorRef, Input, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { environment } from '@env/environment'; import format from 'date-fns/format'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -101,6 +102,7 @@ export class UserEditerComponent implements OnInit { private usersService: UsersService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef ) { } @@ -138,9 +140,9 @@ export class UserEditerComponent implements OnInit { this.form.model.trans(); (this.isEdit ? this.usersService.update(this.form.model) : this.usersService.add(this.form.model)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success')); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error')); } this.form.submitting = false; this.modalRef.destroy({ refresh: true }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/users.component.html b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/users.component.html index 92c4ef873..9af49ef6c 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/users.component.html +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/users.component.html @@ -94,11 +94,21 @@ {{ data.gender == 1 ? ('mxk.users.gender.female' | i18n) : ('mxk.users.gender.male' | i18n) }} - - - - - + + + + + + + + + + + + + + +
@@ -115,6 +125,7 @@ (click)="onNavToUrl($event, data.id, data.username, 'accounts')">{{ 'mxk.text.accounts' | i18n }} +
  • {{ 'mxk.text.groups' | i18n diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/users.component.ts b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/users.component.ts index 8d27ba163..f7e56c44e 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/users.component.ts +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/app/routes/users/users.component.ts @@ -14,10 +14,11 @@ * limitations under the License. */ -import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; -import { _HttpClient } from '@delon/theme'; +import { I18NService } from '@core'; +import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme'; import { format, addDays } from 'date-fns'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; @@ -95,6 +96,7 @@ export class UsersComponent implements OnInit { private orgsService: OrganizationsService, private fb: FormBuilder, private msg: NzMessageService, + @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private router: Router, private cdr: ChangeDetectorRef ) { } @@ -120,10 +122,10 @@ export class UsersComponent implements OnInit { e.preventDefault(); this.usersService.get(set2String(this.query.tableCheckedId)).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.delete.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.delete.error')); } this.cdr.detectChanges(); }); @@ -230,10 +232,10 @@ export class UsersComponent implements OnInit { e.preventDefault(); this.usersService.updateStatus({ id: userId, status: status }).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); @@ -243,10 +245,10 @@ export class UsersComponent implements OnInit { e.preventDefault(); this.usersService.delete(deleteId).subscribe(res => { if (res.code == 0) { - this.msg.success(`提交成功`); + this.msg.success(this.i18n.fanyi('mxk.alert.operate.success')); this.fetch(); } else { - this.msg.success(`提交失败`); + this.msg.error(this.i18n.fanyi('mxk.alert.operate.error')); } this.cdr.detectChanges(); }); diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/en-US.json b/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/en-US.json index f05c66887..67c536072 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/en-US.json +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/en-US.json @@ -631,6 +631,25 @@ "connector.syncTime": "SyncTime", "connector.result": "Result" }, + "alert": { + "add":{ + "success":"Add Success!", + "error":"Add Error!" + }, + "update":{ + "success":"Update Success!", + "error":"Update Error!" + }, + "delete":{ + "success":"Delete Success!", + "error":"Delete Error!" + }, + "operate":{ + "success":"Operate Success!", + "error":"Operate Error!" + } + + }, "text": { "action": "Action", "query": "Query", diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/zh-CN.json b/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/zh-CN.json index e52febb8c..73244fb49 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/zh-CN.json +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/zh-CN.json @@ -630,6 +630,24 @@ "connector.syncTime": "时间", "connector.result": "结果" }, + "alert": { + "add":{ + "success":"新增成功!", + "error":"新增失败!" + }, + "update":{ + "success":"更新成功!", + "error":"更新失败!" + }, + "delete":{ + "success":"删除成功!", + "error":"删除失败!" + }, + "operate":{ + "success":"操作成功!", + "error":"操作失败!" + } + }, "text": { "action": "操作", "query": "查询", diff --git a/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/zh-TW.json b/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/zh-TW.json index cbe3f4fbb..4489e2a8e 100644 --- a/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/zh-TW.json +++ b/maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/zh-TW.json @@ -631,6 +631,24 @@ "connector.syncTime": "時間", "connector.result": "結果" }, + "alert": { + "add":{ + "success":"新增成功!", + "error":"新增失敗!" + }, + "update":{ + "success":"更新成功!", + "error":"更新失敗!" + }, + "delete":{ + "success":"删除成功!", + "error":"删除失敗!" + }, + "operate":{ + "success":"操作成功!", + "error":"操作失敗!" + } + }, "text": { "action": "操作", "query": "查詢",