Home > gettext_column_mapping

gettext_column_mapping

Gettext_column_mapping is a project mainly written in Ruby, based on the MIT license.

Rails plugin for column translation with mutoh/gettext_active_record or grosser/gettext_i18n_rails

= gettext_column_mapping

If you use mutoh/gettext or grosser/fast_gettext to localize your active_record models, this library is for you. This gem only works for now with mysql

== Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

== Requirements Gem requirements :

  • mutoh/gettext_activerecord >= 2.1.0 or grosser/fast_gettext or your own gettext implementation
  • activerecord >= 2.3.0
  • mysql >= 2.7

== Features/Problems

This library is extracted from another application with its requirements. So it may not fit your project It must be refactored and improved.

  • Better API methods naming ?
  • Add more atomic tests
  • Must accept different output than UTF-8

== Example

gem install gettext_column_mapping
gem install fast_gettext gettext_i18n_rails

Rails 2.3.x Usage

# config/environment.rb

config.gem 'gettext_column_mapping'

# config/initializers/gettext.rb

GettextColumnMapping::Initializer.run do |config|
  config.config_file = File.expand_path('../../column_mapping.yml', __FILE__)
end

Rails 3 Usage

# Gemfile
gem 'gettext_column_mapping', :source => 'git://github.com/hallelujah/gettext_column_mapping.git', :require => 'gettext_column_mapping/railtie'

# config/application.rb

config.gettext_column_mapping.config_file = File.expand_path('../column_mapping.yml',__FILE__)

All Rails

# config/initializers/gettext.rb

# Configure FastGettext
FastGettext.add_text_domain 'app_domain', :path => File.join(RAILS_ROOT,'locale')
FastGettext.default_available_locales = ['en','fr','es'] #all you want to allow
FastGettext.default_text_domain = 'app_domain'

# config/column_mapping.yml

my_namespace/foo:
  class_name: OtherFoo
  column_names:
    my_label: Label

See a working {gettext_column_mapping rails examples}[http://github.com/hallelujah/gettext_column_mapping_example_rails.git]

Rails is not mandatory, you can use it in your other project taht satisfies all requirements above !!

Just use the GettextColumnMapping::Initializer.run method

== Rake task

You can add in your Rakefile to have gettext_column_mapping:.* tasks

GettextColumnMapping::Tasks.new("version","text_domain") do |t|
  t.options_store = {
    :po_root => "./po",
    :msgmerge => [:verbose, :no_fuzzy_matching]
  }
  t.locale_path = './locale'
  t.options_finder = {:to => "./static/data.rb", :ignore_tables => "schema_migrations"}
end

== Maintainer Ramihajamalala Hery

== Copyright

Copyright (c) 2010 Ramihajamalala Hery < hery at rails-royce.org >, released under the MIT license

Previous:TestGitBranch