verbb / comments

A Craft CMS plugin for managing comments directly within the CMS.
Other
137 stars 33 forks source link

FR: Custom comment submission messages #216

Closed brycekirk closed 3 years ago

brycekirk commented 3 years ago

Right now, I can edit the submit messages by going into src/controllers/CommentsController.php, but that obviously isn't ideal. A way to edit these messages in the control panel would be great!

engram-design commented 3 years ago

I'd probably recommend using static translations to "translate" this text into whatever you require. I'll probably add a collection of settings to control this.

brycekirk commented 3 years ago

Noted, thanks.

For those interested, you need to add a translations folder to the base directory (or wherever the craft file is), another folder in there with your language, and then a php file called comments.php. So it would look something like this:

[translations] -[en-CA] --comments.php

The contents of comments.php:

<?php
return [
  'Your comment has been posted and is under review.' => 'New text here'
];

More info in the Craft Sites & Localizations docs.

engram-design commented 3 years ago

Thanks for providing the explanation to all! After further thought, I think I'll keep this text out of the control panel, purely for better multi-site support, which you can do through translations. If we were to add these texts to the control panel and the plugin settings, they wouldn't be per-site, instead global.

For that reason, I think we'll stick with translations as the accepted solution.