Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this questionthe problem is I am making dual language website with JS and CSS only. Language change is triggered with button, here's a sample of JS for reference:
function languageSwitch() {
var state = $('.lang-pl:visible').length ? 'pl' : 'en';
if (state === 'pl') {
$('.lang-pl').css('display', 'none');
$('.lang-en').css('display', 'inherit');
} else {
$('.lang-en').css('display', 'none');
$('.lang-pl').css('display', 'inherit');
}
return false;
}
Everything looked great, but I hit a brick wall when it came to translating submit button. On regular fields like labels and even [acceptance] it wasn't problem and it worked like a charm:
<label> <span class="lang-pl">Imię i nazwisko *</span> <span class="lang-en">Name and surname *</span> [text* your-name] </label>
But with this code submit button isn't working- it's showing 'lang-pl' version before and after switching languages:
[submit <span class="lang-pl">Wyślij</span> <span class="lang-en">Send</span>]
Anyone have idea how to solve it?
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this questionthe problem is I am making dual language website with JS and CSS only. Language change is triggered with button, here's a sample of JS for reference:
function languageSwitch() {
var state = $('.lang-pl:visible').length ? 'pl' : 'en';
if (state === 'pl') {
$('.lang-pl').css('display', 'none');
$('.lang-en').css('display', 'inherit');
} else {
$('.lang-en').css('display', 'none');
$('.lang-pl').css('display', 'inherit');
}
return false;
}
Everything looked great, but I hit a brick wall when it came to translating submit button. On regular fields like labels and even [acceptance] it wasn't problem and it worked like a charm:
<label> <span class="lang-pl">Imię i nazwisko *</span> <span class="lang-en">Name and surname *</span> [text* your-name] </label>
But with this code submit button isn't working- it's showing 'lang-pl' version before and after switching languages:
[submit <span class="lang-pl">Wyślij</span> <span class="lang-en">Send</span>]
Anyone have idea how to solve it?
Share Improve this question asked Sep 25, 2018 at 7:39 pixelovepixelove 211 silver badge2 bronze badges 5 |1 Answer
Reset to default 2Just found solution:
I've switched default [submit]
with
<button id='submit' class='wpcf7-form-control wpcf7-submit'><span class="lang-pl">Wyślij</span> <span class="lang-en">Send</span></button>
and it works like a charm, now just styling in CSS
display
toblock
orinline
instead ofinherit
? Also, is yourlanguageSwitch()
function called at all? It's defined in your code, but not actually called. – Pim Commented Sep 25, 2018 at 8:09languageSwitch()
function called somewhere? – Pim Commented Sep 25, 2018 at 8:14$('.lang-pl:visible').length
, maybe you can try to grab the current language from another element and then run the rest of the code. – Pim Commented Sep 25, 2018 at 8:26