Skip to content

Commit

Permalink
Translated and localized gandalf
Browse files Browse the repository at this point in the history
  • Loading branch information
feliciaan committed Jan 16, 2017
1 parent 575389f commit 84f3699
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 37 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.0'

# I18N
gem 'rails-i18n', '~> 4.0'

# We <3 New Relic
gem 'newrelic_rpm'

Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ GEM
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails-i18n (4.0.9)
i18n (~> 0.7)
railties (~> 4.0)
railties (4.2.7.1)
actionpack (= 4.2.7.1)
activesupport (= 4.2.7.1)
Expand Down Expand Up @@ -377,6 +380,7 @@ DEPENDENCIES
puma
rails (~> 4.0)
rails-erd
rails-i18n (~> 4.0)
ri_cal
rmagick
sass-rails (~> 4.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def basic
RegistrationMailer.confirm_registration(@registration).deliver_now
end

flash[:success] = "Registration successful. Please check your mailbox for your ticket or further payment information."
flash[:success] = t('flash.succes') # or further payment information."
respond_with @event
else
render "events/show"
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ module ApplicationHelper

# Prettify helpers
def nice_time(f)
f.try { |d| d.strftime("%a %d %b %Y %H:%M") }
f.try { |d| l(d, format: "%a %d %b %Y %H:%M") }
end

def datepicker_time(f)
f.try { |d| d.strftime("%Y-%m-%d %H:%M") }
end

def nice_date(f)
f.try { |d| d.strftime('%a %d %b %Y')}
f.try { |d| l(d, format: '%a %d %b %Y')}
end

def euro(f)
Expand Down
2 changes: 1 addition & 1 deletion app/views/application/_form_telephone_field.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="form-group">
<%= f.label tag %>:<br/>
<%= f.telephone_field tag, class: 'form-control' %>
<small>Your telephone number will be kept confidential,...</small>
<small>Uw telefoonnummer wordt vertrouwelijk gehouden, en zal enkel gebruikt worden om uw persoonlijke eindscore te sms'en.</small>

This comment has been minimized.

Copy link
@TomNaessens

TomNaessens Jan 16, 2017

Member

Shouldn't this be localized too?

</div>
2 changes: 1 addition & 1 deletion app/views/events/_ticket.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<li class="list-group-item">
<%= al.name_with_price %>
<% if al.event.show_ticket_count %>
<span class="label label-<%= color_for_tickets_left(al) %> pull-right"><%= "#{pluralize(al.tickets_left, "ticket")} left" if al.capacity.presence %></span>
<span class="label label-<%= color_for_tickets_left(al) %> pull-right"><%= "#{pluralize(al.tickets_left, "ticket")} " + t('tickets.left') if al.capacity.presence %></span>
<% end %>
</li>
24 changes: 12 additions & 12 deletions app/views/events/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

<div class="row">
<div class="col-sm-5">
<h2>Description</h2>
<h2><%= t('event.description') %></h2>
<table class="sideways-table">
<tr>
<td>Organisation</td>
<td><%= t('event.organisation') %></td>
<td><%= @event.club.name %></td>
</tr>
<tr>
<td>Location</td>
<td><%= t('event.location') %></td>
<td><%= @event.location %></td>
</tr>
<tr>
<td>Start date</td>
<td><%= t('event.start_date') %></td>
<td><%= nice_time @event.start_date %></td>
</tr>
<tr>
<td>End date</td>
<td><%= t('event.end_date') %></td>
<td><%= nice_time @event.end_date %></td>
</tr>
<tr>
Expand All @@ -26,17 +26,17 @@
</td>
</tr>
<tr>
<td>Website</td>
<td><%= t('event.website') %></td>
<td><%= link_to @event.website, @event.website %></td>
</tr>
<tr>
<td>Contact e-mail</td>
<td><%= t('event.contact_mail') %></td>
<td><%= mail_to @event.contact_email, @event.contact_email %></td>
</tr>
</table>

<% unless @event.access_levels.blank? %>
<h2>Tickets</h2>
<h2><%= t('activerecord.attributes.registration.access_levels')%></h2>
<div class="row">
<div class="col-sm-12">
<ul class="list-group">
Expand All @@ -50,15 +50,15 @@
</div>

<div class="col-sm-4 col-sm-offset-1">
<h2>Register</h2>
<h2><%= t('event.register') %></h2>
<% unless @event.access_levels.find_all{ |al| al.requires_login? }.blank? %>
Some tickets of this event can only be registered for if you are a member of the organiser's organisation.<br />
<%= link_to "Login", new_user_session_path %> using CAS to register for these tickets.
<%= t('tickets.login_required') %><br />
<%= link_to t('tickets.login'), new_user_session_path %> <%= t('tickets.login_cas') %>
<% end %>
<% if can? :register, @event and not @event.access_levels.find_all{ |al| can? :register, al }.blank? %>
<%= render partial: "registrations/form" %>
<% else %>
No tickets available at the moment!
<%= t('tickets.no_available') %>
<% end %>
</div>
</div>
18 changes: 9 additions & 9 deletions app/views/registration_mailer/ticket.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<td class="pr-15" style="font: 17px/18px Arial, Helvetica, sans-serif; color: #007dd6;"><strong><%= @registration.event.name %></strong><br /> <span style="font-size: 14px;"><%= nice_date @registration.event.start_date %></span></td>
</tr>
</tbody>
</tbody>
</table>
</td>
</tr>
Expand All @@ -66,17 +67,16 @@
<table width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="pr-15" style="padding: 0 30px 24px 0; font: 13px/18px Arial, Helvetica, sans-serif; color: #202020;">Dear <%= @registration.name %><br />Thank you for confirming your presence. This e-mail is your personal ticket for this event. Do not forget to print this email and bring the ticket with you.
<br/>
If you won&apos;t be able to attend, we kindly ask you to let us know via the link to the annulation page below. If you experience problems or have questions, do not hesitate to contact us by <%= @registration.event.contact_email %>
<td class="pr-15" style="padding: 0 30px 24px 0; font: 13px/18px Arial, Helvetica, sans-serif; color: #202020;">
<%= raw t('mail.ticket_start', :name => @registration.name, :mail=>@registration.event.contact_email)%>
</td>
</tr>
<tr>
<td>
<table width="151" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="active-d" style="mso-padding-alt: 4px 14px 10px; font: 13px/25px Arial, Helvetica, sans-serif;" align="center" bgcolor="#e8eff9"><a style="padding: 8px 14px; color: #1e64c8; text-decoration: none; display: block;" href="<%= @registration.event.website %>" target="_blank"> <span class="rarr">&rarr;</span>&nbsp;&nbsp;Meer info </a></td>
<td class="active-d" style="mso-padding-alt: 4px 14px 10px; font: 13px/25px Arial, Helvetica, sans-serif;" align="center" bgcolor="#e8eff9"><a style="padding: 8px 14px; color: #1e64c8; text-decoration: none; display: block;" href="<%= @registration.event.website %>" target="_blank"> <span class="rarr">&rarr;</span><%= t('mail.more_info')%></a></td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -114,16 +114,16 @@
<td style="padding: 0 0 15px; font: bold 16px/20px Arial, Helvetica, sans-serif; color: #fff;"><%= @registration.event.name %></td>
</tr>
<tr>
<td style="padding: 0 0 15px; font: 16px/23px Arial, Helvetica, sans-serif; color: #fff;">Start date<br /> <span style="font-size: 16px; font-weight: bold; color: #fff; text-decoration: none;" > <%= nice_time @registration.event.start_date %></span></td>
<td style="padding: 0 0 15px; font: 16px/23px Arial, Helvetica, sans-serif; color: #fff;">End date<br /> <span style="font-size: 16px; font-weight: bold; color: #fff; text-decoration: none;"> <%= nice_time @registration.event.end_date %></span></td>
<td style="padding: 0 0 15px; font: 16px/23px Arial, Helvetica, sans-serif; color: #fff;"><%= t('event.start_date')%><br /> <span style="font-size: 16px; font-weight: bold; color: #fff; text-decoration: none;" > <%= nice_time @registration.event.start_date %></span></td>
<td style="padding: 0 0 15px; font: 16px/23px Arial, Helvetica, sans-serif; color: #fff;"><%= t('event.end_date')%><br /> <span style="font-size: 16px; font-weight: bold; color: #fff; text-decoration: none;"> <%= nice_time @registration.event.end_date %></span></td>
</tr>
<tr>
<td style="padding: 0 0 15px; font: 16px/23px Arial, Helvetica, sans-serif; color: #fff;">Location<br /> <span style="font-size: 16px; font-weight: bold; color: #fff; text-decoration: none;"> <%= @registration.event.location %></span></td>
<td style="padding: 0 0 15px; font: 16px/23px Arial, Helvetica, sans-serif; color: #fff;">Barcode number <br/> <span style="font-size: 16px; font-weight: bold; color: #fff; text-decoration: none;"> <%= @registration.barcode %></span></td>
<td style="padding: 0 0 15px; font: 16px/23px Arial, Helvetica, sans-serif; color: #fff;"><%= t('event.location')%><br /> <span style="font-size: 16px; font-weight: bold; color: #fff; text-decoration: none;"> <%= @registration.event.location %></span></td>
<td style="padding: 0 0 15px; font: 16px/23px Arial, Helvetica, sans-serif; color: #fff;"><%= t('event.barcode_number')%><br/> <span style="font-size: 16px; font-weight: bold; color: #fff; text-decoration: none;"> <%= @registration.barcode %></span></td>
</tr>
<% if @registration.event.registration_cancelable %>
<tr>
<td style="padding: 0 0 15px; font: 16px/23px Arial, Helvetica, sans-serif; color: #fff;">To cancel <%= link_to "click here", cancel_event_registration_url(event_id: @registration.event.id, id: @registration.id, barcode: @registration.barcode), {:style =>'font-size: 16px; font-weight: bold; color: #fff; text-decoration: none;'} %></td>
<td style="padding: 0 0 15px; font: 16px/23px Arial, Helvetica, sans-serif; color: #fff;"><%= t('mail.cancel')%> <%= link_to t('mail.click_here'), cancel_event_registration_url(event_id: @registration.event.id, id: @registration.id, barcode: @registration.barcode), {:style =>'font-size: 16px; font-weight: bold; color: #fff; text-decoration: none;'} %></td>
</tr>
<% end %>
</tbody>
Expand Down
6 changes: 3 additions & 3 deletions app/views/registrations/_basic.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<%= javascript_tag do %>
window.ticketsWithComments = <%= @event.access_levels.find_all(&:has_comment).map(&:id).to_json %>
<% end %>
<%= f.submit "Register", class: 'btn btn-group btn-primary' %>
<%= f.submit "Registreer", class: 'btn btn-group btn-primary' %>
<% end %>
</p>

<div class="well well-sm">
<!--<div class="well well-sm">
Payments can only be done by bank transfer, <strong>not by credit card</strong>.
</div>
</div>-->

</div>
5 changes: 3 additions & 2 deletions app/views/registrations/destroy_cancel.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<h1>Ticket deleted!</h1>
<p>Placeholder text</p>
<h1><%= t('event.cancel.deleted.title') %></h1>

<a href="<%= @event.website %>"><%= t('event.cancel.deleted.click_here_website')%></a>
8 changes: 3 additions & 5 deletions app/views/registrations/show_cancel.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<h1>Schrijf u uit!</h1>
<p><%= @registration.event.name %></p>
<p>dsfsdfsfk</p>
<h1><%= t('event.cancel.title', :event => @registration.event.name) %></h1>
<% if @registration.event.registration_cancelable %>
<%= button_to 'Schrijf mij nu uit!', cancel_destroy_event_registration_path(params), method: :delete, class:'btn btn-default' %>
<%= button_to t('event.cancel.button'), cancel_destroy_event_registration_path(params), method: :delete, class:'btn btn-default' %>
<% else %>
Sorry, uitschrijven is niet meer mogelijk.
<%= t('event.cancel.closed')%>
<% end %>
3 changes: 2 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
I18n.available_locales = [:en, :nl]

module Isengard
class Application < Rails::Application
Expand All @@ -18,7 +19,7 @@ class Application < Rails::Application

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.default_locale = :nl

config.assets.paths << Rails.root.join("app", "assets", "fonts")
config.assets.paths << Rails.root.join("app", "assets", "fonts", "panno")
Expand Down
8 changes: 8 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ en:
attributes:
registration:
access_levels: "Ticket"
tickets:
left: 'over'
login_required: "Some tickets of this event can only be registered for if you are a member of the organiser's organisation."
login: 'Login'
login_cas: 'using CAS to register for these tickets.'
no_available: 'No tickets available at the moment!'
flash:
succes: "Registration successful. Please check your mailbox for your ticket."

helpers:
label:
Expand Down
51 changes: 51 additions & 0 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
nl:
activerecord:
attributes:
registration:
access_levels: "Ticket"
name: "Naam"
email: "E-mail"
phone_number: "Telefoonnummer"
register: 'Registreer'
event:
description: 'Beschrijving'
organisation: 'Organisatie'
location: 'Locatie'
start_date: 'Startdatum'
end_date: 'Einddatum'
website: 'Website'
contact_mail: 'Contact e-mail'
register: 'Registreer'
barcode_number: 'Barcode nummer'
cancel:
title: 'Schrijf u uit voor %{event}'
button: 'Schrijf mij nu uit!'
closed: 'Sorry, uitschrijven is niet meer mogelijk.'
deleted:
title: 'Ticket verwijderd'
click_here_website: 'Klik hier om naar de event website te gaan.'
tickets:
left: 'over'
login_required: 'Sommige tickets kunnen enkel besteld worden als je lid bent van de organiserende vereniging.'
login: 'Log in'
login_cas: 'met CAS om de tickets te kunnen bestellen.'
no_available: 'No tickets available at the moment!'
mail:
ticket_start: "Dear %{name}<br />Thank you for confirming your presence. This e-mail is your personal ticket for this event. Do not forget to print this email and bring the ticket with you.
<br/>
If you won&apos;t be able to attend, we kindly ask you to let us know via the link to the annulation page below. If you experience problems or have questions, do not hesitate to contact us by %{mail}"
more_info: "Meer info"
cancel: "Om te annuleren"
click_here: "klik hier"
flash:
succes: "Registratie succesvol. Uw ticket zou nu in uw mailbox toegekomen moeten zijn."

helpers:
label:
event:
club_id: "Organisatie"
datagrid:
table:
order:
asc: ''
desc: ''

0 comments on commit 84f3699

Please sign in to comment.