Skip to content

tomash/globalize3_accessors

Repository files navigation

Globalize3 Accessors

Introduction

Generator of easy accessor methods for models using Globalize3.

Use globalize_accessors with list of translated fields you want easy access to and extra :locales array listing locales for which you want the accessors to be generated.

This way a single form can be used to edit given model fields with all anticipated translations.

Installation

Add this line to Gemfile:


gem "globalize3_accessors", :git => 'git://github.com/tomash/globalize3_accessors.git'

Example

Definition like this:


class Product
  translates :title, :description
  globalize_accessors :pl, :en, :de
end

Gives you methods: title_pl, title_en, title_de, title_pl=, title_en=, title_de= (and similar set of description_* methods). And they work seamlessly with Globalize3 (not even touching the “core” title, title= methods used by Globalize3 itself).

TODO

  • Make it work with full-blown locales including dash character (minus sign) like en-US, en-GB, pl-PL etc.

License

Copyright © 2011 Tomek “Tomash” Stachewicz (homepage), released under the MIT license.

About

easy accessors for ActiveRecord fields translated with globalize3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages