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

fix language validation & usage in interactive flows #657

Merged
merged 5 commits into from
Sep 16, 2022

Conversation

JakeUrban
Copy link
Contributor

@JakeUrban JakeUrban commented Sep 14, 2022

This PR addresses 2 bugs in Polaris:

  • secondary language tags included in lang parameter values are not supported
  • the language, which is specified in a previous API request, is not used in the SEP-24 interactive flow

Secondary Tag Support

Polaris validates the lang parameter values sent in requests by matching them against the anchor's LANGUAGES settings object. However, this strict matching causes Polaris to reject requests when a secondary language tag is included in the lang value.

For example, if a user wants to read Brazilian Portuguese and specifies pt-br as the lang value in a request to initiate a transaction, Polaris will reject the request with a 400 if settings.LANGUAGES only contains an entry for pt.

This would not occur if the client specified their desired language using the Accept-Language header, which is a case handled by Django directly.

Polaris should use the same validation logic as Django.

SEP-24 Interactive Flow

Additionally, the SEP-24 specification states that the value passed in a POST /transactions/deposit/interactive request should be used for the interactive flow, but Polaris does not currently propagate this information to its interactive flow.

When a client specifies the lang parameter via this request, Polaris should add a query parameter to the interactive URL returned in the response containing the same value passed via lang. When the URL is used to open the interactive flow, Polaris will set the content of the interactive flow to use the specified language for the entire user web session.

@JakeUrban JakeUrban changed the title use django-implemented language code validation support secondary language tags (extensions) Sep 14, 2022
@JakeUrban JakeUrban changed the title support secondary language tags (extensions) fix language validation & usage in interactive flows Sep 14, 2022
@JakeUrban JakeUrban marked this pull request as ready for review September 16, 2022 15:57
@JakeUrban JakeUrban merged commit 4d010a3 into stellar:master Sep 16, 2022
@JakeUrban JakeUrban deleted the support-sublanguages branch September 16, 2022 16:30
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.

None yet

2 participants