From 490c525e083a2d11fe5f0ed1011483f8a66316eb Mon Sep 17 00:00:00 2001 From: enadhilal Date: Wed, 30 Mar 2022 10:44:19 +0300 Subject: [PATCH] add translation for validation text --- .../change-password.component.ts | 123 +++++++++--------- .../authentication/forgot/forgot.component.ts | 20 +-- Mohem/src/assets/localization/i18n.json | 40 ++++++ 3 files changed, 111 insertions(+), 72 deletions(-) diff --git a/Mohem/src/app/authentication/change-password/change-password.component.ts b/Mohem/src/app/authentication/change-password/change-password.component.ts index 57990efb..0921fdd3 100644 --- a/Mohem/src/app/authentication/change-password/change-password.component.ts +++ b/Mohem/src/app/authentication/change-password/change-password.component.ts @@ -35,71 +35,70 @@ export class ChangePasswordComponent implements OnInit { public OLD_PASSWORD: boolean = false; public recentPasswordNote = { - yellowImg: '../assets/icon/yellow.svg', - text: 'Do not user recent password.', - + yellowImg: '../assets/imgs/mohemm-action/info.png', + text: this.ts.trPK('login', 'current-password-validation') }; public isLowerCase = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'At least one lowercase.', + text: this.ts.trPK('login', 'lowercase-password-validation'), isMatch: false }; public isUpperCase = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'At least one uppdercase.', + text: this.ts.trPK('login', 'uppercase-password-validation'), isMatch: false }; public isLetterCase = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'At least one Letter.', + text: this.ts.trPK('login', 'letter-password-validation'), isMatch: false }; public isHasDigit = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'At least one nomeric.', + text: this.ts.trPK('login', 'numerica-password-validation'), isMatch: false }; public isMinLength = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'Minimum 8 characters.', + text: this.ts.trPK('login', 'min-password-validation'), isMatch: false }; public isRepeatedLetter = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'Do not add repeating letters.', + text: this.ts.trPK('login', 'repeating-password-validation'), isMatch: false }; public isContainSpecialChar = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'It should contain special character.', + text: this.ts.trPK('login', 'special-character-password-validation'), isMatch: false }; public confirmMatchNew = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'Confirm Password does not match.', + text: this.ts.trPK('login', 'not-match-password-validation'), isMatch: false }; public userNameMatchNew = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'password should not contain the user name.', + text: this.ts.trPK('login', 'contain-username-password-validation'), isMatch: false }; public userId: string; @@ -278,62 +277,62 @@ export class ChangePasswordComponent implements OnInit { // return this.isUpperCase.redImg; // } case 1: - if (/[a-zA-Z]/.test(this.P_NEW_PASSWORD)) { - this.isLetterCase.isMatch = true; - return this.isLetterCase.greenImg; - } else { - this.isLetterCase.isMatch = false; - return this.isLetterCase.redImg; - } + if (/[a-zA-Z]/.test(this.P_NEW_PASSWORD)) { + this.isLetterCase.isMatch = true; + return this.isLetterCase.greenImg; + } else { + this.isLetterCase.isMatch = false; + return this.isLetterCase.redImg; + } case 3: - if (/[0-9]/.test(this.P_NEW_PASSWORD)) { - this.isHasDigit.isMatch = true; - return this.isHasDigit.greenImg; - } else { - this.isHasDigit.isMatch = false; - return this.isHasDigit.redImg; - } + if (/[0-9]/.test(this.P_NEW_PASSWORD)) { + this.isHasDigit.isMatch = true; + return this.isHasDigit.greenImg; + } else { + this.isHasDigit.isMatch = false; + return this.isHasDigit.redImg; + } case 4: - if (this.P_NEW_PASSWORD.length >= 8) { - this.isMinLength.isMatch = true; - return this.isMinLength.greenImg; - } else { - this.isMinLength.isMatch = false; - return this.isMinLength.redImg; - } + if (this.P_NEW_PASSWORD.length >= 8) { + this.isMinLength.isMatch = true; + return this.isMinLength.greenImg; + } else { + this.isMinLength.isMatch = false; + return this.isMinLength.redImg; + } case 5: - if (/([a-z])\1/i.test(this.P_NEW_PASSWORD)) { - this.isRepeatedLetter.isMatch = false; - return this.isRepeatedLetter.redImg; - } else { - this.isRepeatedLetter.isMatch = true; - return this.isRepeatedLetter.greenImg; - } + if (/([a-z])\1/i.test(this.P_NEW_PASSWORD)) { + this.isRepeatedLetter.isMatch = false; + return this.isRepeatedLetter.redImg; + } else { + this.isRepeatedLetter.isMatch = true; + return this.isRepeatedLetter.greenImg; + } case 6: - if (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(this.P_NEW_PASSWORD)) { - this.isContainSpecialChar.isMatch = true; - return this.isContainSpecialChar.greenImg; - } else { - this.isContainSpecialChar.isMatch = false; - return this.isContainSpecialChar.redImg; - } + if (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(this.P_NEW_PASSWORD)) { + this.isContainSpecialChar.isMatch = true; + return this.isContainSpecialChar.greenImg; + } else { + this.isContainSpecialChar.isMatch = false; + return this.isContainSpecialChar.redImg; + } case 7: - if (this.P_NEW_PASSWORD !== this.P_Confirm_NEW_PASSWORD) { - this.confirmMatchNew.isMatch = false; - return this.confirmMatchNew.redImg; - } else { - this.confirmMatchNew.isMatch = true; - return this.confirmMatchNew.greenImg; - } + if (this.P_NEW_PASSWORD !== this.P_Confirm_NEW_PASSWORD) { + this.confirmMatchNew.isMatch = false; + return this.confirmMatchNew.redImg; + } else { + this.confirmMatchNew.isMatch = true; + return this.confirmMatchNew.greenImg; + } case 8: - if (!this.P_NEW_PASSWORD.includes(this.P_USER_NAME)) { - this.userNameMatchNew.isMatch = true; - return this.userNameMatchNew.greenImg; - } else { - this.userNameMatchNew.isMatch = false; - return this.userNameMatchNew.redImg; - } - } + if (!this.P_NEW_PASSWORD.includes(this.P_USER_NAME)) { + this.userNameMatchNew.isMatch = true; + return this.userNameMatchNew.greenImg; + } else { + this.userNameMatchNew.isMatch = false; + return this.userNameMatchNew.redImg; + } + } } } diff --git a/Mohem/src/app/authentication/forgot/forgot.component.ts b/Mohem/src/app/authentication/forgot/forgot.component.ts index 0e38b23d..70785cba 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.ts +++ b/Mohem/src/app/authentication/forgot/forgot.component.ts @@ -24,69 +24,69 @@ export class ForgotComponent implements OnInit { public logo = 'assets/icon/login/lock.png'; public recentPasswordNote = { yellowImg: '../assets/imgs/mohemm-action/info.png', - text: 'Do not user recent password.' + text: this.ts.trPK('login', 'current-password-validation') }; public isLowerCase = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'At least one lowercase.', + text: this.ts.trPK('login', 'lowercase-password-validation'), isMatch: false }; public isUpperCase = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'At least one uppdercase.', + text: this.ts.trPK('login', 'uppercase-password-validation'), isMatch: false }; public isLetterCase = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'At least one Letter.', + text: this.ts.trPK('login', 'letter-password-validation'), isMatch: false }; public isHasDigit = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'At least one nomeric.', + text: this.ts.trPK('login', 'numerica-password-validation'), isMatch: false }; public isMinLength = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'Minimum 8 characters.', + text: this.ts.trPK('login', 'min-password-validation'), isMatch: false }; public isRepeatedLetter = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'Do not add repeating letters.', + text: this.ts.trPK('login', 'repeating-password-validation'), isMatch: false }; public isContainSpecialChar = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'It should contain special character.', + text: this.ts.trPK('login', 'special-character-password-validation'), isMatch: false }; public confirmMatchNew = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'Confirm Password does not match.', + text: this.ts.trPK('login', 'not-match-password-validation'), isMatch: false }; public userNameMatchNew = { blankImg: '../assets/icon/blank.svg', greenImg: '../assets/icon/green.svg', redImg: '../assets/imgs/close.svg', - text: 'password should not contain the user name.', + text: this.ts.trPK('login', 'contain-username-password-validation'), isMatch: false }; public userId: string; diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 043db2b5..25b14c31 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -176,6 +176,46 @@ "check-user-text3": { "en": "will be sent to your mobile number", "ar": "سيتم ارساله الى رقم هاتفك" + }, + "current-password-validation":{ + "en":"Do not use a current password.", + "ar":"لا تستخدم كلمة المرور الحالية." + }, + "lowercase-password-validation":{ + "en":"At least one lowercase.", + "ar":"حرف صغير واحد على الأقل." + }, + "uppercase-password-validation":{ + "en":"At least one uppercase.", + "ar":"حرف كبير واحد على الأقل." + }, + "letter-password-validation":{ + "en":"At least one Letter.", + "ar":"حرف واحد على الأقل." + }, + "numerica-password-validation":{ + "en":"At least one numeric.", + "ar":"رقم واحد على الأقل." + }, + "min-password-validation":{ + "en":"Minimum 8 characters.", + "ar":"8 أحرف على الأقل." + }, + "repeating-password-validation":{ + "en":"Do not add repeating letters.", + "ar":"لا تقم بإضافة أحرف متكررة." + }, + "special-character-password-validation":{ + "en":"It should contain a special character.", + "ar":"يجب أن يحتوي على طابع خاص." + }, + "not-match-password-validation":{ + "en":"Confirm Password does not match.", + "ar":"تأكيد كلمة المرور لا يتطابق." + }, + "contain-username-password-validation":{ + "en":"The password should not contain the user name.", + "ar":"يجب ألا تحتوي كلمة المرور على اسم المستخدم." } }, "verificationcode": {