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

[WEB-3173] chore: language support for cycles constant file #6415

Open
wants to merge 3 commits into
base: preview
Choose a base branch
from

Conversation

gakshita
Copy link
Collaborator

@gakshita gakshita commented Jan 17, 2025

Summary

This PR moved the Cycles constants file to package and resolved title based on language selected

Summary by CodeRabbit

  • Localization

    • Added localization support for project cycle statuses in English, Spanish, French, and Japanese
    • Updated cycle status labels to use translation keys
    • Removed hardcoded status text in multiple components
  • Constants

    • Removed CYCLE_TABS_LIST constant
    • Updated import paths for cycle-related constants

Copy link

makeplane bot commented Jan 17, 2025

Pull Request Linked with Plane Issues

Comment Automatically Generated by Plane

Copy link
Contributor

coderabbitai bot commented Jan 17, 2025

Warning

Rate limit exceeded

@gakshita has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7bae987 and a7ff59d.

📒 Files selected for processing (3)
  • packages/i18n/src/locales/zh-CN/translations.json (1 hunks)
  • web/core/components/stickies/layout/stickies-list.tsx (1 hunks)
  • web/core/constants/empty-state.tsx (1 hunks)

Walkthrough

This pull request focuses on enhancing the localization of cycle-related constants and components. The changes involve removing the CYCLE_TABS_LIST constant, updating the CYCLE_STATUS constant with localization keys, and modifying several components to use translation hooks. The modifications span across constants, localization files for multiple languages (English, Spanish, French, Japanese), and React components related to cycle management. The primary goal is to standardize and improve the internationalization of cycle status representations.

Changes

File Change Summary
packages/constants/src/cycle.ts Removed CYCLE_TABS_LIST constant, updated CYCLE_STATUS with localization keys
packages/constants/src/index.ts Added export for cycle module
packages/i18n/src/locales/*/translations.json Added project_cycles.status translations for multiple languages
web/core/components/cycles/*/sidebar-header.tsx Updated imports and added translation for cycle titles
web/core/components/cycles/applied-filters/status.tsx Updated imports and added translation for status titles
web/core/components/cycles/dropdowns/filters/status.tsx Updated imports and added translation for status titles

Sequence Diagram

sequenceDiagram
    participant Constants as Cycle Constants
    participant Locales as Translation Files
    participant Component as React Components
    
    Constants->>Locales: Define Localization Keys
    Locales-->>Component: Provide Translations
    Component->>Component: Use Translation Hook
    Component-->>User: Render Localized Text
Loading

Possibly related PRs

Suggested labels

🧹chore, 🌐frontend, 🌟improvement

Suggested reviewers

  • SatishGandham
  • sriramveeraghanta

Poem

🐰 Localization Hop! 🌍

Constants dance, translations sing,
Cycle statuses take wing!
From draft to done, in every tongue,
A multilingual song is sung!
Code hops with joy, borders fall away! 🚀


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
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: 1

🧹 Nitpick comments (4)
packages/constants/src/cycle.ts (1)

Line range hint 1-42: Consider adding type safety for translation keys

To prevent typos and ensure type safety, consider defining an interface or type for the translation keys.

interface CycleTranslationKeys {
  label: keyof typeof translations.project_cycles.status;
  title: keyof typeof translations.project_cycles.status;
  // ... other properties
}

export const CYCLE_STATUS: CycleTranslationKeys[] = [
  // ... existing array
];
web/core/components/cycles/applied-filters/status.tsx (1)

30-30: Simplify the conditional rendering

The optional chaining is redundant since we're already checking for statusDetails in the condition.

-            {statusDetails && t(statusDetails?.title)}
+            {statusDetails && t(statusDetails.title)}
web/core/components/cycles/dropdowns/filters/status.tsx (2)

9-10: Remove empty comments section

The commented line "// types" followed by "// constants" appears to be unused and can be removed.

- // types
- // constants

21-22: Improve comment formatting

The comment formatting is inconsistent. Consider using a single line for the hooks section.

-  //hooks
-  const { t } = useTranslation();
+  // hooks
+  const { t } = useTranslation();
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 95f43a7 and 7bae987.

📒 Files selected for processing (9)
  • packages/constants/src/cycle.ts (1 hunks)
  • packages/constants/src/index.ts (1 hunks)
  • packages/i18n/src/locales/en/translations.json (1 hunks)
  • packages/i18n/src/locales/es/translations.json (1 hunks)
  • packages/i18n/src/locales/fr/translations.json (1 hunks)
  • packages/i18n/src/locales/ja/translations.json (1 hunks)
  • web/core/components/cycles/analytics-sidebar/sidebar-header.tsx (3 hunks)
  • web/core/components/cycles/applied-filters/status.tsx (3 hunks)
  • web/core/components/cycles/dropdowns/filters/status.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (9)
packages/constants/src/index.ts (1)

17-17: LGTM! Export follows consistent pattern

The new cycle export follows the existing barrel file pattern and maintains alphabetical ordering.

packages/constants/src/cycle.ts (1)

11-13: Verify translation keys exist in all language files

The status labels and titles now use translation keys. Please ensure these keys exist in all language files:

  • project_cycles.status.days_left
  • project_cycles.status.in_progress
  • project_cycles.status.yet_to_start
  • project_cycles.status.completed
  • project_cycles.status.draft

Also applies to: 19-21, 27-29, 35-37

✅ Verification successful

All translation keys are properly configured

All required translation keys exist and are properly translated in English, Spanish, French, and Japanese locales.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if all required translation keys exist in all language files
for key in "days_left" "in_progress" "yet_to_start" "completed" "draft"; do
  echo "Checking key: project_cycles.status.$key"
  for locale in en es fr ja; do
    if [ -f "packages/i18n/src/locales/$locale/translations.json" ]; then
      echo "In $locale:"
      jq ".project_cycles.status.$key" "packages/i18n/src/locales/$locale/translations.json"
    fi
  done
done

Length of output: 5024

web/core/components/cycles/applied-filters/status.tsx (1)

3-4: LGTM! Import changes align with package structure

The imports have been correctly updated to use the new package-based constants and i18n hook.

web/core/components/cycles/dropdowns/filters/status.tsx (1)

3-4: LGTM! Import changes match other components

The imports have been correctly updated to use the package-based constants and i18n hook, maintaining consistency with other components.

web/core/components/cycles/analytics-sidebar/sidebar-header.tsx (1)

8-9: LGTM! Proper implementation of i18n support.

The changes correctly implement internationalization by:

  1. Importing required dependencies from @plane/constants and @plane/i18n
  2. Using the translation hook to render the cycle title

Also applies to: 288-288

packages/i18n/src/locales/en/translations.json (1)

321-329: LGTM! Well-structured translations for cycle status.

The English translations are clear, consistent, and follow i18n best practices.

packages/i18n/src/locales/ja/translations.json (1)

321-329: LGTM! Consistent Japanese translations for cycle status.

The Japanese translations maintain structural consistency with other language files while providing culturally appropriate translations.

packages/i18n/src/locales/es/translations.json (1)

321-329: LGTM! Well-localized Spanish translations for cycle status.

The Spanish translations maintain consistency with other language files while providing grammatically correct and culturally appropriate translations.

packages/i18n/src/locales/fr/translations.json (1)

319-328: LGTM! French translations are accurate and well-structured.

The translations for project cycle statuses are grammatically correct and maintain proper French language conventions. The hierarchical structure with the parent key "project_cycles" is also well-organized.

Comment on lines +321 to +329
"project_cycles": {
"status": {
"days_left": "Días restantes",
"completed": "Completado",
"yet_to_start": "Por comenzar",
"in_progress": "En progreso",
"draft": "Borrador"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Missing required translations in Chinese locale file

The project_cycles.status section is completely missing in packages/i18n/src/locales/zh-CN/translations.json. Please add the following structure with appropriate Chinese translations:

  • project_cycles.status.days_left
  • project_cycles.status.completed
  • project_cycles.status.yet_to_start
  • project_cycles.status.in_progress
  • project_cycles.status.draft
🔗 Analysis chain

Verify translation key consistency across language files.

Let's ensure all required translation keys are present in all language files.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistency of project_cycles.status keys across language files

# List all translation files
translation_files=$(fd translations.json packages/i18n/src/locales)

# Check for required keys in each file
for file in $translation_files; do
  echo "Checking $file..."
  jq -e '.project_cycles.status | has("days_left") and has("completed") and has("yet_to_start") and has("in_progress") and has("draft")' "$file"
done

Length of output: 2064


Script:

#!/bin/bash
# Show the actual content of project_cycles.status in zh-CN translations
echo "Content of zh-CN translations:"
jq '.project_cycles.status' packages/i18n/src/locales/zh-CN/translations.json

Length of output: 153


Script:

#!/bin/bash
# Check if project_cycles exists and show its structure
echo "Structure of project_cycles in zh-CN:"
jq '.project_cycles' packages/i18n/src/locales/zh-CN/translations.json

Length of output: 160

@pushya22 pushya22 changed the title chore: ln support for cycles constant file chore: language support for cycles constant file Jan 17, 2025
@gakshita gakshita changed the title chore: language support for cycles constant file [WEB-3173] chore: language support for cycles constant file Jan 17, 2025
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.

1 participant