open-y-subprojects / openy_node_alert

Alerts Application from Open Y distribution. ReactJS frontend, Drupal backend.
GNU General Public License v3.0
0 stars 12 forks source link

Enable translation on Alert CT #134

Open andrebonon opened 5 months ago

andrebonon commented 5 months ago

Problem: Enabling content translation for the Alert Content-Type does not ensure proper translation of an Alert. The React app fetches data from the "/alerts" URL without passing a language parameter, which means Drupal cannot determine which node translation to return.

Solution: Modify the REST Resource "/alerts" to check for a language prefix in the request URL. If a language prefix is present, the service should load and return the content in the corresponding translated language.

andrebonon commented 5 months ago

Problem 2 The "/alerts" route cannot be found if a translated URL is passed as a param. I.E.: /alerts?uri=/fr/component-style-guide-fr&_format=json

The route matcher throws an error. https://github.com/open-y-subprojects/openy_node_alert/blob/main/src/Plugin/rest/resource/AlertsRestResource.php#L198

Check the errors below: Screenshot 2024-03-20 at 20 26 27

Screenshot 2024-03-20 at 20 04 19

podarok commented 5 months ago

This is a good idea, but here are some concerns

Actually - enabling Drupal translation leads to a larger number of issues, because initially distribution was created with a - source in English + machine translation to any other language ( Google translate ), given the lack of resources Ys having for supporting multiple translations in a content I'd call this as a major epic for our Backlog, because there are issues with enabling translation everywhere will lead to checking all components ( Views related) , all SQL queries, all Content Types, Activity Finder, Schedules(you'd need to pull multilanguage data and split it in results for the user's language upgrade path would request everyone to convert their sites to become multilingual, because configs also would need to be translated. Having multilingual enabled when you have only one language - is pretty confusing from Content Editing perspective That said, if we want to enable Drupal core multilanguage - we need to come up with a proper strategy of how this needs to be done and what would be backport policy for the distribution if we decide to not enable Drupal core multilanguage

andrebonon commented 5 months ago

https://github.com/open-y-subprojects/openy_node_alert/pull/136

andrebonon commented 2 weeks ago

this is merged: https://github.com/open-y-subprojects/openy_node_alert/pull/136