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

Add missing i18n translations #10463

Merged

Conversation

rajku-dev
Copy link
Contributor

@rajku-dev rajku-dev commented Feb 7, 2025

Proposed Changes

@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

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Expanded localization with additional interface texts, including new placeholders and error messages to enhance user guidance.
  • Style

    • Improved text formatting with emphasized translations for clarity.
    • Refined placeholder styling for dropdowns and adjusted label casing for a more consistent presentation.
    • Updated titles and labels for better visual presentation.
    • Enhanced visual presentation of questionnaire titles and creator information.
    • Adjusted casing for labels in printed resource letters.

@rajku-dev rajku-dev requested a review from a team as a code owner February 7, 2025 02:04
Copy link
Contributor

coderabbitai bot commented Feb 7, 2025

Walkthrough

This pull request updates localization by adding and modifying several key-value pairs in the en.json file. The changes include the insertion of new translation entries with embedded HTML formatting and adjustments to existing entries (e.g., updating the "by" key). Additionally, select React components have been updated to integrate the <Trans> component from react-i18next, enhancing dynamic content translation and refining UI text styling and casing for improved consistency in the user interface.

Changes

File(s) Change Summary
public/locale/en.json Added new translation keys (e.g., "end_date", "external_id", "medication_already_marked_as_error", and more) and modified existing keys to include HTML formatting (e.g., "by": "by <strong>{{by}}</strong>").
src/components/Facility/ConsultationDetails/QuestionnaireResponsesList.tsx Replaced the simple translation function (t) with the <Trans> component for dynamic content translation, enabling HTML element inclusion within translations.
src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx, src/components/Resource/PrintResourceLetter.tsx, src/pages/Facility/overview.tsx Adjusted UI text formatting: updated placeholder styling (wrapping in a styled <span>), modified text casing for labels (e.g., "From" to "from" and "Encounters" to "encounters").

Possibly related PRs

Suggested labels

tested

Suggested reviewers

  • rithviknishad
  • Jacobjeevan

Poem

I'm a rabbit who hops with glee,
Translating texts wide and free.
New keys and styles hop in the code,
Ensuring our UI lightens the load.
With every change, I cheer and play—
Bursting wit' joy, I nibble the day!
(__/), (•ㅅ•), /   づ


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8aecffc and 92297d3.

📒 Files selected for processing (1)
  • public/locale/en.json (12 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Redirect rules - care-ohc
  • GitHub Check: Header rules - care-ohc
  • GitHub Check: Pages changed - care-ohc
  • GitHub Check: Test
  • GitHub Check: OSSAR-Scan
  • GitHub Check: cypress-run (1)
  • GitHub Check: CodeQL-Build
🔇 Additional comments (10)
public/locale/en.json (10)

412-414: Review "at_time" Translation
The key "at_time": "at <strong>{{time}}</strong>" has been added with HTML formatting to dynamically emphasize the time value. This format aligns with our i18n practices and follows previous review suggestions.


481-483: Validate "by_name" Translation
The key has been updated from the ambiguous "by" to "by_name": "by <strong>{{by}}</strong>" to clearly indicate the dynamic content. This change follows prior suggestions and improves clarity in the UI.


918-920: Assess New "end_date" Key
The newly added "end_date": "End date" provides a clear and concise label. Ensure its capitalization and style are consistent with similar date-related keys across the project.


975-977: Review "external_id" Translation
The added key "external_id": "External ID" is straightforward and uses common terminology. It enhances the internationalization by clearly labeling external identifiers.


1037-1039: Evaluate Updated "filed" Translation
Changing the value to "filed": "filed <strong>{{title}}</strong>" improves the messaging by incorporating dynamic formatting for the title. This update makes the content both visually distinct and informative.


1296-1298: Confirm "medication_already_marked_as_error" Translation
The key "medication_already_marked_as_error": "Medication already marked as entered in error" clearly communicates the error state regarding medication entries. This wording is consistent with previous review recommendations.


1389-1391: Assess "no_locations_available" Message
The newly introduced key "no_locations_available": "No locations available" provides a useful fallback when location data is missing. Verify that the tone and phrasing align with similar keys in the file.


1448-1450: Validate "not_started" Status Label
The addition of "not_started": "Not started" offers a clear and concise status message. This straightforward label aids in user clarity and is well implemented.


1480-1482: Review New "online" Key
The new key "online": "Online" is concise and should help indicate online status where needed. Confirm that its usage context in the UI matches the simplicity of this label.


1497-1499: Review "organization_required" Message
The key "organization_required": "Organization is required" clearly informs the user that an organization must be specified. This message is self-explanatory and aligns with form validation standards.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Feb 7, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 92297d3
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/67a9e95b07947a0008e5a970
😎 Deploy Preview https://deploy-preview-10463--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.

public/locale/en.json Outdated Show resolved Hide resolved
public/locale/en.json Outdated Show resolved Hide resolved
public/locale/en.json Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
public/locale/en.json (3)

716-716: Added Diagnosis Status Placeholder Key
The new key "diagnosis_status_placeholder" with the value "Select diagnosis status" provides a clear prompt for a dropdown input. Verify that its usage in the related UI components is consistent and unambiguous.


717-717: Added Diagnosis Verification Placeholder Key
The key "diagnosis_verification_placeholder" ("Select verification status") has been introduced to clarify user prompts in the diagnosis verification context. Ensure its proper integration in the form components and that it matches the intended use case.


1389-1389: New Key for No Locations Available
The new key "no_locations_available" with the value "No locations available" adds to the localization set. Please check that its usage is distinct from any similar keys (such as "no_locations_found") and fits the intended context accurately.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59e38fd and eaf974f.

📒 Files selected for processing (2)
  • public/locale/en.json (12 hunks)
  • src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: cypress-run (1)
🔇 Additional comments (8)
public/locale/en.json (8)

413-413: New i18n Key for Time Display
The new key "at_time" with the value "at {{time}}" adds HTML emphasis to the time variable. Ensure that components using this translation (likely via react-i18next’s component) safely render the HTML to prevent injection risks and display the intended formatting.


482-482: Updated Key for Attribution
The key "by_name" now definitively indicates its context by including HTML ("by {{by}}") and replaces a more ambiguous "by" value. This improves clarity in the UI. Please confirm that all components referencing this translation have been updated to use "by_name".


919-919: New Key for End Date
The addition of the key "end_date" with the value "End date" will help in forming consistent date labels throughout the application. Confirm that the UI elements consuming this key handle date formats appropriately and are consistent with related keys (e.g., "start_date").


1037-1037: Enhanced Filing Notification with HTML Emphasis
The new key "filed" now reads "filed {{title}}", using HTML to emphasize the title component. Ensure that any component rendering this string correctly processes the HTML markup without introducing security issues.


1296-1296: New Medication Error Notification Key
"medication_already_marked_as_error" has been added with a straightforward message. It is important that this message be used in context where a medication-related error is indicated and that it accurately guides the user.


1448-1448: New Key for Not Started Status
The introduced key "not_started" with the value "Not started" helps improve status labeling in the UI. It is concise and clear; ensure that it is used in contexts where a process is pending initiation.


1480-1480: New Key for Online Status
Adding "online" with the value "Online" enhances the localization for status indicators. Confirm that its usage aligns with other status keys and that the translation is applied uniformly across components reflecting online status.


1497-1497: New Organization Requirement Message
The newly added key "organization_required" returns "Organization is required". This message is clear for form validations. Verify that it is only used where the organization information is mandatory to prevent any potential user confusion.

public/locale/en.json Outdated Show resolved Hide resolved
Co-authored-by: Rithvik Nishad <rithvikn2001@gmail.com>
@rithviknishad rithviknishad added reviewed reviewed by a core member and removed needs review labels Feb 10, 2025
@rithviknishad rithviknishad merged commit cbcb64f into ohcnetwork:develop Feb 10, 2025
14 of 15 checks passed
Copy link

@rajku-dev 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! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs testing reviewed reviewed by a core member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing i18n Translation Keys Causing UI Inconsistencies
2 participants