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

Then, in your view:

 <%= link_to t(ab_test(:make_people_buy_more_foo)) , buy_path %>