Skip to content

Internationalization

Squeegy edited this page Sep 12, 2010 · 3 revisions

You can use the Rails built in I18n framework to translate error messages.

Use samples like these in your locale configs:


en:
  activerecord:
    errors:
      messages:
        missing_image: is really required
        invalid_image: seems to be broken
        image_too_small: "seems to be too small, it needs to be {{minimum}} pixels"

They can also be set on a model level:


en:
  activerecord:
    errors:
      models:
        photo:
          missing_image: needs to be attached
          invalid_image: is broken
          image_too_small: "is too small (should be >= {{minimum}})"

If no message is set in your locale, a default english one will be shown.

Clone this wiki locally