Dodano obsługę tłumaczeń i ustawienia regionalne dla języka polskiego

This commit is contained in:
2026-01-15 23:13:51 +01:00
parent e13efb0fef
commit 17fb83bb32
6 changed files with 405 additions and 41 deletions

View File

@@ -46,17 +46,25 @@ class Shortcode
if (!empty($_POST["em_name"])) {
$em_name = $_POST["em_name"];
} else {
$error .= "Please enter your name </br>";
$error .=
esc_html__("Please enter your name", "in-contact") .
"<br />";
}
if (!empty($_POST["em_mail"])) {
$em_mail = $_POST["em_mail"];
} else {
$error .= "Please enter your email address </br>";
$error .=
esc_html__(
"Please enter your email address",
"in-contact",
) . "<br />";
}
if (!empty($_POST["em_message"])) {
$em_message = $_POST["em_message"];
} else {
$error .= "Please enter your message </br>";
$error .=
esc_html__("Please enter your message", "in-contact") .
"<br />";
}
$targetEmail =
@@ -76,11 +84,25 @@ class Shortcode
"From: " . $em_name . " <" . $em_mail . ">",
"Reply-To: " . $em_name . " <" . $em_mail . ">",
];
$body = '<!DOCTYPE html>
$emailTitle = __("New message from contact form", "in-contact");
$emailHeading = __("Contact details", "in-contact");
$emailNameLabel = __("Name and surname", "in-contact");
$emailEmailLabel = __("Email", "in-contact");
$emailMessageHeading = __("Message content", "in-contact");
$emailReplyLabel = __("Reply to message", "in-contact");
$emailFooter = __(
"This email was generated automatically by the website contact form.",
"in-contact",
);
$emailRights = __("All rights reserved.", "in-contact");
$body =
'<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<title>Nowa wiadomość z formularza kontaktowego</title>
<title>' .
esc_html($emailTitle) .
'</title>
<style>
body {
font-family: Arial, sans-serif;
@@ -142,24 +164,40 @@ class Shortcode
<body>
<div class="container">
<div class="header">
<h1>📩 Nowa wiadomość z formularza</h1>
<h1>📩 ' .
esc_html($emailTitle) .
'</h1>
</div>
<div class="content">
<h2>Dane kontaktowe</h2>
<p><strong>Imię i nazwisko:</strong> {{IMIE_NAZWISKO}}</p>
<p><strong>Email:</strong> {{EMAIL}}</p>
<h2>' .
esc_html($emailHeading) .
'</h2>
<p><strong>' .
esc_html($emailNameLabel) .
':</strong> {{IMIE_NAZWISKO}}</p>
<p><strong>' .
esc_html($emailEmailLabel) .
':</strong> {{EMAIL}}</p>
<div class="info">
<h3>📬 Treść wiadomości:</h3>
<h3>📬 ' .
esc_html($emailMessageHeading) .
':</h3>
<p>{{WIADOMOSC}}</p>
</div>
<a href="mailto:{{EMAIL}}" class="button">Odpowiedz na wiadomość</a>
<a href="mailto:{{EMAIL}}" class="button">' .
esc_html($emailReplyLabel) .
'</a>
</div>
<div class="footer">
Ten e-mail został wygenerowany automatycznie przez formularz kontaktowy strony.<br>
© {{ROK}} Twoja Firma. Wszelkie prawa zastrzeżone.
' .
esc_html($emailFooter) .
'<br>
© {{ROK}} Twoja Firma. ' .
esc_html($emailRights) .
'
</div>
</div>
</body>
@@ -251,7 +289,9 @@ class Shortcode
get_option("incontact-form-ph-name") .
'" value="" required>
<div class="invalid-feedback">
Please enter your name!
' .
esc_html__("Please enter your name!", "in-contact") .
'
</div>
</div>
</div>
@@ -264,7 +304,9 @@ class Shortcode
get_option("incontact-form-ph-email") .
'" value="" required>
<div class="invalid-feedback">
Please enter your email address!
' .
esc_html__("Please enter your email address!", "in-contact") .
'
</div>
</div>
</div>
@@ -277,7 +319,9 @@ class Shortcode
get_option("incontact-form-ph-message") .
'" required></textarea>
<div class="invalid-feedback">
Please enter your message!
' .
esc_html__("Please enter your message!", "in-contact") .
'
</div>
</div>
</div>
@@ -292,7 +336,9 @@ class Shortcode
<p></p>
<div class="col-4">
<button id="submit" name="submit" type="submit" value="Send" class="btn btn-primary">
<i class="fas fa-paper-plane"></i> Send
<i class="fas fa-paper-plane"></i> ' .
esc_html__("Send", "in-contact") .
'
</button>
</div>
</div>