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

[Jormungandr] Harmonize multilanguage parameters in navitia #4084

Merged
merged 7 commits into from
Aug 17, 2023

Conversation

kadhikari
Copy link
Contributor

@kadhikari kadhikari commented Aug 9, 2023

The followings are some details:

  • Only one parameter language should be used instead of three existing parameters.
  • Use of 11 languages allowed in navitia but all languages are not used in each street_network connector.
  • In navitia, use of wrong value raises error with a message = Select a specific language for street network instructions ...
  • if no language is provided in request, using the value configured in the coverage (default value for coverage = fr-FR)
  • then if the language chosen in navitia is absent in a street_network connector, en-US will be used.
  • never supposed to happen, but to avoid crash: in all connectors final fallback is to fr-FR

Note: The existing attribute asgard_language should be deleted once the next release is deployed to all the platforms.

For more details: https://navitia.atlassian.net/browse/NAV-2152

@kadhikari kadhikari requested review from woshilapin, xlqian, SGrenet, pbench, pbougue and wassimbenaissa and removed request for woshilapin August 9, 2023 08:25
Copy link

@SGrenet SGrenet left a comment

Choose a reason for hiding this comment

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

need navitia-configurator PR too to change asgard_language to language
https://github.com/hove-io/navitia-configurator/blob/fbf8cb3e8b3e0691a03b122c1cdc5fd75c099642/coverages.py#L86

and how to switch ? hard manual sync or smooth with retro-compatibility?

@kadhikari
Copy link
Contributor Author

need navitia-configurator PR too to change asgard_language to language https://github.com/hove-io/navitia-configurator/blob/fbf8cb3e8b3e0691a03b122c1cdc5fd75c099642/coverages.py#L86

and how to switch ? hard manual sync or smooth with retro-compatibility?

The new parameter language in navitia as well as attribute in the database has a default value 'french'.
we don't need to modify in navitia-configurator for the existing configuration asgard_language: str = "french"
Will have to update la config after deploying navitia with future release.

class Languages(Enum):
french = "fr-FR"
english = "en-EN"
LANGUAGE_TRANSFORMATION_LIST = {"en-US": "en-EN", "en-GB": "en-EN", "fr-FR": "fr-FR"}
Copy link

Choose a reason for hiding this comment

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

As stated in another comment, this "en-EN" language tag was a documentation error on our side (Handimap).
You can safely replace it with a more conventional en-US without any risk (en-US is our default, and already used used as fallback for any unknown language tag like en-EN).
Sorry for that documentation fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As stated in another comment, this "en-EN" language tag was a documentation error on our side (Handimap). You can safely replace it with a more conventional en-US without any risk (en-US is our default, and already used used as fallback for any unknown language tag like en-EN). Sorry for that documentation fail.

Hi @jthiard will it be possible to put the link of the DOC Hadimap as I don't have other than https://dev.keolis-rennes.handimap.fr/docs/ and it give mes [ fr-FR, en-EN ] as language ?
Thanks

Copy link

Choose a reason for hiding this comment

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

Hi @kadhikari sure, we have two urls :

At this time the two use the same version since there is no future version in staging yet.

If you still see en-EN on https://dev.keolis-rennes.handimap.fr/docs/ it may be your browser cache. You can try https://keolis-rennes.handimap.fr/docs/ which may be not cached on your side.

I just changed the webserver config to send "no cache" headers for our openAPI file to avoid this cache problem in the future.

source/jormungandr/jormungandr/street_network/here.py Outdated Show resolved Hide resolved
source/jormungandr/jormungandr/street_network/handimap.py Outdated Show resolved Hide resolved
source/jormungandr/jormungandr/street_network/handimap.py Outdated Show resolved Hide resolved
@@ -585,7 +585,7 @@ def _build_fallback(
car_park_crowfly_duration = None
via_pt_access = None
via_poi_access = None
language = request.get('_asgard_language', "english_us")
language = request.get('language', "en-US")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for https://github.com/hove-io/navitia/pull/4084/files#diff-1db49300dbe77e5d5ef58deb0ebd54793fd7851c5f9a3b238ebd4091567bf5caR133 and https://github.com/hove-io/navitia/pull/4084/files#diff-3307dc8a614b49809e0d0843ff12386f70537d2f093790b1d2872d6fd89ab70eR352:
Here you don't "respect" the default value of the coverage, no?
I think you should default to None and have asgard-connector deal with the default(coverage) value in a single place.

Copy link
Contributor Author

@kadhikari kadhikari Aug 11, 2023

Choose a reason for hiding this comment

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

It's nearly impossible to have language = None, and it arrives default language in navitia before using connector street_network will be fr-FR
Since instance is absent here, no way to get instance.language !

source/jormungandr/jormungandr/street_network/asgard.py Outdated Show resolved Hide resolved
@kadhikari kadhikari force-pushed the harmonize_multilanguage_parameter_in_navitia branch from ef62ebf to 35ad492 Compare August 11, 2023 14:11
@sonarcloud
Copy link

sonarcloud bot commented Aug 16, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

68.4% 68.4% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.14.1) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@kadhikari kadhikari merged commit 7a1a839 into dev Aug 17, 2023
9 checks passed
@kadhikari kadhikari deleted the harmonize_multilanguage_parameter_in_navitia branch August 17, 2023 13:11
@pbougue pbougue changed the title Harmonize multilanguage parameters in navitia Jormungandr] Harmonize multilanguage parameters in navitia Aug 28, 2023
@pbougue pbougue changed the title Jormungandr] Harmonize multilanguage parameters in navitia [Jormungandr] Harmonize multilanguage parameters in navitia Aug 28, 2023
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.

6 participants