diff --git a/Gemfile b/Gemfile index ea188fb8..83f7e128 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 7ce501f0..caf25991 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -377,6 +380,7 @@ DEPENDENCIES puma rails (~> 4.0) rails-erd + rails-i18n (~> 4.0) ri_cal rmagick sass-rails (~> 4.0) diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 113a8798..0a7a78ec 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -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" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 32c218aa..83f27abd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,7 +2,7 @@ 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) @@ -10,7 +10,7 @@ def datepicker_time(f) 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) diff --git a/app/views/application/_form_telephone_field.html.erb b/app/views/application/_form_telephone_field.html.erb index 54c0aa68..ac121a1a 100644 --- a/app/views/application/_form_telephone_field.html.erb +++ b/app/views/application/_form_telephone_field.html.erb @@ -1,5 +1,5 @@
<%= f.label tag %>:
<%= f.telephone_field tag, class: 'form-control' %> - Your telephone number will be kept confidential,... + Uw telefoonnummer wordt vertrouwelijk gehouden, en zal enkel gebruikt worden om uw persoonlijke eindscore te sms'en.
diff --git a/app/views/events/_ticket.html.erb b/app/views/events/_ticket.html.erb index 76ba6f1c..0157c07d 100644 --- a/app/views/events/_ticket.html.erb +++ b/app/views/events/_ticket.html.erb @@ -1,6 +1,6 @@
  • <%= al.name_with_price %> <% if al.event.show_ticket_count %> - <%= "#{pluralize(al.tickets_left, "ticket")} left" if al.capacity.presence %> + <%= "#{pluralize(al.tickets_left, "ticket")} " + t('tickets.left') if al.capacity.presence %> <% end %>
  • diff --git a/app/views/events/show.html.erb b/app/views/events/show.html.erb index 69677ff6..81639bc0 100644 --- a/app/views/events/show.html.erb +++ b/app/views/events/show.html.erb @@ -2,22 +2,22 @@
    -

    Description

    +

    <%= t('event.description') %>

    - + - + - + - + @@ -26,17 +26,17 @@ - + - +
    Organisation<%= t('event.organisation') %> <%= @event.club.name %>
    Location<%= t('event.location') %> <%= @event.location %>
    Start date<%= t('event.start_date') %> <%= nice_time @event.start_date %>
    End date<%= t('event.end_date') %> <%= nice_time @event.end_date %>
    Website<%= t('event.website') %> <%= link_to @event.website, @event.website %>
    Contact e-mail<%= t('event.contact_mail') %> <%= mail_to @event.contact_email, @event.contact_email %>
    <% unless @event.access_levels.blank? %> -

    Tickets

    +

    <%= t('activerecord.attributes.registration.access_levels')%>

      @@ -50,15 +50,15 @@
    -

    Register

    +

    <%= t('event.register') %>

    <% 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.
    - <%= link_to "Login", new_user_session_path %> using CAS to register for these tickets. + <%= t('tickets.login_required') %>
    + <%= 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 %>
    diff --git a/app/views/registration_mailer/ticket.html.erb b/app/views/registration_mailer/ticket.html.erb index 7cda126c..f8c39431 100644 --- a/app/views/registration_mailer/ticket.html.erb +++ b/app/views/registration_mailer/ticket.html.erb @@ -43,6 +43,7 @@ <%= @registration.event.name %>
    <%= nice_date @registration.event.start_date %> + @@ -66,9 +67,8 @@ - @@ -76,7 +76,7 @@
    Dear <%= @registration.name %>
    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. -
    - If you won'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 %> +
    + <%= raw t('mail.ticket_start', :name => @registration.name, :mail=>@registration.event.contact_email)%>
    - +
      Meer info <%= t('mail.more_info')%>
    @@ -114,16 +114,16 @@ <%= @registration.event.name %> - Start date
    <%= nice_time @registration.event.start_date %> - End date
    <%= nice_time @registration.event.end_date %> + <%= t('event.start_date')%>
    <%= nice_time @registration.event.start_date %> + <%= t('event.end_date')%>
    <%= nice_time @registration.event.end_date %> - Location
    <%= @registration.event.location %> - Barcode number
    <%= @registration.barcode %> + <%= t('event.location')%>
    <%= @registration.event.location %> + <%= t('event.barcode_number')%>
    <%= @registration.barcode %> <% if @registration.event.registration_cancelable %> - 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;'} %> + <%= 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;'} %> <% end %> diff --git a/app/views/registrations/_basic.html.erb b/app/views/registrations/_basic.html.erb index 02a8a8a7..ea94c972 100644 --- a/app/views/registrations/_basic.html.erb +++ b/app/views/registrations/_basic.html.erb @@ -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 %>

    -
    +
    diff --git a/app/views/registrations/destroy_cancel.html.erb b/app/views/registrations/destroy_cancel.html.erb index 9376a36b..435d5cbf 100644 --- a/app/views/registrations/destroy_cancel.html.erb +++ b/app/views/registrations/destroy_cancel.html.erb @@ -1,2 +1,3 @@ -

    Ticket deleted!

    -

    Placeholder text

    +

    <%= t('event.cancel.deleted.title') %>

    + +<%= t('event.cancel.deleted.click_here_website')%> \ No newline at end of file diff --git a/app/views/registrations/show_cancel.html.erb b/app/views/registrations/show_cancel.html.erb index bd0638b1..133d2460 100644 --- a/app/views/registrations/show_cancel.html.erb +++ b/app/views/registrations/show_cancel.html.erb @@ -1,8 +1,6 @@ -

    Schrijf u uit!

    -

    <%= @registration.event.name %>

    -

    dsfsdfsfk

    +

    <%= t('event.cancel.title', :event => @registration.event.name) %>

    <% 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 %> \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index 92281bec..e6ca06c8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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 @@ -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") diff --git a/config/locales/en.yml b/config/locales/en.yml index bd9875e5..1f43ef3e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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: diff --git a/config/locales/nl.yml b/config/locales/nl.yml new file mode 100644 index 00000000..984fb284 --- /dev/null +++ b/config/locales/nl.yml @@ -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}
    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. +
    + If you won'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: '↓'