0.0
No commit activity in last 3 years
No release in over 3 years
Rails gem to help with translations and locale changing. Uses simple locale style like `en` or `de` .. more complex (`en-US`) style may follow.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 3.2

Runtime

>= 5.0
>= 4.0
>= 4.0
 Project Readme

MagicLocales

Rails gem to help with translations and locale changing. Uses simple locale style like :en or :de .. more complex (en-US) style may follow.

The gem includes a seed file with most common european locales.

Usage

  • add gem to your gemfile
  gem "magic_locales"
  • run install generator
  rails g magic_locales:install
  • check new migration and migrate your database
  bundle exec rake db:migrate

Controller-Helper

  • in your application controller:
  include MagicLocaleHelper

  before_action :get_user_language

include MagicLocaleHelper loads in the helper and before_action :get_user_language checks user language (via db-field or accept-language) .. now you can access your users @accept_language.

Features

  • Seed-file for this languages
  bg, cs, da, nl, en, fi, fr, de, el, hr, hu, it, pl, pt, ru, es, sv, uk
  • each translated in:
  cs, de, en, es, fr, it, pl, ru
  • locale switch helper (only visible, if more than 1 locale is live)
  <%= render "magic_locales/locale_switch" %>
  • helper to show fields for each active language (globalize helper)
  <%= f.globalize_fields_for lc do |g| %>
    # ..
  <% end %>

License

This project rocks and uses MIT-LICENSE.