@@ -216,17 +216,17 @@ public function postRegisterAction(Request $request)
216
216
$ grantType = 'password ' ;
217
217
218
218
if (true == $ confirmationEnabled ) {
219
- $ msg = 'Please check your email to complete the registration. ' ;
219
+ $ msg = 'api.registration_check_mail ' ;
220
220
} else {
221
- $ msg = 'Registration complete. Welcome! ' ;
221
+ $ msg = 'api.registration_complete ' ;
222
222
$ oAuthRtn = $ this ->fetchAccessToken ($ request , $ grantType );
223
223
}
224
224
225
225
$ this ->logMessage (201 , 'User successfully created ' .$ request ->request ->get ('username ' ) );
226
226
227
227
return new JsonResponse (array (
228
228
'code ' => 201 ,
229
- 'show_message ' => $ msg ,
229
+ 'show_message ' => $ this -> get ( ' translator ' )-> trans ( $ msg, array (), ' messages ' , $ request -> getLocale ()) ,
230
230
'username ' => $ request ->request ->get ('username ' ),
231
231
'oauth ' => $ oAuthRtn
232
232
));
@@ -279,13 +279,13 @@ public function editPasswordAction()
279
279
// Now all ok
280
280
$ userManager = $ this ->get ('fos_user.user_manager ' );
281
281
$ userManager ->updateUser ($ user );
282
- $ msg = 'Password changed successfully ' ;
282
+ $ msg = 'api.password_changed ' ;
283
283
284
284
$ this ->logMessage (200 , $ msg .' for ' .$ user ->getUsername ());
285
285
286
286
return new JsonResponse (array (
287
287
'code ' => 201 ,
288
- 'show_message ' => $ msg ,
288
+ 'show_message ' => $ this -> get ( ' translator ' )-> trans ( $ msg, array (), ' messages ' , $ request -> getLocale ()) ,
289
289
'username ' => $ user ->getUsername (),
290
290
));
291
291
}
@@ -324,9 +324,11 @@ public function getProfileAction()
324
324
325
325
$ this ->logMessage (200 , 'Profile fetched successfully for ' .$ user ->getUsername ());
326
326
327
+ $ msg = 'api.profile_fetched ' ;
328
+
327
329
return new JsonResponse (array (
328
330
'code ' => 201 ,
329
- 'show_message ' => ' Profile fetched successfully ' ,
331
+ 'show_message ' => $ this -> get ( ' translator ' )-> trans ( $ msg , array (), ' messages ' , $ request -> getLocale ()) ,
330
332
'username ' => $ user ->getUsername (),
331
333
'firstname ' => $ user ->getFirstname (),
332
334
'lastname ' => $ user ->getLastname (),
@@ -408,15 +410,15 @@ public function editProfileAction()
408
410
$ userManager = $ this ->get ('fos_user.user_manager ' );
409
411
$ userManager ->updateUser ($ user );
410
412
411
- $ msg = 'Profile changed successfully ' ;
413
+ $ msg = 'api.profile_edited ' ;
412
414
413
415
$ username = $ user ->getUsername ();
414
416
415
417
$ this ->logMessage (201 , $ msg .' for ' .$ username );
416
418
417
419
return new JsonResponse (array (
418
420
'code ' => 201 ,
419
- 'show_message ' => $ msg . ' for ' . $ username
421
+ 'show_message ' => $ this -> get ( ' translator ' )-> trans ( $ msg , array (), ' messages ' , $ request -> getLocale ()),
420
422
));
421
423
}
422
424
@@ -455,12 +457,13 @@ public function editProfilePicAction()
455
457
$ userManager = $ this ->get ('fos_user.user_manager ' );
456
458
$ userManager ->updateUser ($ user );
457
459
458
- $ msg = 'Profile Pic updated successfully. ' .$ user ->getUsername ();
460
+ $ msg = 'api.profile_pic_edited ' ;
461
+
459
462
$ this ->logMessage (201 , $ msg );
460
463
461
464
return new JsonResponse (array (
462
465
'code ' => 201 ,
463
- 'show_message ' => $ msg ,
466
+ 'show_message ' => $ this -> get ( ' translator ' )-> trans ( $ msg, array (), ' messages ' , $ request -> getLocale ()) ,
464
467
'image_url ' => $ this ->getParameter ('images_profile_dir ' ).$ user ->getImage ()
465
468
));
466
469
}
@@ -511,9 +514,11 @@ public function getResettingRequestAction()
511
514
$ email = $ session ->get (static ::SESSION_EMAIL );
512
515
$ session ->remove (static ::SESSION_EMAIL );
513
516
517
+ $ msg = 'api.mail_send ' ;
518
+
514
519
return new JsonResponse (array (
515
520
'code ' => 201 ,
516
- 'show_message ' => ' Mail already send to ' . $ email. ' . Please check your mail. '
521
+ 'show_message ' => $ this -> get ( ' translator ' )-> trans ( $ msg , array ( ' email ' => $ email ), ' messages ' , $ request -> getLocale ()),
517
522
));
518
523
}
519
524
@@ -553,7 +558,7 @@ public function postAccessTokenAction()
553
558
$ this ->logMessage (201 , $ msg );
554
559
555
560
$ oAuthRtn ['code ' ] = 201 ;
556
- $ oAuthRtn ['show_message ' ] = ' Logged in successfully ' ;
561
+ $ oAuthRtn ['show_message ' ] = $ this -> get ( ' translator ' )-> trans ( ' api.logged_in ' , array (), ' messages ' , $ request -> getLocale ()) ;
557
562
558
563
return new JsonResponse ($ oAuthRtn );
559
564
}
@@ -593,7 +598,7 @@ public function postRefreshTokenAction()
593
598
$ this ->logMessage (201 , $ msg );
594
599
595
600
$ oAuthRtn ['code ' ] = 201 ;
596
- $ oAuthRtn ['show_message ' ] = ' Logged in successfully ' ;
601
+ $ oAuthRtn ['show_message ' ] = $ this -> get ( ' translator ' )-> trans ( ' api.logged_in ' , array (), ' messages ' , $ request -> getLocale ()) ;
597
602
598
603
return new JsonResponse ($ oAuthRtn );
599
604
}
0 commit comments