Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/web/app/modules/ipAddress/ipAddressLogLabels.ts
T
2026-07-08 16:15:37 +02:00

53 lines
1.9 KiB
TypeScript

import type { TFunction } from "i18next";
export function translateIpAddressLogAction(t: TFunction, action?: string | null) {
const normalized = action?.trim();
if (!normalized) {
return "";
}
if (normalized === "login") {
return t("admin.accounts.ipAddresses.logs.actions.login");
}
if (normalized === "register") {
return t("admin.accounts.ipAddresses.logs.actions.register");
}
if (normalized === "reset") {
return t("admin.accounts.ipAddresses.logs.actions.reset");
}
if (normalized === "forgot-password") {
return t("admin.accounts.ipAddresses.logs.actions.forgotPassword");
}
if (normalized === "reset-password") {
return t("admin.accounts.ipAddresses.logs.actions.resetPassword");
}
return t("admin.accounts.ipAddresses.logs.actions.unknownWithValue", { value: normalized });
}
export function translateIpAddressLogDescription(t: TFunction, description?: string | null) {
const normalized = description?.trim();
if (!normalized) {
return "";
}
if (normalized === "registration-attempt") {
return t("admin.accounts.ipAddresses.logs.descriptions.registrationAttempt");
}
if (normalized === "{empty email}") {
return t("admin.accounts.ipAddresses.logs.descriptions.emptyEmail");
}
return t("admin.accounts.ipAddresses.logs.descriptions.unknownWithValue", { value: normalized });
}
export function translateIpAddressLogError(t: TFunction, error?: string | null) {
const normalized = error?.trim();
if (!normalized) {
return "";
}
if (normalized === "blacklisted" || normalized === "Blacklisted") {
return t("admin.accounts.ipAddresses.errors.blacklisted");
}
if (normalized === "unauthorized" || normalized === "Unauthorized" || normalized === "Unauthorized.") {
return t("admin.accounts.ipAddresses.errors.unauthorized");
}
return t("admin.accounts.ipAddresses.errors.unknownWithValue", { value: normalized });
}