From 18049bc1d6b1a97571673b861931c0708fe73227 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Thu, 29 Jan 2026 15:16:12 +0100 Subject: [PATCH] refactor: update i18n keys to match effectiveReason values (#27381) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../hooks/useTeamFeatureOptIn.ts | 2 +- .../hooks/useUserFeatureOptIn.ts | 24 ++++++++----------- apps/web/public/static/locales/en/common.json | 9 +++---- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/apps/web/modules/feature-opt-in/hooks/useTeamFeatureOptIn.ts b/apps/web/modules/feature-opt-in/hooks/useTeamFeatureOptIn.ts index cc4650ba67..548fc89c33 100644 --- a/apps/web/modules/feature-opt-in/hooks/useTeamFeatureOptIn.ts +++ b/apps/web/modules/feature-opt-in/hooks/useTeamFeatureOptIn.ts @@ -55,7 +55,7 @@ function createTeamBlockedWarningFn( return (feature: NormalizedFeature): string | null => { const blockingState = blockingStateMap.get(feature.slug); if (blockingState?.orgState === "disabled") { - return t("feature_blocked_by_org_warning"); + return t("feature_org_disabled"); } return null; }; diff --git a/apps/web/modules/feature-opt-in/hooks/useUserFeatureOptIn.ts b/apps/web/modules/feature-opt-in/hooks/useUserFeatureOptIn.ts index 7f899d3b84..f4e1ee5ad7 100644 --- a/apps/web/modules/feature-opt-in/hooks/useUserFeatureOptIn.ts +++ b/apps/web/modules/feature-opt-in/hooks/useUserFeatureOptIn.ts @@ -41,22 +41,18 @@ function normalizeUserFeatures(data: UserFeatureData[] | undefined): NormalizedF })); } +const WARNING_REASONS: Set = new Set([ + "feature_org_disabled", + "feature_all_teams_disabled", + "feature_any_team_disabled", + "feature_no_explicit_enablement", + "feature_user_only_not_allowed", +]); + function createUserBlockedWarningFn(t: TFunction): (feature: NormalizedFeature) => string | null { return (feature: NormalizedFeature): string | null => { - if (!feature.effectiveReason) return null; - switch (feature.effectiveReason) { - case "feature_org_disabled": - return t("feature_blocked_by_org_warning"); - case "feature_all_teams_disabled": - case "feature_any_team_disabled": - return t("feature_blocked_by_team_warning"); - case "feature_no_explicit_enablement": - return t("feature_no_explicit_enablement_warning"); - case "feature_user_only_not_allowed": - return t("feature_user_only_not_allowed_warning"); - default: - return null; - } + if (!feature.effectiveReason || !WARNING_REASONS.has(feature.effectiveReason)) return null; + return t(feature.effectiveReason); }; } diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 6ddc5fc9ef..df04761628 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -4502,10 +4502,11 @@ "auto_opt_in_experimental_description_personal": "Automatically opt into new experimental features, unless disabled by your team or organization", "auto_opt_in_experimental_description_team": "Automatically opt team members into new experimental features, unless configured by the organization or opted out by members", "auto_opt_in_experimental_description_org": "Automatically opt organization members into new experimental features, unless configured at team or user level", - "feature_blocked_by_team_warning": "This feature is disabled by your team.", - "feature_blocked_by_org_warning": "This feature is disabled by your organization.", - "feature_no_explicit_enablement_warning": "Turn it on for yourself, or ask your team or organization admin to enable it for everyone.", - "feature_user_only_not_allowed_warning": "This feature needs approval from your team or organization.", + "feature_org_disabled": "This feature is disabled by your organization.", + "feature_all_teams_disabled": "This feature is disabled by your team.", + "feature_any_team_disabled": "This feature is disabled by your team.", + "feature_no_explicit_enablement": "Turn it on for yourself, or ask your team or organization admin to enable it for everyone.", + "feature_user_only_not_allowed": "This feature needs approval from your team or organization.", "no_opt_in_features_available": "No opt-in features are currently available", "enabled_via_auto_opt_in": "Enabled via auto opt-in", "account_already_exists_please_login": "An account with this email already exists. Please log in to accept the invitation.",