diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 754fda82..af7a8028 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,7 +7,8 @@ class ApplicationController < ActionController::Base :authenticate, :authorize, :set_time_zone, - :remove_params + :remove_params, + :set_locale def authenticate if session[:current_user_id] @@ -40,4 +41,15 @@ def remove_params params.delete :skip_captcha params.delete :skip_password end + + # Changes the locale if *locale* (en|fr|...) is passed as GET parameter + def set_locale + locale = params[:locale] or session[:locale] + locale = locale.to_sym if locale + + if locale and I18n.available_locales.include?(locale) + I18n.locale = locale + session[:locale] = locale + end + end end diff --git a/app/views/layouts/_user_informations.html.erb b/app/views/layouts/_user_informations.html.erb index 17a91cb8..f2a0b2bb 100644 --- a/app/views/layouts/_user_informations.html.erb +++ b/app/views/layouts/_user_informations.html.erb @@ -2,19 +2,19 @@

<% if @current_user %>

- Signed-in as <%= link_to @current_user.account, edit_user_path %> - <%= link_to "Logout", session_path, :method => :delete %> + <%= t :signed_in_as %> <%= link_to @current_user.account, edit_user_path %> - <%= link_to t(:logout), session_path, :method => :delete %>

- Your address : <%= @current_user.last_address %> + <%= t :your_last_address %> : <%= @current_user.last_address %> <%= link_to image_tag('refresh.png'), user_addresses_path, :remote => true, :method => :post, :id => 'refresh-button', - :title => 'Generate a new receiving address, refresh at will' %> + :title => t(:generate_new_address_legend) %>

<% else %> - <%= link_to "Sign-up", new_user_path %> or <%= link_to "login", new_session_path %> + <%= link_to t(:sign_up), new_user_path %> | <%= link_to t(:sign_in), new_session_path %> <% end %>

\ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 9d703f6a..2fa88442 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -263,3 +263,10 @@ en: new_password_confirmation: Confirmation + # layouts/user_informations.html + generate_new_address_legend: Generate a new receiving address, refresh at will + your_last_address: Your address + logout: Logout + signed_in_as: Signed-in as + sign_up: Sign-up + sign_in: Login \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 2cab33f9..9189dd65 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -179,3 +179,12 @@ fr: <<: *errors_template full_messages: format: "%{attribute} %{message}" + + + # layouts/user_informations.html + generate_new_address_legend: Générer une nouvelle addresse de réception + your_last_address: Votre addresse + logout: Déconnexion + signed_in_as: Connecté en tant que + sign_up: S'enregistrer + sign_in: Se connecter \ No newline at end of file diff --git a/config/locales/pl.yml b/config/locales/pl.yml new file mode 100644 index 00000000..40a341e2 --- /dev/null +++ b/config/locales/pl.yml @@ -0,0 +1,193 @@ +# Polish translations for Ruby on Rails +# by Jacek Becela (jacek.becela@gmail.com, http://github.com/ncr) +# Minor changes and adjustments for Rails 3 by Piotrek Okoński (http://github.com/pokonski) + +pl: + date: + formats: + default: "%d-%m-%Y" + short: "%d %b" + long: "%B %d, %Y" + + day_names: [niedziela, poniedziałek, wtorek, środa, czwartek, piątek, sobota] + abbr_day_names: [nie, pon, wto, śro, czw, pia, sob] + + month_names: [~, styczeń, luty, marzec, kwiecień, maj, czerwiec, lipiec, sierpień, wrzesień, październik, listopad, grudzień] + abbr_month_names: [~, sty, lut, mar, kwi, maj, cze, lip, sie, wrz, paź, lis, gru] + order: + - :day + - :month + - :year + + time: + formats: + default: "%a, %d %b %Y %H:%M:%S %z" + short: "%d %b %H:%M" + long: "%B %d, %Y %H:%M" + am: "przed południem" + pm: "po południu" + + support: + array: + words_connector: ", " + two_words_connector: " i " + last_word_connector: " oraz " + + select: + prompt: "Proszę wybrać" + + number: + format: + separator: "," + delimiter: " " + precision: 3 + significant: false + strip_insignificant_zeros: false + + currency: + format: + format: "%u %n" + unit: "PLN" + separator: "," + delimiter: " " + precision: 2 + significant: false + strip_insignificant_zeros: true + + percentage: + format: + delimiter: "" + + precision: + format: + delimiter: "" + + human: + format: + delimiter: "" + precision: 3 + significant: true + strip_insignificant_zeros: true + storage_units: + format: "%n %u" + units: + byte: + one: "bajt" + other: "bajty" + kb: "KB" + mb: "MB" + gb: "GB" + tb: "TB" + decimal_units: + format: "%n %u" + units: + unit: "" + thousand: Tysiąc + million: Milion + billion: Miliard + trillion: Trylion + quadrillion: Kwadrylion + + datetime: + distance_in_words: + half_a_minute: "pół minuty" + less_than_x_seconds: + one: "mniej niż sekundę" + few: "mniej niż %{count} sekundy" + other: "mniej niż %{count} sekund" + x_seconds: + one: "1 sekunda" + few: "%{count} sekundy" + other: "%{count} sekund" + less_than_x_minutes: + one: "mniej niż minutę" + few: "mniej niż %{count} minuty" + other: "mniej niż %{count} minut" + x_minutes: + one: "1 minuta" + few: "%{count} minuty" + other: "%{count} minut" + about_x_hours: + one: "około godziny" + few: "około %{count} godziny" + other: "około %{count} godzin" + x_days: + one: "1 dzień" + few: "%{count} dni" + other: "%{count} dni" + about_x_months: + one: "około miesiąca" + few: "około %{count} miesiące" + other: "około %{count} miesięcy" + x_months: + one: "1 miesiąc" + few: "%{count} miesiące" + other: "%{count} miesięcy" + about_x_years: + one: "około rok" + few: "około %{count} lata" + other: "około %{count} lat" + over_x_years: + one: "ponad rok" + few: "ponad %{count} lata" + other: "ponad %{count} lat" + almost_x_years: + one: "prawie rok" + few: "prawie %{count} lata" + other: "prawie %{count} lat" + prompts: + year: "Rok" + month: "Miesiąc" + day: "Dzień" + hour: "Godzina" + minute: "Minuta" + second: "Sekundy" + + helpers: + select: + prompt: "Proszę wybrać" + + submit: + create: 'Utwórz %{model}' + update: 'Aktualizuj %{model}' + submit: 'Zapisz %{model}' + + errors: + format: "%{attribute} %{message}" + + messages: &errors_messages + inclusion: "nie znajduje się na liście dopuszczalnych wartości" + exclusion: "jest zarezerwowane" + invalid: "jest nieprawidłowe" + confirmation: "nie zgadza się z potwierdzeniem" + accepted: "musi zostać zaakceptowane" + empty: "nie może być puste" + blank: "nie może być puste" + too_long: "jest za długie (maksymalnie %{count} znaków)" + too_short: "jest za krótkie (przynajmniej %{count} znaków)" + wrong_length: "ma nieprawidłową długość (powinna wynosić %{count} znaków)" + not_a_number: "nie jest liczbą" + not_an_integer: "musi być liczbą całkowitą" + greater_than: "musi być większe od %{count}" + greater_than_or_equal_to: "musi być większe lub równe %{count}" + equal_to: "musi być równe %{count}" + less_than: "musi być mniejsze od %{count}" + less_than_or_equal_to: "musi być mniejsze lub równe %{count}" + odd: "musi być nieparzyste" + even: "musi być parzyste" + + activerecord: + errors: + template: + header: + one: "%{model} nie został zachowany z powodu jednego błędu" + other: "%{model} nie został zachowany z powodu %{count} błędów" + body: "Błędy dotyczą następujących pól:" + + messages: + taken: "zostało już zajęte" + record_invalid: "Negatywne sprawdzenie poprawności: %{errors}" + <<: *errors_messages + + full_messages: + format: "%{attribute}%{message}"