covid19_scenarios icon indicating copy to clipboard operation
covid19_scenarios copied to clipboard

Internationalization

Open mserranom opened this issue 4 years ago • 42 comments

It would be really useful to support translations to other languages.

https://react.i18next.com/ is a reasonable option given the current tech stack

mserranom avatar Mar 20 '20 11:03 mserranom

what languages are you thinking?

n0f3 avatar Mar 20 '20 14:03 n0f3

spanish at least

mserranom avatar Mar 20 '20 14:03 mserranom

I might pick this one up. And I can do the portuguese version, since we definitely need help as well!

rapzo avatar Mar 20 '20 15:03 rapzo

English & Spanish at a bare minimum, imo, but make it easy for people to contribute languages. And I would recommend having people do a google translate smoke test to make sure people aren't putting in messed up information if you cannot get multiple native speakers to sign off on it.

lukepighetti avatar Mar 20 '20 15:03 lukepighetti

I can help translating to spanish and/or helping with i18Next. Let me know if you are working on this @rapzo

charlie632 avatar Mar 20 '20 15:03 charlie632

Doing the setup right now. Once i get it working i'll push to my fork and will open to whomever willing to stretch a hand!

rapzo avatar Mar 20 '20 15:03 rapzo

Great!

charlie632 avatar Mar 20 '20 15:03 charlie632

I can help with the Dutch translation!

ErikSchierboom avatar Mar 20 '20 17:03 ErikSchierboom

I'll help with the French translation

gcollard avatar Mar 20 '20 17:03 gcollard

I can help with hindi!

samarv avatar Mar 20 '20 18:03 samarv

I can help with the Turkish translation.

goktugerce avatar Mar 20 '20 19:03 goktugerce

I can help with the Dutch translation!

Kerel! Hulp nodig!?

t0byman avatar Mar 20 '20 19:03 t0byman

I can help with portuguese

gleiderr avatar Mar 20 '20 22:03 gleiderr

Spanish if you need more people

Nebadon1 avatar Mar 21 '20 01:03 Nebadon1

That's fantastic, folks!

I've merged this PR from @rapzo https://github.com/neherlab/covid19_scenarios/pull/62/

TODO:

  • [x] identify all (current) translatable strings and wrap them with the translation function (#85)

  • [x] extract all the wrapped strings and generate locale files to be filled (WIP: #85)

  • [ ] fill in the new locale files

    • [x] German #77
    • [x] French #70 #89
    • [ ] Portuguese
    • [ ] ?
  • [x] add language switcher in the UI (dropdown?) (DONE: #70)

  • [ ] automatic locale detection based on user's preferences stored in the browser

  • [ ] automatic locale detection by IP geolocation or cloudflare headers (too creepy?)

  • [x] store previously chosen language in local storage (DONE: #70)

  • [ ] add lang URL param or a route

  • [ ] use UI-based crowdsourcing translation services?

  • [ ] Rigth-to-left (RTL) support

  • [ ] Localize and pretty print numbers and dates https://github.com/neherlab/covid19_scenarios/issues/158

  • [ ] Write a small guide on how to add, modify or remove the strings properly. For example one of the scientists want to to change a help tooltip or to add a button. How to make/keep it translatable? Put the guide somewhere in the README.md for now, and I will figure where to put it later.

Issues on the horizon:

  • There is going to be a scientific section, maybe a FAQ page, and likely some sort of tutorial materials in the near(-ish) future. That is going to be very text-dense. I mean sentences and paragraph kind of dense, with sentences have semantic interdependencies. The example is the current "About" page (written in .mdx). This should be planned carefully when choosing the implementation.
  • Images containing text
  • Formulas

I guess it's okay for some of the rarely read and especially difficult to translate stuff to be in English for now.

What are some of the i18n services among popular now? We can hook something up to crowdsource this effort and so that translators don't have to bother with editing JSON files

Cant wait to see this going forward!

ivan-aksamentov avatar Mar 21 '20 04:03 ivan-aksamentov

I will too help in Hindi.

besrabasant avatar Mar 21 '20 06:03 besrabasant

I can help with the German translation.

FireLizard avatar Mar 21 '20 10:03 FireLizard

I can help with the Swedish translation

hannesgr avatar Mar 21 '20 10:03 hannesgr

I'm gonna work on extracting all strings from components. It's a long one... But once the english is complete it will be easier to add new stuff. But if anyone is already at it please open a WIP PR so we don't overlap each other.

rapzo avatar Mar 21 '20 10:03 rapzo

I've just started, so I'll add a WIP PR.

hannesgr avatar Mar 21 '20 10:03 hannesgr

#76

hannesgr avatar Mar 21 '20 11:03 hannesgr

I'll help with the French translation

Ditto

Emmanuel-R8 avatar Mar 21 '20 13:03 Emmanuel-R8

All right, I've tried to identify all translatable strings.

I made a complete PR Here #85. Didn't translate the About page though, not sure about how to go about that one?

hannesgr avatar Mar 21 '20 17:03 hannesgr

Glorious work folks! We've got some conflicting PRs. I merged #70 and #85 can hopefully be rebased on top of it. Feel free to self-organize in the chat:

Image for the link to join the chat

Questions:

  • Do we have to replace all spaces in strings with dashes? I'd be glad if you say no, because our scientists would hate the idea :)

TODO (added to the list above):

  • Write a small guide on how to add, modify or remove the strings properly. For example one of the scientists wan to to change a help tooltip or to add a button. How to make/keep it translatable? Put the guide somewhere in the README.md for now, and I will figure where to put it later.

ivan-aksamentov avatar Mar 21 '20 22:03 ivan-aksamentov

We've got some conflicting PRs. I merged #70 and #85 can hopefully be rebased on top of it. Feel free to self-organize in the chat:

I've rebased #85

  • Do we have to replace all spaces in strings with dashes? I'd be glad if you say no, because our scientists would hate the idea :)

I updated #85 so we use spaces instead of dashes :)

hannesgr avatar Mar 22 '20 07:03 hannesgr

I can help adding Arabic language and add some data for the middle east countries

Samer-Abdulaziz avatar Mar 22 '20 20:03 Samer-Abdulaziz

@sameerasaad do we need full RTL lang support to support Arabic?

lukepighetti avatar Mar 22 '20 22:03 lukepighetti

Some errors occur due to missing translations of json files in ./src/assets/data/. For example when choosing the preset scenario "Country - no mitigation" it shows Error: population scenario "Deutschland" not found.

Maybe we can exclude these translation in the first place.

FireLizard avatar Mar 22 '20 23:03 FireLizard

See also: @FireLizard 's PR with German translation: #77

ivan-aksamentov avatar Mar 22 '20 23:03 ivan-aksamentov

@FireLizard , yeah it looks like we are translating too much.

These JSON files are generated from the external data and are not going to be translated. So Deutschland should be made back Germany before we fetch data by this key.

ivan-aksamentov avatar Mar 22 '20 23:03 ivan-aksamentov