This module allows you to easily cache all responses from the backend - thus speeding up the I18n aspects of your application quite a bit.

To enable caching you can simply include the Cache module to the Simple backend - or whatever other backend you are using:

I18n::Backend::Simple.send(:include, I18n::Backend::Cache)

You will also need to set a cache store implementation that you want to use:

I18n.cache_store = ActiveSupport::Cache.lookup_store(:memory_store)

You can use any cache implementation you want that provides the same API as ActiveSupport::Cache (only the methods fetch and write are being used).

The cache_key implementation assumes that you only pass values to I18n.translate that return a valid key from hash (see www.ruby-doc.org/core/classes/Object.html#M000337).

Namespace