olpeh/onkometrorikki

I18N – add English and Swedish to the UI

olpeh opened this issue · 8 comments

olpeh commented

Is your feature request related to a problem? Please describe.
Finland is a multilingual country, and Finnish is not the easiest language to understand.

Describe the solution you'd like
An easy way to select the preferred language in the UI. Store the selected language in local storage or cookie for use on later visits. Optionally add different languages as routes in order for direct linking by URL.

Describe alternatives you've considered
Alternatively, just keep the UI in Finnish but display the reasons for interruptions in all 3 languages that the HSL API already provides.

@olpeh I'd like to pick this for english. any hint for where to start?

olpeh commented

Hi @farskid
My idea for approaching this has been the following:

  • Modify the backend to return all languages instead of just picking the finnish version
  • Add a language selector to the UI, and displaying the UI and the traffic alerts in the selected language, possibly following this blog post or any other elmy way of doing I18N. My idea was to not do it in the easiest way, but rather do it the "correct" way
  • Save the language selection locally for next visits (also keep in mind that saving the selected theme would be nice)
  • Add language to routing, for example onkometrorikki.fi/en etc.

We could of course split this into smaller chunks and implement one step at a time or something.

One challenge in implementing this is that the feed is the live data, I don't know if there is a test feed available that would always contain some service alerts. Testing this with live data would require the metro have some interruptions while developing.

@olpeh Sounds good to me. I'm on it.
How about credentials as env variables?

olpeh commented

I added a .env.sample file for showing what kind of env variables are used at the moment. I set them for the backend in Heroku. I don't think the frontend needs any env variables.
Basically, credentials are only needed for tweeting.

That is true. FE can run standalone.

olpeh commented

And also, there is no way at the moment to run it using a local backend easily. Should probably make that possible. Added as an issue #10

olpeh commented

@ohanhi has a nice approach for this in trains.today: ohanhi/trains#9

Probably we could use a similar approach here.

olpeh commented

I will start working on this.