diff --git a/app/controllers/translations_controller.rb b/app/controllers/translations_controller.rb index 3134b7b..dafd0e3 100644 --- a/app/controllers/translations_controller.rb +++ b/app/controllers/translations_controller.rb @@ -25,7 +25,7 @@ class TranslationsController < ApplicationController respond_to do |format| if @translation.save - format.html { redirect_to @translation, notice: 'Translation was successfully created.' } + format.html { redirect_to @translation, notice: t('translations.notice.successfully_created') } format.json { render :show, status: :created, location: @translation } else format.html { render :new } diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 5f18bdf..4136c83 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,7 +1,7 @@ - Projekt Euler + <%= t :site_title %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> @@ -9,12 +9,12 @@ <%= navbar position: :static do %> <%= vertical do %> - <%= link_to 'Projekt Euler', root_path %> + <%= link_to t(:site_title), root_path %> <% end %> <%= horizontal do %> <%= nav class: 'navbar-left' do %> - <%= link_to 'Problems', problems_path %> - <%= link_to 'Translations', translations_path %> + <%= link_to Problem.model_name.human(count: 2), problems_path %> + <%= link_to Translation.model_name.human(count: 2), translations_path %> <% end %> <% end %> <% end %> diff --git a/app/views/problems/index.html.erb b/app/views/problems/index.html.erb index a46d613..b6f9b6a 100644 --- a/app/views/problems/index.html.erb +++ b/app/views/problems/index.html.erb @@ -1,11 +1,11 @@ -

Listing Problems

+

<%= Problem.model_name.human(count: 2) %>

<%= render 'problem_pagination' %> - - + + @@ -17,9 +17,9 @@ <% if problem.is_translated? %> <%= link_to problem.title, problem %> <% else %> - Dieses Problem wurde noch nicht übersetzt. + <%= t 'problems.not_yet_translated' %> <%= link_to new_problem_translation_path(problem), class: 'btn btn-default btn-xs' do %> - <%= icon :pencil %> Übersetzung vorschlagen + <%= icon :pencil %> <%= t '.suggest_translation' %> <% end %> <% end %> diff --git a/app/views/problems/show.html.erb b/app/views/problems/show.html.erb index c070457..7a2af88 100644 --- a/app/views/problems/show.html.erb +++ b/app/views/problems/show.html.erb @@ -3,10 +3,10 @@ <% end %> <%= link_to new_problem_translation_path(@problem), class: 'btn btn-default btn-sm pull-right' do %> - <%= icon :pencil %> Übersetzung verbessern + <%= icon :pencil %> <%= t '.improve_translation' %> <% end %> <%= panel do %>
@@ -14,5 +14,5 @@
<% end %>
- <%= link_to 'Dieses Problem auf projecteuler.net', @problem.original_url, target: '_blank' %> + <%= link_to t('.view_original_problem'), @problem.original_url, target: '_blank' %>
\ No newline at end of file diff --git a/app/views/problems/untranslated.html.erb b/app/views/problems/untranslated.html.erb index 3f6dcd5..cab6535 100644 --- a/app/views/problems/untranslated.html.erb +++ b/app/views/problems/untranslated.html.erb @@ -1 +1 @@ -Dieses Problem wurde noch nicht übersetzt. \ No newline at end of file +<%= t 'problems.not_yet_translated' %> \ No newline at end of file diff --git a/app/views/translations/_form.html.erb b/app/views/translations/_form.html.erb index 19910fd..bb9f013 100644 --- a/app/views/translations/_form.html.erb +++ b/app/views/translations/_form.html.erb @@ -1,7 +1,7 @@ <%= form_for([@problem, @translation]) do |f| %> <% if @translation.errors.any? %>
-

<%= pluralize(@translation.errors.count, "error") %> prohibited this problem from being saved:

+

<%= t 'errors.template.header', model: Translation.model_name.human, count: @translation.errors.count %>

IDTitle<%= Problem.human_attribute_name(:id) %><%= Problem.human_attribute_name(:title) %>
- - + + diff --git a/app/views/translations/new.html.erb b/app/views/translations/new.html.erb index 47224da..09378fe 100644 --- a/app/views/translations/new.html.erb +++ b/app/views/translations/new.html.erb @@ -1,5 +1,5 @@ -

New translation for problem <%= @problem.id %>

+

<%= t '.new_translation', id: @problem.id %>

