Sha256: 8404a7d63bb7fc277b939e87335386b910ed78490362c664c521e310ee39c3d6

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

---
sidebar_position: 3
title: i18n
---

# i18n and Ransack

Ransack translation files are available in
[Ransack::Locale](https://github.com/activerecord-hackery/ransack/tree/main/lib/ransack/locale). You may also be interested in one of the
many translations for Ransack available at
http://www.localeapp.com/projects/2999.

Predicate and attribute translations in forms may be specified as follows (see
the translation files in [Ransack::Locale](https://github.com/activerecord-hackery/ransack/tree/main/lib/ransack/locale) for more examples):

locales/en.yml:
```yml
en:
  ransack:
    asc: ascending
    desc: descending
    predicates:
      cont: contains
      not_cont: not contains
      start: starts with
      end: ends with
      gt: greater than
      lt: less than
    models:
      person: Passenger
    attributes:
      person:
        name: Full Name
      article:
        title: Article Title
        body: Main Content
```

Attribute names may also be changed globally, or under `activerecord`:

```yml
en:
  attributes:
    model_name:
      model_field1: field name1
      model_field2: field name2
  activerecord:
    attributes:
      namespace/article:
        title: AR Namespaced Title
      namespace_article:
        title: Old Ransack Namespaced Title
```

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ransack-4.2.1 docs/docs/going-further/i18n.md
ransack-4.2.0 docs/docs/going-further/i18n.md
ransack-4.1.1 docs/docs/going-further/i18n.md
ransack-4.1.0 docs/docs/going-further/i18n.md
ransack-4.0.0 docs/docs/going-further/i18n.md