• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Javascript get language?!

Javascript get language?! 2 years 2 months ago #41774

Hi, I made one form, multilingual, one in Dutch and one in English.
Everything works except for the "final" answers are given.
I am not able to make a "Dutch" and "English" Javascript (works now for dutch, so the advice that comes from the questionnaire is in Dutch for the English users).

Therefore, if I am able to make a if statement for site-language, I might be able to solve the problem

something like
	if(totaalScore < 80 ) && SITELANGUAGE="DUTCH"
	{
		//risicoCategorie = risicoGroen;
		risicoGroep = "groen";
		risicoPercentage = "10%";
		risicoGroepText = "<h2>Advies</h2><div class=\"groenvlak\">Uw risico op een vaatprobleem is:<br/><span style=\"font-size: 24pt;\"><br><10%<br></span><br />U heeft " + aantalKmNotation + " kilometer gereden in uw leven. Dat is " + rondWereld + " maal rond de wereld.</div>";
 
		risicoGroepText += "<p><br />Het is waarschijnlijk dat er andere oorzaken van uw klachten zijn. Als u dit verder onderzocht wilt hebben, kunt u dit in eerste instantie het beste laten doen via uw huisarts of een sportarts in uw regio (zie onderaan deze pagina). </p>";
 
		risicoGroepTextMail = "Uw risico op een vaatprobleem is: <10%. Het is waarschijnlijk dat er andere oorzaken van uw klachten zijn. Als u dit verder onderzocht wilt hebben, kunt u dit in eerste instantie het beste laten doen via uw huisarts of een sportarts in uw regio.";
		//alert('groen');
	}
 
	if(totaalScore < 80 ) && SITELANGUAGE="ENGLISH"
	{
		//risicoCategorie = risicoGroen;
		risicoGroep = "green";
		risicoPercentage = "10%";
		risicoGroepText = "<h2>Advice</h2><div class=\"groenvlak\">Your risk at a sport-related vascular problem is:<br/><span style=\"font-size: 24pt;\"><br><10%<br></span><br />U have cycled around " + aantalKmNotation + " kilometres in your life. This equals " + rondWereld + " times around the world.</div>";
 
		risicoGroepText += "<p><br />It is likely that the complaints are caused by something else. If you want to have additional examination it is best to first see a general practitioner of sports physician in your area. </p>";
 
		risicoGroepTextMail = "Your risk at a sport-related vascular problem is: <10%. It is likely that the complaints are caused by something else. If you want to have additional examination it is best to first see a general practitioner of sports physician in your area.";
		//alert('green');
	}
 
 
Last Edit: 2 years 2 months ago by martijnvanhooff89. Reason: Corrections
The administrator has disabled public write access.

Javascript get language?! 2 years 2 months ago #41782

  • adrianp
  • adrianp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 631
  • Thank you received: 146
Hello,

You can try these steps:

- add a hidden field in your form.

- set a different value in this hidden field's Default Value area, for each of your languages (use the top-left language switcher while editing a form).

- in your JavaScript perform this check based on the hidden field's value.
This is not official customer support. To receive your support, submit a support ticket here.
The administrator has disabled public write access.
The following user(s) said Thank You: martijnvanhooff89

Javascript get language?! 2 years 2 months ago #41784

Thanks :-) that worked!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!