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

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

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 3547988
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/66ff8ce71881ed00080f7bff
😎 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: 3547988
Status: ✅  Deploy successful!
Preview URL: https://b4895d33.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 #3530

Run Properties:  status check failed Failed #3530  •  git commit 3547988dad: Allows configuring available languages through env and adds Hindi to CARE
Project CARE
Branch Review add-hindi
Run status status check failed Failed #3530
Run duration 05m 53s
Commit git commit 3547988dad: 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 1
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 123
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/e2e/patient_spec/PatientBedManagement.cy.ts • 1 failed test • UI-Chrome

View Output

Test Artifacts
Patient swtich bed functionality > Assign a bed for a admitted patient from update consultation page Test Replay Screenshots

.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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review required
Development

Successfully merging this pull request may close these issues.

4 participants