Use this page to test helpers of the Localization Simplified plugin. Put this file in your applications view directory, add a controller action "helper_tests", and view this page
Sentence with UTF-8 characters: Café, Danish(æ,ø,å), Swedish(ä,ö,å), Spanish: (ñ)
| fn | result | expected |
|---|---|---|
time_ago_in_words(3.seconds.ago, true) |
<%= time_ago_in_words(3.seconds.ago, true) %> | 'less than 5 seconds' |
time_ago_in_words(9.seconds.ago, true) |
<%= time_ago_in_words(9.seconds.ago, true) %> | 'less than 10 seconds' |
time_ago_in_words(20.seconds.ago, true) |
<%= time_ago_in_words(20.seconds.ago, true) %> | 'less than 20 seconds' |
time_ago_in_words(31.seconds.ago, true) |
<%= time_ago_in_words(31.seconds.ago, true) %> | 'half a minute' |
time_ago_in_words(50.seconds.ago, true) |
<%= time_ago_in_words(50.seconds.ago, true) %> | 'less than a minute' |
time_ago_in_words(80.seconds.ago, true) |
<%= time_ago_in_words(80.seconds.ago, true) %> | '1 minute' |
time_ago_in_words(4.minutes.ago, true) |
<%= time_ago_in_words(4.minutes.ago, true) %> | '4 minutes' |
time_ago_in_words(50.minutes.ago, true) |
<%= time_ago_in_words(50.minutes.ago, true) %> | 'about 1 hour' |
time_ago_in_words(4.hours.ago, true) |
<%= time_ago_in_words(4.hours.ago, true) %> | 'about 4 hours' |
time_ago_in_words(1.day.ago, true) |
<%= time_ago_in_words(1.day.ago, true) %> | '1 day' |
time_ago_in_words(4.days.ago, true) |
<%= time_ago_in_words(4.days.ago, true) %> | '4 days' |
time_ago_in_words(1.month.ago, true) |
<%= time_ago_in_words(1.month.ago, true) %> | '1 month' |
time_ago_in_words(4.months.ago, true) |
<%= time_ago_in_words(4.months.ago, true) %> | '4 months' |
time_ago_in_words(13.months.ago, true) |
<%= time_ago_in_words(13.months.ago, true) %> | '1 year' |
time_ago_in_words(26.months.ago, true) |
<%= time_ago_in_words(26.months.ago, true) %> | '2 years' |
number_to_currency test:
Array.to_sentence test: [1,2,3].to_sentence: "<%= [1,2,3].to_sentence %>" (expected "1,2, and 3")
<% t = Time.parse('2006-12-25 11:55') -%> <% d = Date.parse('2006-12-25 11:55') -%>| Formatted time: | result | expected |
|---|---|---|
| t.to_formatted_s() | <%= t.to_formatted_s() %> | Mon Dec 25 11:55:00 Romance Standard Time 2006 |
| t.to_formatted_s(:default) | <%= t.to_formatted_s(:default) %> | Mon Dec 25 11:55:00 Romance Standard Time 2006 |
| t.to_formatted_s(:long) | <%= t.to_formatted_s(:long) %> | December 25, 2006 11:55 |
| t.to_formatted_s(:short) | <%= t.to_formatted_s(:short) %> | 25 Dec 11:55 |
| Formatted date: | result | expected |
| d.to_formatted_s() | <%= d.to_formatted_s() %> | 2006-12-25 |
| d.to_formatted_s(:default) | <%= d.to_formatted_s(:default) %> | 2006-12-25 |
| d.to_formatted_s(:long) | <%= d.to_formatted_s(:long) %> | December 25, 2006 |
| d.to_formatted_s(:short) | <%= d.to_formatted_s(:short) %> | 25 Dec |
<%= date_select :testmodel, :date %>
<%= datetime_select :testmodel, :datetime %>
<%=
# this gives exception
# select_date :testmodel, :select_date
%>
truncate 'Iñtërnâtiônàlizætiøn', 12: <%= truncate 'Iñtërnâtiônàlizætiøn', 12 %> (expected: "Iñtërnâti…")