geobeyond / Arpav-PPCV-backend

Backend di Piattaforma Proiezioni Climatiche per il Nord-Est.
Creative Commons Attribution 4.0 International
0 stars 1 forks source link

provide means to localize data-related strings and info #153

Closed ricardogsilva closed 2 days ago

ricardogsilva commented 4 weeks ago

From the requirements:

Add the ability to display an English version of the Platform, with ability to select the language (Italian and English) using a selector button. It is assumed that translations will be the responsibility of the developer

ricardogsilva commented 3 weeks ago

@sirmmo

After some internal discussion, the current plan for the time series translations is to add the series[].info.translations key to the returned payload. This key would be a dict with the translations for each series. Something like this:

{
  "series": [
    {
      "name": "some_ugly_identifier",
      "values": [1, 2, 3],
      "info": {
        "translations": {
          "series_name": {
            "en": "some name",
            "it": "qualche nome"
          }
        }
      }
    }
  ]

Then the frontend would pick the appropriate value, depending on the currently active language.

For the rest of the API responses, I will be also be adding a translations key to the payload, with a similar structure - this is still a bit TBD, but the overall plan is the same.

Do you agree with this strategy?

sirmmo commented 3 weeks ago

Not using tolgee on all data means that in any case the front would have to download multiple files anyway. Having that in the dataset means having one file less to download. Moving some logic from the translation system to this is not a problem. So for me it is GO.