Skip to content

fix: use locales from shared-codebase#1391

Open
Shivam25092001 wants to merge 4 commits intomainfrom
fix-shared-code-locale
Open

fix: use locales from shared-codebase#1391
Shivam25092001 wants to merge 4 commits intomainfrom
fix-shared-code-locale

Conversation

@Shivam25092001
Copy link
Copy Markdown
Contributor

@Shivam25092001 Shivam25092001 commented Feb 17, 2026

Type of Change

  • Enhancement
  • Bugfix
  • New feature
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This change aims to usage of locales from shared-code-utils and hosted as a common resource on s3.
Related changes at shared-code-utils here: https://github.com/juspay/hyperswitch-sdk-utils/pull/41/changes.

Changed

The locales will be consumed from shared-code and fetched from s3 at runtime for required language. Default english locale files are shipped along with the bundle.

Motivation

By this change, we aim to conform to a single source of truth for all the texts appeared on ui to behave the same across all the sdks/ platforms.

STACKED PRs

How did you test it?

  • Created a build with shared-code on branch fix-locale-selection.
  • Inspected the network tab to see if the locale was fetched.

Screenshots / Recordings

Screen.Recording.2026-02-23.at.4.27.51.PM.mov

Checklist

  • I ran npm run re:build
  • I reviewed submitted code
  • I added unit tests for my changes where possible

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com bot commented Feb 17, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  src/CardTheme.res Unsupported file format
  src/CardUtils.res Unsupported file format
  src/Components/BillingNamePaymentInput.res Unsupported file format
  src/Components/FullNamePaymentInput.res Unsupported file format
  src/Components/GiftCards.res Unsupported file format
  src/Components/SaveDetailsCheckbox.res Unsupported file format
  src/Components/SurchargeUtils.res Unsupported file format
  src/Components/Terms.res Unsupported file format
  src/FormViewJourney.res Unsupported file format
  src/FormViewTabs.res Unsupported file format
  src/LocaleStrings/ArabicLocale.res Unsupported file format
  src/LocaleStrings/CatalanLocale.res Unsupported file format
  src/LocaleStrings/ChineseLocale.res Unsupported file format
  src/LocaleStrings/ConstantStrings.res Unsupported file format
  src/LocaleStrings/DeutschLocale.res Unsupported file format
  src/LocaleStrings/DutchLocale.res Unsupported file format
  src/LocaleStrings/EnglishGBLocale.res Unsupported file format
  src/LocaleStrings/EnglishLocale.res Unsupported file format
  src/LocaleStrings/FrenchBelgiumLocale.res Unsupported file format
  src/LocaleStrings/FrenchLocale.res Unsupported file format
  src/LocaleStrings/HebrewLocale.res Unsupported file format
  src/LocaleStrings/ItalianLocale.res Unsupported file format
  src/LocaleStrings/JapaneseLocale.res Unsupported file format
  src/LocaleStrings/LocaleStringHelper.res Unsupported file format
  src/LocaleStrings/LocaleStringTypes.res Unsupported file format
  src/LocaleStrings/PolishLocale.res Unsupported file format
  src/LocaleStrings/PortugueseLocale.res Unsupported file format
  src/LocaleStrings/RussianLocale.res Unsupported file format
  src/LocaleStrings/SpanishLocale.res Unsupported file format
  src/LocaleStrings/SwedishLocale.res Unsupported file format
  src/LocaleStrings/TraditionalChineseLocale.res Unsupported file format
  src/PaymentMethodCollectElement.res Unsupported file format
  src/Payments/CardPayment.res Unsupported file format
  src/Payments/CardVault.res Unsupported file format
  src/Payments/PaymentMethodsRecord.res Unsupported file format
  src/Utilities/PaymentMethodCollectUtils.res Unsupported file format
  src/Utilities/S3Utils.res Unsupported file format
  src/Utilities/Utils.res Unsupported file format
  src/VGSVault/VGSHelpers.res Unsupported file format
  webpack.common.js  0% smaller
  webpack.dev.js  0% smaller

@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

2 similar comments
@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

