0

Is there a way to add the validator strings into the translations?

$message=$this->message!==null?$this->message:Yii::t('yii','{attribute} cannot be blank.');

/* craft/app/validators/CRequiredValidator.php - line 70 */

I'd like to translate that text without changing any of the code (which might be overwritten and lost with an update)

1

Yii already provides translations for those in multiple languages. Check in the craft/app/framework/messages folder to see a list of locales it supports.

If you want it in a locale they haven't translated, yet, then you can provide your own static translation and Craft will use it.

1
  • Ah. I found the problem. The folder name was "no" (general norwegian), but the language is actually called "nb" (norsk bokmål). So it was just the wrong folder name. Changed to "nb" and it gave me the correct translations. Thanks.
    – peirix
    Dec 11 '14 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.