No release in over a year
A gem that helps create a `current_translation` relationship which is the translation in the current locale with fallback to other locales.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Project Readme

GlobalizeCurrentTranslation

Short description and motivation.

Usage

Install the gem on your models like this:

class Category < ApplicationRecord
  translates :name
  include GlobalizeCurrentTranslation::Scope
end

Now you can use the new relationship to order a collection by its current locale but fall back to another locale:

Category.left_joins(:current_translation).order("category_translations.name")

Installation

Add this line to your application's Gemfile:

gem 'globalize_current_translation', git: 'https://github.com/kaspernj/globalize_current_translation.git'

And then execute:

$ bundle

Or install it yourself as:

$ gem install globalize_current_translation

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.