Skip to content

Commit 451f2a3

Browse files
Few language msgs corrected
1 parent 523a677 commit 451f2a3

File tree

4 files changed

+42
-13
lines changed

4 files changed

+42
-13
lines changed

src/ApiBundle/Controller/AuthController.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,17 @@ public function postRegisterAction(Request $request)
216216
$grantType = 'password';
217217

218218
if (true == $confirmationEnabled ) {
219-
$msg = 'Please check your email to complete the registration.';
219+
$msg = 'api.registration_check_mail';
220220
} else {
221-
$msg = 'Registration complete. Welcome!';
221+
$msg = 'api.registration_complete';
222222
$oAuthRtn = $this->fetchAccessToken($request, $grantType);
223223
}
224224

225225
$this->logMessage(201, 'User successfully created '.$request->request->get('username') );
226226

227227
return new JsonResponse(array(
228228
'code' => 201,
229-
'show_message' => $msg,
229+
'show_message' => $this->get('translator')->trans($msg, array(), 'messages', $request->getLocale()),
230230
'username' => $request->request->get('username'),
231231
'oauth' => $oAuthRtn
232232
));
@@ -279,13 +279,13 @@ public function editPasswordAction()
279279
// Now all ok
280280
$userManager = $this->get('fos_user.user_manager');
281281
$userManager->updateUser($user);
282-
$msg = 'Password changed successfully';
282+
$msg = 'api.password_changed';
283283

284284
$this->logMessage(200, $msg.' for '.$user->getUsername());
285285

286286
return new JsonResponse(array(
287287
'code' => 201,
288-
'show_message' => $msg,
288+
'show_message' => $this->get('translator')->trans($msg, array(), 'messages', $request->getLocale()),
289289
'username' => $user->getUsername(),
290290
));
291291
}
@@ -324,9 +324,11 @@ public function getProfileAction()
324324

325325
$this->logMessage(200, 'Profile fetched successfully for '.$user->getUsername());
326326

327+
$msg = 'api.profile_fetched';
328+
327329
return new JsonResponse(array(
328330
'code' => 201,
329-
'show_message' => 'Profile fetched successfully',
331+
'show_message' => $this->get('translator')->trans($msg, array(), 'messages', $request->getLocale()),
330332
'username' => $user->getUsername(),
331333
'firstname' => $user->getFirstname(),
332334
'lastname' => $user->getLastname(),
@@ -408,15 +410,15 @@ public function editProfileAction()
408410
$userManager = $this->get('fos_user.user_manager');
409411
$userManager->updateUser($user);
410412

411-
$msg = 'Profile changed successfully';
413+
$msg = 'api.profile_edited';
412414

413415
$username = $user->getUsername();
414416

415417
$this->logMessage(201, $msg.' for '.$username);
416418

417419
return new JsonResponse(array(
418420
'code' => 201,
419-
'show_message' => $msg.' for '.$username
421+
'show_message' => $this->get('translator')->trans($msg, array(), 'messages', $request->getLocale()),
420422
));
421423
}
422424

@@ -455,12 +457,13 @@ public function editProfilePicAction()
455457
$userManager = $this->get('fos_user.user_manager');
456458
$userManager->updateUser($user);
457459

458-
$msg = 'Profile Pic updated successfully. '.$user->getUsername();
460+
$msg = 'api.profile_pic_edited';
461+
459462
$this->logMessage(201, $msg);
460463

461464
return new JsonResponse(array(
462465
'code' => 201,
463-
'show_message' => $msg,
466+
'show_message' => $this->get('translator')->trans($msg, array(), 'messages', $request->getLocale()),
464467
'image_url' => $this->getParameter('images_profile_dir').$user->getImage()
465468
));
466469
}
@@ -511,9 +514,11 @@ public function getResettingRequestAction()
511514
$email = $session->get(static::SESSION_EMAIL);
512515
$session->remove(static::SESSION_EMAIL);
513516

517+
$msg = 'api.mail_send';
518+
514519
return new JsonResponse(array(
515520
'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()),
517522
));
518523
}
519524

@@ -553,7 +558,7 @@ public function postAccessTokenAction()
553558
$this->logMessage(201, $msg);
554559

555560
$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());
557562

558563
return new JsonResponse($oAuthRtn);
559564
}
@@ -593,7 +598,7 @@ public function postRefreshTokenAction()
593598
$this->logMessage(201, $msg);
594599

595600
$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());
597602

598603
return new JsonResponse($oAuthRtn);
599604
}

src/ApiBundle/Resources/translations/messages.en.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,11 @@ api:
153153
show_error_password_policy: Password 6-20 characters, at least 1 Uppercase, 1 Lowercase, 1 Number and 1 Special Character
154154
show_error_role: Sorry! Wrong Role!
155155
show_error_image: Sorry! Some problem with image uploading!
156+
registration_check_mail: Please check your email to complete the registration.
157+
registration_complete: Registration complete. Welcome!
158+
password_changed: Password changed successfully!
159+
profile_fetched: Profile fetched successfully!
160+
profile_edited: Profile edited successfully!
161+
profile_pic_edited: Profile picture edited successfully!
162+
mail_send: Mail already send to %email%. Please check your mail.
163+
logged_in: Logged in successfully!

src/ApiBundle/Resources/translations/messages.fr.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,11 @@ api:
142142
show_error_password_policy: Mot de passe 6 à 20 caractères, au moins 1 majuscule, 1 minuscule, 1 numéro et 1 caractère spécial
143143
show_error_role: Pardon! Mauvais rôle!
144144
show_error_image: Pardon! Quelque problème avec le téléchargement d'image!
145+
registration_check_mail: Veuillez vérifier votre courriel pour compléter l'inscription.
146+
registration_complete: Inscription complète. Bienvenue!
147+
password_changed: Le mot de passe a été changé avec succès!
148+
profile_fetched: Profil extrait avec succès!
149+
profile_edited: Profil modifié avec succès!
150+
profile_pic_edited: Photo du profil éditée avec succès!
151+
mail_send: Le courrier est déjà envoyé à% email%. Veuillez vérifier votre e-mail.
152+
logged_in: Connecté avec succès!

src/ApiBundle/Resources/translations/messages.hi.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,11 @@ api:
142142
show_error_password_policy: पासवर्ड 6-20 अक्षर, कम से कम 1 अपरकेस, 1 लोअरकेस, 1 संख्या और 1 विशेष अक्षर
143143
show_error_role: माफ़ कीजिये! गलत भूमिका!
144144
show_error_image: माफ़ कीजिये! छवि अपलोड करने के साथ कुछ समस्या!
145+
registration_check_mail: पंजीकरण पूरा करने के लिए अपने ईमेल की जाँच करें।
146+
registration_complete: पंजीकरण पूर्ण। स्वागत हे!
147+
password_changed: पासवर्ड सफलतापूर्वक बदला गया!
148+
profile_fetched: प्रोफाइल सफलता पूर्वक दिलवाया!
149+
profile_edited: प्रोफाइल सफलतापूर्वक संपादित!
150+
profile_pic_edited: प्रोफ़ाइल चित्र सफलतापूर्वक संपादित!
151+
mail_send: मेल पहले से ही% email% करने के लिए भेज देते हैं। कृपया अपने मेल की जाँच करें।
152+
logged_in: सफलतापूर्वक लॉग इन हो चुका है!

0 commit comments

Comments
 (0)