Hey everyone I have a problem that I haven't been ...
# support
n
Hey everyone I have a problem that I haven't been able to solve for days and I was hoping you might be able to give me a hint in the right direction. My issue is: I'm trying to translate the website to German. I have added the de.yml file in my config/locales folder and I also added the following lines in my application.rb file:
Copy code
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
    config.i18n.available_locales = [:en, :de]
    config.i18n.default_locale = :en
    config.i18n.fallbacks = true
Additionally I have created the following method in the application controller:
Copy code
before_action :set_locale
  def set_locale
    I18n.locale = :de
  end
And of course in the front end I'm using the syntax they use in their own files (example: <%= I18n.t("hello") %>) I saw that as an admin should be able to choose from available locales for the storefront but no matter what I do, I can't seem to make the german translation appear 🫣😞 Does anyone have any clue what I should be looking into? Any input is greatly appreciated 🙏 Thank you!
s
Hallo 👋 I use solidus in french in my config/application.rb I have only
Copy code
config.i18n.default_locale = :fr
config.i18n.available_locales = %i(fr it de)
and I can easy change locale from admin panel
What your /admin/stores route is showing ?
n
hi Sabo! yes my admin/stores is there but I don't see the select you have
as you can see on the right I see "locales available in the storefront" but I don't can't choose german
did you install anything before you were able to change the language? or was this ready by default?
s
Ah, I have also this gems in my Gemfile, I don't know if you too ?
Copy code
gem 'solidus_i18n'
gem 'rails-i18n'
n
omg that was it! 😅 I didn't think I had to install this as everywhere I read, it said it is built in... well you live and you learn. you're amazing, thank you so much for your help!
🙌 1
s
Aha yes me too the first time I thought it was built in, you're welcome 😉