<%= render 'form' %> -<%= link_to 'Back', translations_path %> +<%= link_to t('.back'), translations_path %> diff --git a/app/views/translations/show.html.erb b/app/views/translations/show.html.erb index 8b01959..4e54b94 100644 --- a/app/views/translations/show.html.erb +++ b/app/views/translations/show.html.erb @@ -3,7 +3,7 @@ <% end %> <%= panel do %> @@ -12,5 +12,5 @@ <% end %>
- <%= link_to 'Dieses Problem auf projecteuler.net', @translation.problem.original_url, target: '_blank' %> + <%= link_to t('problems.show.view_original_problem'), @translation.problem.original_url, target: '_blank' %>
diff --git a/config/application.rb b/config/application.rb index 0560984..54b7b30 100644 --- a/config/application.rb +++ b/config/application.rb @@ -17,7 +17,8 @@ module Projekteuler # config.time_zone = 'Central Time (US & Canada)' # 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.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s] + config.i18n.available_locales = :de + config.i18n.default_locale = :de end end diff --git a/config/environments/development.rb b/config/environments/development.rb index ddf0e90..13bd782 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -33,5 +33,5 @@ Rails.application.configure do config.assets.raise_runtime_errors = true # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true + config.action_view.raise_on_missing_translations = true end diff --git a/config/environments/test.rb b/config/environments/test.rb index 053f5b6..b8485ce 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -35,5 +35,5 @@ Rails.application.configure do config.active_support.deprecation = :stderr # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true + config.action_view.raise_on_missing_translations = true end diff --git a/config/locales/de.yml b/config/locales/de.yml new file mode 100644 index 0000000..c0e6bde --- /dev/null +++ b/config/locales/de.yml @@ -0,0 +1,205 @@ +--- +de: + site_title: Projekt Euler + date: + abbr_day_names: + - So + - Mo + - Di + - Mi + - Do + - Fr + - Sa + abbr_month_names: + - + - Jan + - Feb + - Mär + - Apr + - Mai + - Jun + - Jul + - Aug + - Sep + - Okt + - Nov + - Dez + day_names: + - Sonntag + - Montag + - Dienstag + - Mittwoch + - Donnerstag + - Freitag + - Samstag + formats: + default: '%d.%m.%Y' + long: '%e. %B %Y' + short: '%e. %b' + month_names: + - + - Januar + - Februar + - März + - April + - Mai + - Juni + - Juli + - August + - September + - Oktober + - November + - Dezember + order: + - :day + - :month + - :year + datetime: + distance_in_words: + about_x_hours: + one: etwa eine Stunde + other: etwa %{count} Stunden + about_x_months: + one: etwa ein Monat + other: etwa %{count} Monate + about_x_years: + one: etwa ein Jahr + other: etwa %{count} Jahre + almost_x_years: + one: fast ein Jahr + other: fast %{count} Jahre + half_a_minute: eine halbe Minute + less_than_x_minutes: + one: weniger als eine Minute + other: weniger als %{count} Minuten + less_than_x_seconds: + one: weniger als eine Sekunde + other: weniger als %{count} Sekunden + over_x_years: + one: mehr als ein Jahr + other: mehr als %{count} Jahre + x_days: + one: ein Tag + other: '%{count} Tage' + x_minutes: + one: eine Minute + other: '%{count} Minuten' + x_months: + one: ein Monat + other: '%{count} Monate' + x_seconds: + one: eine Sekunde + other: '%{count} Sekunden' + prompts: + day: Tag + hour: Stunden + minute: Minuten + month: Monat + second: Sekunden + year: Jahr + errors: + format: '%{attribute} %{message}' + messages: + accepted: muss akzeptiert werden + blank: muss ausgefüllt werden + present: darf nicht ausgefüllt werden + confirmation: stimmt nicht mit %{attribute} überein + empty: muss ausgefüllt werden + equal_to: muss genau %{count} sein + even: muss gerade sein + exclusion: ist nicht verfügbar + greater_than: muss größer als %{count} sein + greater_than_or_equal_to: muss größer oder gleich %{count} sein + inclusion: ist kein gültiger Wert + invalid: ist nicht gültig + less_than: muss kleiner als %{count} sein + less_than_or_equal_to: muss kleiner oder gleich %{count} sein + not_a_number: ist keine Zahl + not_an_integer: muss ganzzahlig sein + odd: muss ungerade sein + record_invalid: 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}' + restrict_dependent_destroy: + many: Datensatz kann nicht gelöscht werden, da abhängige %{record} existieren. + one: Datensatz kann nicht gelöscht werden, da ein abhängiger %{record}-Datensatz + existiert. + taken: ist bereits vergeben + too_long: ist zu lang (mehr als %{count} Zeichen) + too_short: ist zu kurz (weniger als %{count} Zeichen) + wrong_length: hat die falsche Länge (muss genau %{count} Zeichen haben) + other_than: darf nicht gleich %{count} sein + template: + body: 'Bitte überprüfen Sie die folgenden Felder:' + header: + one: 'Konnte %{model} nicht speichern: ein Fehler.' + other: 'Konnte %{model} nicht speichern: %{count} Fehler.' + helpers: + select: + prompt: Bitte wählen + submit: + create: '%{model} erstellen' + submit: '%{model} speichern' + update: '%{model} aktualisieren' + number: + currency: + format: + delimiter: . + format: '%n %u' + precision: 2 + separator: ',' + significant: false + strip_insignificant_zeros: false + unit: € + format: + delimiter: . + precision: 2 + separator: ',' + significant: false + strip_insignificant_zeros: false + human: + decimal_units: + format: '%n %u' + units: + billion: + one: Milliarde + other: Milliarden + million: Millionen + quadrillion: + one: Billiarde + other: Billiarden + thousand: Tausend + trillion: Billionen + unit: '' + format: + delimiter: '' + precision: 1 + significant: true + strip_insignificant_zeros: true + storage_units: + format: '%n %u' + units: + byte: + one: Byte + other: Bytes + gb: GB + kb: KB + mb: MB + tb: TB + percentage: + format: + delimiter: '' + format: "%n%" + precision: + format: + delimiter: '' + support: + array: + last_word_connector: ' und ' + two_words_connector: ' und ' + words_connector: ', ' + time: + am: vormittags + formats: + default: '%A, %d. %B %Y, %H:%M Uhr' + long: '%A, %d. %B %Y, %H:%M Uhr' + short: '%d. %B, %H:%M Uhr' + pm: nachmittags diff --git a/config/locales/en.yml b/config/locales/en.yml deleted file mode 100644 index 0653957..0000000 --- a/config/locales/en.yml +++ /dev/null @@ -1,23 +0,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. -# -# To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. - -en: - hello: "Hello world" diff --git a/config/locales/models/problem/de.yml b/config/locales/models/problem/de.yml new file mode 100644 index 0000000..6a416c4 --- /dev/null +++ b/config/locales/models/problem/de.yml @@ -0,0 +1,14 @@ +# ruby encoding: utf-8 + +de: + activerecord: + models: + problem: + one: Problem + other: Probleme + attributes: + problem: + id: ID + translation_id: Übersetzungs-ID + title: Titel + content: Inhalt \ No newline at end of file diff --git a/config/locales/models/translation/de.yml b/config/locales/models/translation/de.yml new file mode 100644 index 0000000..404edfe --- /dev/null +++ b/config/locales/models/translation/de.yml @@ -0,0 +1,14 @@ +# ruby encoding: utf-8 + +de: + activerecord: + models: + translation: + one: Übersetzung + other: Übersetzungen + attributes: + translation: + id: ID + problem_id: Problem-ID + title: Titel + content: Inhalt \ No newline at end of file diff --git a/config/locales/views/problems/de.yml b/config/locales/views/problems/de.yml new file mode 100644 index 0000000..a3f4c57 --- /dev/null +++ b/config/locales/views/problems/de.yml @@ -0,0 +1,11 @@ +# ruby encoding: utf-8 + +de: + problems: + not_yet_translated: Dieses Problem wurde noch nicht übersetzt. + index: + suggest_translation: Übersetzung vorschlagen + show: + improve_translation: Übersetzung verbessern + problem_subtitle: Problem %{id} + view_original_problem: Dieses Problem auf projecteuler.net \ No newline at end of file diff --git a/config/locales/views/translations/de.yml b/config/locales/views/translations/de.yml new file mode 100644 index 0000000..4e10690 --- /dev/null +++ b/config/locales/views/translations/de.yml @@ -0,0 +1,9 @@ +# ruby encoding: utf-8 + +de: + translations: + new: + back: Zurück + new_translation: Neue Übersetzung für Problem %{id} + notice: + successfully_created: Übersetzung wurde erfolgreich erstellt. \ No newline at end of file
IDTitle<%= Translation.human_attribute_name(:id) %><%= Translation.human_attribute_name(:title) %>