Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.
tokumine edited this page Jan 4, 2011 · 3 revisions

Rails I18n and Vanity

Use your translation keys in the list of alternatives if you want to test many alternative i18n strings, then translate the keys in the view as normal – vanity will feeds you different keys to each user.

eg. in your experiment:

   ab_test "Make people buy more foo" do
       alternatives ".form.two.foo", "form.two.bar", ".form.two.baz"  # <= different i18n keys in your locale file
       metrics :record_conversion
   end

Then, in your view:

 <%= link_to t(ab_test(:make_people_buy_more_foo)) , buy_path %>
Clone this wiki locally