@@ -6,14 +6,14 @@ use rust_i18n::t;
66
77impl ChangeAdminUserPasswordRequest {
88 /// validate
9- pub fn validate ( & self ) -> crate :: error:: Result < ( ) > {
9+ pub fn validate ( & self , locale : String ) -> crate :: error:: Result < ( ) > {
1010 let mut errors: Vec < ErrorMessage > = vec ! [ ] ;
1111 let mut valid = true ;
1212
1313 if !self . password . required ( ) ? {
1414 let error_message = ErrorMessage {
1515 key : String :: from ( "password" ) ,
16- message : t ! ( "validation_required" , attribute = t!( "password" ) ) . to_string ( ) ,
16+ message : t ! ( "validation_required" , locale = locale , attribute = t!( "password" , locale = locale ) ) . to_string ( ) ,
1717 } ;
1818 valid = false ;
1919 errors. push ( error_message) ;
@@ -22,7 +22,7 @@ impl ChangeAdminUserPasswordRequest {
2222 if !self . new_password . required ( ) ? {
2323 let error_message = ErrorMessage {
2424 key : String :: from ( "new_password" ) ,
25- message : t ! ( "validation_required" , attribute = t!( "new_password" ) ) . to_string ( ) ,
25+ message : t ! ( "validation_required" , locale = locale , attribute = t!( "new_password" , locale = locale ) ) . to_string ( ) ,
2626 } ;
2727 valid = false ;
2828 errors. push ( error_message) ;
@@ -31,7 +31,7 @@ impl ChangeAdminUserPasswordRequest {
3131 if !self . confirm_password . required ( ) ? {
3232 let error_message = ErrorMessage {
3333 key : String :: from ( "confirm_password" ) ,
34- message : t ! ( "validation_required" , attribute = t!( "confirm_password" ) ) . to_string ( ) ,
34+ message : t ! ( "validation_required" , locale = locale , attribute = t!( "confirm_password" , locale = locale ) ) . to_string ( ) ,
3535 } ;
3636 valid = false ;
3737 errors. push ( error_message) ;
@@ -40,7 +40,7 @@ impl ChangeAdminUserPasswordRequest {
4040 if self . new_password != self . confirm_password {
4141 let error_message = ErrorMessage {
4242 key : String :: from ( "confirm_password" ) ,
43- message : t ! ( "validation_confirmed" , attribute = t!( "confirm_password" ) ) . to_string ( ) ,
43+ message : t ! ( "validation_confirmed" , locale = locale , attribute = t!( "confirm_password" , locale = locale ) ) . to_string ( ) ,
4444 } ;
4545 valid = false ;
4646 errors. push ( error_message) ;
0 commit comments