mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 19:02:31 +00:00
fix(web): keep ICU quotes out of messages inserted as raw HTML
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import type { Metadata } from "next"
|
import type { Metadata } from "next"
|
||||||
import { getTranslations, getMessages, setRequestLocale } from "next-intl/server"
|
import { getTranslations, getMessages, setRequestLocale } from "next-intl/server"
|
||||||
import { Link } from "@/i18n/navigation"
|
import { Link } from "@/i18n/navigation"
|
||||||
|
import { icuQuotesToHtml } from "@/i18n/loadMessages"
|
||||||
import { DocHeader } from "@/components/ui/doc-header"
|
import { DocHeader } from "@/components/ui/doc-header"
|
||||||
|
|
||||||
export async function generateMetadata({
|
export async function generateMetadata({
|
||||||
@@ -114,7 +115,7 @@ export default async function GlossaryPage({
|
|||||||
</dt>
|
</dt>
|
||||||
<dd
|
<dd
|
||||||
className="text-gray-800 leading-relaxed [&_a]:text-blue-600 [&_a]:hover:underline [&_code]:bg-gray-100 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-sm"
|
className="text-gray-800 leading-relaxed [&_a]:text-blue-600 [&_a]:hover:underline [&_code]:bg-gray-100 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-sm"
|
||||||
dangerouslySetInnerHTML={{ __html: entry.def }}
|
dangerouslySetInnerHTML={{ __html: icuQuotesToHtml(entry.def) }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { Metadata } from "next"
|
import type { Metadata } from "next"
|
||||||
import { getTranslations, getMessages, setRequestLocale } from "next-intl/server"
|
import { getTranslations, getMessages, setRequestLocale } from "next-intl/server"
|
||||||
import { Link } from "@/i18n/navigation"
|
import { Link } from "@/i18n/navigation"
|
||||||
|
import { icuQuotesToHtml } from "@/i18n/loadMessages"
|
||||||
import { DocHeader } from "@/components/ui/doc-header"
|
import { DocHeader } from "@/components/ui/doc-header"
|
||||||
import { Callout } from "@/components/ui/callout"
|
import { Callout } from "@/components/ui/callout"
|
||||||
import CopyableCode from "@/components/CopyableCode"
|
import CopyableCode from "@/components/CopyableCode"
|
||||||
@@ -135,7 +136,7 @@ export default async function SystemLogsTabPage({
|
|||||||
className={idx < dataRows.length - 1 ? "border-b border-gray-100" : ""}
|
className={idx < dataRows.length - 1 ? "border-b border-gray-100" : ""}
|
||||||
>
|
>
|
||||||
<td className="px-3 py-2 align-top">{row.subtab}</td>
|
<td className="px-3 py-2 align-top">{row.subtab}</td>
|
||||||
<td className="px-3 py-2 align-top font-mono text-xs" dangerouslySetInnerHTML={{ __html: row.endpoint }} />
|
<td className="px-3 py-2 align-top font-mono text-xs" dangerouslySetInnerHTML={{ __html: icuQuotesToHtml(row.endpoint) }} />
|
||||||
<td className="px-3 py-2 align-top">
|
<td className="px-3 py-2 align-top">
|
||||||
{t.rich(`dataCollected.rows.${idx}.source`, { code })}
|
{t.rich(`dataCollected.rows.${idx}.source`, { code })}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ function decodeEntities(value: unknown): unknown {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Messages inserted as raw HTML skip ICU, so its quoting goes back to entities.
|
||||||
|
export function icuQuotesToHtml(html: string): string {
|
||||||
|
return html.replace(/'<'/g, "<").replace(/'>'/g, ">")
|
||||||
|
}
|
||||||
|
|
||||||
function toCamel(name: string): string {
|
function toCamel(name: string): string {
|
||||||
return name.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase())
|
return name.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user