Forum: Rails I18n Translation %{model} and other issues

85458feac00c538a9689d43ee0f3c8d6?d=identicon&s=25 Tomas R. (josetomas_r)
on 2011-04-18 00:46
I just downloaded "es-CL" translation file from git repo
but thanslation for Errors are not working good, for example

12 errors prohibited this client from being saved:
Contact phone no puede estar en blanco
Contact phone es demasiado corto (6 caracteres mínimo)
Contact cellphone no puede estar en blanco
Contact cellphone es demasiado corto (7 caracteres mínimo)
Contact address no puede estar en blanco
Contact email es demasiado corto (5 caracteres mínimo)
Contact email no es válido
Name no puede estar en blanco
Surname no puede estar en blanco
Surname2 no puede estar en blanco
Gender no está incluido en la lista
Rut no puede estar en blanco

my es.yml has this lines

  activerecord:
    errors:
      template:
        header:
          one:   "No se pudo guardar este/a %{model} porque se encontró
1 error"
          other:  "No se pudo guardar este/a %{model} porque se
encontraron %{count} errores"
        # The variable :count is also available
        body: "Se encontraron problemas con los siguientes campos:"

anyways %{model} is shown as %{model} not the model name
Also I need to translate the attributes names
D24691bdb2ed83327cd763d00c57f858?d=identicon&s=25 T. N. T. (tnt)
on 2011-05-07 19:07
Tomas R. wrote in post #993402:
> ...
> my es.yml has this lines
>
>   activerecord:
>     errors:
>       template:
>         header:
>           one:   "No se pudo guardar este/a %{model} porque se encontró
> 1 error"
>           other:  "No se pudo guardar este/a %{model} porque se
> encontraron %{count} errores"
>         # The variable :count is also available
>         body: "Se encontraron problemas con los siguientes campos:"

  activerecord:
    models:
      client: 'client in chilenian spanish'

should do it for the models and if I'm not wrong for the attributes:

  (activerecord:)
    attributes:
      client:
        phone: 'phone in spanish'
        cellphone: 'cellphone in spanish'
        ...

I have a subdirectory for the model (activerecord) stuff locales/models
and within that a subdirectory for each model (would be
locales/models/clients in your case). So a locales/models/clients/es.yml
could caontain:

es:
  attributes:
    phone: 'phone in spanish'
    cellphone: 'cellphone in spanish'
    ...

But how to set the model names in this way (outside the default dir) I
also would be interested in.

Regards T.
This topic is locked and can not be replied to.