No commit activity in last 3 years
No release in over 3 years
Easy accessors for ActiveRecord attributes translated using Globalize3.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
 Dependencies
 Project Readme

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.