dieghernan / RKI-Corona-Atlas

Interactive map of the international COVID-19 risk areas as designated by the German authorities.
https://corona-atlas.de/
MIT License
4 stars 1 forks source link

Add new languages #7

Closed rodrihgh closed 3 years ago

rodrihgh commented 3 years ago

Currently working in Polish and French

dieghernan commented 3 years ago

It seems we are pushing the limits of Jekyll on this project. I made a few amendments, now it should work, but if we want to add new languages (that means more pages and more build time, leading to the error) we may change the building strategy:

If we add new languages - potential strategy

Instead on relying on GH pages engine, we could use this action to run the build: https://github.com/dieghernan/RKI-Corona-Atlas/blob/master/.github/workflows/build-gh-pages.yml. This won't cause any timeout issues, but there are two caveats:

Conclusion

Now we are still on "old" strategy (GH engine) with lower boundary resolution, and page build is coming from master branch.

If we want to move to the new strategy (new languages, more resolution on maps, page from gh-pages branch) I can make it work, but expect some delay between scrapping and page update. For your information, the action https://github.com/dieghernan/RKI-Corona-Atlas/blob/master/.github/workflows/build-gh-pages.yml is currently disabled as we are still in "old" mode.

dieghernan commented 3 years ago

@rodrihgh I added the new languages to the navbar, feel free to amend/modify/improve

rodrihgh commented 3 years ago

Thank you for taking the time to tackle the issue. However, I think the current state is too involved, so I have quarantined the French and Polish languages. You are welcome to roll back everything else on your side, too. @dieghernan

Let me make an alternative suggestion...

rodrihgh commented 3 years ago

I would strongly prefer a solution where we do not duplicate the same map with every new language. As a matter of fact, we are using the same polygons with different text, so I think we should try a different approach:

  1. We build just one map (maybe two just in case we want to keep the more complex German text separated) as a standalone block.
  2. We include the map in an "iframe-esque" way into every page (not 100% sure if iframes are the best technical solution)
  3. We adapt the text to the corresponding language over the top. I have a gut feeling that the internationalization plugin for Leaflet should allow to do that: https://github.com/yohanboniface/Leaflet.i18n

It is still unclear how to work with the said plugin, e.g. whether translations should happen at "nuclear" level (country names, dates, idioms...) or "block" level (information blocks per country). If we cannot make the plugin work, I would still prefer to keep the "iframe" approach with English information in ES, FR, PL & Co.

If you like this idea, I will take a look at the plugin and see what it can do.

rodrihgh commented 3 years ago

Just an example of internationalization in the wild:

https://github.com/Raruto/leaflet-elevation/blob/a9f2c2a6230d8bfb55bbe12d7eae3a45845cfaa4/examples/leaflet-elevation_i18n-strings.html#L40-L67

https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_i18n-strings.html

rodrihgh commented 3 years ago

I have worked out a page that loads GeoJSON on Javascript and glues it together with the corresponding risk colors and labels. I have taken the code from Raruto's repo above, so the styling does not look like ours yet:

grafik

@dieghernan I would let you style the map as you want on the Javascript code (you may also need to change the scripts on the header, too:

https://github.com/dieghernan/RKI-Corona-Atlas/blob/772041c3e9d386158d4802425a9c9ecc5d837c28/assets/html/load_geojson.html#L48-L105

Once you are done, I can insert the map in all the different pages with the corresponding text.

rodrihgh commented 3 years ago

Done!

For you to know how things now are done: