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

Allows configuring available languages through env and adds Hindi to CARE #8692

Merged
merged 8 commits into from
Oct 7, 2024

Conversation

shivankacker
Copy link
Member

Proposed Changes

  • Adds a new availableLocales variable in care config, derived from the REACT_AVAILABLE_LOCALES variable.
  • Added example env

@ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

@shivankacker shivankacker requested a review from a team as a code owner October 2, 2024 19:55
Copy link

netlify bot commented Oct 2, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 148a154
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/670042b92127390008d10c09
😎 Deploy Preview https://deploy-preview-8692--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

cloudflare-workers-and-pages bot commented Oct 2, 2024

Deploying care-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 148a154
Status: ✅  Deploy successful!
Preview URL: https://5bbaeef8.care-fe.pages.dev
Branch Preview URL: https://add-hindi.care-fe.pages.dev

View logs

Copy link

cypress bot commented Oct 2, 2024

CARE    Run #3540

Run Properties:  status check passed Passed #3540  •  git commit 148a154688: Allows configuring available languages through env and adds Hindi to CARE
Project CARE
Branch Review add-hindi
Run status status check passed Passed #3540
Run duration 03m 11s
Commit git commit 148a154688: Allows configuring available languages through env and adds Hindi to CARE
Committer Shivank Kacker
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 124
View all changes introduced in this branch ↗︎

.env Outdated
@@ -12,3 +12,4 @@ REACT_CARE_API_URL=https://careapi.ohc.network
# Dev envs
ESLINT_NO_DEV_ERRORS=true
CARE_CDN_URL="https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com http://localhost:4566"
REACT_AVAILABLE_LOCALES="EN,HI,TA,ML,MR,KN"
Copy link
Member

Choose a reason for hiding this comment

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

should we pick small case? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

wouldn't 'ALLOWED_LOCALES' term be more appropriate?

Copy link
Member

Choose a reason for hiding this comment

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

care.config.ts Outdated
@@ -38,6 +38,9 @@ const careConfig = {
customLogo: logo(env.REACT_CUSTOM_LOGO),
customLogoAlt: logo(env.REACT_CUSTOM_LOGO_ALT),
customDescription: env.REACT_CUSTOM_DESCRIPTION,
availableLocales: (env.REACT_AVAILABLE_LOCALES || "")
.split(",")
.map((l) => l.trim().toLowerCase()),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.map((l) => l.trim().toLowerCase()),
.map((l) => l.trim()),

Copy link
Member Author

Choose a reason for hiding this comment

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

@bodhish this is to be sure that random case characters in the ENV don't break things.

Copy link
Member

Choose a reason for hiding this comment

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

Lets not have it, env configuration is one time and validation for the env will take care of it. #8470

@@ -0,0 +1,45 @@
import Asset from "./Asset.json";
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this for all languages 🤔
Can't we write a dynamic import? ie all files in a folder 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated. Using dynamic imports as much as possible now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Update: Dynamic imports were causing issues during build due to their async nature. Reverted back.

Copy link
Member

Choose a reason for hiding this comment

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

I really don't want us to have this file for each language, not a priority to fix now but I think we should find a better solution for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can take this up in a later issue. Tracking it through #8705

Comment on lines 21 to 23
const availableLocales = Object.keys(LANGUAGE_NAMES).filter(
(l) => l === "en" || careConfig.availableLocales?.includes(l),
);
Copy link
Member

Choose a reason for hiding this comment

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

why do we need a special case for en?

Copy link
Member Author

Choose a reason for hiding this comment

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

So that even when there are no available languages set in env english is still there

Copy link
Member

Choose a reason for hiding this comment

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

I think its safe to assume that the env will configured correctly, we also have a default set, so I think we can ignore it

@github-actions github-actions bot added the Deploy-Failed Deplyment is not showing preview label Oct 3, 2024
@shivankacker shivankacker removed the Deploy-Failed Deplyment is not showing preview label Oct 3, 2024
@nihal467
Copy link
Member

nihal467 commented Oct 3, 2024

@shivankacker iam seeing commits and conversation going on, is it good for testing

@nihal467 nihal467 added the question Further information is requested label Oct 3, 2024
@shivankacker
Copy link
Member Author

@nihal467 waiting for @bodhish 's go ahead, but it is okay for testing

@shivankacker shivankacker added needs testing and removed question Further information is requested labels Oct 4, 2024
@shivankacker
Copy link
Member Author

@nihal467 this is ready for testing

@nihal467
Copy link
Member

nihal467 commented Oct 4, 2024

LGTM

@bodhish bodhish merged commit 8f55271 into develop Oct 7, 2024
27 checks passed
@bodhish bodhish deleted the add-hindi branch October 7, 2024 23:26
Copy link

github-actions bot commented Oct 7, 2024

@shivankacker @shivankacker Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

chakribontha pushed a commit to chakribontha/care_fe that referenced this pull request Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants