feat: add it-IT to internationalization (#2439)

* login it

* deepl translations, corrections

* login, en typos

* it internal, typo fixes

* message texts, optim console texts, guide for internationalization

* missing console, fix de, en

* Add missing keys from main

* translate missing keys

* add it to console selection, change it policy descriptors

* add missing i18n from jwt idp, fixes

* add missing translations

* missing translations

* fix

* auth user language change, interceptor

* remove multiline operator

Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
Max Peintner
2021-11-15 08:23:35 +01:00
committed by GitHub
co-authored by Livio Amstutz
parent cfdb8c3301
commit 12eed30c08
15 changed files with 3082 additions and 275 deletions
@@ -18,7 +18,7 @@ import { EditDialogComponent, EditDialogType } from './edit-dialog/edit-dialog.c
export class AuthUserDetailComponent implements OnDestroy {
public user!: User.AsObject;
public genders: Gender[] = [Gender.GENDER_MALE, Gender.GENDER_FEMALE, Gender.GENDER_DIVERSE];
public languages: string[] = ['de', 'en'];
public languages: string[] = ['de', 'en', 'it'];
private subscription: Subscription = new Subscription();
@@ -39,19 +39,26 @@ export class AuthUserDetailComponent implements OnDestroy {
) {
this.loading = true;
this.refreshUser();
this.userService.getSupportedLanguages().then((lang) => {
this.languages = lang.languagesList;
});
}
refreshUser(): void {
this.refreshChanges$.emit();
this.userService.getMyUser().then(resp => {
if (resp.user) {
this.user = resp.user;
}
this.loading = false;
}).catch(error => {
this.toast.showError(error);
this.loading = false;
});
this.userService
.getMyUser()
.then((resp) => {
if (resp.user) {
this.user = resp.user;
}
this.loading = false;
})
.catch((error) => {
this.toast.showError(error);
this.loading = false;
});
}
public ngOnDestroy(): void {
@@ -71,13 +78,15 @@ export class AuthUserDetailComponent implements OnDestroy {
width: '400px',
});
dialogRefPhone.afterClosed().subscribe(resp => {
dialogRefPhone.afterClosed().subscribe((resp) => {
if (resp && resp !== this.user.userName) {
this.userService.updateMyUserName(resp).then(() => {
this.userService
.updateMyUserName(resp)
.then(() => {
this.toast.showInfo('USER.TOAST.USERNAMECHANGED', true);
this.refreshUser();
})
.catch(error => {
.catch((error) => {
this.toast.showError(error);
});
}
@@ -101,7 +110,7 @@ export class AuthUserDetailComponent implements OnDestroy {
this.toast.showInfo('USER.TOAST.SAVED', true);
this.refreshChanges$.emit();
})
.catch(error => {
.catch((error) => {
this.toast.showError(error);
});
}
@@ -109,7 +118,8 @@ export class AuthUserDetailComponent implements OnDestroy {
public saveEmail(email: string): void {
this.userService
.setMyEmail(email).then(() => {
.setMyEmail(email)
.then(() => {
this.toast.showInfo('USER.TOAST.EMAILSAVED', true);
if (this.user.human) {
const mailToSet = new Email();
@@ -117,18 +127,22 @@ export class AuthUserDetailComponent implements OnDestroy {
this.user.human.email = mailToSet.toObject();
this.refreshUser();
}
}).catch(error => {
})
.catch((error) => {
this.toast.showError(error);
});
}
public enteredPhoneCode(code: string): void {
this.userService.verifyMyPhone(code).then(() => {
this.toast.showInfo('USER.TOAST.PHONESAVED', true);
this.refreshUser();
}).catch(error => {
this.toast.showError(error);
});
this.userService
.verifyMyPhone(code)
.then(() => {
this.toast.showInfo('USER.TOAST.PHONESAVED', true);
this.refreshUser();
})
.catch((error) => {
this.toast.showError(error);
});
}
public changedLanguage(language: string): void {
@@ -136,40 +150,50 @@ export class AuthUserDetailComponent implements OnDestroy {
}
public resendPhoneVerification(): void {
this.userService.resendMyPhoneVerification().then(() => {
this.toast.showInfo('USER.TOAST.PHONEVERIFICATIONSENT', true);
this.refreshChanges$.emit();
}).catch(error => {
this.toast.showError(error);
});
this.userService
.resendMyPhoneVerification()
.then(() => {
this.toast.showInfo('USER.TOAST.PHONEVERIFICATIONSENT', true);
this.refreshChanges$.emit();
})
.catch((error) => {
this.toast.showError(error);
});
}
public resendEmailVerification(): void {
this.userService.resendMyEmailVerification().then(() => {
this.toast.showInfo('USER.TOAST.EMAILVERIFICATIONSENT', true);
this.refreshChanges$.emit();
}).catch(error => {
this.toast.showError(error);
});
this.userService
.resendMyEmailVerification()
.then(() => {
this.toast.showInfo('USER.TOAST.EMAILVERIFICATIONSENT', true);
this.refreshChanges$.emit();
})
.catch((error) => {
this.toast.showError(error);
});
}
public deletePhone(): void {
this.userService.removeMyPhone().then(() => {
this.toast.showInfo('USER.TOAST.PHONEREMOVED', true);
if (this.user.human?.phone) {
const phone = new Phone();
this.user.human.phone = phone.toObject();
this.refreshUser();
}
}).catch(error => {
this.toast.showError(error);
});
this.userService
.removeMyPhone()
.then(() => {
this.toast.showInfo('USER.TOAST.PHONEREMOVED', true);
if (this.user.human?.phone) {
const phone = new Phone();
this.user.human.phone = phone.toObject();
this.refreshUser();
}
})
.catch((error) => {
this.toast.showError(error);
});
}
public savePhone(phone: string): void {
if (this.user.human) {
this.userService
.setMyPhone(phone).then(() => {
.setMyPhone(phone)
.then(() => {
this.toast.showInfo('USER.TOAST.PHONESAVED', true);
if (this.user.human) {
const phoneToSet = new Phone();
@@ -177,7 +201,8 @@ export class AuthUserDetailComponent implements OnDestroy {
this.user.human.phone = phoneToSet.toObject();
this.refreshUser();
}
}).catch(error => {
})
.catch((error) => {
this.toast.showError(error);
});
}
@@ -199,7 +224,7 @@ export class AuthUserDetailComponent implements OnDestroy {
width: '400px',
});
dialogRefPhone.afterClosed().subscribe(resp => {
dialogRefPhone.afterClosed().subscribe((resp) => {
if (resp) {
this.savePhone(resp);
}
@@ -219,7 +244,7 @@ export class AuthUserDetailComponent implements OnDestroy {
width: '400px',
});
dialogRefEmail.afterClosed().subscribe(resp => {
dialogRefEmail.afterClosed().subscribe((resp) => {
if (resp) {
this.saveEmail(resp);
}