diff --git a/README.md b/README.md index cf0d55d9..0a76203f 100644 --- a/README.md +++ b/README.md @@ -543,6 +543,20 @@ Constants are formed by first stripping all non-word characters and then upcasin The field specified as the _enum_accessor_ must contain unique data values. +## I18n + +ActiveHash supports i18n as ActiveModel. +Put following code in one of your locale file (e.g. `config/locales/LANGUAGE_CODE.yml`) + +```yaml +# for example, inside config/locales/ja.yml +ja: + activemodel: + models: + # `Country.model_name.human` will evaluates to "国" + country: "国" +``` + ## Contributing If you'd like to become an ActiveHash contributor, the easiest way it to fork this repo, make your changes, run the specs and submit a pull request once they pass. diff --git a/lib/active_hash/base.rb b/lib/active_hash/base.rb index 7a65cd6d..eeb347eb 100644 --- a/lib/active_hash/base.rb +++ b/lib/active_hash/base.rb @@ -57,7 +57,7 @@ def normalize(v) end if Object.const_defined?(:ActiveModel) - extend ActiveModel::Naming + extend ActiveModel::Translation include ActiveModel::Conversion else def to_param