Mattias Bodlund 1 year ago
parent
commit
70dfface47
7 changed files with 40 additions and 3 deletions
  1. BIN
      .DS_Store
  2. BIN
      app/.DS_Store
  3. BIN
      app/assets/.DS_Store
  4. +1
    -0
      app/assets/images/ikea-foundation-week.svg
  5. +13
    -1
      app/controllers/site_controller.rb
  6. +2
    -2
      config/application.rb
  7. +24
    -0
      config/locales/en.yml

BIN
.DS_Store View File


BIN
app/.DS_Store View File


BIN
app/assets/.DS_Store View File


+ 1
- 0
app/assets/images/ikea-foundation-week.svg
File diff suppressed because it is too large
View File


+ 13
- 1
app/controllers/site_controller.rb View File

@ -1,7 +1,19 @@
class SiteController < ApplicationController
def def index
def index
language = parse_accept_language(request.env['HTTP_ACCEPT_LANGUAGE'])
render plain: "Language preference: #{language}"
end
private
def parse_accept_language(header)
header.to_s.split(',').map { |l|
lang, q_factor = l.split(';q=')
[lang, (q_factor || '1').to_f]
}.sort_by { |_, q| -q }.map(&:first).first
end
end

+ 2
- 2
config/application.rb View File

@ -30,8 +30,8 @@ module Week2024
config.time_zone = "Copenhagen"
config.i18n.default_locale = :sv
config.i18n.available_locales = [:zh, :hr, :cs, :da, :nl, :fi, :fr, :fr, :de, :hu, :it, :ja, :ko, :nb, :pl, :pt, :ro, :sr, :sk, :sl, :es, :sv, :uk]
config.i18n.default_locale = :en
config.i18n.available_locales = [:en, :zh, :hr, :cs, :da, :nl, :fi, :fr, :fr, :de, :hu, :it, :ja, :ko, :nb, :pl, :pt, :ro, :sr, :sk, :sl, :es, :sv, :uk]
config.i18n.fallbacks = true
config.active_storage.routes_prefix = 'storage' #change /rails/active_storage to /storage


+ 24
- 0
config/locales/en.yml View File

@ -0,0 +1,24 @@
en:
languages:
zh: Chinese
hr: Croatian
cs: Czech
da: Danish
nl: Dutch
fi: Finnish
fr: French
de: German
hu: Hungarian
it: Italian
ja: Japanese
ko: Korean
nb: Norwegian (Bokmål)
pl: Polish
pt: Portuguese
ro: Romanian
sr: Serbian
sk: Slovak
sl: Slovenian
es: Spanish
sv: Swedish
uk: Ukrainian

Loading…
Cancel
Save