Skip to content

Complain of missing translation #44

Closed

Description

@kjeremy

I get the following:

Translation missing: en.activerecord.errors.models.affiliation.attributes.start.before

When I have this in my model:

class Affiliation
validates :start, :date => { :before => :end }
end

Activity

  1. andrew2005 commented on Oct 26, 2013

    @andrew2005

    I'm also getting this error in my unit tests. Did you find a fix?

  2. gipnokote commented on Oct 30, 2013

    @gipnokote

    Looks like it doesn't find locale YMLs of the gem. So as a temp fix I copied it's contents into my project en.yml (and other locales) like this:

    en:
      ...here be project tranlsation strings...
    
      errors:
        messages:
          not_a_date: "is not a date"
          after: "must be after %{date}"
          after_or_equal_to: "must be after or equal to %{date}"
          before: "must be before %{date}"
          before_or_equal_to: "must be before or equal to %{date}"
    
  3. gdlx commented on Aug 29, 2014

    @gdlx

    We shouldn't have to do that (as said in #20) but here's a small initializer to load en locale dynamically without including locale files in the app.

    config/initializers/date_validator_i18n.rb:

    I18n.load_path << "#{Gem.loaded_specs['date_validator'].full_gem_path}/locales/en.yml"

    You can also load all gem's locales with:

    I18n.load_path << Dir[File.expand_path("#{Gem.loaded_specs['date_validator'].full_gem_path}/locales", '*.yml')).to_s]
  4. bryanrite commented on Nov 14, 2014

    @bryanrite

    👍

  5. Uepsilon commented on Jan 6, 2015

    @Uepsilon

    just stumbled across this. Since @gauthier-delacroix solution does not work with ruby > 2.1 and ruby 4, here is the adapted solution for ruby 2.1.5 with rails 4.x

    Single:

    I18n.load_path += "#{Gem.loaded_specs['date_validator'].full_gem_path}/locales/en.yml"

    All

    I18n.load_path += Dir[File.expand_path( '*.yml', "#{Gem.loaded_specs['date_validator'].full_gem_path}/locales").to_s]
  6. added 2 commits that reference this issue on May 17, 2015
    f308c22
    9a41869
  7. vjustov commented on May 19, 2015

    @vjustov
    Contributor

    This is fixed in #60

  8. oriolgual commented on May 23, 2015

    @oriolgual
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions