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
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 8 additions & 24 deletions web/core/constants/cycle.ts → packages/constants/src/cycle.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
// types
import { TCycleLayoutOptions, TCycleTabOptions } from "@plane/types";

export const CYCLE_TABS_LIST: {
key: TCycleTabOptions;
name: string;
}[] = [
{
key: "active",
name: "Active",
},
{
key: "all",
name: "All",
},
];

export const CYCLE_STATUS: {
label: string;
value: "current" | "upcoming" | "completed" | "draft";
Expand All @@ -24,33 +8,33 @@ export const CYCLE_STATUS: {
bgColor: string;
}[] = [
{
label: "day left",
label: "project_cycles.status.days_left",
Copy link
Member

Choose a reason for hiding this comment

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

We will have to change it to labelTranslationKey and titleTranslationKey respectively.

value: "current",
title: "In progress",
title: "project_cycles.status.in_progress",
color: "#F59E0B",
textColor: "text-amber-500",
bgColor: "bg-amber-50",
},
{
label: "Yet to start",
label: "project_cycles.status.yet_to_start",
value: "upcoming",
title: "Yet to start",
title: "project_cycles.status.yet_to_start",
color: "#3F76FF",
textColor: "text-blue-500",
bgColor: "bg-indigo-50",
},
{
label: "Completed",
label: "project_cycles.status.completed",
value: "completed",
title: "Completed",
title: "project_cycles.status.completed",
color: "#16A34A",
textColor: "text-green-600",
bgColor: "bg-green-50",
},
{
label: "Draft",
label: "project_cycles.status.draft",
value: "draft",
title: "Draft",
title: "project_cycles.status.draft",
color: "#525252",
textColor: "text-custom-text-300",
bgColor: "bg-custom-background-90",
Expand Down
1 change: 1 addition & 0 deletions packages/constants/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export * from "./swr";
export * from "./user";
export * from "./workspace";
export * from "./stickies";
export * from "./cycle";
12 changes: 11 additions & 1 deletion packages/i18n/src/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,15 @@
"change_parent_issue": "Change parent issue",
"remove_parent_issue": "Remove parent issue",
"add_parent": "Add parent",
"loading_members": "Loading members..."
"loading_members": "Loading members...",

"project_cycles": {
"status": {
"days_left": "Days left",
"completed": "Completed",
"yet_to_start": "Yet to start",
"in_progress": "In progress",
"draft": "Draft"
}
}
}
12 changes: 11 additions & 1 deletion packages/i18n/src/locales/es/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,15 @@
"remove_parent_issue": "Eliminar problema padre",
"add_parent": "Agregar padre",
"loading_members": "Cargando miembros...",
"inbox": "bandeja de entrada"
"inbox": "bandeja de entrada",

"project_cycles": {
"status": {
"days_left": "Días restantes",
"completed": "Completado",
"yet_to_start": "Por comenzar",
"in_progress": "En progreso",
"draft": "Borrador"
}
}
Comment on lines +321 to +329
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

}
11 changes: 10 additions & 1 deletion packages/i18n/src/locales/fr/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,14 @@
"remove_parent_issue": "Supprimer le problème parent",
"add_parent": "Ajouter un parent",
"loading_members": "Chargement des membres...",
"inbox": "Boîte de réception"
"inbox": "Boîte de réception",
"project_cycles": {
"status": {
"days_left": "Jours restants",
"completed": "Terminé",
"yet_to_start": "À démarrer",
"in_progress": "En cours",
"draft": "Brouillon"
}
}
}
12 changes: 11 additions & 1 deletion packages/i18n/src/locales/ja/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,15 @@
"remove_parent_issue": "親問題を削除",
"add_parent": "親問題を追加",
"loading_members": "メンバーを読み込んでいます...",
"inbox": "受信箱"
"inbox": "受信箱",

"project_cycles": {
"status": {
"days_left": "残り日数",
"completed": "完了",
"yet_to_start": "未着手",
"in_progress": "進行中",
"draft": "下書き"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import { observer } from "mobx-react";
import { Controller, useForm } from "react-hook-form";
import { ArchiveIcon, ArchiveRestoreIcon, ChevronRight, EllipsisIcon, LinkIcon, Trash2 } from "lucide-react";
// types
import { CYCLE_STATUS } from "@plane/constants";
import { useTranslation } from "@plane/i18n";
import { ICycle } from "@plane/types";
// ui
import { CustomMenu, setToast, TOAST_TYPE } from "@plane/ui";
// components
import { DateRangeDropdown } from "@/components/dropdowns";
// constants
import { CYCLE_STATUS } from "@/constants/cycle";
import { CYCLE_UPDATED } from "@/constants/event-tracker";
// helpers
import { renderFormattedPayloadDate, getDate } from "@/helpers/date-time.helper";
Expand Down Expand Up @@ -53,6 +54,7 @@ export const CycleSidebarHeader: FC<Props> = observer((props) => {
const { allowPermissions } = useUserPermissions();
const { updateCycleDetails, restoreCycle } = useCycle();
const { setTrackElement, captureCycleEvent } = useEventTracker();
const { t } = useTranslation();

// form info
const { control, reset } = useForm({
Expand Down Expand Up @@ -283,7 +285,7 @@ export const CycleSidebarHeader: FC<Props> = observer((props) => {
backgroundColor: `${currentCycle.color}20`,
}}
>
{currentCycle.title}
{t(currentCycle.title)}
</span>
)}
</div>
Expand Down
6 changes: 4 additions & 2 deletions web/core/components/cycles/applied-filters/status.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { observer } from "mobx-react";
import { X } from "lucide-react";
import { CYCLE_STATUS } from "@/constants/cycle";
import { CYCLE_STATUS } from "@plane/constants";
import { useTranslation } from "@plane/i18n";
import { cn } from "@/helpers/common.helper";

type Props = {
Expand All @@ -11,6 +12,7 @@ type Props = {

export const AppliedStatusFilters: React.FC<Props> = observer((props) => {
const { handleRemove, values, editable } = props;
const { t } = useTranslation();

return (
<>
Expand All @@ -25,7 +27,7 @@ export const AppliedStatusFilters: React.FC<Props> = observer((props) => {
statusDetails?.textColor
)}
>
{statusDetails?.title}
{statusDetails && t(statusDetails?.title)}
{editable && (
<button
type="button"
Expand Down
8 changes: 5 additions & 3 deletions web/core/components/cycles/dropdowns/filters/status.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useState } from "react";
import { observer } from "mobx-react";
import { CYCLE_STATUS } from "@plane/constants";
import { useTranslation } from "@plane/i18n";
import { TCycleGroups } from "@plane/types";
// components
import { FilterHeader, FilterOption } from "@/components/issues";
// types
import { CYCLE_STATUS } from "@/constants/cycle";
// constants

type Props = {
Expand All @@ -17,7 +18,8 @@ export const FilterStatus: React.FC<Props> = observer((props) => {
const { appliedFilters, handleUpdate, searchQuery } = props;
// states
const [previewEnabled, setPreviewEnabled] = useState(true);

//hooks
const { t } = useTranslation();
const appliedFiltersCount = appliedFilters?.length ?? 0;
const filteredOptions = CYCLE_STATUS.filter((p) => p.value.includes(searchQuery.toLowerCase()));

Expand All @@ -36,7 +38,7 @@ export const FilterStatus: React.FC<Props> = observer((props) => {
key={status.value}
isChecked={appliedFilters?.includes(status.value) ? true : false}
onClick={() => handleUpdate(status.value)}
title={status.title}
title={t(status.title)}
/>
))
) : (
Expand Down
Loading