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

Fixes: Translations Are Not Correctly Tested in Our PR Workflow #2263

Conversation

Nandika-A
Copy link

@Nandika-A Nandika-A commented Sep 11, 2024

What kind of change does this PR introduce?

Issue Number:

Fixes #2260

Did you add tests for your changes?
No

Snapshots/Videos:

image

If relevant, did you update the documentation?
No

Summary

  1. Modified compare_translations.py to handle nested JSON objects correctly. The previous implementation only compared top-level keys, causing issues with missing or extra keys in nested structures.
  2. Added the function "flatten_json" to recursively compare keys for nested json.
  3. Error messages now show the full key path using dot notation .

Does this PR introduce a breaking change?
No

Other information

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • New Features

    • Introduced a function to flatten nested JSON objects, improving data usability.
    • Updated translation loading to return flattened data for easier handling.
    • Expanded localization capabilities with numerous new key-value pairs in English, Hindi, Chinese, French, and Spanish, enhancing user experience across various functionalities.
  • Bug Fixes

    • Adjusted the default directory path for translation files to ensure correct file access.

Copy link

coderabbitai bot commented Sep 11, 2024

Walkthrough

The pull request introduces a new function, flatten_json, to flatten nested JSON objects, enhancing the handling of translation data. The load_translation function is modified to return a flattened dictionary instead of the original. Additionally, the default directory path for translation files is updated from "locales" to "public/locales", affecting the file retrieval process during execution. Several new translations are added across multiple languages, improving the application's multilingual support.

Changes

Files Change Summary
src/github/workflows/compare_translations.py Added flatten_json function for flattening nested JSON; modified load_translation to return a flattened dictionary; updated default directory path in main function.
public/locales/en/translation.json Added numerous new key-value pairs for user interface strings related to authentication and organization management.
public/locales/hi/translation.json Added new key-value pairs for user roles and chat functionality.
public/locales/zh/translation.json Enhanced translations for user interface elements related to login and organization management.
public/locales/fr/translation.json Added new translations for user authentication and management, improving usability.
public/locales/sp/translation.json Introduced new translations and modified existing ones related to advertisements and user management.

Assessment against linked issues

Objective Addressed Explanation
Ensure translations are correctly tested during PR workflow (#2260)
Ensure all translations are present for non-default languages (#2260) The PR does not guarantee completeness of translations.

Possibly related PRs

Poem

In the burrow where translations play,
A flattening function brightens the day.
With paths now clear, the files align,
Ensuring our words in every design.
Hop, hop, hooray for changes so fine! 🐇✨


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 generate interesting stats about this repository and render them as a table.
    -- @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 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.

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

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

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 11, 2024
pranshugupta54
pranshugupta54 previously approved these changes Sep 13, 2024
Copy link
Member

@pranshugupta54 pranshugupta54 left a comment

Choose a reason for hiding this comment

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

LGTM

@pranshugupta54
Copy link
Member

Created a separate issue to sync the translations.

Copy link
Contributor

@palisadoes palisadoes left a comment

Choose a reason for hiding this comment

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

Please add the missing translations in this PR or else all new PRs will fail

@Nandika-A
Copy link
Author

Please add the missing translations in this PR or else all new PRs will fail

Okay sure

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 13, 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: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c093346 and 82f83cd.

Files selected for processing (1)
  • public/locales/en/translation.json (38 hunks)
Additional comments not posted (7)
public/locales/en/translation.json (7)

26-43: The additions to the "loginPage" section look good!

The new key-value pairs follow a consistent naming convention, have appropriate values, and align well with the context of the login page.


88-91: The additions to the "listNavbar" section are appropriate.

The new key-value pairs in the "listNavbar" section have concise and descriptive keys, and the values are suitable for navigation items.


96-100: The additions to the "leftDrawer" section look good.

The new key-value pairs in the "leftDrawer" section have clear and contextual keys, and the values are appropriate for menu items in a left drawer.


119-125: The additions to the "leftDrawerOrg" section are appropriate.

The new key-value pairs in the "leftDrawerOrg" section have contextual keys related to organization-specific items, and the values are suitable for their respective purposes.


155-167: The additions to the "orgList" section look good.

The new key-value pairs in the "orgList" section have descriptive keys that provide clear context for organization list-related functionalities. The values are appropriate and align well with their respective keys.


171-173: The additions to the "orgListCard" section are appropriate.

The new key-value pairs in the "orgListCard" section have concise and descriptive keys, and the values are suitable for their respective purposes.


Line range hint 1-1156: Overall, the additions to the translation file look good!

The new key-value pairs added across different sections of the file follow consistent naming conventions, have appropriate values, and align well with their respective contexts. The changes enhance the localization capabilities of the application.

Just one suggestion: Consider merging the "loginPage" and "userLoginPage" sections to avoid duplication and maintain consistency.

Great job with the translations!

public/locales/en/translation.json Show resolved Hide resolved
@palisadoes
Copy link
Contributor

  1. Please fix the failing tests. The translation check either isn't working correctly or you have missing translations.
  2. We cannot merge this PR until the checks are fixed or else all other PRs will fail before the code base is tested.

codecov.SHA256SUM Outdated Show resolved Hide resolved
src/screens/OrganizationPeople/AddMember.tsx Outdated Show resolved Hide resolved
@Nandika-A
Copy link
Author

Hi @palisadoes ! I have made all the changes, could you please review them?

@palisadoes palisadoes merged commit e143243 into PalisadoesFoundation:develop Sep 17, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sync translations Translations Are Not Correctly Tested in Our PR Workflow
3 participants