Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the display of different groups of suggestions depending on the language #711

Conversation

dtrucs
Copy link
Collaborator

@dtrucs dtrucs commented Jun 21, 2022

With this PR there is now another way to display different suggestions group depending on the language

By setting an object with the languages code as keys instead of an array. By this way you can optimize the valorization of a territory according to the selected language. If you don't need this feature (or if you want the same configuration for several language), use default key instead of a language code. The configuration in the example below displays 2 groups of suggestions for all languages except the English version with one different:

"suggestions": {
  "default": [
    {
      "titleTranslationId": "home.territoryTreks",
      "iconUrl": "/icons/practice-pedestrian.svg",
      "ids": ["2", "582", "586", "501", "771", "596"],
      "type": "trek"
    },
    {
      "titleTranslationId": "home.events",
      "iconUrl": "/icons/category-events.svg",
      "ids": ["1", "5"],
      "type": "events"
    },
  ],
  "en": [
    {
      "titleTranslationId": "home.treksDiscovery",
      "iconUrl": "/icons/pedestrian.svg",
      "ids": ["2", "582", "586"],
      "type": "trek"
    },
  ]
}

For backward compatibility you can still use an array, this is the same behavior that object with only a default key. For example:

"suggestions": [
  {
    "titleTranslationId": "home.territoryTreks",
    "iconUrl": "/icons/practice-pedestrian.svg",
    "ids": ["2", "582", "586", "501", "771", "596"],
    "type": "trek"
  },
  {
    "titleTranslationId": "home.events",
    "iconUrl": "/icons/category-events.svg",
    "ids": ["1", "5"],
    "type": "events"
  },
]

@dtrucs dtrucs force-pushed the Allow-different-groups-of-suggestions-depending-on-the-language branch from e5f06b5 to ca6b324 Compare June 21, 2022 15:53
Copy link
Member

@camillemonchicourt camillemonchicourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK c'est un peu complexe et discutable comme fonctionnalité, mais pourquoi pas.

"type": 'trek' | 'service' | 'outdoor' | 'events' // if not set, default to `trek`
}
```
There are two ways to displays suggestions groups:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi donner les 2 méthodes, ça complique les choses.
Alors que la seconde méthode est dépréciée ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, i changed the documentation 👍

}
```
There are two ways to displays suggestions groups:
- By using an `object` with the languages code as keys (feature available since 3.8.7 version). By this way you can optimize the valorization of a territory according to the selected language. If you don't need this feature (or if you want the same configuration for several language), use `default` key instead of a language code. The configuration in the example below displays 2 groups of suggestions for all languages except the English version with one different:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"By this way you can optimize the valorization..." à remplacer par "By this way you can differentiate the valorization..."
C'est pas forcément de l'optimisation... Mais uniquement de différencier les suggestions en fonction de la langue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@camillemonchicourt
Copy link
Member

On devrait aussi modifier le fichier d'exemple (https://github.com/GeotrekCE/Geotrek-rando-v3/blob/main/frontend/customization/config/home.json) pour mettre la nouvelle méthode d'écriture des suggestions, avec juste un bloc "default".

@dtrucs dtrucs force-pushed the Allow-different-groups-of-suggestions-depending-on-the-language branch 2 times, most recently from dff7857 to 191d845 Compare June 27, 2022 09:05
@camillemonchicourt
Copy link
Member

OK merci pour les modifications.
La PR doit aussi inclure la mise à jour de https://github.com/GeotrekCE/Geotrek-rando-v3/blob/main/frontend/customization/config/home.json avec le bloc default.

@dtrucs dtrucs force-pushed the Allow-different-groups-of-suggestions-depending-on-the-language branch from 191d845 to fcf1316 Compare June 27, 2022 12:54
@camillemonchicourt camillemonchicourt merged commit 81daa80 into develop Jun 27, 2022
@camillemonchicourt camillemonchicourt deleted the Allow-different-groups-of-suggestions-depending-on-the-language branch June 27, 2022 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants