Language E-Mail from Contact form

This is the right place to report general bugs, make suggestions or ask for help.
Post Reply
marustiweb
Posts: 4
Joined: Thu May 07, 2020 9:30 am

Language E-Mail from Contact form

Post by marustiweb » Thu May 07, 2020 2:30 pm

Just getting started with FlatPress and noticed that the E-Mail sent from FlatPress is hard coded in english which is not so practicle based on all the various language provided by FlatPress. I had a quick look and came up with the following solution:

in contact.php change

Code: Select all

				
				$msg = "Name: \n{$arr['name']} \n\n";
				
				if (isset($arr['email']))
					$msg .= "Email: {$arr['email']}\n\n";
				if (isset($arr['url']))
					$msg .= "WWW: {$arr['url']}\n\n";
				$msg .= "Content:\n{$arr['content']}\n";
				
					$success = @utils_mail(
						(
						isset($arr['email'])? 
							$arr['email'] 
							: 
							$fp_config['general']['email']
						), 
						"Contact sent through {$fp_config['general']['title']} ", $msg );
						
to

Code: Select all

$msg = " ".$lang['contact']['message']['name']." \n{$arr['name']} \n\n";
				
				if (isset($arr['email']))
					$msg .= " ".$lang['contact']['message']['email']." {$arr['email']}\n\n";
				if (isset($arr['url']))
					$msg .= " ".$lang['contact']['message']['www']." {$arr['url']}\n\n";
				$msg .= " ".$lang['contact']['message']['content']." \n{$arr['content']}\n";
				
					$success = @utils_mail(
						(
						isset($arr['email'])? 
							$arr['email'] 
							: 
							$fp_config['general']['email']
						), 
						"".$lang['contact']['message']['subject']." {$fp_config['general']['title']} ", $msg );
in lang.contact.php add (example for german language file)

Code: Select all

	$lang['contact']['message'] = array(
		'subject'	=> 'Nachricht von',
		'name'		=> 'Name:',
		'email'		=> 'E-Mail:',
		'www'		=> 'Webseite:',
		'content'	=> 'Nachricht:',
	);

blog7
Posts: 5
Joined: Fri May 15, 2020 3:05 pm

Re: Language E-Mail from Contact form

Post by blog7 » Fri May 15, 2020 3:17 pm

Why don't use utf-8? And all we reading email in all laguages
blog7.org

marustiweb
Posts: 4
Joined: Thu May 07, 2020 9:30 am

Re: Language E-Mail from Contact form

Post by marustiweb » Sun May 31, 2020 2:24 pm

I dont understand how that would make a difference to the hard coded english text?
To re-produce set your side to a different language then english, enable the default contact form and send yourself a test email and check the subject and lables in that email.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest