我正在運行一個帶有英文和西班牙文翻譯文件的網站,英文爲默認文件。human_attribute_name和rails中的翻譯文件
使用翻譯如:
en:
tenants:
about: "About"
到
es:
tenants:
about: "Acera"
使用
t "tenants.about"
作品沒有問題,無論從en.yml和es.yml文件時正確地讀取適當。
但是,當試圖使用human_attribute_name屬性從西班牙語es.yml文件的另一部分拉取模型屬性時,值不會被讀取。
因此,像
Job.human_attribute_name(:title)
返回 「稱號」,而不是 「性標題」。
與人源化的屬性相同es.yml文件的部分如下:
es:
tenants:
about: "Acerca"
activerecord:
attributes:
job:
title: "Título de la oferta de trabajo"
location: "Localización de la oferta de trabajo"
job_type: "Tipo de trabajo"
description: "Descripción"
任何瞭解,將不勝感激。
我不認爲這是問題,但我已經添加了完整的es.yml來幫助澄清 – cman77