fix(core): language consumption from locale in payment and payout links#7993
Merged
Gnanasundari24 merged 3 commits intomainfrom May 12, 2025
Merged
Conversation
2 tasks
Changed Files
|
sahkal
previously approved these changes
May 9, 2025
SanchithHegde
approved these changes
May 9, 2025
sahkal
reviewed
May 9, 2025
sahkal
approved these changes
May 9, 2025
pixincreate
added a commit
that referenced
this pull request
May 12, 2025
…adyen-ideal * 'main' of github.com:juspay/hyperswitch: (62 commits) fix(core): language consumption from locale in payment and payout links (#7993) feat(refunds_v2): Add refunds list flow in v2 apis (#7966) refactor(connector): [Noon] auth header (#7977) fix(connector): [Novalnet] send decoded token for apple pay payment (#7973) feat(business_profile): add business_profile config to enable external vault (#7876) feat(vsaas): integrate onboarding flow for vertical saas (#7884) feat(connector): Introduce connector template code for WorldpayXML (#7968) feat(connector): [ADYEN, CHECKOUT] Added In Feature Matrix API (#7914) feat(core): add psync support for recovery external payments (#7855) refactor(open_router): call elimination routing of open router if enabled instead of dynamo (#7961) feat(payment_methods): add v2 api for fetching token data (#7629) ci(cypress): Fix Bank Redirects for stripe test (#8004) chore(version): 2025.05.12.0 refactor(authentication): moved cavv storing from table to temp locker (#7978) chore(version): 2025.05.09.0 feat(connector): [paypal, trustpay] add in feature matrix (#7911) fix(update_metadata): Update Metadata for any connectors other than stripe gives 500 error (#7984) fix(router): Fixed stack over flow for session call in authentication connectors (#7983) chore(version): 2025.05.08.0 fix(payment): disable payment update via client config (#7970) ...
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
Fix the locale handling in the payment and payout links translation functionality to properly support language-location combinations like
es-ES. Currently, the system is using the full locale value from theAccept-Languageheader without parsing it, causing translations for such locales to fail when the header includes region information.The fix extracts the base language code from locale strings containing region identifiers to ensure proper translation mapping (e.g.,
es-ESwill now correctly map toestranslations).Additional Changes
Motivation and Context
This PR fixes issue #7981 where the translation system fails to properly handle locale codes with region identifiers in the
Accept-Languageheader.When users send requests with headers like
Accept-Language: es-ES, the system was using the full string (es-ES) for translation lookup instead of extracting the base language code (es). This caused Spanish translations to default to English because no exact match fores-ESwas found in the translation data.By parsing the locale string and extracting just the language part, we ensure that users receive translations in their requested language regardless of whether they include region information.
How did you test it?
1. Create a payment link with es-ES in Accept-Language header
cURL
Response
2. Create a payout link
cURL
Response
Checklist
cargo +nightly fmt --allcargo clippy