Compare commits

..

2 Commits

Author SHA1 Message Date
Jamie Curnow
118c4793e3 Amend locale readme 2025-11-14 08:34:16 +10:00
Jamie Curnow
d7384c568f Fix #4933 when cert may not have domain names 2025-11-14 08:33:42 +10:00
4 changed files with 31 additions and 21 deletions

View File

@@ -10,8 +10,12 @@ interface Props {
color?: string;
}
const DomainLink = ({ domain, color }: { domain: string; color?: string }) => {
const DomainLink = ({ domain, color }: { domain?: string; color?: string }) => {
// when domain contains a wildcard, make the link go nowhere.
// Apparently the domain can be null or undefined sometimes.
// This try is just a safeguard to prevent the whole formatter from breaking.
if (!domain) return null;
try {
let onClick: ((e: React.MouseEvent) => void) | undefined;
if (domain.includes("*")) {
onClick = (e: React.MouseEvent) => e.preventDefault();
@@ -27,18 +31,21 @@ const DomainLink = ({ domain, color }: { domain: string; color?: string }) => {
{domain}
</a>
);
} catch {
return null;
}
};
export function DomainsFormatter({ domains, createdOn, niceName, provider, color }: Props) {
const elms: ReactNode[] = [];
if (domains.length === 0 && !niceName) {
if ((!domains || domains.length === 0) && !niceName) {
elms.push(
<span key="nice-name" className="badge bg-danger-lt me-2">
Unknown
</span>,
);
}
if (niceName && provider !== "letsencrypt") {
if (!domains || (niceName && provider !== "letsencrypt")) {
elms.push(
<span key="nice-name" className="badge bg-info-lt me-2">
{niceName}
@@ -46,7 +53,9 @@ export function DomainsFormatter({ domains, createdOn, niceName, provider, color
);
}
if (domains) {
domains.map((domain: string) => elms.push(<DomainLink key={domain} domain={domain} color={color} />));
}
return (
<div className="flex-fill">

View File

@@ -39,8 +39,9 @@ not be complete by the time you're reading this:
- frontend/src/locale/src/[yourlang].json
- frontend/src/locale/src/lang-list.json
- frontend/src/locale/src/HelpDoc/*
- frontend/src/locale/src/HelpDoc/[yourlang]/*
- frontend/src/locale/IntlProvider.tsx
- frontend/check-locales.cjs
## Checking for missing translations in languages

View File

@@ -1,9 +1,9 @@
import * as de from "./de/index";
import * as en from "./en/index";
import * as ja from "./ja/index";
import * as pl from "./pl/index";
import * as sk from "./sk/index";
import * as zh from "./zh/index";
import * as pl from "./pl/index";
const items: any = { en, de, ja, sk, zh, pl };