How to translate form.php language message ?

5 replies · opened May 14, 2021

AAlimawMay 14, 2021

I am writing a multi-laguage web site.

Q1 :
The form.php file contains:

$message = array(
	'success'			=> 'We have **successfully** received your Message and will get Back to you as soon as possible.',
	'error'				=> 'Email **could not** be sent due to some Unexpected Error. Please Try Again later.',
	'error_bot'			=> 'Bot Detected! Form could not be processed! Please Try Again!',
	'error_unexpected'	=> 'An **unexpected error** occured. Please Try Again later.',
	'recaptcha_invalid'	=> 'Captcha not Validated! Please Try Again!',
	'recaptcha_error'	=> 'Captcha not Submitted! Please Try Again.'
);

Is there a way to dynamically replace these values ?
I'm new to PHP, but in C++ we vould pass an argument to the constructor of the class or add a setter. Is it possible to do something similar ?

Q2:
I have 2 dates fields in the form, where is the validation code of the form ? I need to add code to meke sure 1st date is inferior to 2nd date.

In addition, the recipient do need to receive the mail with french date format dd/mm/yyyy, whatever the dispayed format on the form.

Thanks a lot.

SSemicolon WebSTAFFMay 14, 2021

Hello,

  1. You can setup Custom Messages for you Form directly in the HTML itself using the following code inside the `` HTML Codes:
    [ch_pre][/ch_pre]

For complete list of settings you can refer to this Documentation: http://docs.semicolonweb.com/docs/forms/settings/ .

  1. Currently, there is no inbuilt Validation method to compare the Dates. But, you can consider using the Date Range Datepicker from this Template: http://themes.semicolonweb.com/html/canvas/component-datepicker.html . This should serve the Purpose perfectly fine.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

AAlimawMay 14, 2021

Thanks a lot, i'll give it a go :)
About yhe daterangepicker, I'm afraid I read somewhere it does not support translation, at least for the time being.

SSemicolon WebSTAFFMay 14, 2021

Hello,

Please check the Image attached. This is still the DatePicker you are currently using.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

AAlimawMay 14, 2021

I used a workaround for the date range: date picker for the start date and slider for the number of days...

Thanks for the trick for the message translation, it works fine :

  
  
  
SSemicolon WebSTAFFMay 14, 2021

Hello,

Very Happy to Help! :)

Thats a great way to use the DatePicker. Glad the issue was resolved.

Do let us know if we can help you with anything else or if you find any further issues with Canvas.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard