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

[Translations] Errors and Success #2078

Merged

Conversation

pranshugupta54
Copy link
Member

@pranshugupta54 pranshugupta54 commented Jul 6, 2024

What kind of change does this PR introduce?

Translations

Issue Number:

Fixes #1579

Did you add tests for your changes?

N/A

Snapshots/Videos:

N/A

Summary

Fixed translations for all errors and success messages.

Does this PR introduce a breaking change?

No

Other information

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • New Features

    • Added dynamic success and error messages across multiple components for better localization and user feedback.
    • Enhanced multilingual support by updating language files (en, fr, hi, sp, zh) with new message keys.
  • Bug Fixes

    • Updated test cases to match new dynamic message formats and fixed minor text inconsistencies.
  • Refactor

    • Replaced static messages with dynamic translations in several components to improve internationalization.

These updates significantly enhance the user experience by providing more informative and localized feedback across various actions and languages.

Copy link

coderabbitai bot commented Jul 6, 2024

Walkthrough

This set of changes focuses on improving internationalization in the project by adding new success, error, and status messages in multiple languages (English, French, Spanish, Hindu, and Chinese). The messages are dynamically used in various components across the application to ensure they align with user-selected language preferences. This update helps address issues where messages were not properly translated.

Changes

Files/Groups Change Summaries
public/locales/**/common.json Added new success messages for item operations: addedSuccessfully, updatedSuccessfully, removedSuccessfully, successfullyUpdated.
public/locales/**/errors.json Added new error message errorOccurredCouldntCreate and fixed minor formatting issues.
public/locales/**/translation.json Added messages for password validation, post visibility, advertisement management, check-ins, and attendee management.
src/components/*/AddOnRegister.tsx, AdvertisementEntry.tsx, AdvertisementRegister.tsx, TableRow.tsx, EventRegistrantsModal.tsx, UserPasswordUpdate.tsx, PostCard.tsx, StartPostModal.tsx, UsersTableItem.tsx, MemberDetail.tsx, AddMember.tsx, Settings.tsx Updated to use dynamic translation messages instead of hardcoded strings for success and error notifications.
src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx, Advertisements/Advertisements.test.tsx, AdvertisementRegister/AdvertisementRegister.test.tsx, CheckIn/TableRow.test.tsx, EventRegistrantsModal.test.tsx, UserPasswordUpdate/UserPasswordUpdate.test.tsx, UserPortal/PostCard/PostCard.test.tsx Updated test cases to match the new dynamically translated messages.

Sequence Diagram(s)

N/A

Assessment against linked issues

Objective (Issue #1579) Addressed Explanation
All notifications must be in the preferred language.
All warnings and errors must appear in the preferred language.
All text must be translated based on user preference.

Poem

Amidst the code and changes vast,
Language barriers now are past.
Success and error, all translated true,
A global embrace in every view.
So code it sings, in tongues anew,
A project enriched, in every hue.
🎉✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

github-actions bot commented Jul 6, 2024

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

@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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 45efc65 and daf2f99.

Files selected for processing (15)
  • public/locales/en/common.json (1 hunks)
  • public/locales/en/errors.json (1 hunks)
  • public/locales/en/translation.json (4 hunks)
  • src/components/AddOn/core/AddOnRegister/AddOnRegister.tsx (1 hunks)
  • src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.tsx (1 hunks)
  • src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.tsx (6 hunks)
  • src/components/CheckIn/TableRow.tsx (3 hunks)
  • src/components/EventRegistrantsModal/EventRegistrantsModal.tsx (5 hunks)
  • src/components/UserPasswordUpdate/UserPasswordUpdate.tsx (2 hunks)
  • src/components/UserPortal/PostCard/PostCard.tsx (2 hunks)
  • src/components/UserPortal/StartPostModal/StartPostModal.tsx (1 hunks)
  • src/components/UsersTableItem/UsersTableItem.tsx (1 hunks)
  • src/screens/MemberDetail/MemberDetail.tsx (1 hunks)
  • src/screens/OrganizationPeople/AddMember.tsx (2 hunks)
  • src/screens/UserPortal/Settings/Settings.tsx (1 hunks)
Files skipped from review due to trivial changes (7)
  • public/locales/en/common.json
  • src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.tsx
  • src/components/UserPasswordUpdate/UserPasswordUpdate.tsx
  • src/components/UserPortal/StartPostModal/StartPostModal.tsx
  • src/components/UsersTableItem/UsersTableItem.tsx
  • src/screens/MemberDetail/MemberDetail.tsx
  • src/screens/UserPortal/Settings/Settings.tsx
Additional comments not posted (22)
public/locales/en/errors.json (1)

9-9: The added error message looks good!

The new error message "errorOccurredCouldntCreate": "An error occurred. Couldn't create {{entity}}" follows the same structure and conventions as the other messages.

src/components/CheckIn/TableRow.tsx (3)

9-9: Translation function imported correctly.

The useTranslation hook from react-i18next is correctly imported to handle translations.


19-19: Translation function usage looks good.

The useTranslation hook is correctly used with the key prefix checkIn.


30-34: Success and error messages translated correctly.

The success and error messages for check-in operations are now using translation keys. This ensures that the messages will be displayed in the user's preferred language.

src/components/EventRegistrantsModal/EventRegistrantsModal.tsx (6)

16-16: Translation function imported correctly.

The useTranslation hook from react-i18next is correctly imported to handle translations.


38-41: Translation function usage looks good.

The useTranslation hook is correctly used with the key prefixes eventRegistrantsModal and common.


47-47: Translation key used correctly for eventId.

The translation key for eventId is correctly used in the query variables.


51-51: Translation key used correctly for orgId.

The translation key for orgId is correctly used in the query variables.


67-71: Success and error messages translated correctly.

The success and error messages for adding and removing attendees are now using translation keys. This ensures that the messages will be displayed in the user's preferred language.


85-89: Success and error messages translated correctly.

The success and error messages for adding and removing attendees are now using translation keys. This ensures that the messages will be displayed in the user's preferred language.

src/components/AddOn/core/AddOnRegister/AddOnRegister.tsx (1)

55-55: Success message translated correctly.

The success message for plugin addition is now using a translation key. This ensures that the message will be displayed in the user's preferred language.

src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.tsx (4)

50-50: LGTM!

The introduction of tErrors to handle error messages is consistent with the PR objectives and follows best practices.


111-111: LGTM!

The error message for end date validation now uses a translation function, ensuring it is displayed in the chosen language.


126-126: LGTM!

The success message for advertisement creation now uses a translation function, ensuring it is displayed in the chosen language.


139-141: LGTM!

The error message for advertisement creation now uses a translation function from the errors namespace, ensuring it is displayed in the chosen language.

src/components/UserPortal/PostCard/PostCard.tsx (2)

217-217: LGTM!

The success message for post update now uses a translation function, ensuring it is displayed in the chosen language.


232-232: LGTM!

The success message for post deletion now uses a translation function, ensuring it is displayed in the chosen language.

src/screens/OrganizationPeople/AddMember.tsx (1)

60-61: LGTM!

The introduction of tCommon and the use of the translation function for member addition success messages ensure that messages are displayed in the chosen language.

Also applies to: 95-95

public/locales/en/translation.json (4)

592-594: LGTM!

The new translations related to user password updates ensure that the messages are displayed in the chosen language.


753-754: LGTM!

The new translations related to posts ensure that the messages are displayed in the chosen language.


863-866: LGTM!

The new translations related to advertisements ensure that the messages are displayed in the chosen language.


961-967: LGTM!

The new translations related to check-ins and event registrants ensure that the messages are displayed in the chosen language.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 6, 2024
Copy link

@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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between daf2f99 and d474051.

Files selected for processing (12)
  • public/locales/fr/common.json (1 hunks)
  • public/locales/fr/errors.json (1 hunks)
  • public/locales/fr/translation.json (4 hunks)
  • public/locales/hi/common.json (1 hunks)
  • public/locales/hi/errors.json (1 hunks)
  • public/locales/hi/translation.json (4 hunks)
  • public/locales/sp/common.json (1 hunks)
  • public/locales/sp/errors.json (1 hunks)
  • public/locales/sp/translation.json (4 hunks)
  • public/locales/zh/common.json (1 hunks)
  • public/locales/zh/errors.json (1 hunks)
  • public/locales/zh/translation.json (4 hunks)
Files skipped from review due to trivial changes (3)
  • public/locales/hi/common.json
  • public/locales/hi/errors.json
  • public/locales/sp/common.json
Additional comments not posted (29)
public/locales/zh/errors.json (1)

9-9: Ensure translation consistency for error messages.

The new translation for the error message "An error occurred. Couldn't create {{entity}}" appears to be correct and consistent with the existing translations.

public/locales/fr/errors.json (1)

9-9: Ensure translation consistency for error messages.

The new translation for the error message "An error occurred. Couldn't create {{entity}}" appears to be correct and consistent with the existing translations.

public/locales/sp/errors.json (1)

9-9: Ensure translation consistency for error messages.

The new translation for the error message "An error occurred. Couldn't create {{entity}}" appears to be correct and consistent with the existing translations.

public/locales/zh/common.json (1)

81-84: Ensure translation consistency for success messages.

The new translations for success messages ("{{item}} added successfully", "{{item}} updated successfully", "{{item}} removed successfully", and "Successfully updated") appear to be correct and consistent with the existing translations.

public/locales/fr/common.json (1)

81-84: LGTM!

The new translations for success messages are correct and consistent with the existing translations.

public/locales/zh/translation.json (4)

597-599: LGTM!

The new translations for password validation messages are correct and consistent with the existing translations.


758-758: LGTM!

The new translation for the post visibility message is correct and consistent with the existing translations.


871-873: LGTM!

The new translations for advertisement messages are correct and consistent with the existing translations.


969-974: LGTM!

The new translations for check-in and event registrant messages are correct and consistent with the existing translations.

public/locales/hi/translation.json (8)

597-597: Translation approved.

The translation for confirmNewPassword is accurate.


598-598: Translation approved.

The translation for passCantBeEmpty is accurate.


599-599: Translation approved.

The translation for passNoMatch is accurate.


758-758: Translation approved.

The translation for postNowVisibleInFeed is accurate.


870-870: Translation approved.

The translation for editAdvertisement is accurate.


871-871: Translation approved.

The translation for advertisementDeleted is accurate.


872-872: Translation approved.

The translation for endDateGreaterOrEqual is accurate.


873-873: Translation approved.

The translation for advertisementCreated is accurate.

public/locales/fr/translation.json (7)

597-597: Translation Approved: "confirmNewPassword"

The translation "Confirmer le nouveau mot de passe" is correct.


598-598: Translation Approved: "passCantBeEmpty"

The translation "Le mot de passe ne peut pas être vide" is correct.


599-599: Translation Approved: "passNoMatch"

The translation "Le nouveau mot de passe et la confirmation du mot de passe ne correspondent pas." is correct.


758-758: Translation Approved: "postNowVisibleInFeed"

The translation "Le post est maintenant visible dans le fil d'actualité" is correct.


871-873: Translations Approved: Advertisement Management and Check-In Functionality

The translations for:

  • "advertisementDeleted": "Publicité supprimée avec succès."
  • "endDateGreaterOrEqual": "La date de fin doit être supérieure ou égale à la date de début"
  • "advertisementCreated": "Publicité créée avec succès."

are all correct.


969-970: Translations Approved: Check-In Functionality

The translations for:

  • "errorCheckingIn": "Erreur lors de l'enregistrement"
  • "checkedInSuccessfully": "Enregistrement réussi"

are both correct.


973-974: Translations Approved: Event Attendee Management

The translations for:

  • "errorAddingAttendee": "Erreur lors de l'ajout du participant"
  • "errorRemovingAttendee": "Erreur lors de la suppression du participant"

are both correct.

public/locales/sp/translation.json (5)

766-767: Ensure translation accuracy.

The translations for password-related messages appear correct:

  • "passCantBeEmpty": "La contraseña no puede estar vacía"
  • "passNoMatch": "La nueva contraseña y la confirmación no coinciden."

961-962: Ensure translation accuracy.

The translation for the post visibility message appears correct:

  • "postNowVisibleInFeed": "La publicación ahora es visible en el feed"

1090-1092: Ensure translation accuracy.

The translations for advertisement-related messages appear correct:

  • "advertisementDeleted": "Anuncio eliminado con éxito."
  • "endDateGreaterOrEqual": "La fecha de finalización debe ser mayor o igual a la fecha de inicio"
  • "advertisementCreated": "Anuncio creado con éxito."

1211-1212: Ensure translation accuracy.

The translations for check-in messages appear correct:

  • "errorCheckingIn": "Error al registrarse"
  • "checkedInSuccessfully": "Registrado con éxito"

1215-1216: Ensure translation accuracy.

The translations for event attendee management messages appear correct:

  • "errorAddingAttendee": "Error al agregar asistente"
  • "errorRemovingAttendee": "Error al eliminar asistente"

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 6, 2024
Copy link

@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: 2

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d474051 and adc106a.

Files selected for processing (8)
  • src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx (1 hunks)
  • src/components/Advertisements/Advertisements.test.tsx (1 hunks)
  • src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.test.tsx (5 hunks)
  • src/components/CheckIn/TableRow.test.tsx (2 hunks)
  • src/components/EventRegistrantsModal/EventRegistrantsModal.test.tsx (4 hunks)
  • src/components/UserPasswordUpdate/UserPasswordUpdate.test.tsx (1 hunks)
  • src/components/UserPortal/PostCard/PostCard.test.tsx (1 hunks)
  • src/components/UserPortal/PostCard/PostCard.tsx (1 hunks)
Files skipped from review due to trivial changes (6)
  • src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx
  • src/components/Advertisements/Advertisements.test.tsx
  • src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.test.tsx
  • src/components/EventRegistrantsModal/EventRegistrantsModal.test.tsx
  • src/components/UserPasswordUpdate/UserPasswordUpdate.test.tsx
  • src/components/UserPortal/PostCard/PostCard.test.tsx
Files skipped from review as they are similar to previous changes (1)
  • src/components/UserPortal/PostCard/PostCard.tsx

src/components/CheckIn/TableRow.test.tsx Show resolved Hide resolved
src/components/CheckIn/TableRow.test.tsx Show resolved Hide resolved
Copy link

codecov bot commented Jul 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.92%. Comparing base (45efc65) to head (adc106a).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2078   +/-   ##
========================================
  Coverage    97.92%   97.92%           
========================================
  Files          232      232           
  Lines         6208     6214    +6     
  Branches      1791     1791           
========================================
+ Hits          6079     6085    +6     
  Misses         118      118           
  Partials        11       11           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

coderabbitai bot commented Jul 6, 2024

Actions performed

Comments resolved and changes approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants