-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
chore: ln support workspace projects constants #6429
chore: ln support workspace projects constants #6429
Conversation
Important Review skippedMore than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review. 173 files out of 256 files are above the max files limit of 75. Please upgrade to Pro plan to get higher limits. You can disable this status message by setting the WalkthroughThis pull request introduces a comprehensive internationalization (i18n) effort across the Plane project. The changes primarily focus on centralizing constants, updating import paths, and implementing translation support for various components. The modifications span multiple files, including constants, translation JSON files, and React components, with the goal of enhancing the application's multilingual capabilities by replacing hardcoded strings with translatable keys. Changes
Sequence DiagramsequenceDiagram
participant Constants as @plane/constants
participant I18n as @plane/i18n
participant Component as React Component
Constants-->>I18n: Define translation keys
I18n-->>Component: Provide translation function
Component->>I18n: Request translation
I18n-->>Component: Return translated text
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🔭 Outside diff range comments (4)
web/core/components/project/dropdowns/filters/access.tsx (1)
Line range hint
23-23
: Fix search functionality to work with translated labelsThe current implementation filters options based on the translation key rather than the translated text, which may not provide the expected search experience for users.
- const filteredOptions = NETWORK_CHOICES.filter((a) => a.label.includes(searchQuery.toLowerCase())); + const filteredOptions = NETWORK_CHOICES.filter((a) => + t(a.label).toLowerCase().includes(searchQuery.toLowerCase()) + );web/core/components/cycles/delete-modal.tsx (1)
Line range hint
95-106
: Add translations for modal content.The modal content contains hardcoded English strings that should be translated for consistency with the i18n effort.
content={ <> - {`Are you sure you want to delete ${isEpic ? "epic" : "issue"} `} + {t("cycles.delete_modal.confirmation", { type: isEpic ? t("common.epic") : t("common.issue") })} <span className="break-words font-medium text-custom-text-100"> {projectDetails?.identifier}-{issue?.sequence_id} </span> - {` ? All of the data related to the ${isEpic ? "epic" : "issue"} will be permanently removed. This action cannot be undone.`} + {t("cycles.delete_modal.warning", { type: isEpic ? t("common.epic") : t("common.issue") })} </> }web/core/components/project/dropdowns/order-by.tsx (1)
Line range hint
78-85
: Add translations for sort direction labels.The "Ascending" and "Descending" strings should be translated for consistency.
- Ascending + {t("common.ascending")} {!isOrderingDisabled && !isDescending && <Check className="h-3 w-3" />} </CustomMenu.MenuItem> <CustomMenu.MenuItem className="flex items-center justify-between gap-2" onClick={() => { if (!isDescending) onChange(`-${value}` as TProjectOrderByOptions); }} disabled={isOrderingDisabled} > - Descending + {t("common.descending")}web/core/components/issues/delete-issue-modal.tsx (1)
Line range hint
76-78
: Add translations for success messages.The success toast messages should be translated for consistency with the i18n effort.
setToast({ type: TOAST_TYPE.SUCCESS, - title: "Success!", - message: `${isSubIssue ? "Sub-issue" : isEpic ? "Epic" : "Issue"} deleted successfully`, + title: t("common.success"), + message: t("workspace_projects.issue.delete_success", { + type: isSubIssue ? t("common.sub_issue") : isEpic ? t("common.epic") : t("common.issue") + }), });
🧹 Nitpick comments (15)
web/core/components/project/applied-filters/access.tsx (1)
23-23
: Consider adding fallback for undefined translation keyWhile the null check on
accessDetails
is good, consider adding a fallback in case the translation key is not found.- {accessDetails && t(accessDetails?.label)} + {accessDetails && t(accessDetails.label, accessDetails.label)}web/core/components/project/applied-filters/project-display-filters.tsx (1)
26-26
: Consider adding fallback for undefined translation keySimilar to the access filter component, consider adding a fallback for the translation key.
- {filterLabel && t(filterLabel)} + {filterLabel && t(filterLabel, filterLabel)}web/core/components/project/dropdowns/filters/access.tsx (1)
40-40
: Consider adding fallback for translation keyMaintain consistency with other components by adding a fallback for the translation key.
- title={t(access.label)} + title={t(access.label, access.label)}web/core/components/inbox/modals/delete-issue-modal.tsx (1)
4-5
: Ensure consistent internationalization across all user-facing strings.While error messages are properly internationalized, other strings remain hardcoded:
- Success toast messages
- Modal title
- Modal content
Apply this diff for consistent i18n:
- title: "Success!", - message: `Issue deleted successfully`, + title: t("common.success"), + message: t("inbox.issue_deleted_successfully"), - title="Delete issue" + title={t("inbox.delete_issue")} - Are you sure you want to delete issue + {t("inbox.delete_issue_confirmation")}Also applies to: 25-25, 50-52
web/core/components/modules/delete-module-modal.tsx (1)
7-8
: Maintain consistent internationalization across all strings.Similar to the delete issue modal, several strings remain hardcoded:
- Success toast messages
- Modal title
- Modal content
Apply this diff for consistent i18n:
- title: "Success!", - message: "Module deleted successfully.", + title: t("common.success"), + message: t("modules.delete_success"), - title="Delete module" + title={t("modules.delete_module")} - Are you sure you want to delete module + {t("modules.delete_confirmation")}Also applies to: 34-34, 66-68
web/core/components/issues/workspace-draft/delete-modal.tsx (1)
5-6
: Ensure consistent internationalization across all strings.Similar to other modals, several strings remain hardcoded:
- Success toast messages
- Modal title
- Modal content
Apply this diff for consistent i18n:
- title: "Success!", - message: `draft deleted.`, + title: t("common.success"), + message: t("workspace_draft.delete_success"), - title="Delete draft" + title={t("workspace_draft.delete_draft")} - Are you sure you want to delete this draft? This can't be undone. + {t("workspace_draft.delete_confirmation")}Also applies to: 30-30, 57-59, 80-82
web/core/components/cycles/delete-modal.tsx (1)
64-64
: Improve error message translation handling.The current implementation might lead to inconsistent translation behavior. Consider these improvements:
- Add fallback for missing translations
- Ensure consistent handling between title and message translations
- title: t(currentError.title), - message: currentError.message && t(currentError.message), + title: t(currentError.title, currentError.title), + message: currentError.message ? t(currentError.message, currentError.message) : undefined,Also applies to: 66-66
web/core/components/project/dropdowns/order-by.tsx (1)
39-39
: Remove unnecessary optional chaining after t() function.The translation function already handles undefined values safely, making the optional chaining redundant.
- {orderByDetails && t(orderByDetails?.label)} + {orderByDetails && t(orderByDetails.label)} - {orderByDetails && t(orderByDetails?.label)} + {orderByDetails && t(orderByDetails.label)} - {option && t(option?.label)} + {option && t(option.label)}Also applies to: 45-45, 64-64
web/ce/components/projects/create/attributes.tsx (1)
Line range hint
47-47
: Consider using a more specific translation key namespace.The "select_network" translation key should follow the same namespace pattern as other project-related translations for consistency.
- <span className="text-custom-text-400">{t("select_network")}</span> + <span className="text-custom-text-400">{t("workspace_projects.network.select_network")}</span>web/core/components/issues/delete-issue-modal.tsx (1)
63-66
: Improve error message translation handling.Similar to the delete-modal.tsx, the error message translation handling needs improvement for consistency and fallback handling.
- title: t(PROJECT_ERROR_MESSAGES.permissionError.title), - message: PROJECT_ERROR_MESSAGES.permissionError.message && t(PROJECT_ERROR_MESSAGES.permissionError.message), + title: t(PROJECT_ERROR_MESSAGES.permissionError.title, PROJECT_ERROR_MESSAGES.permissionError.title), + message: PROJECT_ERROR_MESSAGES.permissionError.message + ? t(PROJECT_ERROR_MESSAGES.permissionError.message, PROJECT_ERROR_MESSAGES.permissionError.message) + : undefined,- title: t(currentError.title), - message: currentError.message && t(currentError.message), + title: t(currentError.title, currentError.title), + message: currentError.message + ? t(currentError.message, currentError.message) + : undefined,Also applies to: 88-90
web/ce/components/projects/create/root.tsx (1)
6-6
: Consider translating all user-facing strings.While the import changes look good, there are still hardcoded strings in the component that should use the translation function, such as "Customize time range" and other UI text.
packages/constants/src/project.ts (1)
16-17
: Remove commented-out values.The old values preserved as comments should be removed to maintain clean code.
- description: "workspace_projects.network.private.description", //"Accessible only by invite", + description: "workspace_projects.network.private.description",Also applies to: 22-23
web/core/components/automation/auto-close-automation.tsx (1)
8-9
: LGTM! Consider extending i18n coverage.While the month translation is properly implemented, consider translating remaining hardcoded strings such as:
- "Auto-close issues"
- "Customize time range"
- Other UI text
Also applies to: 32-32, 123-123
packages/i18n/src/locales/es/translations.json (1)
320-357
: Consider refining some Spanish translations for better clarity.While most translations are good, consider these improvements:
- "Pendientes" for "backlog" might be clearer as "Lista de pendientes" or "Backlog" (commonly used in Spanish tech).
- "Sin comenzar" could be "No iniciado" to match the more formal tone used elsewhere.
- The error messages could be more specific, e.g., "Error al eliminar la incidencia" could be "No se pudo eliminar la incidencia".
packages/i18n/src/locales/fr/translations.json (1)
320-357
: Consider refining some French translations for better clarity and consistency.While most translations are good, consider these improvements:
- "Backlog" (line 338) is kept in English - consider using "Carnet" or "En attente" for better localization.
- The error messages could be more idiomatic, e.g., "Échec de la suppression" could be "Impossible de supprimer".
- Consider adding spaces before colons and semicolons as per French typography rules.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (25)
packages/constants/src/index.ts
(1 hunks)packages/constants/src/project.ts
(4 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)packages/i18n/src/locales/zh-CN/translations.json
(1 hunks)web/app/[workspaceSlug]/(projects)/profile/[userId]/page.tsx
(2 hunks)web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/settings/page.tsx
(0 hunks)web/ce/components/projects/create/attributes.tsx
(3 hunks)web/ce/components/projects/create/root.tsx
(1 hunks)web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx
(3 hunks)web/core/components/automation/auto-archive-automation.tsx
(3 hunks)web/core/components/automation/auto-close-automation.tsx
(3 hunks)web/core/components/cycles/delete-modal.tsx
(3 hunks)web/core/components/inbox/modals/delete-issue-modal.tsx
(3 hunks)web/core/components/issues/delete-issue-modal.tsx
(4 hunks)web/core/components/issues/workspace-draft/delete-modal.tsx
(4 hunks)web/core/components/modules/delete-module-modal.tsx
(3 hunks)web/core/components/project/applied-filters/access.tsx
(2 hunks)web/core/components/project/applied-filters/project-display-filters.tsx
(2 hunks)web/core/components/project/dropdowns/filters/access.tsx
(3 hunks)web/core/components/project/dropdowns/order-by.tsx
(4 hunks)web/core/components/project/form.tsx
(4 hunks)web/core/components/stickies/layout/stickies-list.tsx
(1 hunks)
💤 Files with no reviewable changes (1)
- web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/settings/page.tsx
✅ Files skipped from review due to trivial changes (1)
- web/core/components/stickies/layout/stickies-list.tsx
🔇 Additional comments (16)
packages/constants/src/index.ts (1)
17-17
: LGTM: Export addition follows consistent patternThe new export follows the established pattern in the file and maintains consistency with other module exports.
web/core/components/project/applied-filters/access.tsx (1)
4-5
: LGTM: Import updates align with centralization effortThe import path changes correctly align with the effort to centralize constants.
web/core/components/project/applied-filters/project-display-filters.tsx (1)
5-6
: LGTM: Import changes maintain consistencyThe import changes follow the same pattern as other components, maintaining consistency across the codebase.
web/core/components/project/dropdowns/filters/access.tsx (1)
4-6
: LGTM: Import changes follow established patternThe import changes maintain consistency with other components.
web/app/[workspaceSlug]/(projects)/profile/[userId]/page.tsx (2)
6-7
: LGTM! Import changes and hook setup look good.The migration of constants to @plane/constants and addition of i18n support is well-structured.
Also applies to: 29-29
37-37
: Verify translation key existence and maintain consistent state grouping.The state distribution logic now depends on translated strings for grouping. This could lead to runtime issues if:
- Translation keys are missing
- Translations affect the grouping logic
Run this script to verify the translation keys exist:
Also applies to: 40-40
✅ Verification successful
Translation keys exist and state grouping is consistent
The code is safe because:
- All state group translations are properly defined in translations.json under
workspace_projects.state
- The code uses optional chaining and find() to handle potential missing translations gracefully
- State groups are consistently defined and used across the codebase
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if all GROUP_CHOICES keys have corresponding translations ast-grep --pattern 'GROUP_CHOICES = { $$$ }' | while read -r line; do keys=$(echo "$line" | grep -o '"[^"]*"' | tr -d '"') for key in $keys; do rg "\"$key\":" packages/i18n/src/locales/ done doneLength of output: 63
Script:
#!/bin/bash # First, find the GROUP_CHOICES definition echo "=== Finding GROUP_CHOICES definition ===" rg "GROUP_CHOICES.*=.*{" -A 10 # Also search for any state group related constants echo -e "\n=== Finding state group related code ===" rg "state_group|stateGroup" -t typescript # Check translation files structure echo -e "\n=== Checking translation files structure ===" fd . packages/i18n/src/locales/ -t fLength of output: 783
Script:
#!/bin/bash # Find GROUP_CHOICES with simpler pattern echo "=== Finding GROUP_CHOICES definition ===" rg "GROUP_CHOICES" -l # Search state_group with correct extension echo -e "\n=== Finding state group related code ===" rg "state_group|stateGroup" --type-add 'ts:*.{ts,tsx}' -t ts # Check English translations content echo -e "\n=== Checking English translations ===" cat packages/i18n/src/locales/en/translations.json | jq .Length of output: 35590
web/core/components/automation/auto-archive-automation.tsx (1)
7-8
: LGTM! Well-implemented i18n support.The internationalization changes are properly implemented:
- Correct import of translation hook and constants
- Proper usage of translation function with parameters
Also applies to: 31-31, 96-96
packages/constants/src/project.ts (1)
37-41
: Verify translation parameter usage.All month entries use the same translation key "common.months_count". Ensure that the translation files properly handle the
month
parameter for different values.✅ Verification successful
Translation parameter usage is correctly implemented ✅
The translation key "common.months_count" is properly defined with ICU MessageFormat plural support:
{months, plural, one{# month} other{# months}}
. This will correctly handle all the month values (1, 3, 6, 9, 12) with appropriate singular/plural forms.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if translation files handle the month parameter rg -l "common.months_count" packages/i18n/src/locales/Length of output: 54
Script:
#!/bin/bash # Find translation-related files and directories fd -t f -e json -e yaml -e yml . | grep -i "locale\|i18n\|translation" # Search for any files containing "months" related translations rg -l "months?" --type=json --type=yaml --type=yml # Look for i18n setup/config files fd -t f . | grep -i "i18n"Length of output: 1123
Script:
#!/bin/bash # Check translation files content cat packages/i18n/src/locales/en/translations.json | grep -A 2 -B 2 "months_count" # Look for parameter handling in translation types cat packages/i18n/src/types/translation.ts # Search for actual usage of the translation key rg "common\.months_count" -A 2 -B 2Length of output: 1000
web/core/components/project/form.tsx (3)
6-7
: LGTM! Import changes align with centralization effort.The imports have been properly updated to use centralized constants and i18n support.
211-211
: LGTM! Network label properly internationalized.The network label is now correctly using the translation function.
350-350
: LGTM! Network selection label properly internationalized.The network selection label is now correctly using the translation function.
web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx (2)
4-5
: LGTM! Import changes align with centralization effort.The imports have been properly updated to use centralized constants and i18n support.
96-96
: LGTM! Network label properly internationalized.The network label is now correctly using the translation function with proper null handling.
packages/i18n/src/locales/zh-CN/translations.json (1)
319-356
: LGTM! Well-structured Chinese translations.The translations are properly organized and include all necessary keys for the workspace projects feature. The Chinese characters are appropriate and maintain consistency with the existing translations.
packages/i18n/src/locales/ja/translations.json (1)
319-357
: LGTM! Well-structured Japanese translations.The translations are properly organized and include all necessary keys for the workspace projects feature. The Japanese characters are appropriate and maintain consistency with the existing translations.
packages/i18n/src/locales/en/translations.json (1)
321-358
: Well-structured workspace project translations!The new
workspace_projects
section is well-organized with logical groupings and clear, user-friendly messages. The pluralization rule for months is properly implemented.
There was a problem hiding this 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 (4)
web/core/components/cycles/delete-modal.tsx (1)
64-66
: Consider improving type safety for error messages.While the implementation works, the runtime check for
i18n_message
existence could be handled through TypeScript types.Consider defining a type for error messages:
interface ErrorMessage { i18n_title: string; i18n_message?: string; }Then use it in PROJECT_ERROR_MESSAGES:
const PROJECT_ERROR_MESSAGES: Record<string, ErrorMessage> = { permissionError: { i18n_title: "workspace_projects.error.permission" }, // ... other messages };web/core/components/issues/delete-issue-modal.tsx (1)
63-66
: Consider extracting common error handling logic.The error handling logic is duplicated across multiple modal components. This could be extracted into a shared utility.
Consider creating a shared utility:
// utils/error-handling.ts export const handleErrorToast = (t: TFunction, error: typeof PROJECT_ERROR_MESSAGES[keyof typeof PROJECT_ERROR_MESSAGES]) => { setToast({ title: t(error.i18n_title), type: TOAST_TYPE.ERROR, message: error.i18n_message && t(error.i18n_message), }); };Then use it in both components:
handleErrorToast(t, currentError);Also applies to: 89-91
web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx (1)
96-96
: Improve readability of network label access.The current implementation uses multiple optional chaining operators, making it harder to read.
Consider breaking down the operation:
const networkChoice = NETWORK_CHOICES.find((n) => n.key === projectDetails?.network); const networkLabel = networkChoice?.i18n_label ?? ""; return <span>{t(networkLabel)}</span>;packages/constants/src/project.ts (1)
52-56
: Differentiate month labels for better translation support.All entries in PROJECT_AUTOMATION_MONTHS use the same i18n_label key. This might limit translation flexibility for different month counts.
Consider using unique keys:
export const PROJECT_AUTOMATION_MONTHS = [ { i18n_label: "common.months_count.one", value: 1 }, { i18n_label: "common.months_count.three", value: 3 }, { i18n_label: "common.months_count.six", value: 6 }, { i18n_label: "common.months_count.nine", value: 9 }, { i18n_label: "common.months_count.twelve", value: 12 }, ];
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
packages/constants/src/project.ts
(2 hunks)web/app/[workspaceSlug]/(projects)/profile/[userId]/page.tsx
(2 hunks)web/ce/components/projects/create/attributes.tsx
(3 hunks)web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx
(3 hunks)web/core/components/automation/auto-archive-automation.tsx
(3 hunks)web/core/components/automation/auto-close-automation.tsx
(3 hunks)web/core/components/cycles/delete-modal.tsx
(3 hunks)web/core/components/inbox/modals/delete-issue-modal.tsx
(3 hunks)web/core/components/issues/delete-issue-modal.tsx
(4 hunks)web/core/components/issues/workspace-draft/delete-modal.tsx
(4 hunks)web/core/components/modules/delete-module-modal.tsx
(3 hunks)web/core/components/project/applied-filters/access.tsx
(2 hunks)web/core/components/project/applied-filters/project-display-filters.tsx
(2 hunks)web/core/components/project/dropdowns/filters/access.tsx
(3 hunks)web/core/components/project/dropdowns/order-by.tsx
(4 hunks)web/core/components/project/form.tsx
(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
- web/core/components/project/applied-filters/access.tsx
- web/core/components/automation/auto-archive-automation.tsx
- web/core/components/inbox/modals/delete-issue-modal.tsx
- web/ce/components/projects/create/attributes.tsx
- web/app/[workspaceSlug]/(projects)/profile/[userId]/page.tsx
- web/core/components/project/dropdowns/filters/access.tsx
- web/core/components/modules/delete-module-modal.tsx
- web/core/components/project/dropdowns/order-by.tsx
- web/core/components/project/form.tsx
- web/core/components/automation/auto-close-automation.tsx
- web/core/components/issues/workspace-draft/delete-modal.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (2)
web/core/components/project/applied-filters/project-display-filters.tsx (1)
5-6
: LGTM! Clean internationalization implementation.The changes correctly implement i18n support by:
- Using the centralized constants from @plane/constants
- Properly implementing the useTranslation hook
- Safely accessing and translating the i18n_label
Also applies to: 18-18, 23-23, 26-26
packages/constants/src/project.ts (1)
115-117
: Consider adding i18n_message for permission errors.The permissionError object lacks an i18n_message while other error types have one. This inconsistency might affect error handling.
Let's check if permission errors need specific messages:
…plane into chore-ln-workspace-projects
2f56caa
into
feat-language-support
Description
Type of Change
Screenshots and Media (if applicable)
Test Scenarios
References
Summary by CodeRabbit
Release Notes
Internationalization
Constants Refactoring
@plane/constants
package.Localization Improvements
Supported Languages
These changes improve the application's internationalization capabilities and provide a more consistent approach to managing project-related constants.