We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

How can I translate/custom Phalcon's error messages?

Phalcon has some built in error messages, like this

    Value of field 'phone' doesn't match regular expression

I'm working on a multi-lang project, I want to make these error messages can be multi-lang, too.
Are these messages translatable?


I am developing multi-lang project too.

  • When you define your validators you can pass your custom message values e.g.


use Phalcon\Mvc\Model\Validator\PresenceOf;

class Subscriptors extends Phalcon\Mvc\Model

  public function validation()
      $this->validate(new PresenceOf(array(
          'field' => 'name',
          'message' => 'The name is required'
      if ($this->validationHasFailed() == true) {
          return false;

  • If you are asking about model messages, there is an issue with Phalcon's default notNullValidators. It is described here https://forum.phalcon.io/discussion/2547/give-custom-model-validation-priority.

  • I am suggesting you using gettext extension for translations. It has the best performance and supports plurals. Plurals are important if you are interested in generating high quality translations.