ncbo / ontologies_api

Hypermedia API for NCBO's ontology-related projects
http://data.bioontology.org
Other
25 stars 10 forks source link

Feature: Multilingual support - Add request language middleware #148

Closed syphax-bouazzouni closed 3 months ago

syphax-bouazzouni commented 3 months ago

Require

Context

This PR adds a middleware request_lang that will save for each request the parameter lang or language if set, as a global variable that will filter the values by it.

In addition, it updates the search helper, to add the selected language as a suffix of the SOLR requests, to search by the selected language only.

Changes

codecov-commenter commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 73.28%. Comparing base (f439e21) to head (88973e9).

:exclamation: Current head 88973e9 differs from pull request most recent head 2a675bb. Consider uploading reports for the commit 2a675bb to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #148 +/- ## =========================================== + Coverage 73.13% 73.28% +0.15% =========================================== Files 52 53 +1 Lines 2903 2916 +13 =========================================== + Hits 2123 2137 +14 + Misses 780 779 -1 ``` | [Flag](https://app.codecov.io/gh/ncbo/ontologies_api/pull/148/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ncbo) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/ncbo/ontologies_api/pull/148/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ncbo) | `73.28% <100.00%> (+0.15%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ncbo#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

alexskr commented 3 months ago

I understand why the Solr schema was added to the ontologies_api project in this PR; it eliminates the need to keep the ontoportal/solr-ut image synchronized when schema changes occur. A more elegant solution could be implemented to maintain schema synchronization between ontologies_api and ontologies_linked_data, but this requirement will disappear after the schemaless Solr feature is implemented. At that point, the Solr configuration could be removed from ontologies_api.