diff --git a/Gemfile b/Gemfile
index 7164647..024a44c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -14,6 +14,8 @@ gem 'coffee-rails', '~> 4.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
+gem 'rails-i18n', '~> 5.0.0'
+
gem 'rails-controller-testing'
# Use jquery as the JavaScript library
diff --git a/Gemfile.lock b/Gemfile.lock
index d34bbc0..11b4dd3 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -132,6 +132,9 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
+ rails-i18n (5.0.4)
+ i18n (~> 0.7)
+ railties (~> 5.0)
railties (5.1.4)
actionpack (= 5.1.4)
activesupport (= 5.1.4)
@@ -214,6 +217,7 @@ DEPENDENCIES
mathjax-rails (~> 2.6.1)
rails (= 5.1.4)
rails-controller-testing
+ rails-i18n (~> 5.0.0)
sass-rails (~> 5.0.7)
sdoc (~> 0.4.2)
sqlite3 (~> 1.3.13)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 142f027..ec958ef 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -20,7 +20,7 @@ module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title = '')
- base_title = t('site_title')
+ base_title = t('application.site_title')
if page_title.empty?
base_title
else
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index cd19456..81d5a05 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -1,6 +1,6 @@
<%= navbar position: :static do %>
<%= vertical do %>
- <%= link_to t(:site_title), root_path %>
+ <%= link_to t('application.site_title'), root_path %>
<% end %>
<%= horizontal do %>
<%= nav class: 'navbar-left' do %>
diff --git a/config/locales/de.yml b/config/locales/de.yml
deleted file mode 100644
index c0e6bde..0000000
--- a/config/locales/de.yml
+++ /dev/null
@@ -1,205 +0,0 @@
----
-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/views/application/de.yml b/config/locales/views/application/de.yml
index 15e1d8b..2340f66 100644
--- a/config/locales/views/application/de.yml
+++ b/config/locales/views/application/de.yml
@@ -2,6 +2,7 @@
de:
application:
+ site_title: "Projekt Euler"
sign_in: 'Einloggen'
sign_out: 'Ausloggen'
info: "Info"
diff --git a/db/seeds.rb b/db/seeds.rb
index f7236d1..452dab4 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -10,19 +10,34 @@ Translation.delete_all
Problem.delete_all
Admin.delete_all
-for i in 1..10 do
- translation = Translation.create(
- problem_id: i,
- title: "Problem Nummer #{i}",
- content: "Das hier ist der Inhalt von Problem #{i}.
Hier ist die zweite Zeile."
- )
- Problem.create(id: i, translation_id: translation.id)
+
+for i in 1..20 do
+ Problem.create!(id: i)
end
-Problem.create(id: 11)
+for i in 1..10 do
+ translation = Translation.create!(
+ problem: Problem.find(i),
+ title: "Problem Nummer #{i}",
+ content: %Q(
Das hier ist der Inhalt von Problem #{i}.
+
Hier ist die zweite Zeile.
Es können auch Formeln im Text (z.B. $1+2=3$) oder als eigene Zeile genutzt werden.
+ \\[ a^2 + b^2 = c^2 \\] + ) + ) -Admin.create( + problem = Problem.find(i) + problem.translation = translation + problem.save! +end + + +Admin.create!( email: 'admin@example.com', password: 'password', password_confirmation: 'password' -) \ No newline at end of file +) + +p "Created #{Problem.count} problems" +p "Created #{Translation.count} translations" +p "Created #{Admin.count} admins"