diff --git a/packages/constants/src/index.ts b/packages/constants/src/index.ts index 64f5c222c12..d8733acff6d 100644 --- a/packages/constants/src/index.ts +++ b/packages/constants/src/index.ts @@ -19,6 +19,7 @@ export * from "./stickies"; export * from "./module"; export * from "./project"; export * from "./views"; +export * from "./themes"; export * from "./inbox"; export * from "./profile"; export * from "./workspace-drafts"; diff --git a/web/core/constants/themes.ts b/packages/constants/src/themes.ts similarity index 79% rename from web/core/constants/themes.ts rename to packages/constants/src/themes.ts index dd758481181..84e8c0d0b70 100644 --- a/web/core/constants/themes.ts +++ b/packages/constants/src/themes.ts @@ -1,9 +1,15 @@ -export const THEMES = ["light", "dark", "light-contrast", "dark-contrast", "custom"]; +export const THEMES = [ + "light", + "dark", + "light-contrast", + "dark-contrast", + "custom", +]; export interface I_THEME_OPTION { key: string; value: string; - label: string; + i18n_label: string; type: string; icon: { border: string; @@ -16,7 +22,7 @@ export const THEME_OPTIONS: I_THEME_OPTION[] = [ { key: "system_preference", value: "system", - label: "System preference", + i18n_label: "System preference", type: "light", icon: { border: "#DEE2E6", @@ -27,7 +33,7 @@ export const THEME_OPTIONS: I_THEME_OPTION[] = [ { key: "light", value: "light", - label: "Light", + i18n_label: "Light", type: "light", icon: { border: "#DEE2E6", @@ -38,7 +44,7 @@ export const THEME_OPTIONS: I_THEME_OPTION[] = [ { key: "dark", value: "dark", - label: "Dark", + i18n_label: "Dark", type: "dark", icon: { border: "#2E3234", @@ -49,7 +55,7 @@ export const THEME_OPTIONS: I_THEME_OPTION[] = [ { key: "light_contrast", value: "light-contrast", - label: "Light high contrast", + i18n_label: "Light high contrast", type: "light", icon: { border: "#000000", @@ -60,7 +66,7 @@ export const THEME_OPTIONS: I_THEME_OPTION[] = [ { key: "dark_contrast", value: "dark-contrast", - label: "Dark high contrast", + i18n_label: "Dark high contrast", type: "dark", icon: { border: "#FFFFFF", @@ -71,7 +77,7 @@ export const THEME_OPTIONS: I_THEME_OPTION[] = [ { key: "custom", value: "custom", - label: "Custom theme", + i18n_label: "Custom theme", type: "light", icon: { border: "#FFC9C9", diff --git a/packages/i18n/src/locales/en/translations.json b/packages/i18n/src/locales/en/translations.json index ee4d9360502..84cb127b0bf 100644 --- a/packages/i18n/src/locales/en/translations.json +++ b/packages/i18n/src/locales/en/translations.json @@ -312,7 +312,7 @@ "change_parent_issue": "Change parent issue", "remove_parent_issue": "Remove parent issue", "add_parent": "Add parent", - "loading_members": "Loading members...", + "loading_members": "Loading members...", "view_link_copied_to_clipboard": "View link copied to clipboard.", "required": "Required", "optional": "Optional", @@ -340,7 +340,7 @@ "name": "Name" } }, - + "toast": { "success": "Success!", "error": "Error!" @@ -670,38 +670,38 @@ "workspace_projects": { "network": { - "private": { - "title": "Private", - "description": "Accessible only by invite" - }, - "public": { - "title": "Public", - "description": "Anyone in the workspace except Guests can join" - } - }, - "error": { - "permission": "You don't have permission to perform this action.", - "cycle_delete": "Failed to delete cycle", - "module_delete": "Failed to delete module", - "issue_delete": "Failed to delete issue" - }, - "state": { - "backlog": "Backlog", - "unstarted": "Unstarted", - "started": "Started", - "completed": "Completed", - "cancelled": "Cancelled" - }, - "sort": { - "manual": "Manual", - "name": "Name", - "created_at": "Created date", - "members_length": "Number of members" - }, - "scope": { - "my_projects": "My projects", - "archived_projects": "Archived" + "private": { + "title": "Private", + "description": "Accessible only by invite" }, + "public": { + "title": "Public", + "description": "Anyone in the workspace except Guests can join" + } + }, + "error": { + "permission": "You don't have permission to perform this action.", + "cycle_delete": "Failed to delete cycle", + "module_delete": "Failed to delete module", + "issue_delete": "Failed to delete issue" + }, + "state": { + "backlog": "Backlog", + "unstarted": "Unstarted", + "started": "Started", + "completed": "Completed", + "cancelled": "Cancelled" + }, + "sort": { + "manual": "Manual", + "name": "Name", + "created_at": "Created date", + "members_length": "Number of members" + }, + "scope": { + "my_projects": "My projects", + "archived_projects": "Archived" + }, "common": { "months_count": "{months, plural, one{# month} other{# months}}" }, @@ -1298,6 +1298,41 @@ "created": "Created", "subscribed": "Subscribed" }, + + "home_widgets": { + "empty_state": { + "general": { + "title": "It's Quiet Without Widgets, Turn Them On", + "description": "It looks like all your widgets are turned off. Enable them\nnow to enhance your experience!", + "primary_button": { + "text": "Manage widgets" + } + } + } + }, + + "themes": { + "theme_options": { + "system_preference": { + "label": "System preference" + }, + "light": { + "label": "Light" + }, + "dark": { + "label": "Dark" + }, + "light_contrast": { + "label": "Light high contrast" + }, + "dark_contrast": { + "label": "Dark high contrast" + }, + "custom": { + "label": "Custom theme" + } + } + }, "project_modules": { "status": { "backlog": "Backlog", diff --git a/packages/i18n/src/locales/es/translations.json b/packages/i18n/src/locales/es/translations.json index 67a4a03bcb8..128fad97815 100644 --- a/packages/i18n/src/locales/es/translations.json +++ b/packages/i18n/src/locales/es/translations.json @@ -339,7 +339,7 @@ "name": "Nombre" } }, - + "toast": { "success": "¡Éxito!", "error": "¡Error!" @@ -1300,7 +1300,41 @@ "created": "Creados", "subscribed": "Suscritos" }, - + + "home_widgets": { + "empty_state": { + "general": { + "title": "Está tranquilo sin widgets, actívalos", + "description": "Parece que todos tus widgets están desactivados. ¡Enciéndelos ahora para mejorar tu experiencia!", + "primary_button": { + "text": "Gestionar widgets" + } + } + } + }, + + "themes": { + "theme_options": { + "system_preference": { + "label": "Preferencia del sistema" + }, + "light": { + "label": "Claro" + }, + "dark": { + "label": "Oscuro" + }, + "light_contrast": { + "label": "Alto contraste claro" + }, + "dark_contrast": { + "label": "Alto contraste oscuro" + }, + "custom": { + "label": "Tema personalizado" + } + } + }, "project_modules": { "status": { "backlog": "Pendientes", @@ -1322,6 +1356,6 @@ "due_date": "Fecha de vencimiento", "created_at": "Fecha de creación", "manual": "Manual" - } + } } } diff --git a/packages/i18n/src/locales/fr/translations.json b/packages/i18n/src/locales/fr/translations.json index a79032d4c79..ced42eaf51e 100644 --- a/packages/i18n/src/locales/fr/translations.json +++ b/packages/i18n/src/locales/fr/translations.json @@ -1298,6 +1298,40 @@ "subscribed": "Abonnés" }, + "home_widgets": { + "empty_state": { + "general": { + "title": "C'est calme sans widgets, activez-les", + "description": "Il semble que tous vos widgets soient désactivés. Activez-les maintenant pour améliorer votre expérience !", + "primary_button": { + "text": "Gérer les widgets" + } + } + } + }, + + "themes": { + "theme_options": { + "system_preference": { + "label": "Préférence système" + }, + "light": { + "label": "Clair" + }, + "dark": { + "label": "Sombre" + }, + "light_contrast": { + "label": "Contraste élevé clair" + }, + "dark_contrast": { + "label": "Contraste élevé sombre" + }, + "custom": { + "label": "Thème personnalisé" + } + } + }, "project_modules": { "status": { "backlog": "Backlog", diff --git a/packages/i18n/src/locales/ja/translations.json b/packages/i18n/src/locales/ja/translations.json index 11dc625eb37..0d43c6f3836 100644 --- a/packages/i18n/src/locales/ja/translations.json +++ b/packages/i18n/src/locales/ja/translations.json @@ -340,7 +340,7 @@ "name": "名前" } }, - + "toast": { "success": "成功!", "error": "エラー!" @@ -1207,36 +1207,36 @@ "text": "付箋を追加" } } + } + }, + "toasts": { + "errors": { + "wrong_name": "付箋の名前は100文字を超えることはできません。", + "already_exists": "説明のない付箋がすでに存在します" }, - "toasts": { - "errors": { - "wrong_name": "付箋の名前は100文字を超えることはできません。", - "already_exists": "説明のない付箋がすでに存在します" - }, - "created": { - "title": "付箋が作成されました", - "message": "付箋が正常に作成されました" - }, - "not_created": { - "title": "付箋を作成できません", - "message": "付箋を作成できませんでした" - }, - "updated": { - "title": "付箋が更新されました", - "message": "付箋が正常に更新されました" - }, - "not_updated": { - "title": "付箋を更新できません", - "message": "付箋を更新できませんでした" - }, - "removed": { - "title": "付箋が削除されました", - "message": "付箋が正常に削除されました" - }, - "not_removed": { - "title": "付箋を削除できません", - "message": "付箋を削除できませんでした" - } + "created": { + "title": "付箋が作成されました", + "message": "付箋が正常に作成されました" + }, + "not_created": { + "title": "付箋を作成できません", + "message": "付箋を作成できませんでした" + }, + "updated": { + "title": "付箋が更新されました", + "message": "付箋が正常に更新されました" + }, + "not_updated": { + "title": "付箋を更新できません", + "message": "付箋を更新できませんでした" + }, + "removed": { + "title": "付箋が削除されました", + "message": "付箋が正常に削除されました" + }, + "not_removed": { + "title": "付箋を削除できません", + "message": "付箋を削除できませんでした" } }, @@ -1301,7 +1301,40 @@ "subscribed": "購読済み" }, - + "home_widgets": { + "empty_state": { + "general": { + "title": "ウィジェットがないと静かですね、オンにしましょう", + "description": "すべてのウィジェットがオフになっているようです。 今すぐ有効にして、体験を向上させましょう!", + "primary_button": { + "text": "ウィジェットを管理" + } + } + } + }, + + "themes": { + "theme_options": { + "system_preference": { + "label": "システム設定" + }, + "light": { + "label": "ライト" + }, + "dark": { + "label": "ダーク" + }, + "light_contrast": { + "label": "ライト高コントラスト" + }, + "dark_contrast": { + "label": "ダーク高コントラスト" + }, + "custom": { + "label": "カスタムテーマ" + } + } + }, "project_modules": { "status": { "backlog": "バックログ", @@ -1325,5 +1358,4 @@ "manual": "手動" } } - } diff --git a/packages/i18n/src/locales/zh-CN/translations.json b/packages/i18n/src/locales/zh-CN/translations.json index a1390e99bb4..b7805cabca4 100644 --- a/packages/i18n/src/locales/zh-CN/translations.json +++ b/packages/i18n/src/locales/zh-CN/translations.json @@ -369,7 +369,7 @@ "name": "名称" } }, - + "toast": { "success": "成功!", "error": "错误!" @@ -816,7 +816,6 @@ } }, - "workspace_projects": { "network": { "private": { @@ -898,5 +897,27 @@ "2_weeks": "2周", "custom": "自定义" } - } + }, + "themes": { + "theme_options": { + "system_preference": { + "label": "系统偏好" + }, + "light": { + "label": "明亮" + }, + "dark": { + "label": "暗黑" + }, + "light_contrast": { + "label": "高对比度明亮" + }, + "dark_contrast": { + "label": "高对比度暗黑" + }, + "custom": { + "label": "自定义主题" + } + } + } } diff --git a/web/app/profile/appearance/page.tsx b/web/app/profile/appearance/page.tsx index 5b1a96c5be1..c89bcdf3c33 100644 --- a/web/app/profile/appearance/page.tsx +++ b/web/app/profile/appearance/page.tsx @@ -3,6 +3,8 @@ import { useEffect, useState } from "react"; import { observer } from "mobx-react"; import { useTheme } from "next-themes"; +// plane imports +import { I_THEME_OPTION, THEME_OPTIONS } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IUserTheme } from "@plane/types"; import { setPromiseToast } from "@plane/ui"; @@ -11,7 +13,6 @@ import { LogoSpinner } from "@/components/common"; import { CustomThemeSelector, ThemeSwitch, PageHead } from "@/components/core"; import { ProfileSettingContentHeader, ProfileSettingContentWrapper } from "@/components/profile"; // constants -import { I_THEME_OPTION, THEME_OPTIONS } from "@/constants/themes"; // helpers import { applyTheme, unsetCustomCssVariables } from "@/helpers/theme.helper"; // hooks diff --git a/web/core/components/command-palette/actions/theme-actions.tsx b/web/core/components/command-palette/actions/theme-actions.tsx index 2ae81d3f316..9df95c00a96 100644 --- a/web/core/components/command-palette/actions/theme-actions.tsx +++ b/web/core/components/command-palette/actions/theme-actions.tsx @@ -5,9 +5,10 @@ import { Command } from "cmdk"; import { observer } from "mobx-react"; import { useTheme } from "next-themes"; import { Settings } from "lucide-react"; +// plane imports +import { THEME_OPTIONS } from "@plane/constants"; +import { useTranslation } from "@plane/i18n"; import { TOAST_TYPE, setToast } from "@plane/ui"; -// constants -import { THEME_OPTIONS } from "@/constants/themes"; // hooks import { useUserProfile } from "@/hooks/store"; @@ -20,6 +21,7 @@ export const CommandPaletteThemeActions: FC = observer((props) => { const { setTheme } = useTheme(); // hooks const { updateUserTheme } = useUserProfile(); + const { t } = useTranslation(); // states const [mounted, setMounted] = useState(false); @@ -53,7 +55,7 @@ export const CommandPaletteThemeActions: FC = observer((props) => { >
- {theme.label} + {t(theme.i18n_label)}
))} diff --git a/web/core/components/core/theme/theme-switch.tsx b/web/core/components/core/theme/theme-switch.tsx index 7a188a48aa0..1a188fa03ef 100644 --- a/web/core/components/core/theme/theme-switch.tsx +++ b/web/core/components/core/theme/theme-switch.tsx @@ -1,10 +1,11 @@ "use client"; import { FC } from "react"; +// plane imports +import { I_THEME_OPTION, THEME_OPTIONS } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // constants import { CustomSelect } from "@plane/ui"; -import { THEME_OPTIONS, I_THEME_OPTION } from "@/constants/themes"; // ui type Props = {