diff --git a/messages/en-US.json b/messages/en-US.json index 411fbb12..09838cc8 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -297,5 +297,58 @@ "userDeleteServer": "Delete User from Server", "userMessageRemove": "The user will be removed from all organizations and be completely removed from the server.", "userMessageConfirm": "To confirm, please type the name of the user below.", - "userQuestionRemove": "Are you sure you want to permanently delete {selectedUser} from the server?" + "userQuestionRemove": "Are you sure you want to permanently delete {selectedUser} from the server?", + "licenseKey": "License Key", + "valid": "Valid", + "numberOfSites": "Number of Sites", + "licenseKeySearch": "Search license keys...", + "licenseKeyAdd": "Add License Key", + "type": "Type", + "licenseKeyRequired": "License key is required", + "licenseTermsAgree": "You must agree to the license terms", + "licenseErrorKeyLoad": "Failed to load license keys", + "licenseErrorKeyLoadDescription": "An error occurred loading license keys.", + "licenseErrorKeyDelete": "Failed to delete license key", + "licenseErrorKeyDeleteDescription": "An error occurred deleting license key.", + "licenseKeyDeleted": "License key deleted", + "licenseKeyDeletedDescription": "The license key has been deleted.", + "licenseErrorKeyActivate": "Failed to activate license key", + "licenseErrorKeyActivateDescription": "An error occurred while activating the license key.", + "licenseKeyActivated": "License key activated", + "licenseKeyActivatedDescription": "The license key has been successfully activated.", + "licenseErrorKeyRecheck": "Failed to recheck license keys", + "licenseErrorKeyRecheckDescription": "An error occurred rechecking license keys.", + "licenseErrorKeyRechecked": "License keys rechecked", + "licenseErrorKeyRecheckedDescription": "All license keys have been rechecked", + "licenseActivateKey": "Activate License Key", + "licenseActivateKeyDescription": "Enter a license key to activate it.", + "licenseActivate": "Activate License", + "licenseAgreement": "By checking this box, you confirm that you have read and agree to the license terms corresponding to the tier associated with your license key.", + "fossorialLicense": "View Fossorial Commercial License & Subscription Terms", + "licenseMessageRemove": "This will remove the license key and all associated permissions granted by it.", + "licenseMessageConfirm": "To confirm, please type the license key below.", + "licenseQuestionRemove": "Are you sure you want to delete the license key {selectedKey} ?", + "licenseKeyDelete": "Delete License Key", + "licenseKeyDeleteConfirm": "Confirm Delete License Key", + "licenseTitle": "Manage License Status", + "licenseTitleDescription": "View and manage license keys in the system", + "licenseHost": "Host License", + "licenseHostDescription": "Manage the main license key for the host.", + "notLicensed": "Not Licensed", + "hostId": "Host ID", + "licenseReckeckAll": "Recheck All Keys", + "licenseSiteUsage": "Sites Usage", + "licenseSiteUsageDecsription": "View the number of sites using this license.", + "licenseNoSiteLimit": "There is no limit on the number of sites using an unlicensed host.", + "licensePurchase": "Purchase License", + "licensePurchaseSites": "Purchase Additional Sites", + "licenseSitesUsedMax": "{usedSites} of {maxSites} sites used", + "licenseSitesUsed": "{count, plural, =0 {# sites} =1 {# site} other {# sites}} in system.", + "licensePurchaseDescription": "Choose how many sites you want to {selectedMode, select, license {purchase a license for. You can always add more sites later.} other {add to your existing license.}}", + "licenseFee": "License fee", + "licensePriceSite": "Price per site", + "total": "Total", + "licenseContinuePayment": "Continue to Payment", + "pricingPage": "pricing page", + "licensePricingPage": "For the most up-to-date pricing and discounts, please visit the " } diff --git a/src/app/admin/license/LicenseKeysDataTable.tsx b/src/app/admin/license/LicenseKeysDataTable.tsx index 98ed814a..a68d8273 100644 --- a/src/app/admin/license/LicenseKeysDataTable.tsx +++ b/src/app/admin/license/LicenseKeysDataTable.tsx @@ -13,6 +13,7 @@ import { LicenseKeyCache } from "@server/license/license"; import { ArrowUpDown } from "lucide-react"; import moment from "moment"; import CopyToClipboard from "@app/components/CopyToClipboard"; +import { useTranslations } from 'next-intl'; type LicenseKeysDataTableProps = { licenseKeys: LicenseKeyCache[]; @@ -32,6 +33,9 @@ export function LicenseKeysDataTable({ onDelete, onCreate }: LicenseKeysDataTableProps) { + + const t = useTranslations(); + const columns: ColumnDef[] = [ { accessorKey: "licenseKey", @@ -43,7 +47,7 @@ export function LicenseKeysDataTable({ column.toggleSorting(column.getIsSorted() === "asc") } > - License Key + {t('licenseKey')} ); @@ -68,7 +72,7 @@ export function LicenseKeysDataTable({ column.toggleSorting(column.getIsSorted() === "asc") } > - Valid + {t('valid')} ); @@ -87,7 +91,7 @@ export function LicenseKeysDataTable({ column.toggleSorting(column.getIsSorted() === "asc") } > - Type + {t('type')} ); @@ -112,7 +116,7 @@ export function LicenseKeysDataTable({ column.toggleSorting(column.getIsSorted() === "asc") } > - Number of Sites + {t('numberOfSites')} ); @@ -126,7 +130,7 @@ export function LicenseKeysDataTable({ variant="outlinePrimary" onClick={() => onDelete(row.original)} > - Delete + {t('delete')} ) @@ -138,10 +142,10 @@ export function LicenseKeysDataTable({ columns={columns} data={licenseKeys} title="License Keys" - searchPlaceholder="Search license keys..." + searchPlaceholder={t('licenseKeySearch')} searchColumn="licenseKey" onAdd={onCreate} - addButtonText="Add License Key" + addButtonText={t('licenseKeyAdd')} /> ); } diff --git a/src/app/admin/license/components/SitePriceCalculator.tsx b/src/app/admin/license/components/SitePriceCalculator.tsx index cf771b51..427d56b2 100644 --- a/src/app/admin/license/components/SitePriceCalculator.tsx +++ b/src/app/admin/license/components/SitePriceCalculator.tsx @@ -16,6 +16,7 @@ import { CredenzaHeader, CredenzaTitle } from "@app/components/Credenza"; +import { useTranslations } from 'next-intl'; type SitePriceCalculatorProps = { isOpen: boolean; @@ -60,27 +61,26 @@ export function SitePriceCalculator({ ? licenseFlatRate + siteCount * pricePerSite : siteCount * pricePerSite; + const t = useTranslations(); + return ( {mode === "license" - ? "Purchase License" - : "Purchase Additional Sites"} + ? t('licensePurchase') + : t('licensePurchaseSites')} - Choose how many sites you want to{" "} - {mode === "license" - ? "purchase a license for. You can always add more sites later." - : "add to your existing license."} + {t('licensePurchaseDescription', {selectedMode: mode})}
- Number of Sites + {t('numberOfSites')}
+ diff --git a/src/app/admin/license/page.tsx b/src/app/admin/license/page.tsx index a9678898..41c159f8 100644 --- a/src/app/admin/license/page.tsx +++ b/src/app/admin/license/page.tsx @@ -57,6 +57,7 @@ import ConfirmDeleteDialog from "@app/components/ConfirmDeleteDialog"; import { SitePriceCalculator } from "./components/SitePriceCalculator"; import Link from "next/link"; import { Checkbox } from "@app/components/ui/checkbox"; +import { useTranslations } from 'next-intl'; const formSchema = z.object({ licenseKey: z @@ -77,6 +78,7 @@ function obfuscateLicenseKey(key: string): string { export default function LicensePage() { const api = createApiClient(useEnvContext()); + const t = useTranslations(); const [rows, setRows] = useState([]); const [isCreateModalOpen, setIsCreateModalOpen] = useState(false); const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); @@ -129,11 +131,8 @@ export default function LicensePage() { } } catch (e) { toast({ - title: "Failed to load license keys", - description: formatAxiosError( - e, - "An error occurred loading license keys" - ) + title: t('licenseErrorKeyLoad'), + description: formatAxiosError(e, t('licenseErrorKeyLoadDescription')) }); } } @@ -148,17 +147,14 @@ export default function LicensePage() { } await loadLicenseKeys(); toast({ - title: "License key deleted", - description: "The license key has been deleted" + title: t('licenseKeyDeleted'), + description: t('licenseKeyDeletedDescription') }); setIsDeleteModalOpen(false); } catch (e) { toast({ - title: "Failed to delete license key", - description: formatAxiosError( - e, - "An error occurred deleting license key" - ) + title: t('licenseErrorKeyDelete'), + description: formatAxiosError(e, t('licenseErrorKeyDeleteDescription')) }); } finally { setIsDeletingLicense(false); @@ -174,16 +170,13 @@ export default function LicensePage() { } await loadLicenseKeys(); toast({ - title: "License keys rechecked", - description: "All license keys have been rechecked" + title: t('licenseErrorKeyRechecked'), + description: t('licenseErrorKeyRecheckedDescription') }); } catch (e) { toast({ - title: "Failed to recheck license keys", - description: formatAxiosError( - e, - "An error occurred rechecking license keys" - ) + title: t('licenseErrorKeyRecheck'), + description: formatAxiosError(e, t('licenseErrorKeyRecheckDescription')) }); } finally { setIsRecheckingLicense(false); @@ -201,8 +194,8 @@ export default function LicensePage() { } toast({ - title: "License key activated", - description: "The license key has been successfully activated." + title: t('licenseKeyActivated'), + description: t('licenseKeyActivatedDescription') }); setIsCreateModalOpen(false); @@ -211,11 +204,8 @@ export default function LicensePage() { } catch (e) { toast({ variant: "destructive", - title: "Failed to activate license key", - description: formatAxiosError( - e, - "An error occurred while activating the license key." - ) + title: t('licenseErrorKeyActivate'), + description: formatAxiosError(e, t('licenseErrorKeyActivateDescription')) }); } finally { setIsActivatingLicense(false); @@ -245,9 +235,9 @@ export default function LicensePage() { > - Activate License Key + {t('licenseActivateKey')} - Enter a license key to activate it. + {t('licenseActivateKeyDescription')} @@ -262,7 +252,7 @@ export default function LicensePage() { name="licenseKey" render={({ field }) => ( - License Key + {t('licenseKey')} @@ -285,12 +275,7 @@ export default function LicensePage() {
- By checking this box, you - confirm that you have read - and agree to the license - terms corresponding to the - tier associated with your - license key. + {t('licenseAgreement')}
- View Fossorial - Commercial License & - Subscription Terms + {t('fossorialLicense')}
@@ -313,7 +296,7 @@ export default function LicensePage() { - + @@ -336,47 +319,40 @@ export default function LicensePage() { }} dialog={
-

- Are you sure you want to delete the license key{" "} - - {obfuscateLicenseKey( - selectedLicenseKey.licenseKey - )} - - ? +

+ {t('licenseQuestionRemove', {selectedKey: obfuscateLicenseKey(selectedLicenseKey.licenseKey)})}

- This will remove the license key and all - associated permissions granted by it. + {t('licenseMessageRemove')}

- To confirm, please type the license key below. + {t('licenseMessageConfirm')}

} - buttonText="Confirm Delete License Key" + buttonText={t('licenseKeyDeleteConfirm')} onConfirm={async () => deleteLicenseKey(selectedLicenseKey.licenseKeyEncrypted) } string={selectedLicenseKey.licenseKey} - title="Delete License Key" + title={t('licenseKeyDelete')} /> )} - Host License + {t('licenseHost')} - Manage the main license key for the host. + {t('licenseHostDescription')}
@@ -397,7 +373,7 @@ export default function LicensePage() { ) : (
- Not Licensed + {t('notLicensed')}
)} @@ -405,7 +381,7 @@ export default function LicensePage() { {licenseStatus?.hostId && (
- Host ID + {t('hostId')}
@@ -413,7 +389,7 @@ export default function LicensePage() { {hostLicense && (
- License Key + {t('licenseKey')}
- Recheck All Keys + {t('licenseReckeckAll')} - Sites Usage + {t('licenseSiteUsage')} - View the number of sites using this license. + {t('licenseSiteUsageDecsription')}
- {licenseStatus?.usedSites || 0}{" "} - {licenseStatus?.usedSites === 1 - ? "site" - : "sites"}{" "} - in system + {t('licenseSitesUsed', {count: licenseStatus?.usedSites || 0})}
{!licenseStatus?.isHostLicensed && (

- There is no limit on the number of sites - using an unlicensed host. + {t('licenseNoSiteLimit')}

)} {licenseStatus?.maxSites && (
- {licenseStatus.usedSites || 0} of{" "} - {licenseStatus.maxSites} sites used + {t('licenseSitesUsedMax', {usedSites: licenseStatus.usedSites || 0, maxSites: licenseStatus.maxSites})} {Math.round( @@ -495,7 +465,7 @@ export default function LicensePage() { setIsPurchaseModalOpen(true); }} > - Purchase License + {t('licensePurchase')} ) : ( @@ -507,7 +477,7 @@ export default function LicensePage() { setIsPurchaseModalOpen(true); }} > - Purchase Additional Sites + {t('licensePurchaseSites')} )}