Factory Girl in Rails
You can use I18n directly in factory definitions

FactoryGirl.define do
  factory :static_page do
    language "en"
    trait :purchase_loan do
      page_name { I18n.t("static_page.page_name.purchase_loan", locale: language) }
      titlebar_text { I18.t("static_page.titlebar_text.purchase_loan", locale: language) }
    end

    trait :refinance_loan do
      page_name { I18n.t("static_page.page_name.refinance_loan", locale: language) }
      titlebar_text { I18.t("static_page.titlebar_text.refinance_loan", locale: language) }
    end
  end
end


This will allow you to share locales in views / application code and in your tests.

But you could go 1 step further and in your model store only locale keys, ie.

class StaticPage &lt; ActiveRecord::Base
  #attribues in db :pagename, :titlebar, :language
  def pagename_text
    I18n.t(pagename, locale: language)
  end

  def titlebar_text
    I18n.t(titlebar, locale: language)
  end
end


then you can use it this way:

purchase_loan_en = StaticPage.create(language: 'en', page_name: 'static_page.page_name.purchase_loan')


this will allow you to remove translations directly from factories.

Have a look on I18n Rails guide for how to use I18n. Maybe you don't even need to store language in database.