jdemaeyer / brightsky

JSON API for DWD's open weather data.
https://brightsky.dev/
MIT License
287 stars 18 forks source link

Provide other languages than Deutsch and English for alerts #163

Open papjul opened 5 months ago

papjul commented 5 months ago

From what I can see, CAP alerts are emitted in many languages. I can see French, Spanish, Arabic, Russian, Turkish, Polish, but this may not be a fixed list for all alerts.

From an app parsing point of view, it would be more flexible/convenient for these to be provided this way:

  "alerts": [
    {
      // …
      "headline": {
         "en": "Official WARNING of WIND GUSTS",
         "de": "Amtliche WARNUNG vor WINDBÖEN",
         "fr": "ALERTE officielle pour VENT FORT",
         // …
     }
     // …
  ]

For retrocompatibility, you may continue to provide headlineEn and headlineDe, or bump a new version of the API endpoint.

Thanks!

jdemaeyer commented 5 months ago

Hi @papjul, thanks for the request!

This would indeed be a nice feature. I left it out in the initial feature set to avoid the additional database complexity (of either managing the extra tables or dealing with JSONB shenanigans), but it might be time for an extension now that there seems to be real-world demand :)

papjul commented 5 months ago

Don't worry, there has not been any real-world demand so far to my knowledge! I just happen to run a multilingual weather app, and found while working on CAP files that Germany had many translations, so why not handle them :)