Skip to content

Overridable default locale YAML - #71

Merged
oriolgual merged 1 commit into
codegram:masterfrom
ppworks:master
Nov 9, 2016
Merged

oriolgual merged 1 commit into
codegram:masterfrom
ppworks:master

Conversation

@ppworks

@ppworks ppworks commented Jan 25, 2016

Copy link
Copy Markdown
Contributor

I changed the path of locale files from locale/*.yml to config/locale/*.yml(It's Rails Engine default).

Before

I18n.load_path
=> ["/Users/koshikawa/tmp/fugo/vendor/bundle/gems/activesupport-4.2.5/lib/active_support/locale/en.yml",
 "/Users/koshikawa/tmp/fugo/vendor/bundle/gems/activemodel-4.2.5/lib/active_model/locale/en.yml",
 "/Users/koshikawa/tmp/fugo/vendor/bundle/gems/activerecord-4.2.5/lib/active_record/locale/en.yml",
 "/Users/koshikawa/tmp/fugo/vendor/bundle/gems/actionview-4.2.5/lib/action_view/locale/en.yml",
 "/Users/koshikawa/app/config/locales/en.yml,
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/af.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/ca.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/de.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/en.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/es.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/fr.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/it.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/ja.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/nl.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/pl.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/pt-BR.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/ru.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/tr.yml"]

After

I18n.load_path
=> ["/Users/koshikawa/tmp/fugo/vendor/bundle/gems/activesupport-4.2.5/lib/active_support/locale/en.yml",
 "/Users/koshikawa/tmp/fugo/vendor/bundle/gems/activemodel-4.2.5/lib/active_model/locale/en.yml",
 "/Users/koshikawa/tmp/fugo/vendor/bundle/gems/activerecord-4.2.5/lib/active_record/locale/en.yml",
 "/Users/koshikawa/tmp/fugo/vendor/bundle/gems/actionview-4.2.5/lib/action_view/locale/en.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/af.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/ca.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/de.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/en.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/es.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/fr.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/it.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/ja.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/nl.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/pl.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/pt-BR.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/ru.yml",
 "/Users/koshikawa/repository/github.com/codegram/date_validator/config/locales/tr.yml",
 "/Users/koshikawa/app/config/locales/en.yml"]

This change makes us be able to override default locale setting as below.

path_to_your_app_root/config/locale/*.yml

en:
  errors:
    messages:
      not_a_date: "is not a DATE!!!" 

@ppworks

ppworks commented Mar 25, 2016

Copy link
Copy Markdown
Contributor Author

Could you check this? @codegram

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants