Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 861539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:59:36+00:00 2026-05-15T08:59:36+00:00

I have a multi-tenant application and I’m experimenting with using the i18n gem to

  • 0

I have a multi-tenant application and I’m experimenting with using the i18n gem to allow each of our clients to customize the system to their liking, changing the text on various pages, customizing emails, and so forth. Admittedly, I’m not using i18n as it was intended to be used, since I’m not actually translating different “languages”, everything is in English, but each client has a DIFFERENT English, if that makes sense.

Still, I’ve come across what I think is a horribly bad design decision in the i18n gem: if ever a translation does not exist, rather than simply not doing a translation and printing out whatever it normally would, it raises an error. For example,

<%= distance_of_time_in_words_to_now @press_release.submitted_at %>

comes out as

translation missing: en, datetime, distance_in_words, x_days

I mean, come on! I don’t even WANT that to be translated.

I understand that the reason this is happening is because I don’t have the default translations loaded, but I’m using ActiveRecord as a backend and I wanted to keep it clean. The “solution” would be to import all of the yaml translation files into my database translation store, but that doesn’t seem like a good idea. What if I upgrade rails in the future? I’m going to have to worry about keeping all of these translations in sync.

Again, I cannot fathom why this is the default behavior. When would ANYBODY want that funky error message to show up instead of just using the default “3 days ago”?

Anyway, my question is, is there a way to have it automatically turn off the translation and use the untranslated message if the translation doesn’t exist? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:59:37+00:00Added an answer on May 15, 2026 at 8:59 am

    This seems to do the trick.

    require 'i18n' # without this, the gem will be loaded in the server but not in the console, for whatever reason
    
    # store translations in the database's translations table
    I18n.backend = I18n::Backend::ActiveRecord.new
    
    # for translations that don't exist in the database, fallback to the Simple Backend which loads the default English Rails YAML files
    I18nSimpleBackend = I18n::Backend::Simple.new
    I18n.exception_handler = lambda do |exception, locale, key, options|
      case exception
      when I18n::MissingTranslationData
        I18nSimpleBackend.translate(:en, key, options || {})
      else
        raise exception
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume we have a multi-tenant blog application. Each user of the application may have
I'm working on a multi-tenant ASP.NET MVC application. So far we have been using
I'm working on one multi-tenancy application, where each tenant will have access to 1
I'm using 'rails3-jquery-autocomplete' gem, but it doesn't have multi column search, but there is
We are building an ASP.Net MVC 2 multi-tenant application on SQL Server using the
I'm building a multi-tenant web application where for security concerns, we need to have
We have a multi-tenant system with a separate database per tenant (but with the
I am creating a multi tenant db for an application. I have gone with
i develop a asp.net mvc3 shop application which is multi tenant. Each customer (around
I have an EF 4.2 EDMX model which I use in a multi-tenant application.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.