From c6fee85e5feea1af4588df2f549f221bb70368e9 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 15 Apr 2021 10:45:01 -0500 Subject: [PATCH] i18n app/views/campaigns/_campaigns_table.html.erb --- app/views/campaigns/_campaigns_table.html.erb | 6 +-- config/locales/campaigns.en.yml | 37 +++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 config/locales/campaigns.en.yml diff --git a/app/views/campaigns/_campaigns_table.html.erb b/app/views/campaigns/_campaigns_table.html.erb index 0c3dc09f..3f1ed55c 100644 --- a/app/views/campaigns/_campaigns_table.html.erb +++ b/app/views/campaigns/_campaigns_table.html.erb @@ -13,7 +13,7 @@ <% if campaign.end_datetime %>

- Until: <%= Format::Date.full(campaign.end_datetime, campaign.nonprofit.timezone) %> + <%= t('campaigns.until_end_datetime', end_datetime: Format::Date.full(campaign.end_datetime, campaign.nonprofit.timezone)) %>

<% end %>
@@ -23,11 +23,11 @@ <%= campaign.summary ? strip_tags(campaign.summary) : strip_tags(campaign.tagline) %>

<% if campaign.show_total_count %> - <%= metric['supporters_count'] %> supporters + <%= t('campaigns.total_count_of_supporters', supporters_count: metric['supporters_count'] ) %> <% end %> <% if campaign.show_total_raised %> - <%= print_currency metric['total_raised'], campaign.nonprofit.currency_symbol %> raised + <%= t('campaigns.total_amount_raised_html', total_raised: print_currency(metric['total_raised'], campaign.nonprofit.currency_symbol))%> <% end %> diff --git a/config/locales/campaigns.en.yml b/config/locales/campaigns.en.yml new file mode 100644 index 00000000..6a2a3f06 --- /dev/null +++ b/config/locales/campaigns.en.yml @@ -0,0 +1,37 @@ +# License: CC0-1.0 +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# +# To learn more, please read the Rails Internationalization guide +# available at https://guides.rubyonrails.org/i18n.html. + +en: + campaigns: + until_end_datetime: "Until: %{end_datetime}" + total_count_of_supporters_html: "%{supporters_count} supporters" + total_amount_raised_html: "%{total_raised} raised"