Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 21 additions & 1 deletion apps/app/src/components/status-policies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ const STATUS_COLORS: Record<StatusType, string> = {
"not-relevant": "#ff0000",
} as const;

// Map status types to translation keys
const getStatusTranslation = (status: StatusType, t: ReturnType<typeof useI18n>) => {
switch (status) {
case "draft":
return t("policies.status.draft");
case "published":
return t("policies.status.published");
case "archived":
return t("policies.status.archived");
case "needs_review":
return t("policies.status.needs_review");
case "relevant":
return t("policies.status.relevant");
case "not-relevant":
return t("policies.status.not-relevant");
default:
return status;
}
};

export function StatusPolicies({
status,
className,
Expand All @@ -38,7 +58,7 @@ export function StatusPolicies({
className={cn("size-2.5")}
style={{ backgroundColor: STATUS_COLORS[status] ?? " " }}
/>
{withLabel ? t(`policies.status.${status}`) : null}
{withLabel ? getStatusTranslation(status, t) : null}
</div>
);
}
21 changes: 21 additions & 0 deletions apps/app/src/locales/analyze-locale-usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ const SEARCH_DIRECTORIES = ['./src', './../portal/src']
// Always exclude node_modules from search
const EXCLUDE_DIR = '--exclude-dir=node_modules'

// Keys to exclude from unused check
// Supports wildcards with * at the end, e.g. 'common.frequency.*'
const EXCLUDE_KEYS = [
'common.frequency.*',
'common.status.*',
]

// ANSI color codes for terminal output - using a minimal set
const COLORS = {
reset: '\x1b[0m',
Expand Down Expand Up @@ -118,6 +125,20 @@ async function findTranslationIssues(findUnused: boolean, findDuplicates: boolea
process.stdout.write(`\r${COLORS.gray}Progress: ${percent}% (${count}/${total})${COLORS.reset}`)
}

// Skip excluded keys - now with wildcard support
const isExcluded = EXCLUDE_KEYS.some(excludePattern => {
if (excludePattern.endsWith('*')) {
// For wildcard patterns, check if the key starts with the pattern minus the *
const prefix = excludePattern.slice(0, -1)
return key.startsWith(prefix)
}
return key === excludePattern
})

if (isExcluded) {
continue
}

const isUsed = await isKeyUsedInCode(key)
if (!isUsed) {
unusedKeys.push(key)
Expand Down
1 change: 1 addition & 0 deletions apps/app/src/locales/auth/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ export const onboarding = {
success: "Thanks, you're all set!",
error: "Something went wrong, please try again.",
creating: "Creating your organization...",
switch: "Switching organization...",
} as const
8 changes: 8 additions & 0 deletions apps/app/src/locales/core/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export const common = {
needs_review: "Needs Review",
draft: "Draft",
not_assessed: "Not Assessed",
assessed: "Assessed",
active: "Active",
inactive: "Inactive",
title: "Status",
},
filters: {
Expand Down Expand Up @@ -143,4 +146,9 @@ export const common = {
edit: "Edit",
description: "Description",
last_updated: "Last Updated",
frequency: {
monthly: "Monthly",
quarterly: "Quarterly",
yearly: "Yearly"
}
} as const
6 changes: 2 additions & 4 deletions apps/app/src/locales/en.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { DeepReadonly } from 'next/dist/shared/lib/deep-readonly'

// Core translations used across the application
import { common } from './core/common'
import { errors } from './core/errors'
Expand Down Expand Up @@ -29,7 +27,7 @@ import { vendors } from './features/vendors'
// Settings translations
import { settings } from './settings/settings'

const translations = {
export const translations = {
// Core
common,
errors,
Expand Down Expand Up @@ -63,4 +61,4 @@ const translations = {
} as const

export type Translations = typeof translations
export default translations as DeepReadonly<Translations>
export default translations
2 changes: 2 additions & 0 deletions apps/app/src/locales/features/policies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export const policies = {
published: "Published",
needs_review: "Needs Review",
archived: "Archived",
relevant: "Relevant",
"not-relevant": "Not Relevant"
},
policies: "policies",
title: "Policies",
Expand Down
30 changes: 27 additions & 3 deletions apps/app/src/locales/features/risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ export const risk = {
form: {
update_inherent_risk_success: "Inherent risk updated successfully",
update_inherent_risk_error: "Failed to update inherent risk",
update_inherent_risk: "Update Inherent Risk",
update_inherent_risk_description: "Adjust the inherent risk before any controls are applied",
update_residual_risk_success: "Residual risk updated successfully",
update_residual_risk_error: "Failed to update residual risk",
update_residual_risk: "Update Residual Risk",
update_residual_risk_description: "Adjust the residual risk after controls have been applied",
update_risk_success: "Risk updated successfully",
update_risk_error: "Failed to update risk",
update_risk: "Update Risk",
update_risk_description: "Update risk details and metadata",
create_risk_success: "Risk created successfully",
create_risk_error: "Failed to create risk",
risk_title: "Risk Title",
Expand All @@ -20,6 +26,8 @@ export const risk = {
risk_category_placeholder: "Select risk category",
risk_description: "Description",
risk_description_description: "Enter risk description",
risk_department: "Department",
risk_department_placeholder: "Select department",
risk_status: "Status",
risk_status_placeholder: "Select status"
},
Expand All @@ -29,22 +37,38 @@ export const risk = {
risk: "Risk"
},
empty: {
create_risk: "Create Risk"
create_risk: "Create Risk",
no_risks: {
title: "No risks yet",
description: "Get started by creating your first risk"
}
}
},
dashboard: {
title: "Risk Dashboard",
by_department: "Risks by Department",
status: "Risks by Status",
risks_by_assignee: "Risks by Assignee"
risks_by_assignee: "Risks by Assignee",
overview: "Overview",
inherent_risk_description: "Initial risk level before any controls are applied",
residual_risk_description: "Remaining risk level after controls are applied"
},
metrics: {
probability: "Probability",
impact: "Impact"
impact: "Impact",
inherentRisk: "Inherent Risk",
residualRisk: "Residual Risk"
},
tasks: {
title: "Tasks",
task_overview: "Task Overview",
attachments: "Attachments",
overview: "Overview",
sheet: {
title: "Create Task",
update: "Update Task",
update_description: "Update task details and metadata"
},
form: {
title: "Task Details",
task_title: "Task Title",
Expand Down
8 changes: 7 additions & 1 deletion apps/app/src/locales/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const settings = {
org_delete_alert_description:
"This action cannot be undone. This will permanently delete your organization and remove your data from our servers.",
delete_confirm_tip: "Type 'delete' to confirm",
delete_confirm: "delete",
org_delete_error: "Error deleting organization",
org_delete_success: "Organization deleted",
org_name_updated: "Organization name updated",
Expand Down Expand Up @@ -91,6 +92,10 @@ export const settings = {
description: "There are no active members in your organization",
},
},
status: {
accepted: "Accepted",
pending: "Pending"
},
role: {
owner: "Owner",
admin: "Admin",
Expand Down Expand Up @@ -139,7 +144,8 @@ export const settings = {
"Send an invitation to a new team member to join your organization",
error: {
title: "Invitation Error",
description: "There was an error processing your invitation."
description: "There was an error processing your invitation.",
home: "Go to Home"
},
form: {
email: {
Expand Down