Skip to content

Commit

Permalink
Merge branch 'develop' into orgtabs_count_with_header
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaJ2305 authored Jan 27, 2025
2 parents e987884 + a481488 commit 2432160
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 113 deletions.
29 changes: 25 additions & 4 deletions care.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,31 @@ const careConfig = {
},

careApps: env.REACT_ENABLED_APPS
? env.REACT_ENABLED_APPS.split(",").map((app) => ({
branch: app.split("@")[1],
package: app.split("@")[0],
}))
? env.REACT_ENABLED_APPS.split(",").map((app) => {
const [module, cdn] = app.split("@");
const [org, repo] = module.split("/");

if (!org || !repo) {
throw new Error(
`Invalid plug configuration: ${module}. Expected 'org/repo@url'.`,
);
}

let url = "";
if (!cdn) {
url = `https://${org}.github.io/${repo}`;
}

if (!url.startsWith("http")) {
url = `${cdn.includes("localhost") ? "http" : "https"}://${cdn}`;
}

return {
url: new URL(url).toString(),
name: repo,
package: module,
};
})
: [],

plotsConfigUrl:
Expand Down
12 changes: 11 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"i18next": "^24.2.1",
"i18next-browser-languagedetector": "^8.0.2",
"i18next-http-backend": "^3.0.1",
"i18next-resources-to-backend": "^1.2.1",
"input-otp": "^1.4.2",
"lodash-es": "^4.17.21",
"lucide-react": "^0.473.0",
Expand Down Expand Up @@ -140,7 +141,7 @@
"@types/google.maps": "^3.58.1",
"@types/jsdom": "^21.1.7",
"@types/markdown-it": "^14.1.2",
"@types/node": "^22.9.0",
"@types/node": "^22.10.10",
"@types/react": "^18.3.12",
"@types/react-copy-to-clipboard": "^5.0.7",
"@types/react-csv": "^1.1.10",
Expand Down
104 changes: 0 additions & 104 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,40 +272,6 @@
"aadhaar_otp_send_success": "OTP has been sent to the mobile number registered with the Aadhar number.",
"aadhaar_validation_length_error": "Should be a 12-digit aadhaar number or 16-digit virtual ID",
"aadhaar_validation_space_error": "Aadhaar number should not contain spaces",
"abha": "ABHA",
"abha__auth_method__AADHAAR_OTP": "Aadhaar OTP",
"abha__auth_method__MOBILE_OTP": "Mobile OTP",
"abha__disclaimer_1": "I am voluntarily sharing my Aadhaar Number / Virtual ID issued by the Unique Identification Authority of India (\"UIDAI\"), and my demographic information for the purpose of creating an Ayushman Bharat Health Account number (\"ABHA number\") and Ayushman Bharat Health Account address (\"ABHA Address\"). I authorize NHA to use my Aadhaar number / Virtual ID for performing Aadhaar based authentication with UIDAI as per the provisions of the Aadhaar (Targeted Delivery of Financial and other Subsidies, Benefits and Services) Act, 2016 for the aforesaid purpose. I understand that UIDAI will share my e-KYC details, or response of \"Yes\" with NHA upon successful authentication.",
"abha__disclaimer_2": "I consent to usage of my ABHA address and ABHA number for linking of my legacy (past) health records and those which will be generated during this encounter.",
"abha__disclaimer_3": "I authorize the sharing of all my health records with healthcare provider(s) for the purpose of providing healthcare services to me during this encounter.",
"abha__disclaimer_4": "I consent to the anonymization and subsequent use of my health records for public health purposes.",
"abha__qr_scanning_error": "Error scanning QR code, Invalid QR code",
"abha_address": "ABHA Address",
"abha_address_created_error": "Failed to create Abha Address. Please try again later.",
"abha_address_created_success": "Abha Address has been created successfully.",
"abha_address_suggestions": "Here are some suggestions:",
"abha_address_validation_character_error": "Should only contain letters, numbers, underscore(_) or dot(.)",
"abha_address_validation_end_error": "Shouldn't end with a dot (.)",
"abha_address_validation_length_error": "Should be atleast 4 character long",
"abha_address_validation_start_error": "Shouldn't start with a number or dot (.)",
"abha_details": "ABHA Details",
"abha_disabled_due_to_no_health_facility": "ABHA Number generation and linking is disabled for this facility, Please link a health facility to enable this feature.",
"abha_link_options__create_with_aadhaar__description": "Create New ABHA Number Using Aadhaar Number",
"abha_link_options__create_with_aadhaar__title": "Create with Aadhaar",
"abha_link_options__create_with_driving_license__description": "Create New ABHA Number Using Driving License",
"abha_link_options__create_with_driving_license__title": "Create with Driving License",
"abha_link_options__disabled_tooltip": "We are currently working on this feature",
"abha_link_options__link_with_demographics__description": "Link Existing ABHA Number Using Demographic details",
"abha_link_options__link_with_demographics__title": "Link with Demographics",
"abha_link_options__link_with_otp__description": "Link Existing ABHA Number Using Mobile or Aadhaar OTP",
"abha_link_options__link_with_otp__title": "Link with OTP",
"abha_link_options__link_with_qr__description": "Link Existing ABHA Number by Scanning the ABHA QR",
"abha_link_options__link_with_qr__title": "Link with ABHA QR",
"abha_number": "ABHA Number",
"abha_number_exists": "ABHA Number already exists",
"abha_number_exists_description": "There is an ABHA Number already linked with the given Aadhaar Number, Do you want to create a new ABHA Address?",
"abha_number_linked_successfully": "ABHA Number has been linked successfully.",
"abha_profile": "ABHA Profile",
"accept": "Accept",
"accept_all": "Accept All",
"access_level": "Access Level",
Expand Down Expand Up @@ -395,8 +361,6 @@
"and_the_status_of_request_is": "and the status of request is",
"antenatal": "Antenatal",
"any_additional_information": "Any Additional Information",
"any_id": "Enter any ID linked with your ABHA number",
"any_id_description": "Currently we support: Aadhaar Number / Mobile Number",
"any_other_comments": "Any other comments",
"app_settings": "App Settings",
"apply": "Apply",
Expand Down Expand Up @@ -442,7 +406,6 @@
"assigned_facility": "Facility assigned",
"assigned_to": "Assigned to",
"assigned_volunteer": "Assigned Volunteer",
"async_operation_warning": "This operation may take some time. Please check back later.",
"atypical_presentation_details": "Atypical presentation details",
"audio__allow_permission": "Please allow microphone permission in site settings",
"audio__allow_permission_button": "Click here to know how to allow",
Expand Down Expand Up @@ -546,7 +509,6 @@
"check_status": "Check Status",
"checked_in": "Checked-In",
"checking_availability": "Checking Availability",
"checking_consent_status": "Consent request status is being checked!",
"checking_eligibility": "Checking Eligibility",
"checking_for_update": "Checking for update",
"checking_policy_eligibility": "Checking Policy Eligibility",
Expand Down Expand Up @@ -615,38 +577,6 @@
"confirm_transfer_complete": "Confirm Transfer Complete!",
"confirm_unavailability": "Confirm Unavailability",
"confirmed": "Confirmed",
"consent__hi_range": "Health Information Range",
"consent__hi_type__DiagnosticReport": "Diagnostic Report",
"consent__hi_type__DischargeSummary": "Discharge Summary",
"consent__hi_type__HealthDocumentRecord": "Health Document Record",
"consent__hi_type__ImmunizationRecord": "Immunization Record",
"consent__hi_type__OPConsultation": "OP Consultation",
"consent__hi_type__Prescription": "Prescription",
"consent__hi_type__WellnessRecord": "Wellness Record",
"consent__hi_types": "HI Profiles",
"consent__patient": "Patient",
"consent__purpose": "Purpose",
"consent__purpose__BTG": "Break The Glass",
"consent__purpose__CAREMGT": "Care Management",
"consent__purpose__DSRCH": "Disease Specific Healthcare Research",
"consent__purpose__HPAYMT": "Healthcare Payment",
"consent__purpose__PATRQT": "Self Requested",
"consent__purpose__PUBHLTH": "Public Health",
"consent__status": "Status",
"consent__status__DENIED": "Denied",
"consent__status__EXPIRED": "Expired",
"consent__status__GRANTED": "Granted",
"consent__status__REQUESTED": "Requested",
"consent__status__REVOKED": "Revoked",
"consent_request__date_range": "Health Records Date Range",
"consent_request__expiry": "Consent Expiry Date",
"consent_request__hi_types": "Health Information Types",
"consent_request__hi_types_placeholder": "Select One or More HI Types",
"consent_request__patient_identifier": "Patient Identifier",
"consent_request__purpose": "Purpose of Request",
"consent_request_rejected": "Patient has rejected the consent request",
"consent_request_waiting_approval": "Waiting for the Patient to approve the consent request",
"consent_requested_successfully": "Consent requested successfully!",
"consult": "Consult",
"consultation_history": "Consultation History",
"consultation_missing_warning": "You have not created a consultation for the patient in",
Expand Down Expand Up @@ -689,14 +619,11 @@
"covid_details": "Covid Details",
"create": "Create",
"create_a_new_encounter_to_get_started": "Create a new encounter to get started",
"create_abha_address": "Create ABHA Address",
"create_add_more": "Create & Add More",
"create_asset": "Create Asset",
"create_consultation": "Create Consultation",
"create_encounter": "Create Encounter",
"create_facility": "Create Facility",
"create_new_abha_address": "Create New ABHA Address",
"create_new_abha_profile": "Don't have an ABHA Number",
"create_new_asset": "Create New Asset",
"create_new_encounter": "Create a new encounter to get started",
"create_new_facility": "Create a new facility and add it to the organization.",
Expand Down Expand Up @@ -970,10 +897,6 @@
"end_datetime": "End Date/Time",
"end_dose": "End Dose",
"end_time": "End Time",
"enter_aadhaar_number": "Enter a 12-digit Aadhaar ID",
"enter_aadhaar_otp": "Enter OTP sent to the registered mobile with Aadhaar",
"enter_abha_address": "Enter ABHA Address",
"enter_any_id": "Enter any ID linked with your ABHA number",
"enter_dosage_instructions": "Enter Dosage Instructions",
"enter_file_name": "Enter File Name",
"enter_message": "Start typing...",
Expand Down Expand Up @@ -1107,8 +1030,6 @@
"geo_organization_is_required": "Geo organization is required when nationality is India",
"geo_organization_required": "Geo organization is required",
"geolocation_is_not_supported_by_this_browser": "Geolocation is not supported by this browser",
"get_auth_methods": "Get Available Authentication Methods",
"get_auth_mode_error": "Could not find any supported authentication methods, Please try again with a different authentication method",
"get_current_location": "Get Current Location",
"get_tests": "Get Tests",
"getting_location": "Getting Location...",
Expand All @@ -1119,35 +1040,13 @@
"has_domestic_healthcare_support": "Has domestic healthcare support?",
"has_sari": "Has SARI (Severe Acute Respiratory illness)?",
"health-profile": "Health Profile",
"health_facility__config_registration_error": "Health ID registration failed",
"health_facility__config_update_error": "Health Facility config update failed",
"health_facility__config_update_success": "Health Facility config updated successfully",
"health_facility__hf_id": "Health Facility Id",
"health_facility__link": "Link Health Facility",
"health_facility__not_registered_1.1": "The ABDM health facility is successfully linked with care",
"health_facility__not_registered_1.2": "but not registered as a service in bridge",
"health_facility__not_registered_2": "Click on Link Health Facility to register the service",
"health_facility__not_registered_3": "Not Registered",
"health_facility__registered_1.1": "The ABDM health facility is successfully linked with care",
"health_facility__registered_1.2": "and registered as a service in bridge",
"health_facility__registered_2": "No Action Required",
"health_facility__registered_3": "Registered",
"health_facility__validation__hf_id_required": "Health Facility Id is required",
"hearing": "We are hearing you...",
"help_confirmed": "There is sufficient diagnostic and/or clinical evidence to treat this as a confirmed condition.",
"help_differential": "One of a set of potential (and typically mutually exclusive) diagnoses asserted to further guide the diagnostic process and preliminary treatment.",
"help_entered_in_error": "The statement was entered in error and is not valid.",
"help_provisional": "This is a tentative diagnosis - still a candidate that is under consideration.",
"help_refuted": "This condition has been ruled out by subsequent diagnostic and clinical evidence.",
"help_unconfirmed": "There is not sufficient diagnostic and/or clinical evidence to treat this as a confirmed condition.",
"hi__fetch_records": "Fetch Records over ABDM",
"hi__page_title": "Health Information",
"hi__record_archived__title": "This record has been archived",
"hi__record_archived_description": "This record has been archived and is no longer available for viewing.",
"hi__record_archived_on": " This record was archived on",
"hi__record_not_fetched_description": "This record hasn't been fetched yet. Please check back after some time.",
"hi__record_not_fetched_title": "This record hasn't been fetched yet",
"hi__waiting_for_record": "Waiting for the Host HIP to send the record.",
"hide": "Hide",
"hide_notes": "Hide notes",
"high": "High",
Expand Down Expand Up @@ -1355,7 +1254,6 @@
"missing_required_params_for_patient_verification": "Missing required parameters for patient verification",
"mobile": "Mobile",
"mobile_number": "Mobile Number",
"mobile_number_different_from_aadhaar_mobile_number": "We have noticed that you have entered a mobile number that is different from the one linked to your Aadhaar. We will send an OTP to this number to link it with your Abha number.",
"mobile_number_validation_error": "Enter a valid mobile number",
"mobile_otp_send_error": "Failed to send OTP. Please try again later.",
"mobile_otp_send_success": "OTP has been sent to the given mobile number.",
Expand Down Expand Up @@ -1722,7 +1620,6 @@
"questionnaire_submitted_successfully": "Questionnaire submitted successfully",
"quick_actions": "Quick Actions",
"quick_actions_description": "Schedule an appointment or create a new encounter",
"raise_consent_request": "Raise a consent request to fetch patient records over ABDM",
"ration_card__APL": "APL",
"ration_card__BPL": "BPL",
"ration_card__NO_CARD": "Non-card holder",
Expand Down Expand Up @@ -2203,7 +2100,6 @@
"upload_report": "Upload Report",
"uploading": "Uploading",
"use_address_as_permanent": "Use this address for permanent address",
"use_existing_abha_address": "Use Existing ABHA Address",
"use_phone_number_for_emergency": "Use this phone number for emergency contact",
"user_add_error": "Error while adding User",
"user_added_successfully": "User added successfully",
Expand Down
32 changes: 29 additions & 3 deletions src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import careConfig from "@careConfig";
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import HttpApi from "i18next-http-backend";
import resourcesToBackend from "i18next-resources-to-backend";
import { initReactI18next } from "react-i18next";

export const LANGUAGES = {
Expand All @@ -12,21 +14,45 @@ export const LANGUAGES = {
hi: "हिन्दी",
} as const;

const namespaceToUrl = (namespace: string) => {
return careConfig.careApps.find((app) => app.name === namespace)?.url ?? "";
};

i18n
.use(HttpApi)
.use(initReactI18next)
.use(LanguageDetector)
.use(
resourcesToBackend((language, namespace, callback) => {
fetch(`${namespaceToUrl(namespace)}/locale/${language}.json`)
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
})
.then((resources) => {
callback(null, resources);
})
.catch((error) => {
console.error(
`Failed to load translations for ${language}/${namespace}:`,
error,
);
callback(error, null);
});
}),
)
.init({
backend: {
loadPath: "/locale/{{lng}}.json",
},
fallbackLng: "en",
ns: ["care_fe", ...careConfig.careApps.map((app) => app.name)],
load: "currentOnly",
supportedLngs: Object.keys(LANGUAGES),
interpolation: {
escapeValue: false,
skipOnVariables: false,
},
defaultNS: "care_fe",
});

export default i18n;

0 comments on commit 2432160

Please sign in to comment.