rubyforgood / Flaredown

Flaredown web app and API
http://www.flaredown.com
GNU General Public License v3.0
39 stars 15 forks source link

non-english browsers for existing accounts using "en" translations are missing all labels #552

Open compwron opened 2 years ago

compwron commented 2 years ago

To fix this, re-add fallback to english for missing translations

Code I ran to fix this for one "de" user

user.checkins.last.symptoms.map { |x| Symptom::Translation.find_by(symptom_id: x.symptom_id).name } #  ["HWS", "Hände", "Ohrenweh"]
user.checkins.last.symptoms.map { |x| Symptom::Translation.find_by(symptom_id: x.symptom_id).update!(locale: "de") } # not "de" specific
user.checkins.last.treatments.flat_map { |x| Treatment::Translation.where(treatment_id: x.treatment_id).flat_map(&:name) }
user.checkins.last.treatments.map do |x|
  tt = Treatment::Translation.find_by(treatment_id: x.treatment_id)
  new_tt = tt.dup
  new_tt.locale = "de"
  new_tt.save!
end

This is the cause of this bug report:

Everything works better now, the only issue I still have is that I don’t see my treatments in the history anymore. They are also not visible in menu below. Any advise?

Add reaction loganmerriam 😎

@Galatea hmm, I'll make a ticket for contributors to look into. I'm seeing them on my account right now so it must not be 100% universal which makes it harder to track down the source of the issue.

Add reaction Galatea

Thanks, I just realized that only conditions are available in the history, symptoms and treatments are missing. Strangely I can see them in my patterns.

Add reaction