I'm building an app in Rails with SSR ERB views. In the app I'm building, each user is associated with a brand (i.e., a company). Based on the brand the user is associated with, the app must present the "correct" branded experience -- including styling, images, copy, etc. I'd like to figure out a clean way to pull the logic to pick the appropriate copy out of the views.
For example, I'd love to be able to replace:
<% if @user.brand_foo? %>
<h1>This is my favorite brand</h1>
<% else %>
<h1>No, really, this is my favorite brand</h1>
<% end %>
with something like
# in some (yml?) file
brand_foo:
product_page:
super_good_header: "This is my favorite brand"
brand_bar:
product_page:
super_good_header: "No, really, this is my favorite brand"
# in the view
<h1><%= branded("product_page.super_good_header", @user.brand) %></h1>
I've been thinking about leaning on I18n, and having each set of copy live as a locale, but I'm worried that that decision might bite me later down the line when I actually need language localization.
How have you done this in your apps? Do you have any suggestions?
Thanks!