From 1eed8b0ac8cc767fc9c5e3980b5f832ab908be69 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Wed, 31 Dec 2014 15:36:50 +0100 Subject: [PATCH 01/16] Set default locale to german, add default translation file --- config/application.rb | 2 +- config/locales/de.yml | 202 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 config/locales/de.yml diff --git a/config/application.rb b/config/application.rb index 0560984..41bd81a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -18,6 +18,6 @@ module Projekteuler # 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 = :de end end diff --git a/config/locales/de.yml b/config/locales/de.yml new file mode 100644 index 0000000..78558b2 --- /dev/null +++ b/config/locales/de.yml @@ -0,0 +1,202 @@ +de: + 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: + one: ! 'Datensatz kann nicht gelöscht werden, da ein abhängiger %{record}-Datensatz existiert.' + many: ! 'Datensatz kann nicht gelöscht werden, da abhängige %{record} existieren.' + 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 From 45ba9b84213b297844860b7bade7c944e71fcfcf Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Thu, 1 Jan 2015 17:26:44 +0100 Subject: [PATCH 02/16] Remove english i18n files/settings --- config/application.rb | 1 + config/locales/en.yml | 23 ----------------------- 2 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 config/locales/en.yml diff --git a/config/application.rb b/config/application.rb index 41bd81a..68b467a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -18,6 +18,7 @@ module Projekteuler # 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.available_locales = :de config.i18n.default_locale = :de end end 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" From 8abbfb9bbeda8160274f933e9cd94e34b187b189 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Thu, 1 Jan 2015 17:31:26 +0100 Subject: [PATCH 03/16] Load locale files from all subfolders --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 68b467a..54b7b30 100644 --- a/config/application.rb +++ b/config/application.rb @@ -17,7 +17,7 @@ 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.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s] config.i18n.available_locales = :de config.i18n.default_locale = :de end From 8f74d7ac6dc78f3f150db92100566d97224c8570 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Thu, 1 Jan 2015 17:32:01 +0100 Subject: [PATCH 04/16] Add model/attribute translations --- config/locales/models/problem/de.yml | 12 ++++++++++++ config/locales/models/translation/de.yml | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 config/locales/models/problem/de.yml create mode 100644 config/locales/models/translation/de.yml diff --git a/config/locales/models/problem/de.yml b/config/locales/models/problem/de.yml new file mode 100644 index 0000000..f546695 --- /dev/null +++ b/config/locales/models/problem/de.yml @@ -0,0 +1,12 @@ +# ruby encoding: utf-8 + +de: + activerecord: + models: + problem: 'Problem' + 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..8bb3a2f --- /dev/null +++ b/config/locales/models/translation/de.yml @@ -0,0 +1,12 @@ +# ruby encoding: utf-8 + +de: + activerecord: + models: + translation: 'Übersetzung' + attributes: + translation: + id: 'ID' + problem_id: 'Problem-ID' + title: 'Titel' + content: 'Inhalt' \ No newline at end of file From d4847270ca1c372442851a2e02f6178ec7c4052f Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Thu, 1 Jan 2015 17:34:41 +0100 Subject: [PATCH 05/16] Enable missing translation warnings --- config/environments/development.rb | 2 +- config/environments/test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 From c9574ff9c190d0a51fa02fde78684a6888275eb6 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Thu, 1 Jan 2015 18:10:38 +0100 Subject: [PATCH 06/16] Add plurals of problem and translation --- config/locales/models/problem/de.yml | 4 +++- config/locales/models/translation/de.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/locales/models/problem/de.yml b/config/locales/models/problem/de.yml index f546695..fdbc3c8 100644 --- a/config/locales/models/problem/de.yml +++ b/config/locales/models/problem/de.yml @@ -3,7 +3,9 @@ de: activerecord: models: - problem: 'Problem' + problem: + one: 'Problem' + other: 'Probleme' attributes: problem: id: 'ID' diff --git a/config/locales/models/translation/de.yml b/config/locales/models/translation/de.yml index 8bb3a2f..da5ec68 100644 --- a/config/locales/models/translation/de.yml +++ b/config/locales/models/translation/de.yml @@ -3,7 +3,9 @@ de: activerecord: models: - translation: 'Übersetzung' + translation: + one: 'Übersetzung' + other: 'Übersetzungen' attributes: translation: id: 'ID' From de4d33879fe4da43c4328ab77c90608150b31d02 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Thu, 1 Jan 2015 18:12:25 +0100 Subject: [PATCH 07/16] Translate complete index application.html.erb --- app/views/layouts/application.html.erb | 8 ++++---- config/locales/de.yml | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) 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/config/locales/de.yml b/config/locales/de.yml index 78558b2..a8ed5ed 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1,4 +1,5 @@ de: + site_title: 'Projekt Euler' date: abbr_day_names: - So From 6dfdcffc69c224173a5125a4903b1633b15361d2 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Fri, 2 Jan 2015 11:52:20 +0100 Subject: [PATCH 08/16] Translate problems index --- app/views/problems/index.html.erb | 10 +++++----- config/locales/views/problems/de.yml | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 config/locales/views/problems/de.yml diff --git a/app/views/problems/index.html.erb b/app/views/problems/index.html.erb index a46d613..b35a1b1 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 '.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/config/locales/views/problems/de.yml b/config/locales/views/problems/de.yml new file mode 100644 index 0000000..5e975a0 --- /dev/null +++ b/config/locales/views/problems/de.yml @@ -0,0 +1,7 @@ +# ruby encoding: utf-8 + +de: + problems: + index: + not_yet_translated: 'Dieses Problem wurde noch nicht übersetzt.' + suggest_translation: 'Übersetzung vorschlagen' \ No newline at end of file From 545a165752b727bceca91768d08e221655905531 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Fri, 2 Jan 2015 13:36:32 +0100 Subject: [PATCH 09/16] Translate problems/show --- app/views/problems/show.html.erb | 6 +++--- config/locales/views/problems/de.yml | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) 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/config/locales/views/problems/de.yml b/config/locales/views/problems/de.yml index 5e975a0..8ec2ef0 100644 --- a/config/locales/views/problems/de.yml +++ b/config/locales/views/problems/de.yml @@ -4,4 +4,8 @@ de: problems: index: not_yet_translated: 'Dieses Problem wurde noch nicht übersetzt.' - suggest_translation: 'Übersetzung vorschlagen' \ No newline at end of file + 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 From 3887d2bfb1bcd1b9d2bd0f34ba477d0b347d3a69 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Fri, 2 Jan 2015 13:47:51 +0100 Subject: [PATCH 10/16] Translate problems/untranslated --- app/views/problems/index.html.erb | 2 +- app/views/problems/untranslated.html.erb | 2 +- config/locales/views/problems/de.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/problems/index.html.erb b/app/views/problems/index.html.erb index b35a1b1..b6f9b6a 100644 --- a/app/views/problems/index.html.erb +++ b/app/views/problems/index.html.erb @@ -17,7 +17,7 @@ <% if problem.is_translated? %> <%= link_to problem.title, problem %> <% else %> - <%= t '.not_yet_translated' %> + <%= t 'problems.not_yet_translated' %> <%= link_to new_problem_translation_path(problem), class: 'btn btn-default btn-xs' do %> <%= icon :pencil %> <%= t '.suggest_translation' %> <% end %> 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/config/locales/views/problems/de.yml b/config/locales/views/problems/de.yml index 8ec2ef0..85bdaa4 100644 --- a/config/locales/views/problems/de.yml +++ b/config/locales/views/problems/de.yml @@ -2,8 +2,8 @@ de: problems: + not_yet_translated: 'Dieses Problem wurde noch nicht übersetzt.' index: - not_yet_translated: 'Dieses Problem wurde noch nicht übersetzt.' suggest_translation: 'Übersetzung vorschlagen' show: improve_translation: 'Übersetzung verbessern' From 1f4f0f334af9171e061e5d91ead4f229f6e3ba1d Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Fri, 2 Jan 2015 14:31:21 +0100 Subject: [PATCH 11/16] Use improved de.yml --- config/locales/de.yml | 64 ++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index a8ed5ed..c0e6bde 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1,5 +1,6 @@ +--- de: - site_title: 'Projekt Euler' + site_title: Projekt Euler date: abbr_day_names: - So @@ -10,7 +11,7 @@ de: - Fr - Sa abbr_month_names: - - + - - Jan - Feb - Mär @@ -32,11 +33,11 @@ de: - Freitag - Samstag formats: - default: ! '%d.%m.%Y' - long: ! '%e. %B %Y' - short: ! '%e. %b' + default: '%d.%m.%Y' + long: '%e. %B %Y' + short: '%e. %b' month_names: - - + - - Januar - Februar - März @@ -79,16 +80,16 @@ de: other: mehr als %{count} Jahre x_days: one: ein Tag - other: ! '%{count} Tage' + other: '%{count} Tage' x_minutes: one: eine Minute - other: ! '%{count} Minuten' + other: '%{count} Minuten' x_months: one: ein Monat - other: ! '%{count} Monate' + other: '%{count} Monate' x_seconds: one: eine Sekunde - other: ! '%{count} Sekunden' + other: '%{count} Sekunden' prompts: day: Tag hour: Stunden @@ -97,7 +98,7 @@ de: second: Sekunden year: Jahr errors: - format: ! '%{attribute} %{message}' + format: '%{attribute} %{message}' messages: accepted: muss akzeptiert werden blank: muss ausgefüllt werden @@ -116,46 +117,47 @@ de: not_a_number: ist keine Zahl not_an_integer: muss ganzzahlig sein odd: muss ungerade sein - record_invalid: ! 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}' + record_invalid: 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}' restrict_dependent_destroy: - one: ! 'Datensatz kann nicht gelöscht werden, da ein abhängiger %{record}-Datensatz existiert.' - many: ! 'Datensatz kann nicht gelöscht werden, da abhängige %{record} existieren.' + 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:' + body: 'Bitte überprüfen Sie die folgenden Felder:' header: - one: ! 'Konnte %{model} nicht speichern: ein Fehler.' - other: ! 'Konnte %{model} nicht speichern: %{count} Fehler.' + 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' + create: '%{model} erstellen' + submit: '%{model} speichern' + update: '%{model} aktualisieren' number: currency: format: delimiter: . - format: ! '%n %u' + format: '%n %u' precision: 2 - separator: ! ',' + separator: ',' significant: false strip_insignificant_zeros: false unit: € format: delimiter: . precision: 2 - separator: ! ',' + separator: ',' significant: false strip_insignificant_zeros: false human: decimal_units: - format: ! '%n %u' + format: '%n %u' units: billion: one: Milliarde @@ -173,7 +175,7 @@ de: significant: true strip_insignificant_zeros: true storage_units: - format: ! '%n %u' + format: '%n %u' units: byte: one: Byte @@ -191,13 +193,13 @@ de: delimiter: '' support: array: - last_word_connector: ! ' und ' - two_words_connector: ! ' und ' - words_connector: ! ', ' + 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' + default: '%A, %d. %B %Y, %H:%M Uhr' + long: '%A, %d. %B %Y, %H:%M Uhr' + short: '%d. %B, %H:%M Uhr' pm: nachmittags From 80c35c8cf3bd353821ba04579670769d77fc53ff Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Fri, 2 Jan 2015 14:59:53 +0100 Subject: [PATCH 12/16] Translate translations/new --- app/views/translations/_form.html.erb | 2 +- app/views/translations/new.html.erb | 4 ++-- config/locales/views/translations/de.yml | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 config/locales/views/translations/de.yml 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 %>

    <% @translation.errors.full_messages.each do |message| %> 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/config/locales/views/translations/de.yml b/config/locales/views/translations/de.yml new file mode 100644 index 0000000..121d2c1 --- /dev/null +++ b/config/locales/views/translations/de.yml @@ -0,0 +1,7 @@ +# ruby encoding: utf-8 + +de: + translations: + new: + back: Zurück + new_translation: Neue Übersetzung für Problem %{id} \ No newline at end of file From 66d6d948a1046f4fa5953b5bf777250d4fd54778 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Fri, 2 Jan 2015 15:03:09 +0100 Subject: [PATCH 13/16] Translate translations/index --- app/views/translations/index.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/translations/index.html.erb b/app/views/translations/index.html.erb index ad98e8d..b4d5237 100644 --- a/app/views/translations/index.html.erb +++ b/app/views/translations/index.html.erb @@ -1,11 +1,11 @@ -

    Listing translations

    +

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

    <%= render 'translation_pagination' %>
IDTitle<%= Problem.human_attribute_name(:id) %><%= Problem.human_attribute_name(:title) %>
- - + + From 9b17745375e41fc87ea028f8b430e926c8f0bc27 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Fri, 2 Jan 2015 15:14:39 +0100 Subject: [PATCH 14/16] Translate translations/show --- app/views/translations/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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' %>
From e8ab309c9655a88d856f6d95988ea0148e864ba7 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Fri, 2 Jan 2015 15:29:09 +0100 Subject: [PATCH 15/16] Translate a notice --- app/controllers/translations_controller.rb | 2 +- config/locales/views/translations/de.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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/config/locales/views/translations/de.yml b/config/locales/views/translations/de.yml index 121d2c1..4e10690 100644 --- a/config/locales/views/translations/de.yml +++ b/config/locales/views/translations/de.yml @@ -4,4 +4,6 @@ de: translations: new: back: Zurück - new_translation: Neue Übersetzung für Problem %{id} \ No newline at end of file + new_translation: Neue Übersetzung für Problem %{id} + notice: + successfully_created: Übersetzung wurde erfolgreich erstellt. \ No newline at end of file From 9cf3d6f0f7ac43e6daff5372d5445d48fb6c78b9 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Sat, 3 Jan 2015 12:39:29 +0100 Subject: [PATCH 16/16] Remove unneeded quotation marks in translations --- config/locales/models/problem/de.yml | 12 ++++++------ config/locales/models/translation/de.yml | 12 ++++++------ config/locales/views/problems/de.yml | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/config/locales/models/problem/de.yml b/config/locales/models/problem/de.yml index fdbc3c8..6a416c4 100644 --- a/config/locales/models/problem/de.yml +++ b/config/locales/models/problem/de.yml @@ -4,11 +4,11 @@ de: activerecord: models: problem: - one: 'Problem' - other: 'Probleme' + one: Problem + other: Probleme attributes: problem: - id: 'ID' - translation_id: 'Übersetzungs-ID' - title: 'Titel' - content: 'Inhalt' \ No newline at end of file + 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 index da5ec68..404edfe 100644 --- a/config/locales/models/translation/de.yml +++ b/config/locales/models/translation/de.yml @@ -4,11 +4,11 @@ de: activerecord: models: translation: - one: 'Übersetzung' - other: 'Übersetzungen' + one: Übersetzung + other: Übersetzungen attributes: translation: - id: 'ID' - problem_id: 'Problem-ID' - title: 'Titel' - content: 'Inhalt' \ No newline at end of file + 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 index 85bdaa4..a3f4c57 100644 --- a/config/locales/views/problems/de.yml +++ b/config/locales/views/problems/de.yml @@ -2,10 +2,10 @@ de: problems: - not_yet_translated: 'Dieses Problem wurde noch nicht übersetzt.' + not_yet_translated: Dieses Problem wurde noch nicht übersetzt. index: - suggest_translation: 'Übersetzung vorschlagen' + 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 + improve_translation: Übersetzung verbessern + problem_subtitle: Problem %{id} + view_original_problem: Dieses Problem auf projecteuler.net \ No newline at end of file
IDTitle<%= Translation.human_attribute_name(:id) %><%= Translation.human_attribute_name(:title) %>