these are some helper classes to provide translation text via the fast_gettext gem from a database usng datamapper. (it will not work with activerecord !!). beside the locale there is also a text domain which can be used to overlay the default text domain. for example you have a rideshare board for several locations but want to have slightly different text/translation here or there, then you canuse the default text domain for the common text and overwrite some passages in the respective text domain for a location.
require 'dm-migrations' require 'dm-validations' require 'dm-timestamps' require 'dm-sqlite-adapter' # use any other adapter you need require 'ixtlan/gettext/models' DataMapper.auto_upgrade!
that prolog is the minimal datamapper setup and might be already in place in your project.
- Ixtlan::Gettext::Translation(text:String, translation_key:Ixtlan::Gettext::TranslationKey, locale:Ixtlan::Gettext::Locale, domain:Ixtlan::UserManagement::Domain)
require 'ixtlan/gettext/manager' include FastGettext::Translation gettext = Ixtlan::Gettext::Manager.new gettext.use( 'en' ) puts _("phrase to translate")
after the data in datbase changed you might need to clear the cache
within rails if you have an instance of the manager via the config (keeping a single instance per application):
or (assuming your rails is named 'rideboards')
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request