customMessageForCardTerms
} else {
localeString.cardTerms(business.name)
localeString.cardTermsPart1 ++ business.name ++ localeString.cardTermsPart2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please write it using string templates

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We tried implementing it using string templates but some string interpolations like surchargeMsgAmount require rendering parts of the text in bold, which involves platform-specific React logic. Since the locale utils are shared between the web and mobile SDKs, adding such rendering logic there isn't feasible.

Because of outliers like this, abstracting string interpolation into shared util functions would be inconsistent — we'd have utils for some cases but not others.

Also, locale strings were split into parts so that consumers can freely decide how to join and display them. Adding a shared util that does the joining for them would defeat that purpose.

@aritro2002
Copy link
Copy Markdown
Contributor

aritro2002 commented Feb 23, 2026

  • shortSurchargeMessage
  • surchargeMsgAmountForCard
  • surchargeMsgAmount
  • cardTerms
  • nameEmptyText
  • completeNameEmptyText
  • giftCardPaymentRemainingMessage
  • sepaDebitTerms
  • achBankDebitTerms
  • becsDebitTerms
  • cardBrandConfiguredErrorText

  • formFundsCreditInfoText
  • formSubheaderAccountText
  • formHeaderReviewTabLayoutText
  • formHeaderBankText
  • formHeaderWalletText
  • linkRedirectionText
  • linkExpiryInfo
  • payoutFromText

I see that you've split several strings into multiple parts (e.g., cardTerms1 and cardTerms2) and are manually concatenating them everywhere using templates like ${cardTerms1}${someValue}${cardTerms2}. The problem with this approach is that it leads to repeated hard-coded logic across multiple files. If something changes in the future, we won’t know which files need to be updated, and this can easily introduce inconsistencies.

Instead, it would be better to create a reusable utility function that handles this logic in one place. This way, we can simply call the function wherever needed, making the code cleaner, easier to maintain, and less error-prone.

Comment on lines +42 to +50
{
context: ["/assets/v2/jsons/locales/"],
target: "https://beta.hyperswitch.io",
changeOrigin: true,
secure: true,
pathRewrite: {
"^/assets/v2/jsons/locales/": "/assets/v2/jsons/locales/",
},
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's no need to add this piece of code to the webpack dev configuration — just keep the target empty; the rest can remain as it is. This is only needed for local testing.

Copy link
Copy Markdown
Contributor Author

@Shivam25092001 Shivam25092001 Feb 25, 2026

Choose a reason for hiding this comment

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

Yes, we'll need this for local testing by creating a proxy to sandbox.

just keep the target empty

Didn't get this. Can you please explain

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I meant that we should not hard-code the target URL in the proxy config. Since this is only for local development, anyone who is testing can set their own URL(integ, sbx,prod) if needed. There’s no point in pushing a fixed sandbox or beta endpoint into the public repo.
So instead of keeping "https://beta.hyperswitch.io" in the config, we should leave the target field empty, and developers can fill it locally while testing.

Comment on lines +121 to +128
let json = await response->Fetch.Response.json
let localeStrings = LocaleUtils.getLocaleStringsFromJson(json)
Console.log2("-- Locale strings fetched from S3: ", localeStrings)
localeStrings
} else {
raise(Exn.raiseError("Failed to fetch locale"))
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of using console.log, please use the logger as used in the API calls in the paymentHelpers.res file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, mb, thanks. Missed the log statement here by mistake

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed the log statement

Comment on lines +87 to +97
| Some(Ca) => "ca"
// | Some(Zh) => "zh" // Pending support
| Some(Pt) => "pt"
| Some(It) => "it"
| Some(Pl) => "pl"
| Some(Nl) => "nl"
| Some(NI_BE) => "nl-BE" // to check
| Some(Sv) => "sv"
| Some(Ru) => "ru"
// | Some(Zh_HANT) => "zh-Hant" // Pending support
| Some(Lt) => "lt"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

zh and zh-Hant is used my merchants on prod

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes will add this in a stacked PR, working on that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

} else if index === oneClickWalletsArr->Array.length - 1 {
<>
{React.string(`${Utils.nbsp}${localeString.\"and"}${Utils.nbsp}`)}
{React.string(`${Utils.nbsp}${localeString.and_}${Utils.nbsp}`)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why did you change the type \"and" to and_?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will revert this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed this change

@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

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.

2 participants