traductor traducir para pagina inglés ingles google good español codigo buscar ruby-on-rails activerecord localization translation

ruby on rails - traducir - ¿Hay un archivo de traducción inglés predeterminado para Active Record?



traducir al español (3)

Esto sucedió porque mi configuración de idioma era ''en-US'' y no ''en''. Hay archivos de traducción en activerecord / lib / locale. Copié estas traducciones en un nuevo archivo en_US.yml.

"en-US": activerecord: errors: template: body: There were problems with the following fields header: one: 1 error prohibited this {{model}} from being saved other: "{{count}} errors prohibited this {{model}} from being saved" messages: inclusion: "is not included in the list" exclusion: "is reserved" invalid: "is invalid" confirmation: "doesn''t match confirmation" accepted: "must be accepted" empty: "can''t be empty" blank: "can''t be blank" too_long: "is too long (maximum is {{count}} characters)" too_short: "is too short (minimum is {{count}} characters)" wrong_length: "is the wrong length (should be {{count}} characters)" taken: "has already been taken" not_a_number: "is not a number" greater_than: "must be greater than {{count}}" greater_than_or_equal_to: "must be greater than or equal to {{count}}" equal_to: "must be equal to {{count}}" less_than: "must be less than {{count}}" less_than_or_equal_to: "must be less than or equal to {{count}}" odd: "must be odd" even: "must be even"

Luego acabo de agregar mis cadenas personalizadas después de estas.

Estoy actualizando una aplicación a una aplicación de carriles a 2.3.2 y estoy descubriendo que no puedo mostrar los mensajes de error de validación por defecto para ActiveRecord porque no tengo un archivo de traducción para él.

Este es el error que se informa:

translation missing: en-US, activerecord, errors, template, header translation missing: en-US, activerecord, errors, template, body Email translation missing: en-US, activerecord, errors, models, user, attributes, email, taken

¿Alguien sabe dónde puedo encontrar un archivo predeterminado de traducción al inglés que incluya todas las cadenas que las validaciones podrían usar?


FYI, si los está incluyendo en el formato hash de estilo antiguo, use esto;

:activerecord => { :errors => { :template => { :body => ''There were problems with the following fields'', :header => { :one => ''1 error prohibited this {{model}} from being saved'', :other => "{{count}} errors prohibited this {{model}} from being saved" } }, :messages => { :inclusion => "is not included in the list", :exclusion => "is reserved", :invalid => "is invalid", :confirmation => "doesn''t match confirmation", :accepted => "must be accepted", :empty => "can''t be empty", :blank => "can''t be blank", :too_long => "is too long (maximum is {{count}} characters)", :too_short => "is too short (minimum is {{count}} characters)", :wrong_length => "is the wrong length (should be {{count}} characters)", :taken => "has already been taken", :not_a_number => "is not a number", :greater_than => "must be greater than {{count}}", :greater_than_or_equal_to => "must be greater than or equal to {{count}}", :equal_to => "must be equal to {{count}}", :less_than => "must be less than {{count}}", :less_than_or_equal_to => "must be less than or equal to {{count}}", :odd => "must be odd", :even => "must be even" } }

}


Puede evitar copiar y pegar las traducciones estándar diciendo a I18n que retroceda a: es cuando no puede encontrar una traducción en: en_US. El ejemplo de inicializador a continuación muestra cómo lo hicimos para retroceder de ''en-GB'' y ''it-IT'' al standrd ''en'', lanzando en pluralizaciones para una buena medida

# config/initializer/i18n.rb I18n.backend = I18n::Backend::Chain.new(I18n.backend) I18n::Backend::Chain.send(:include, I18n::Backend::Fallbacks) I18n.fallbacks[:''en-GB''] << :en I18n.fallbacks[:''it-IT''] << :en require "i18n/backend/pluralization" I18n::Backend::Chain.send(:include, I18n::Backend::Pluralization)