Add translation system (#85)
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
) {
|
||||
$response = [
|
||||
"success" => false,
|
||||
"errorMessage" => "Please fill all mandatory fields"
|
||||
"errorMessage" => translate('fill_mandatory_fields', $i18n)
|
||||
];
|
||||
echo json_encode($response);
|
||||
} else {
|
||||
@@ -33,7 +33,7 @@
|
||||
if ($result === false) {
|
||||
$response = [
|
||||
"success" => false,
|
||||
"errorMessage" => "Error saving notifications data"
|
||||
"errorMessage" => translate('error_saving_notifications', $i18n)
|
||||
];
|
||||
echo json_encode($response);
|
||||
} else {
|
||||
@@ -57,13 +57,14 @@
|
||||
|
||||
if ($stmt->execute()) {
|
||||
$response = [
|
||||
"success" => true
|
||||
"success" => true,
|
||||
"message" => translate('notifications_settings_saved', $i18n)
|
||||
];
|
||||
echo json_encode($response);
|
||||
} else {
|
||||
$response = [
|
||||
"success" => false,
|
||||
"errorMessage" => "Error saving notification data"
|
||||
"errorMessage" => translate('error_saving_notifications', $i18n)
|
||||
];
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
) {
|
||||
$response = [
|
||||
"success" => false,
|
||||
"errorMessage" => "Please fill all fields"
|
||||
"errorMessage" => translate('fill_all_fields', $i18n)
|
||||
];
|
||||
echo json_encode($response);
|
||||
} else {
|
||||
@@ -34,6 +34,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
$fromEmail = $data["fromemail"] ?? "wallos@wallosapp.com";
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
$mail->CharSet="UTF-8";
|
||||
$mail->isSMTP();
|
||||
|
||||
$mail->Host = $smtpAddress;
|
||||
@@ -51,18 +52,19 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
$mail->setFrom($fromEmail, 'Wallos App');
|
||||
$mail->addAddress($email, $name);
|
||||
|
||||
$mail->Subject = 'Wallos Notification';
|
||||
$mail->Body = 'This is a test notification. If you\'re seeing this, the configuration is correct.';
|
||||
$mail->Subject = translate('wallos_notification', $i18n);
|
||||
$mail->Body = translate('test_notification', $i18n);
|
||||
|
||||
if ($mail->send()) {
|
||||
$response = [
|
||||
"success" => true,
|
||||
"message" => translate('notification_sent_successfuly', $i18n)
|
||||
];
|
||||
echo json_encode($response);
|
||||
} else {
|
||||
$response = [
|
||||
"success" => false,
|
||||
"errorMessage" => "Error sending email." . $mail->ErrorInfo
|
||||
"errorMessage" => translate('email_error', $i18n) . $mail->ErrorInfo
|
||||
];
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user