diff --git a/i18n-delta-fr.json b/i18n-delta-fr.json new file mode 100644 index 0000000000..af87e3e33d --- /dev/null +++ b/i18n-delta-fr.json @@ -0,0 +1,128 @@ +{ + "messages": { + "The table is taking a breath": "La table reprend son souffle", + "Someone raised the X-card. Nothing is said about who or why. Choose how to go on.": "Quelqu’un a levé la carte X. Rien n’est dit sur qui ni pourquoi. Choisis comment poursuivre.", + "Someone raised the X-card. Nothing more needs saying. The story waits.": "Quelqu’un a levé la carte X. Inutile d’en dire plus. L’histoire attend.", + "Withdraw the last passage": "Retirer le dernier passage", + "Write it again, elsewhere": "Réécrire ailleurs", + "Continue": "Continuer", + "Leave the table for now": "Quitter la table pour l’instant", + "Looking it up...": "Recherche en cours...", + "No description available. The content pack may not be installed, or this entry was added by hand.": "Aucune description disponible. Le pack de contenu n’est peut-être pas installé, ou cette entrée a été ajoutée à la main.", + "No details available. The content pack may not be installed, or this item was added by hand.": "Aucun détail disponible. Le pack de contenu n’est peut-être pas installé, ou cet objet a été ajouté à la main.", + "Requires attunement": "Nécessite une harmonisation", + "+{bonus} magic": "+{bonus} magique", + "Weight": "Poids", + "Value": "Valeur", + "AC bonus": "Bonus à la CA", + "Armor class": "Classe d’armure", + "Damage": "Dégâts", + "None": "Aucun", + "Range": "Portée", + "Shield": "Bouclier", + "Carried in one hand; only one shield counts at a time.": "Porté à une main ; un seul bouclier compte à la fois.", + "Dexterity": "Dextérité", + "Strength": "Force", + "Needs {strength}; below that, your speed drops by 10 feet while wearing it.": "Nécessite {strength} ; en dessous, ta vitesse est réduite de 3 m (10 pi) tant que tu la portes.", + "No minimum.": "Aucun minimum.", + "Stealth": "Discrétion", + "Disadvantage on Dexterity (Stealth) checks while wearing it.": "Désavantage aux tests de Dextérité (Discrétion) tant que tu la portes.", + "No penalty.": "Aucune pénalité.", + "+{bonus} weapon": "Arme +{bonus}", + "Adds {bonus} to attack and damage rolls.": "Ajoute +{bonus} aux jets d’attaque et de dégâts.", + "No damage": "Aucun dégât", + "It does not hurt on its own; its special rules say what it does.": "N’inflige pas de dégâts par elle-même ; ses règles spéciales précisent son effet.", + "Armor": "Armure", + "Weapon": "Arme", + "Description": "Description", + "Select the mark beside it for the full entry.": "Sélectionne le symbole à côté pour voir l’entrée complète.", + "{n} lb.": "{n} lb", + "lb.": "lb", + "{range} ft.": "{range} pi", + "range": "portée", + "varies": "variable", + "Dex": "Dex", + "Con": "Con", + "Wis": "Sag", + "max": "max", + "Add your full Dexterity modifier.": "Ajoute tout ton modificateur de Dextérité.", + "Dexterity does not add to it.": "La Dextérité ne s’ajoute pas.", + "Add your Dexterity modifier, up to +{cap}.": "Ajoute ton modificateur de Dextérité, jusqu’à +{cap}.", + "Adventuring gear": "Équipement d’aventurier", + "Equipment pack": "Paquetage d’équipement", + "Ammunition": "Munitions", + "Mount": "Monture", + "Light armor": "Armure légère", + "Medium armor": "Armure intermédiaire", + "Heavy armor": "Armure lourde", + "Simple melee weapon": "Arme courante de corps à corps", + "Simple ranged weapon": "Arme courante à distance", + "Martial melee weapon": "Arme de guerre de corps à corps", + "Martial ranged weapon": "Arme de guerre à distance", + "Magic item": "Objet magique", + "Wondrous item": "Objet merveilleux", + "Potion": "Potion", + "Ring": "Anneau", + "Rod": "Sceptre", + "Scroll": "Parchemin", + "Staff": "Bâton", + "Wand": "Baguette", + "Common": "Courant", + "Uncommon": "Peu courant", + "Rare": "Rare", + "Very rare": "Très rare", + "Legendary": "Légendaire", + "Artifact": "Artéfact", + "Double-headed": "Double lame", + "Finesse": "Finesse", + "Gunpowder": "Poudre noire", + "Heavy": "Lourde", + "Light": "Légère", + "Loading": "Chargement", + "Magazine": "Chargeur", + "Reach": "Allonge", + "Special": "Spéciale", + "Thrown": "Lancer", + "Two-handed": "Deux mains", + "Versatile": "Polyvalente", + "acid": "acide", + "bludgeoning": "contondant", + "cold": "froid", + "fire": "feu", + "force": "force", + "lightning": "foudre", + "necrotic": "nécrotique", + "piercing": "perforant", + "poison": "poison", + "psychic": "psychique", + "radiant": "radiant", + "slashing": "tranchant", + "thunder": "tonnerre", + "Needs arrows, bolts or stones to attack at range; the ammunition is spent as it is fired.": "Nécessite des flèches, carreaux ou billes pour attaquer à distance ; la munition est dépensée au tir.", + "A weapon with a striking end at each side; the second end can make the extra light-weapon attack, doing the die in brackets.": "Arme dotée d’une extrémité offensive de chaque côté ; la seconde extrémité permet l’attaque supplémentaire d’arme légère, infligeant le dé indiqué entre crochets.", + "Attack and damage may use Dexterity instead of Strength, whichever is better.": "L’attaque et les dégâts peuvent utiliser la Dextérité au lieu de la Force, selon le meilleur modificateur.", + "Fires with black powder, which it consumes along with the shot; wet or missing powder means it cannot fire.": "Tire avec de la poudre noire, consommée avec la munition ; sans poudre ou si elle est mouillée, l’arme ne peut pas tirer.", + "Too big for Small creatures to use well: they attack with disadvantage.": "Trop volumineuse pour les créatures de taille Petite : elles attaquent avec désavantage.", + "Small enough to fight with one in each hand (two-weapon fighting).": "Assez légère pour combattre avec une arme dans chaque main (combat à deux armes).", + "Slow to reload: only one shot per action, bonus action or reaction, however many attacks you have.": "Lente à recharger : un seul tir par action, action bonus ou réaction, quel que soit ton nombre d’attaques.", + "Holds the number of shots in brackets; once they are spent, an action reloads it.": "Contient le nombre de coups indiqué entre crochets ; une fois vidé, il faut une action pour recharger.", + "Strikes 5 feet further than usual, so 10 feet away instead of 5.": "Frappe 1,50 m (5 pi) plus loin que la normale, soit à 3 m (10 pi) au lieu de 1,50 m (5 pi).", + "Has its own rules beyond the usual attack; the GM applies them when it is used.": "Possède ses propres règles en plus de l’attaque habituelle ; le MJ les applique lors de son utilisation.", + "Can be thrown to make a ranged attack, using the same ability as a melee swing with it.": "Peut être lancée pour faire une attaque à distance, en utilisant la même caractéristique qu’au corps à corps.", + "Needs both hands to attack with, so no shield or second weapon.": "Nécessite les deux mains pour attaquer ; impossible d’utiliser un bouclier ou une seconde arme.", + "Usable in one hand or two; the two-handed grip does the larger damage die in brackets.": "Utilisable à une ou deux mains ; la prise à deux mains inflige le dé de dégâts supérieur indiqué entre crochets.", + "Corrosive: sprays, oozes and dissolving breath.": "Corrosif : jets d’acide, vases et souffles dissolvants.", + "Blunt force: clubs, hammers, fists, falling.": "Force contondante : gourdins, marteaux, poings, chutes.", + "Freezing: ice breath, rays of frost, winter magic.": "Glacial : souffles de glace, rayons de givre, magie hivernale.", + "Burning: dragon fire, fireballs, torches.": "Brûlant : feu de dragon, boules de feu, torches.", + "Pure magical energy; almost nothing resists it (magic missile, eldritch blast).": "Énergie magique pure ; presque rien n’y résiste (projectile magique, décharge occulte).", + "Electricity: bolts, blue dragons, storm magic.": "Électricité : éclairs, dragons bleus, magie des tempêtes.", + "Withering life force: undead touches, life drain, most death magic.": "Flétrissement vital : contact des morts-vivants, drain de vie, magie nécromantique.", + "Puncture: arrows, spears, fangs.": "Perforation : flèches, lances, crocs.", + "Venom and toxins: stings, poisoned blades, poison breath.": "Venins et toxines : dards, lames empoisonnées, souffles empoisonnés.", + "Mental assault: mind flayers, some enchantments, telepathic damage.": "Assaut mental : flagelleurs mentaux, certains enchantements, dégâts télépathiques.", + "Holy light and searing brilliance: celestials, clerics' spells, the sun.": "Lumière sacrée et éclat brûlant : célestes, sorts de clercs, soleil.", + "Cutting: swords, axes, claws.": "Tranchant : épées, haches, griffes.", + "Concussive sound: thunderwave, shatter, a giant's shout.": "Onde sonore : vague tonnante, fracassement, cri de géant." + } +} diff --git a/scripts/name-lookups.json b/scripts/name-lookups.json index 1695517972..ecbb9b488e 100644 --- a/scripts/name-lookups.json +++ b/scripts/name-lookups.json @@ -420,6 +420,7 @@ "app/campaigns/[campaignId]/BoardStageLayers.tsx#first": [["key",1,"the first icon file of a family (no record chosen)"]], "app/campaigns/[campaignId]/CalendarSection.tsx#number": [["key",2,"digits a regex already captured, ids, headers, stored and form numbers (number inputs), dice parts, the pack's English text (\"1,000 feet\", a purse); src/: every site read"]], "app/campaigns/[campaignId]/CalendarSection.tsx#partial": [["key",1,"UI keys, ids, refs, view choices and documented defaults (a palette, a tile, a peer volume, the first sheet)"]], + "app/campaigns/[campaignId]/CardReturnedNote.tsx#partial": [["pattern",2,"a fixed pattern over DB-stored English card-return reach/range refusal lines"]], "app/campaigns/[campaignId]/CharacterSheetDialog.tsx#number": [["key",1,"digits a regex already captured, ids, headers, stored and form numbers (number inputs), dice parts, the pack's English text (\"1,000 feet\", a purse); src/: every site read"]], "app/campaigns/[campaignId]/CharacterVoices.tsx#keyed": [["key",2,"ids, refs, slugs, tool names, field names, env names, event kinds, UI keys, caches, door and map keys; a sheet's conditionMeta by the condition key it was written under; the usage route's gear map by the sheet's own stored item names (src/: every site read)"]], "app/campaigns/[campaignId]/CharacterVoices.tsx#whole": [["key",1,"UI keys, ids, refs, view choices and documented defaults (a palette, a tile, a peer volume, the first sheet)"]], @@ -510,10 +511,11 @@ "app/campaigns/[campaignId]/MarketShopEditor.tsx#whole": [["identity",2,"a stock line by whole name"]], "app/campaigns/[campaignId]/MessageActions.tsx#whole": [["key",1,"UI keys, ids, refs, view choices and documented defaults (a palette, a tile, a peer volume, the first sheet)"]], "app/campaigns/[campaignId]/MessageContent.tsx#partial": [["key",1,"UI keys, ids, refs, view choices and documented defaults (a palette, a tile, a peer volume, the first sheet)"]], + "app/campaigns/[campaignId]/MessageParts.tsx#keyed": [["key",2,"condition word lookup in translateConditionWord"]], "app/campaigns/[campaignId]/MessageParts.tsx#partial": [ [ "pattern", - 7, + 21, "a fixed pattern over text that reads no record's name: its English words are scripts/text-comparisons.json's to classify" ], [ @@ -961,6 +963,7 @@ "components/InviteShareDialog.tsx#partial": [["key",2,"UI keys, file names, glyphs and markdown"]], "components/NotificationBell.tsx#partial": [["key",5,"UI keys, file names, glyphs and markdown"]], "components/SafetyToneFields.tsx#partial": [["key",1,"UI keys, file names, glyphs and markdown"]], + "components/SceneTitle.tsx#partial": [["pattern",3,"a fixed pattern over server title-card labels (Chapter / Act / End of Act)"]], "components/ScheduleSection.tsx#number": [["key",1,"digits a regex already captured, ids, headers, stored and form numbers (number inputs), dice parts, the pack's English text (\"1,000 feet\", a purse); src/: every site read"]], "components/ServerAddressButton.tsx#first": [["key",1,"the first shareable address"]], "components/ServerAddressButton.tsx#partial": [["key",1,"UI keys, file names, glyphs and markdown"]], @@ -2317,7 +2320,7 @@ "lib/dm/speech.ts#partial": [ [ "pattern", - 15, + 18, "a fixed pattern over text that reads no record's name: its English words are scripts/text-comparisons.json's to classify" ], [ diff --git a/scripts/text-comparisons.json b/scripts/text-comparisons.json index 77bd8941f1..8dd82f6232 100644 --- a/scripts/text-comparisons.json +++ b/scripts/text-comparisons.json @@ -1065,6 +1065,7 @@ "lib/battlemap/generate.ts#str-list": [["key",1,"scene kinds (ambience bed ids)"]], "lib/battlemap/hand-class.ts#str-eq": [["english-source",1,"the engine's own weapon name (\"Unarmed strike\")"]], "lib/battlemap/hand-core.ts#re-word": [["english-source",1,"display: an English range shortened to \"ft\"; any other text is shown as written, nothing is inferred"]], + "lib/battlemap/hand-core.ts#str-eq": [["english-source",1,"engine's fixed placeholder name \"the enemy\" in can-act turn verdict"]], "lib/battlemap/hand-core.ts#str-key": [["key",1,"ability ids"]], "lib/battlemap/hand-core.ts#toLowerCase": [["key",1,"class id"],["key",1,"SRD feature names as once-per-turn keys, as pc-attack-spend.ts writes them (grantedRideMark)"]], "lib/battlemap/hand-core.ts#toUpperCase": [["display",1,"capitalised range"]], @@ -1072,8 +1073,8 @@ "lib/battlemap/hand-intent.ts#str-list": [["key",5,"hand action ids and fields (fixed choice)"]], "lib/battlemap/hand-options.ts#re-word": [["english-source",1,"the engine's own \"Maneuver:\" feature prefix (written by the builder)"]], "lib/battlemap/hand-options.ts#toLowerCase": [["key",1,"resource variant from an SRD option name (a tool argument)"]], - "lib/battlemap/hand-play.ts#re-word": [["english-source",2,"the action line the hand itself writes (\"I attack X with ...\"), read back by the hand"]], - "lib/battlemap/hand-play.ts#str-eq": [["english-source",6,"the engine's own weapon name (\"Unarmed strike\"), spell resource label and SRD feature names"]], + "lib/battlemap/hand-play.ts#re-word": [["english-source",3,"the action line the hand itself writes (\"I attack X with ...\"), read back by the hand"]], + "lib/battlemap/hand-play.ts#str-eq": [["english-source",8,"the engine's own weapon name (\"Unarmed strike\"), \"Escape: \" prefix, \"@\" readied marker, spell resource label and SRD feature names"]], "lib/battlemap/hand-play.ts#str-includes": [["english-source",2,"reference: SRD weapon properties (fixed vocabulary of the SRD rows and the workshop's property picker)"]], "lib/battlemap/hand-play.ts#str-key": [["key",1,"bonus attack ids"]], "lib/battlemap/hand-react.ts#re-word": [["english-source",1,"the engine's own \"Maneuver:\" feature prefix and reaction amounts"]], @@ -2270,6 +2271,7 @@ "lib/harness/render.ts#re-word": [["key",1,"the server's own [System] tag that opens a turn instruction it appends (src/lib/dm/tool-text.ts): the same English tag at every table"]], "lib/harness/run-dir-logic.ts#str-list": [["key",1,"run folder name prefixes and the sign-in file names Codex keeps (file names)"]], "lib/harness/test-run.ts#toLowerCase": [["key",1,"a fixed test secret in a reply"]], + "lib/harness/test-run.ts#\\w": [["key",1,"template placeholder keys in passT ({key})"]], "lib/harness/types.ts#str-list": [["key",1,"effort levels (fixed choice)"]], "lib/help/index.ts#[a-z]": [["key",1,"anchor id from a help title"]], "lib/help/index.ts#re-word": [["key",1,"a content-pack row's flag value (\"yes\")"]], @@ -3925,13 +3927,6 @@ "device settings key lookup" ] ], - "app/campaigns/[campaignId]/MessageParts.tsx#[a-z]": [ - [ - "key", - 1, - "display-only translation of DB-stored English system note templates (Chapter/Act/turn/combat) in translateSystemNote" - ] - ], "lib/content/names.ts#\\b": [ [ "key", @@ -3974,18 +3969,60 @@ "display-only tool grant category splitting in ClassChoices.tsx" ] ], + "app/campaigns/[campaignId]/CardReturnedNote.tsx#re-word": [ + [ + "display", + 2, + "display-only translation of DB-stored English reach/range refusal lines in CardReturnedNote.tsx" + ] + ], + "app/campaigns/[campaignId]/MessageParts.tsx#\\b": [ + [ + "display", + 2, + "display-only calendar year/day boundary in translateCalendarClause" + ] + ], "app/campaigns/[campaignId]/MessageParts.tsx#re-word": [ [ "display", - 9, - "display-only translation of DB-stored English system note templates in translateSystemNote" + 61, + "display-only translation of DB-stored English system note and player action templates" + ] + ], + "app/campaigns/[campaignId]/MessageParts.tsx#re-affix": [ + [ + "display", + 1, + "display-only plural suffix stripping for duration unit translation in MessageParts.tsx" ] ], "app/campaigns/[campaignId]/MessageParts.tsx#str-eq": [ [ "display", - 2, - "display-only translation of DB-stored English system note templates in translateSystemNote" + 21, + "display-only translation of DB-stored English system note and player action templates" + ] + ], + "app/campaigns/[campaignId]/MessageParts.tsx#str-key": [ + [ + "display", + 1, + "display-only condition word lookup in translateConditionWord" + ] + ], + "app/campaigns/[campaignId]/MessageParts.tsx#str-list": [ + [ + "display", + 4, + "display-only calendar day/month/part/season word lists in translateCalendarClause" + ] + ], + "components/SceneTitle.tsx#re-word": [ + [ + "display", + 3, + "display-only translation of Chapter/Act/End of Act title card labels in SceneTitle.tsx" ] ], "app/characters/builder/steps/CallingStep.tsx#str-key": [ diff --git a/src/app/admin/AdminStorageSection.tsx b/src/app/admin/AdminStorageSection.tsx index 3f0731bef3..5f7d32617a 100644 --- a/src/app/admin/AdminStorageSection.tsx +++ b/src/app/admin/AdminStorageSection.tsx @@ -42,12 +42,6 @@ function formatSize(bytes: number) { return `${Math.max(bytes > 0 ? 1 : 0, Math.round(bytes / 1024))} KB`; } -// "{value} live updates", keyed by noun so the table's language speaks: -// count(t, 3, "admin.storage.liveUpdate"). The key is a plural base -// (…_one/…_other), which translate() resolves at run time. -const count = (t: (key: string, vars?: Record) => string, value: number, key: string) => - t(key, { count: value }); - export function AdminStorageSection() { const t = useT(); const tp = useTp(); @@ -147,8 +141,8 @@ export function AdminStorageSection() { ) : null}
  • - {count(t, stats.eventRows, "admin.storage.liveUpdate")} - {count(t, stats.usageRows, "admin.storage.usageRow")} + {tp("{count} live update", "{count} live updates", { count: stats.eventRows })} + {tp("{count} usage row", "{count} usage rows", { count: stats.usageRows })} {t("{size} of prompt traces", { size: formatSize(stats.traceBytes) })}
  • @@ -160,9 +154,9 @@ export function AdminStorageSection() { {t("Last tidy {date}: {events} cleared, {traces} dropped, {merged} merged, {space} returned.", { date: new Date(report.at).toLocaleString(), - events: count(t, report.eventsRemoved, "admin.storage.update"), - traces: count(t, report.tracesCleared, "admin.storage.trace"), - merged: count(t, report.usageRowsMerged, "admin.storage.usageRow"), + events: tp("{count} update", "{count} updates", { count: report.eventsRemoved }), + traces: tp("{count} trace", "{count} traces", { count: report.tracesCleared }), + merged: tp("{count} usage row", "{count} usage rows", { count: report.usageRowsMerged }), space: formatSize(report.bytesReclaimed), })} diff --git a/src/app/api/admin/harness/route.ts b/src/app/api/admin/harness/route.ts index 95c4587d07..a94a7a774b 100644 --- a/src/app/api/admin/harness/route.ts +++ b/src/app/api/admin/harness/route.ts @@ -8,6 +8,7 @@ import { rescueStrandedCampaigns } from "@/lib/image-backend-rescue"; import { forgetHarnessStatus, harnessConfig, probeAllHarnesses, probeHarness } from "@/lib/harness/status"; import { testHarness } from "@/lib/harness/test-run"; import { isHarnessId } from "@/lib/harness/types"; +import { requestT } from "@/lib/request-locale"; import { isDeviceWorld } from "@/lib/server-env"; export const runtime = "nodejs"; @@ -52,9 +53,10 @@ export async function POST(request: Request) { if (isErrorResponse(admin)) { return admin; } + const t = requestT(request); const parsed = actionSchema.safeParse(await request.json().catch(() => ({}))); if (!parsed.success) { - return Response.json({ error: "Unknown action." }, { status: 400 }); + return Response.json({ error: t("Unknown action.") }, { status: 400 }); } const { action, id } = parsed.data; if (action === "refresh") { @@ -65,16 +67,16 @@ export async function POST(request: Request) { if (action === "test") { const config = harnessConfig(); if (id && id !== config.id) { - return Response.json({ error: "Save this program as the server's agent before testing it." }, { status: 409 }); + return Response.json({ error: t("Save this program as the server's agent before testing it.") }, { status: 409 }); } - return Response.json(await testHarness(isHarnessId(config.id) ? config.id : undefined)); + return Response.json(await testHarness(isHarnessId(config.id) ? config.id : undefined, t)); } if (action === "adopt") { // One step from a passing test to painting tables: on, the default for // new campaigns, and the campaigns stranded on a backend that cannot // paint moved onto it. Only after a real picture came back here. if (!harnessConfig().imagesVerifiedAt) { - return Response.json({ error: "Paint a test picture first." }, { status: 409 }); + return Response.json({ error: t("Paint a test picture first.") }, { status: 409 }); } saveGlobalConfig({ harness: { images: "native" }, images: { defaultBackend: "harness" } }); forgetHarnessStatus(); @@ -83,9 +85,9 @@ export async function POST(request: Request) { // A real picture, painted the way the tables paint one, before they are // allowed to ask for it (src/lib/harness/picture-test.ts). Only a success // here clears the option. - const result = await testHarnessPictures(); + const result = await testHarnessPictures(t); if (!result.image) { - return Response.json({ ...result, error: result.error ?? "The picture could not be made." }, { status: 502 }); + return Response.json({ ...result, error: result.error ?? t("The picture could not be made.") }, { status: 502 }); } saveGlobalConfig({ harness: { imagesVerifiedAt: new Date().toISOString() } }); forgetHarnessStatus(); diff --git a/src/app/api/content/[kind]/[slug]/route.ts b/src/app/api/content/[kind]/[slug]/route.ts index 21ecc719c7..7dbd02ac3a 100644 --- a/src/app/api/content/[kind]/[slug]/route.ts +++ b/src/app/api/content/[kind]/[slug]/route.ts @@ -1,6 +1,8 @@ import { currentUser, unauthorized } from "@/lib/auth"; import { getEntryDetail } from "@/lib/content"; import { withBestEffort } from "@/lib/content/entry-labels"; +import { localizeItemEntryFr } from "@/lib/content/item-descriptions-fr"; +import { bookLocaleOf } from "@/lib/rulebook/book"; import { bundledItemRows, bundledSpellRows } from "@/lib/rulebook/catalog-rows"; import { bundledGearRow } from "@/lib/workshop/bundled-gear-rows"; import { contentScopeFor } from "@/lib/content/scope"; @@ -59,9 +61,11 @@ export async function GET( return asEntry(entry); } + const french = bookLocaleOf(request) === "fr"; const entry = getEntryDetail(kind as Parameters[0], decoded); if (entry) { - return Response.json({ entry: withBestEffort(kind, entry, { classSlug: String(entry.data.class_slug ?? "") || undefined }) }); + const withLabel = withBestEffort(kind, entry, { classSlug: String(entry.data.class_slug ?? "") || undefined }); + return Response.json({ entry: kind === "items" && french ? localizeItemEntryFr(withLabel) : withLabel }); } // The bundled book's rows the search serves with no pack ("srd:web", // "srd-gear:longsword"), so their info reads with no pack too. @@ -74,7 +78,7 @@ export async function GET( ? bundledGearRow(decoded) : null; if (bundled) { - return Response.json({ entry: bundled }); + return Response.json({ entry: kind === "items" && french ? localizeItemEntryFr(bundled) : bundled }); } const brewed = homebrewKind ? findHomebrewBySlug(scope.userIds, homebrewKind, decoded) : null; return brewed ? asEntry(brewed) : Response.json({ error: "Not found." }, { status: 404 }); diff --git a/src/app/api/content/[kind]/route.ts b/src/app/api/content/[kind]/route.ts index fd49909d7c..dceb9d0651 100644 --- a/src/app/api/content/[kind]/route.ts +++ b/src/app/api/content/[kind]/route.ts @@ -1,5 +1,6 @@ import { currentUser, unauthorized } from "@/lib/auth"; import { withBestEffort } from "@/lib/content/entry-labels"; +import { localizeItemEntryFr } from "@/lib/content/item-descriptions-fr"; import { catalogPrices } from "@/lib/characters/catalog"; import { contentPackInstalled } from "@/lib/content/db"; import { contentScopeFor, unadmittedNames } from "@/lib/content/scope"; @@ -154,6 +155,9 @@ export async function GET( ]; results = [...results, ...notFiled(results, bundled).slice(0, base.limit ?? 50)]; } + if (bookLocaleOf(request) === "fr") { + results = (results as Array<{ name: string; source?: string; data?: unknown }>).map((entry) => localizeItemEntryFr(entry)); + } break; } case "feats": diff --git a/src/app/campaigns/[campaignId]/BoardChrome.tsx b/src/app/campaigns/[campaignId]/BoardChrome.tsx index 4fbf455376..dd6df04705 100644 --- a/src/app/campaigns/[campaignId]/BoardChrome.tsx +++ b/src/app/campaigns/[campaignId]/BoardChrome.tsx @@ -341,10 +341,11 @@ function HealthWordChip({ word }: { word: HealthWord }) { export function ConditionChip({ label, rounds, note }: { label: string; rounds?: number; note?: string }) { const tp = useTp(); + const locale = useLocale(); return ( - {label} + {contentName("conditions", label, locale)} {rounds ? ` ${tp("({count} rd)", "({count} rd)", { count: rounds })}` : ""} {/* What the engine's metadata says: until whose turn, the save that ends it, who laid it (src/lib/battlemap/condition-notes.ts). */} @@ -381,6 +382,7 @@ function EdgeChips({ edge }: { edge: TargetEdge }) { function ConditionRow({ id, label, rounds, note }: { id: string; label: string; rounds?: number; note?: string }) { const t = useT(); const tp = useTp(); + const locale = useLocale(); const rule = conditionRule(id, t); return (
  • @@ -393,7 +395,7 @@ function ConditionRow({ id, label, rounds, note }: { id: string; label: string; (globals.css). */} - {label} + {contentName("conditions", label, locale)} {rounds ? {` ${tp("({count} rd)", "({count} rd)", { count: rounds })}`} : null} {rule ? {rule} : null} @@ -615,7 +617,7 @@ export function TokenPlate({ {rest.length ? (

    {t("+{count} more: ", { count: rest.length })} - {rest.map((condition) => condition.label).join(", ")} + {rest.map((condition) => contentName("conditions", condition.label, locale)).join(", ")}

    ) : null} diff --git a/src/app/campaigns/[campaignId]/CardReturnedNote.tsx b/src/app/campaigns/[campaignId]/CardReturnedNote.tsx index daffecba75..0a73bb5930 100644 --- a/src/app/campaigns/[campaignId]/CardReturnedNote.tsx +++ b/src/app/campaigns/[campaignId]/CardReturnedNote.tsx @@ -14,6 +14,30 @@ import type { ConcentrationSwap } from "@/lib/dm/concentration-confirm-logic"; // the story telling it as done. Nothing was spent, so the Hand deals the // card again; its player can also play it again from here in one press, // with the same sentence and the same choices. +type T = ReturnType; + +function translateCardReturnedReason(t: T, raw: string): string { + let m = /^(.+?) is (\d+) ft from (.+?), out of melee reach \((\d+) ft\)\.(.*)$/.exec(raw); + if (m) { + return t("{attacker} is {distance} ft from {target}, out of melee reach ({reach} ft).", { + attacker: m[1], + distance: m[2], + target: m[3], + reach: m[4], + }); + } + m = /^(.+?) is (\d+) ft from (.+?), beyond this attack's (\d+) ft maximum range\.(.*)$/.exec(raw); + if (m) { + return t("{attacker} is {distance} ft from {target}, beyond this attack's {range} ft maximum range.", { + attacker: m[1], + distance: m[2], + target: m[3], + range: m[4], + }); + } + return raw; +} + export function CardReturnedNote({ message, mine, name }: { message: CampaignMessage; mine: boolean; name: string }) { const [state, setState] = useState<"idle" | "sending" | "sent">("idle"); const [error, setError] = useState(""); @@ -67,7 +91,7 @@ export function CardReturnedNote({ message, mine, name }: { message: CampaignMes {mine ? t("This did not happen. It is back in your hand.") : t("This did not happen. It went back to {name}'s hand.", { name })} - {message.cardReturned ? {message.cardReturned} : null} + {message.cardReturned ? {translateCardReturnedReason(t, message.cardReturned)} : null}

    {mine && message.intent ? ( diff --git a/src/app/campaigns/[campaignId]/CinematicParts.tsx b/src/app/campaigns/[campaignId]/CinematicParts.tsx index 3579efd97c..4c3bc10e9b 100644 --- a/src/app/campaigns/[campaignId]/CinematicParts.tsx +++ b/src/app/campaigns/[campaignId]/CinematicParts.tsx @@ -2,6 +2,7 @@ import { isOocAnswer } from "@/lib/dm/ooc-question"; import { CardReturnedNote } from "@/app/campaigns/[campaignId]/CardReturnedNote"; +import type { translateSystemNote as TranslateSystemNote } from "@/app/campaigns/[campaignId]/MessageParts"; import { extraTurnTag, litOrderRows, pointerOrderIndex } from "@/lib/battlemap/initiative-rows"; import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type FormEvent, type ReactNode } from "react"; import { EyeOff } from "lucide-react"; @@ -600,6 +601,21 @@ export function TabletopChronicle({ }) { const t = useT(); const tp = useTp(); + const locale = useLocale(); + // Lazy-load MessageParts so its transcript dependencies stay out of the + // table route's first-load JS bundle (scripts/bundle-budget.json). + const [translateNote, setTranslateNote] = useState(null); + useEffect(() => { + if (locale === "en") return; + let cancelled = false; + void import("@/app/campaigns/[campaignId]/MessageParts").then((mod) => { + if (!cancelled) setTranslateNote(() => mod.translateSystemNote); + }); + return () => { + cancelled = true; + }; + }, [locale]); + const formatSystem = (raw: string) => (translateNote ? translateNote(t, raw) : raw); const rollsById = useMemo(() => new Map(rolls.map((roll) => [roll.id, roll])), [rolls]); const { recent, earlier } = useMemo(() => chronicleWindow(messages), [messages]); const signature = useMemo(() => chronicleSignature(recent, rolls.length), [recent, rolls.length]); @@ -691,13 +707,13 @@ export function TabletopChronicle({ const roll = rollsById.get(id); return roll ? : null; })} -

    {chronicleSystemLine(message.content)}

    +

    {formatSystem(chronicleSystemLine(message.content))}

    ); } return (

    - {chronicleSystemLine(message.content)} + {formatSystem(chronicleSystemLine(message.content))}

    ); })} diff --git a/src/app/campaigns/[campaignId]/EncounterPanel.tsx b/src/app/campaigns/[campaignId]/EncounterPanel.tsx index 17fb236418..703a5cadab 100644 --- a/src/app/campaigns/[campaignId]/EncounterPanel.tsx +++ b/src/app/campaigns/[campaignId]/EncounterPanel.tsx @@ -87,7 +87,7 @@ export function EncounterPanel({ }, [sheets, encounter.enemies, genre]); async function forceEnd() { - if (!await appConfirm("End this encounter without a resolution? No XP is awarded.")) { + if (!await appConfirm(t("End this encounter without a resolution? No XP is awarded."))) { return; } setEnding(true); @@ -104,7 +104,7 @@ export function EncounterPanel({ // table reached for this button and got no XP and the combat music still // playing. The abort stays offered when the engine will not end it. async function endFight() { - if (!await appConfirm("End the fight now? XP is awarded and the board clears; it cannot be reopened.", { title: "End the fight", actionLabel: "End it" })) { + if (!await appConfirm(t("End the fight now? XP is awarded and the board clears; it cannot be reopened."), { title: t("End the fight"), actionLabel: t("End it") })) { return; } setEnding(true); @@ -116,7 +116,7 @@ export function EncounterPanel({ }); if (!response.ok) { const body = (await response.json().catch(() => ({}))) as { error?: string }; - if (await appConfirm(`${body.error ?? "The engine would not end the fight."} Force-end it without XP instead?`, { actionLabel: "Force-end" })) { + if (await appConfirm(`${body.error ?? t("The engine would not end the fight.")} ${t("Force-end it without XP instead?")}`, { actionLabel: t("Force-end") })) { await fetch(`/api/campaigns/${campaignId}/encounter`, { method: "DELETE" }); } } @@ -135,10 +135,11 @@ export function EncounterPanel({

    - Combat{encounter.orderReady ? ` · Round ${encounter.round}` : " · Rolling initiative"} + {t("Combat")} + {encounter.orderReady ? ` · ${t("Round {n}", { n: encounter.round })}` : ` · ${t("Rolling initiative")}`} {encounter.lair ? ( - {encounter.lair.usedThisRound ? "lair acted" : "lair awake"} + {encounter.lair.usedThisRound ? t("lair acted") : t("lair awake")} ) : null}

    @@ -148,9 +149,9 @@ export function EncounterPanel({ onClick={canEditOrder ? endFight : forceEnd} disabled={ending} className="text-xs text-stone-500 hover:text-red-300 disabled:opacity-50 motion-press" - title={canEditOrder ? "End the fight: XP and the after-the-fight card" : "Force-end the encounter (lead only)"} + title={canEditOrder ? t("End the fight: XP and the after-the-fight card") : t("Force-end the encounter (lead only)")} > - End encounter + {t("End encounter")} ) : null}
    @@ -174,8 +175,8 @@ export function EncounterPanel({ className="flex w-full items-center gap-1 text-xs text-stone-500 hover:text-stone-300" > - {group.members[0].name.replace(/\s+\d+$/, "")} · {standing.length} of{" "} - {group.members.length} standing + {group.members[0].name.replace(/\s+\d+$/, "")} ·{" "} + {t("{standing} of {total} standing", { standing: standing.length, total: group.members.length })}
  • , ]; @@ -207,11 +208,11 @@ export function EncounterPanel({ {group.members[0].name.replace(/\s+\d+$/, "")} x{group.members.length} - CR {crLabel(group.members[0].cr)} + {t("CR {cr}", { cr: crLabel(group.members[0].cr) })} - {standing.length} standing + {t("{standing} standing", { standing: standing.length })} , @@ -260,7 +261,7 @@ export function EncounterPanel({ ) : null} {enemy.name} - CR {crLabel(enemy.cr)} + {t("CR {cr}", { cr: crLabel(enemy.cr) })} {enemy.regenerating ? ( - {enemy.regenerating.stopped ? "dies at its turn" : "regenerates at its turn"} + {enemy.regenerating.stopped ? t("dies at its turn") : t("regenerates at its turn")} ) : null} {/* DM only: publicEncounter attaches these for the seat that is allowed them, so their presence is the permission. */} {enemy.currentHp !== undefined && enemy.status === "alive" ? ( - {enemy.currentHp}/{enemy.maxHp} AC {enemy.ac} + {enemy.currentHp}/{enemy.maxHp}{enemy.ac !== undefined ? ` ${t("AC {ac}", { ac: enemy.ac })}` : ""} ) : null} {/* A creature the party dominates (issue 503, SideBadge.tsx). */} {enemy.legendary ? ( -
    +
    {Array.from({ length: enemy.legendary.actionsMax }, (_, index) => ( (picked ? previewRows(picked, aim ?? (picked.target === "enemy" ? defaultAim : null), conditions, choices, t, locale) : []), [picked, aim, defaultAim, conditions, choices, t, locale], @@ -788,7 +790,7 @@ function HandInner({ if (!picked) return null; const option = (value: string, label: string, disabled: string | null = null) => ({ value, label, disabled }); const pickedName = cardDisplayName(picked, locale); - return { title: pickedName, boardInput: true, lines: [picked.description ?? picked.rules, ...rows.map(row => `${row.key}: ${row.value}`), ...(picked.area ? [pickHint(t, picked.area, barProps.areaPick), ...(hasPick(picked.area, barProps.areaPick) ? [describePick(picked.area, barProps.areaPick)] : [])] : []), t("Sends: {sentence}", { sentence }), ...(notice ? [notice] : [])], controls: [ + return { title: pickedName, boardInput: true, lines: [picked.description ?? picked.rules, ...rows.map(row => `${row.key}: ${row.value}`), ...(picked.area ? [pickHint(t, picked.area, barProps.areaPick), ...(hasPick(picked.area, barProps.areaPick) ? [describePick(picked.area, barProps.areaPick)] : [])] : []), t("Sends: {sentence}", { sentence: displaySentence }), ...(notice ? [notice] : [])], controls: [ ...(offered.length ? [{ id: "hand-target" as const, label: t("Target"), value: aim?.id, disabled: null, options: offered.map(target => option(target.id, `${target.name}${target.note ? ` · ${target.note}` : ""}`)) }] : []), ...(barProps.options.length ? [{ id: "hand-option" as const, label: t("Attack options (choose to toggle)"), disabled: null, options: barProps.options.map(entry => option(entry.id, `${barProps.chosen.includes(entry.id) ? "✓ " : ""}${entry.label}`, entry.disabled ?? null)) }] : []), ...(picked.intent.card === "attack" && cards.some(card => card.type === "rider") ? [{ id: "hand-rider" as const, label: t("Riders (choose to toggle)"), disabled: null, options: cards.filter(card => card.type === "rider").map(card => option(card.id, `${attachedRiders.some(rider => rider.id === card.id) ? "✓ " : ""}${cardDisplayName(card, locale)}`, card.disabled)) }] : []), @@ -803,7 +805,7 @@ function HandInner({ ] }; // `t` is bound to the locale (locale.tsx useT), so it stands for both: // listing the two left the React Compiler unable to keep this memo. - }, [t, boardNative, boardSwap, boardChoices, cards, picked, rows, sentence, offered, aim, attachedRiders, barProps.options, barProps.chosen, barProps.choice, barProps.count, barProps.mix, barProps.trigger, barProps.areaPick, barProps.shares, splits, notice, inputBlocked, blockedReason]); + }, [t, boardNative, boardSwap, boardChoices, cards, picked, rows, displaySentence, offered, aim, attachedRiders, barProps.options, barProps.chosen, barProps.choice, barProps.count, barProps.mix, barProps.trigger, barProps.areaPick, barProps.shares, splits, notice, inputBlocked, blockedReason]); const nativeSignature = JSON.stringify([campaignId, sheet?.id, signature, nativePanel, sending && !boardSwap]); useEffect(() => { if (swapReply.current && swapTurn.current !== `${campaignId}:${sheet?.id}:${signature}`) { @@ -1175,7 +1177,7 @@ function HandInner({ riders={attachedRiders} onDropRider={(rider) => setRiderIds((current) => current.filter((id) => id !== rider.id))} rows={rows} - sentence={sentence} + sentence={displaySentence} sending={sending} {...barProps} onShare={splits ? barProps.onShare : undefined} diff --git a/src/app/campaigns/[campaignId]/HandAimBar.tsx b/src/app/campaigns/[campaignId]/HandAimBar.tsx index 08cbba8aed..e1f38b7d01 100644 --- a/src/app/campaigns/[campaignId]/HandAimBar.tsx +++ b/src/app/campaigns/[campaignId]/HandAimBar.tsx @@ -5,9 +5,10 @@ import { useEffect, useRef, type CSSProperties } from "react"; import { cn } from "@/lib/cn"; import { replayAnimation } from "@/lib/motion/replay"; import { ui } from "@/lib/ui"; -import { useT } from "@/lib/locale"; +import { useLocale, useT } from "@/lib/locale"; import { Tooltip } from "@/components/ui/Tooltip"; import type { HandAttackOption, HandAttackOptionId, HandCard } from "@/lib/battlemap/hand"; +import { cardDisplayName } from "@/lib/battlemap/hand-display"; import { handReady, shareList, type HandAim, type PreviewRow } from "@/lib/battlemap/hand-play"; import type { HandShare } from "@/lib/battlemap/hand-intent"; import { hasPick, pickHint, pickWords, type AreaPick } from "@/lib/battlemap/hand-area"; @@ -197,6 +198,7 @@ function HandOptionChip({ // Closed until asked for: Wish's runs to pages, and it would push the Play // button off a phone. export function HandFullText({ card }: { card: HandCard }) { + const t = useT(); // Less the rules line written just above (hand-full-text-logic.ts). const text = cardFullText(card); if (!text) return null; @@ -222,7 +224,7 @@ export function HandFullText({ card }: { card: HandCard }) { }} > - Full text + {t("Full text")}

    {text}

    @@ -235,19 +237,21 @@ export function HandFullText({ card }: { card: HandCard }) { // which stays: the reason is still said on the Hand's notice line below it. export function HandReadPanel({ card, onClose }: { card: HandCard; onClose: () => void }) { const t = useT(); + const locale = useLocale(); + const displayName = cardDisplayName(card, locale); const ref = useRef(null); useEffect(() => { ref.current?.scrollIntoView({ block: "nearest" }); }, [card.id]); return ( -
    +
    {typeLabel(t, card.type)} - {card.name} + {displayName}
    {card.rules ?

    {card.rules}

    : null} @@ -328,6 +332,8 @@ export function HandAimBar({ onCommit: () => void; }) { const t = useT(); + const locale = useLocale(); + const displayName = cardDisplayName(card, locale); const toggles = options.filter((option) => !option.group); const grouped = options.filter((option) => option.group); const needsTarget = card.target === "enemy" || card.target === "ally"; @@ -371,7 +377,7 @@ export function HandAimBar({ {typeLabel(t, card.type)} - {card.name} + {displayName} {hint}
    @@ -594,7 +600,7 @@ export function HandAimBar({ className={cn(ui.btnPrimary, "max-w-full")} > {sending ? : null} - {card.compose ? t("Write it") : card.name} + {card.compose ? t("Write it") : displayName}
    diff --git a/src/app/campaigns/[campaignId]/MessageParts.tsx b/src/app/campaigns/[campaignId]/MessageParts.tsx index 3e50f746bd..48641ae2f8 100644 --- a/src/app/campaigns/[campaignId]/MessageParts.tsx +++ b/src/app/campaigns/[campaignId]/MessageParts.tsx @@ -9,6 +9,7 @@ import { PortraitMedallion } from "@/components/sheet/SheetParts"; import { useFaceChain } from "@/app/campaigns/[campaignId]/useFaceChain"; import { useFaceSize } from "@/app/campaigns/[campaignId]/useFaceSize"; import { cn } from "@/lib/cn"; +import { contentName } from "@/lib/content/names"; import { playerFaces } from "@/lib/speaker-faces"; import { ADVENTURE_BEGINS_NOTE, @@ -18,7 +19,7 @@ import { systemNoteWords, type CampaignMember, } from "@/lib/campaign-types"; -import { useT } from "@/lib/locale"; +import { useLocale, useT } from "@/lib/locale"; import type { CampaignMessage } from "@/lib/db/messages"; import type { CharacterSheet } from "@/lib/schemas/sheet"; import type { TranscriptSheet } from "@/app/campaigns/[campaignId]/departing"; @@ -91,8 +92,63 @@ export function reportAction(t: T, message: CampaignMessage, onReport: (message: // translated here, at display, only when the content is exactly the note. const ADVENTURE_BEGINS_DM_LINE = `${ADVENTURE_BEGINS_NOTE} The Game Master opens the scene.`; -function translateSystemNote(t: (key: string, vars?: Record) => string, raw: string): string { +function translateDuration(t: T, raw: string): string { + return raw.replace(/(? { + const base = unit.replace(/s$/, ""); + return t(Number(n) === 1 ? `{n} ${base}` : `{n} ${base}s`, { n }); + }); +} + +function translateCalendarClause(t: T, raw: string): string { + const DAYS = ["Firstday", "Seconday", "Midweek", "Fourthday", "Fifthday", "Restday", "Midday"]; + const MONTHS = [ + "Deepwinter", "Frostmoon", "Thaw", "Greening", "Bloom", "Seedfall", + "Highsun", "Longlight", "Firstharvest", "Goldfall", "Leafturn", "Yearsend", + "First Month", "Second Month", "Third Month", "Fourth Month", "Fifth Month", "Sixth Month", + "Seventh Month", "Eighth Month", "Ninth Month", "Tenth Month", "Eleventh Month", "Twelfth Month", + ]; + const PARTS = ["deep night", "before dawn", "morning", "midday", "afternoon", "evening", "night"]; + const SEASONS = ["winter", "spring", "summer", "autumn"]; + let out = raw; + out = out.replace(/It is now ([^.\n]*\b(?:year \d+|Day \d+)\b[^.\n]*)\./g, (_: string, rest: string) => { + let dateStr = rest; + for (const d of DAYS) dateStr = dateStr.replace(new RegExp(`(? t("year {n}", { n: y })); + dateStr = dateStr.replace(/(? t("Day {n}", { n: d })); + for (const p of PARTS) dateStr = dateStr.replace(new RegExp(`, ${p}(?=,|$)`, "g"), `, ${t(p)}`); + for (const s of SEASONS) dateStr = dateStr.replace(new RegExp(`, ${s}(?=,|$)`, "g"), `, ${t(s)}`); + return t("It is now {date}.", { date: dateStr }); + }); + return out; +} + +function translateMountDesc(t: T, desc: string): string { + return desc + .replace(/(? t("speed {feet} ft.", { feet })) + .replace(/(? t("controlled (shares your initiative)")) + .replace(/(? t("independent (acts on its own turn)")); +} + +function translateConditionWord(t: T, word: string): string { + const MAP: Record = { + incapacitated: "incapacitated", + stunned: "stunned", + paralyzed: "paralyzed", + unconscious: "unconscious", + petrified: "petrified", + held: "held", + charmed: "charmed", + calmed: "calmed", + }; + return MAP[word] ? t(MAP[word]) : word; +} + +export function translateSystemNote(t: T, raw: string): string { if (raw === "The fight is over.") return t("The fight is over."); + if (raw === "Every character is down and none can rise on their own.") { + return t("Every character is down and none can rise on their own."); + } let m = /^Chapter (\d+)(?:, "([^"]+)",)? comes to a close\.(.*)$/.exec(raw); if (m) { const head = m[2] @@ -114,21 +170,145 @@ function translateSystemNote(t: (key: string, vars?: Record + t("The party takes a short rest ({duration})", { duration: translateDuration(t, dur) }), + ); + out = out.replace(/^Inside the genie's vessel, the party takes a short rest \(([^)]+)\)/, (_, dur) => + t("Inside the genie's vessel, the party takes a short rest ({duration})", { duration: translateDuration(t, dur) }), + ); + out = out.replace(/^The party takes a long rest \(([^)]+)\)/, (_, dur) => + t("The party takes a long rest ({duration})", { duration: translateDuration(t, dur) }), + ); + out = out.replace(/ No benefit from it for ([^.\n]+)\./g, (_, who) => + ` ${t("No benefit from it for {who}.", { who })}`, + ); + out = out.replace(/^(\d+ (?:week|weeks|day|days|hour|hours|minute|minutes)) pass(?:es)?: /, (_, dur) => + `${t("{duration} pass:", { duration: translateDuration(t, dur) })} `, + ); out = out.replace(/It is now ([^']+)'s turn \(round (\d+)\)\./g, (_, ch, r) => t("It is now {character}'s turn (round {n}).", { character: ch, n: r }), ); + out = out.replace(/It is now ([^']+)'s turn again\./g, (_, ch) => + t("It is {character}'s turn again.", { character: ch }), + ); + out = out.replace(/It is ([^']+)'s turn again\./g, (_, ch) => + t("It is {character}'s turn again.", { character: ch }), + ); out = out.replace(/It is now ([^']+)'s turn\./g, (_, ch) => t("It is now {character}'s turn.", { character: ch }), ); - out = out.replace(/([A-Z][^.\n]+?) acts before ([^.]+)\./g, (_, enemy, ch) => - t("{enemy} acts before {character}.", { enemy, character: ch }), + out = translateCalendarClause(t, out); + out = out.replace(/([^.\n]+?) ends their turn\./g, (_, ch) => + t("{character} ends their turn.", { character: ch.trim() }), + ); + out = out.replace(/([\p{Lu}][^.\n]+?) (acts|act) before ([^.\n]+)\./gu, (_, enemy, verb, ch) => + verb === "acts" + ? t("{enemy} acts before {character}.", { enemy, character: ch }) + : t("{enemies} act before {character}.", { enemies: enemy, character: ch }), + ); + out = out.replace(/Every character has fallen: the fight is lost\./g, () => + t("Every character has fallen: the fight is lost."), + ); + out = out.replace(/The party lead skipped ([^']+)'s turn\./g, (_, ch) => + t("The party lead skipped {character}'s turn.", { character: ch }), ); out = out.replace(/Skipped enemy turns resolve automatically:/g, () => t("Skipped enemy turns resolve automatically:"), ); + // Death saves (src/lib/dm/death.ts) + out = out.replace( + /([^.\s\n][^.\n]*?) death save: rolled (\d+), (natural 20|success|failure)(?: \(([^)]+)\))?\./g, + (_, name, total, result, tally) => { + const resultFr = t(result); + return tally + ? t("{name} death save: rolled {total}, {result} ({tally}).", { name: name.trim(), total, result: resultFr, tally }) + : t("{name} death save: rolled {total}, {result}.", { name: name.trim(), total, result: resultFr }); + }, + ); + out = out.replace(/([^.\s\n][^.\n]*?) rolls a natural 20 on their death save and regains 1 HP!/g, (_, name) => + t("{name} rolls a natural 20 on their death save and regains 1 HP!", { name: name.trim() }), + ); + out = out.replace( + /([^.\s\n][^.\n]*?) succeeds their third death save and is stable \(unconscious at 0 HP\)\. They regain 1 hit point in (\d+) hours?\./g, + (_, name, hours) => + Number(hours) === 1 + ? t("{name} succeeds their third death save and is stable (unconscious at 0 HP). They regain 1 hit point in {hours} hour.", { name: name.trim(), hours }) + : t("{name} succeeds their third death save and is stable (unconscious at 0 HP). They regain 1 hit point in {hours} hours.", { name: name.trim(), hours }), + ); + out = out.replace( + /([^.\s\n][^.\n]*?) succeeds their third death save and is stable at 0 HP, still raging on their feet\./g, + (_, name) => t("{name} succeeds their third death save and is stable at 0 HP, still raging on their feet.", { name: name.trim() }), + ); + out = out.replace( + /([^.\s\n][^.\n]*?) fails their third death save\. Rage Beyond Death holds the death off: they die when the rage ends, if they are still at 0 hit points then\./g, + (_, name) => t("{name} fails their third death save. Rage Beyond Death holds the death off: they die when the rage ends, if they are still at 0 hit points then.", { name: name.trim() }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) fails their final death save and dies\./g, (_, name) => + t("{name} fails their final death save and dies.", { name: name.trim() }), + ); + out = out.replace(/([^.\s\n][^.\n]*?)'s rage ends: their turn passed with no attack made and no damage taken\./g, (_, name) => + t("{name}'s rage ends: their turn passed with no attack made and no damage taken.", { name: name.trim() }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) comes round with (\d+) hit points?\./g, (_, name, hp) => + Number(hp) === 1 + ? t("{name} comes round with {hp} hit point.", { name: name.trim(), hp }) + : t("{name} comes round with {hp} hit points.", { name: name.trim(), hp }), + ); + // Stand-still & skipped enemy lines (src/lib/dm/turn-lines-logic.ts) + out = out.replace(/([^.\s\n][^.\n]*?) is ([^.\n]+?) and loses (its|their) turn\./g, (_, name, by, pron) => + pron === "their" + ? t("{name} is {by} and loses their turn.", { name: name.trim(), by: translateConditionWord(t, by.trim()) }) + : t("{name} is {by} and loses its turn.", { name: name.trim(), by: translateConditionWord(t, by.trim()) }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) is caught by surprise and does nothing this round\./g, (_, name) => + t("{name} is caught by surprise and does nothing this round.", { name: name.trim() }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) has no one left to fight\./g, (_, name) => + t("{name} has no one left to fight.", { name: name.trim() }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) closes in on ([^.\n]+?) but cannot reach them this turn\./g, (_, name, target) => + t("{name} closes in on {target} but cannot reach them this turn.", { name: name.trim(), target }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) cannot reach ([^.\n]+?) this turn\./g, (_, name, target) => + t("{name} cannot reach {target} this turn.", { name: name.trim(), target }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) moves for a shot at ([^.\n]+?) but is still out of range\./g, (_, name, target) => + t("{name} moves for a shot at {target} but is still out of range.", { name: name.trim(), target }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) cannot get ([^.\n]+?) within range this turn\./g, (_, name, target) => + t("{name} cannot get {target} within range this turn.", { name: name.trim(), target }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) moves but still has no clear line to ([^.\n]+)\./g, (_, name, target) => + t("{name} moves but still has no clear line to {target}.", { name: name.trim(), target }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) has no clear line to ([^.\n]+?) this turn\./g, (_, name, target) => + t("{name} has no clear line to {target} this turn.", { name: name.trim(), target }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) is too frightened to close in on ([^.\n]+)\./g, (_, name, target) => + t("{name} is too frightened to close in on {target}.", { name: name.trim(), target }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) does not close in while ([^.\n]+?) holds a readied action\./g, (_, name, holder) => + t("{name} does not close in while {holder} holds a readied action.", { name: name.trim(), holder }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) is ([^.\n]+?) and makes no attack\./g, (_, name, by) => + t("{name} is {by} and makes no attack.", { name: name.trim(), by: translateConditionWord(t, by.trim()) }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) finds no one it can attack this turn\./g, (_, name) => + t("{name} finds no one it can attack this turn.", { name: name.trim() }), + ); + out = out.replace(/([^.\s\n][^.\n]*?)'s turn has not come yet\./g, (_, name) => + t("{name}'s turn has not come yet.", { name: name.trim() }), + ); + out = out.replace(/([^.\s\n][^.\n]*?) does not attack this turn\./g, (_, name) => + t("{name} does not attack this turn.", { name: name.trim() }), + ); out = out.replace( - /([^:;]+) attacks ([^:]+?) with ([^(:]+) \(([^)]+) vs AC (\d+): (HIT|CRIT|MISS)(?: for ([^)]+))?\)\./g, + /([^:;]+) attacks ([^:]+?) with ([^(:]+) \(([^)]+) vs AC (\d+): (HIT|CRIT|MISS)(?: for ([^)]+(?:\([^)]*\))?))?\)\./g, (_, enemy, target, weapon, roll, ac, outcome, dmg) => { const outcomeFr = outcome === "HIT" ? t("HIT") : outcome === "CRIT" ? t("CRIT") : t("MISS"); @@ -152,10 +332,101 @@ function translateSystemNote(t: (key: string, vars?: Record ` ${t("{target} falls!", { target })}`); out = out.replace(/^Combat begins\. Initiative order: /, () => `${t("Combat begins. Initiative order:")} `); return out; } +// Translates engine-bound English sentences emitted by `composeSentence` at +// display time so the campaign chat log renders in the user's locale without +// changing the stored English action prose that the DM engine parses. +function translatePlayerAction(t: T, locale: "en" | "fr", raw: string): string { + if (locale === "en") return raw; + const trimmed = raw.trim(); + if (trimmed === "I end my turn.") return t("I end my turn."); + if (trimmed === "I stand up.") return t("I stand up."); + if (trimmed === "I dismount.") return t("I dismount."); + if (trimmed === "I take the Search action.") return t("I take the Search action."); + if (trimmed === "I try to escape the grapple.") return t("I try to escape the grapple."); + let m = /^I attack (.+?) with (an unarmed strike|my .+?)( as a bonus action \(([^)]+)\))?\.(.*)$/.exec(trimmed); + if (m) { + const who = m[1] === "the nearest enemy" ? t("the nearest enemy") : m[1] === "myself" ? t("myself") : m[1]; + const weapon = m[2] === "an unarmed strike" ? t("an unarmed strike") : contentName("items", m[2].slice(3), locale); + const lead = m[4] + ? t("I attack {who} with {weapon} as a bonus action ({feature}).", { who, weapon, feature: t(m[4]) }) + : t("I attack {who} with {weapon}.", { who, weapon }); + const tail = m[5] ? translateActionTail(t, locale, m[5]) : ""; + return `${lead}${tail}`; + } + m = /^I make my off-hand attack(?: against (.+?))? with (an unarmed strike|my .+?) as a bonus action\.(.*)$/.exec(trimmed); + if (m) { + const weapon = m[2] === "an unarmed strike" ? t("an unarmed strike") : contentName("items", m[2].slice(3), locale); + const lead = m[1] + ? t("I make my off-hand attack against {who} with {weapon} as a bonus action.", { who: m[1], weapon }) + : t("I make my off-hand attack with {weapon} as a bonus action.", { weapon }); + const tail = m[3] ? translateActionTail(t, locale, m[3]) : ""; + return `${lead}${tail}`; + } + m = /^I (draw|stow|drop|strap on|take off) my (.+)\.$/.exec(trimmed); + if (m) { + const item = contentName("items", m[2], locale); + if (m[1] === "draw") return t("I draw my {item}.", { item }); + if (m[1] === "stow") return t("I stow my {item}.", { item }); + if (m[1] === "drop") return t("I drop my {item}.", { item }); + if (m[1] === "strap on") return t("I strap on my {item}.", { item }); + return t("I take off my {item}.", { item }); + } + m = /^I pick up the (.+)\.$/.exec(trimmed); + if (m) return t("I pick up the {item}.", { item: contentName("items", m[1], locale) }); + m = /^I (Dash|Disengage|Hide|take the Dodge action)( as a bonus action \(([^)]+)\))?( and step away)?\.$/.exec(trimmed); + if (m) { + const bonus = m[3] ? ` ${t("as a bonus action ({route})", { route: t(m[3]) })}` : ""; + if (m[1] === "Dash") return t("I Dash{bonus}.", { bonus }); + if (m[1] === "Disengage") return t("I Disengage{bonus} and step away.", { bonus }); + if (m[1] === "Hide") return t("I Hide{bonus}.", { bonus }); + return t("I take the Dodge action{bonus}.", { bonus }); + } + m = /^I try to (grapple|shove|stabilize) (.+)\.$/.exec(trimmed); + if (m) { + const who = m[2] === "the nearest enemy" ? t("the nearest enemy") : m[2] === "my dying ally" ? t("my dying ally") : m[2]; + if (m[1] === "grapple") return t("I try to grapple {who}.", { who }); + if (m[1] === "shove") return t("I shove {who}.", { who }); + return t("I try to stabilize {who}.", { who }); + } + m = /^I take the Help action for (.+)\.$/.exec(trimmed); + if (m) return t("I take the Help action for {who}.", { who: m[1] === "my ally" ? t("my ally") : m[1] }); + m = /^I shake (.+) awake\.$/.exec(trimmed); + if (m) return t("I shake {who} awake.", { who: m[1] === "my ally" ? t("my ally") : m[1] }); + return raw; +} + +function translateActionTail(t: T, locale: "en" | "fr", tail: string): string { + const CLAUSES = [ + "I attack recklessly.", + "If it hits, I use Stunning Strike.", + "I strike to knock them out, not to kill.", + "I spend my Inspiration on it.", + "If it misses, I use Stroke of Luck.", + "If it hits, I use Hurl Through Hell.", + "I trade its advantage for Rapid Strike.", + "If it hits, Open Hand Technique knocks them prone.", + "If it hits, Open Hand Technique pushes them away.", + "If it hits, Open Hand Technique takes their reactions.", + "If it hits, I use Divine Smite.", + ]; + let out = tail; + for (const clause of CLAUSES) { + out = out.replace(clause, t(clause)); + } + out = out.replace(/If it hits, I use Divine Smite with a level (\d+) slot\./g, (_, lvl) => + t("If it hits, I use Divine Smite with a level {level} slot.", { level: lvl }), + ); + out = out.replace(/I use (.+?) on this attack\./g, (_, rider) => + t("I use {rider} on this attack.", { rider: contentName("classFeatures", rider, locale) }), + ); + return out; +} + export function SystemMessage({ content, glyph }: { content: string; glyph?: SystemGlyph }) { const t = useT(); if (content.startsWith(LEAD_NOTE_PREFIX)) { @@ -263,6 +534,7 @@ export function PlayerMessage({ // A message without a character to its name still has its actions and its // speaker line: "Player" is the stand-in, read in the interface's language. const t = useT(); + const locale = useLocale(); const fallbackName = t("Player"); const sheet: TranscriptSheet | undefined = message.characterId ? sheetsById.get(message.characterId) @@ -296,6 +568,7 @@ export function PlayerMessage({ // eslint-disable-next-line @next/next/no-img-element const face = portraitUrl ? : null; const ooc = message.content.startsWith("(ooc)"); + const body = ooc ? message.content : translatePlayerAction(t, locale, message.content); // The portrait as tall as the name and bubble beside it (useFaceSize). const [faceStyle, textColumn] = useFaceSize(); return ( @@ -321,7 +594,7 @@ export function PlayerMessage({ {sheet?.name ?? fallbackName}

    -

    {message.content}

    +

    {body}

    {message.cardReturned ? : null}
    diff --git a/src/app/campaigns/[campaignId]/Moments.tsx b/src/app/campaigns/[campaignId]/Moments.tsx index 6be438629a..aa365864e9 100644 --- a/src/app/campaigns/[campaignId]/Moments.tsx +++ b/src/app/campaigns/[campaignId]/Moments.tsx @@ -7,6 +7,7 @@ import { GameIcon } from "@/components/ui/GameIcon"; import type { AuditEntry, CampaignLocation } from "@/app/campaigns/[campaignId]/useCampaignStream"; import { effectiveMaxHp } from "@/lib/dm/condition-logic"; import { prefersReducedMotion, useLowEffects } from "@/lib/effects-mode"; +import { useT } from "@/lib/locale"; import type { CharacterSheet, EquipmentItem } from "@/lib/schemas/sheet"; import { magicItemBonus } from "@/lib/srd/item-row"; import { matchMagicItem } from "@/lib/srd/magic-items"; @@ -170,6 +171,7 @@ function packOf(sheet: CharacterSheet): Map { // with its painted icon. Read off the sheet itself, so every way an item can // arrive is covered and nothing about how it arrives changes. export function LootMoment({ sheet }: { sheet: CharacterSheet | null | undefined }) { + const t = useT(); const signature = sheet ? `${sheet.id}|${sheet.equipment.map((item) => `${item.name}x${item.qty}`).join("|")}` : ""; const [known, setKnown] = useState({ signature, id: sheet?.id ?? "", pack: sheet ? packOf(sheet) : new Map() }); const [queue, setQueue] = useState([]); @@ -209,7 +211,7 @@ export function LootMoment({ sheet }: { sheet: CharacterSheet | null | undefined - {tier === "epic" ? "A treasure" : tier === "rare" ? "A rare find" : "Added to your pack"} + {tier === "epic" ? t("A treasure") : tier === "rare" ? t("A rare find") : t("Added to your pack")} {current.name} {current.qty > 1 ? ` x${current.qty}` : ""} @@ -225,6 +227,7 @@ const TRAVEL_MS = 3400; // is open, its name rides in under a compass rose. A place already current // when the table opened is not announced. export function TravelBanner({ locations }: { locations: CampaignLocation[] }) { + const t = useT(); const place = locations.find((location) => location.isCurrent) ?? null; const visited = locations.filter((location) => location.visited).map((location) => location.id).join(","); const [known, setKnown] = useState({ id: place?.id ?? "", visited }); @@ -253,7 +256,7 @@ export function TravelBanner({ locations }: { locations: CampaignLocation[] }) { {/* eslint-disable-next-line @next/next/no-img-element */} - {shown.firstVisit ? "New place discovered" : "The party arrives"} + {shown.firstVisit ? t("New place discovered") : t("The party arrives")} {shown.name}
    diff --git a/src/app/campaigns/[campaignId]/MonsterHand.tsx b/src/app/campaigns/[campaignId]/MonsterHand.tsx index cf7b7bdde3..e4331903a6 100644 --- a/src/app/campaigns/[campaignId]/MonsterHand.tsx +++ b/src/app/campaigns/[campaignId]/MonsterHand.tsx @@ -105,7 +105,7 @@ function MonsterHandInner({ .map((sheet) => ({ id: sheet.id, name: sheet.name, kind: "enemy" as const, ac: effectiveAcFor(sheet), conditions: sheet.conditions, note: `${t("{hp}/{max} hp", { hp: sheet.currentHp, max: effectiveMaxHp(sheet) })}${t(" · AC {ac}", { ac: effectiveAcFor(sheet) })}` })), ...encounter.enemies .filter((enemy) => enemy.status === "alive" && (offSide(encounter, enemy.id, "enemy") ?? "foe") !== mySide) - .map((enemy) => ({ id: enemy.id, name: enemy.name, kind: "enemy" as const, ac: enemy.ac, conditions: enemy.conditions, row: true, note: `${enemy.currentHp !== undefined ? t("{hp}/{max} hp", { hp: enemy.currentHp, max: enemy.maxHp ?? 0 }) : enemy.health}${enemy.ac !== undefined ? t(" · AC {ac}", { ac: enemy.ac }) : ""}` })), + .map((enemy) => ({ id: enemy.id, name: enemy.name, kind: "enemy" as const, ac: enemy.ac, conditions: enemy.conditions, row: true, note: `${enemy.currentHp !== undefined ? t("{hp}/{max} hp", { hp: enemy.currentHp, max: enemy.maxHp ?? 0 }) : t(enemy.health)}${enemy.ac !== undefined ? t(" · AC {ac}", { ac: enemy.ac }) : ""}` })), ], [t, sheets, encounter, mySide], ); @@ -115,12 +115,12 @@ function MonsterHandInner({ () => [ ...encounter.enemies .filter((enemy) => enemy.status === "alive" && (offSide(encounter, enemy.id, "enemy") ?? "foe") === mySide) - .map((enemy) => ({ id: enemy.id, name: enemy.name, kind: "enemy" as const, ac: enemy.ac, conditions: enemy.conditions, row: true, note: `${enemy.currentHp !== undefined ? `${enemy.currentHp}/${enemy.maxHp} hp` : enemy.health}${enemy.ac !== undefined ? ` · AC ${enemy.ac}` : ""}` })), + .map((enemy) => ({ id: enemy.id, name: enemy.name, kind: "enemy" as const, ac: enemy.ac, conditions: enemy.conditions, row: true, note: `${enemy.currentHp !== undefined ? `${enemy.currentHp}/${enemy.maxHp} hp` : t(enemy.health)}${enemy.ac !== undefined ? ` · AC ${enemy.ac}` : ""}` })), ...sheets .filter((sheet) => !sheet.deathSaves?.dead && (offSide(encounter, sheet.id, "pc") ?? "party") === mySide) .map((sheet) => ({ id: sheet.id, name: sheet.name, kind: "enemy" as const, ac: effectiveAcFor(sheet), conditions: sheet.conditions, note: `${sheet.currentHp}/${effectiveMaxHp(sheet)} hp · AC ${effectiveAcFor(sheet)}` })), ], - [sheets, encounter, mySide], + [t, sheets, encounter, mySide], ); const [pickedId, setPickedId] = useState(null); @@ -372,7 +372,7 @@ function MonsterHandInner({ {shown(enemy.name)}
    - {enemy.currentHp !== undefined ? t("{hp}/{max} hp", { hp: enemy.currentHp, max: enemy.maxHp ?? 0 }) : enemy.health} + {enemy.currentHp !== undefined ? t("{hp}/{max} hp", { hp: enemy.currentHp, max: enemy.maxHp ?? 0 }) : t(enemy.health)} {enemy.ac !== undefined ? t(" · AC {ac}", { ac: enemy.ac }) : ""} {acted ? ` · ${t("acted")}` : ""} {movement ? ` · ${t("{left} ft left", { left: movement.leftFeet })}${movement.dashes ? ` · ${t("Dashed")}` : ""}` : ""} diff --git a/src/app/campaigns/[campaignId]/NarrationNote.tsx b/src/app/campaigns/[campaignId]/NarrationNote.tsx index 4939d1ebef..1cd481d277 100644 --- a/src/app/campaigns/[campaignId]/NarrationNote.tsx +++ b/src/app/campaigns/[campaignId]/NarrationNote.tsx @@ -1,5 +1,6 @@ "use client"; +import { useT } from "@/lib/locale"; import { useCapabilities } from "@/lib/use-capabilities"; import type { ImageBackend } from "@/lib/types"; @@ -15,6 +16,7 @@ const noteClass = "reveal text-[11px] leading-4 text-stone-500"; const warnClass = "reveal text-[11px] leading-4 text-amber-400/90"; export function NarrationNote() { + const t = useT(); const capabilities = useCapabilities(); const tts = capabilities?.tts; // No answer yet, or a server older than these fields: say nothing rather @@ -25,36 +27,35 @@ export function NarrationNote() { if (tts.provider === "off") { return (

    - Narration is switched off on this server, so nothing will be read aloud. An admin turns it on in - Admin > Speech. + {t("Narration is switched off on this server, so nothing will be read aloud. An admin turns it on in Admin > Speech.")}

    ); } - const server = tts.provider === "kokoro" ? "the Kokoro speech server" : "an OpenAI-compatible speech server"; - const where = tts.place === "local" || !tts.place ? "on this server's own network" : `at ${tts.place}`; + const server = tts.provider === "kokoro" ? t("the Kokoro speech server") : t("an OpenAI-compatible speech server"); + const where = tts.place === "local" || !tts.place ? t("on this server's own network") : t("at {place}", { place: tts.place }); // The server answers but has no model to ask for (an older server sends // no such field and says nothing here). if (tts.needsModel) { return (

    - Narration is on, but {server} {where} has no model picked, so nothing is read aloud until an admin picks - one in Admin > Speech. + {t("Narration is on, but {server} {where} has no model picked, so nothing is read aloud until an admin picks one in Admin > Speech.", { server, where })}

    ); } if (!tts.reachable) { return (

    - Narration is on, but {server} {where} is not answering, so passages will stay silent until it does. An - admin can test it in Admin > Speech. + {t("Narration is on, but {server} {where} is not answering, so passages will stay silent until it does. An admin can test it in Admin > Speech.", { server, where })}

    ); } return (

    - Each passage is sent as text to {server} {where} and comes back as audio. - {tts.place === "local" || !tts.place ? " Nothing leaves it." : ""} The address, model and key are the - server's, set in Admin > Speech. + {t("Each passage is sent as text to {server} {where} and comes back as audio.{local} The address, model and key are the server's, set in Admin > Speech.", { + server, + where, + local: tts.place === "local" || !tts.place ? ` ${t("Nothing leaves it.")}` : "", + })}

    ); } @@ -68,17 +69,19 @@ const PAINTERS: Record = { }; export function ImagesNote({ backend }: { backend: ImageBackend }) { + const t = useT(); const capabilities = useCapabilities(); if (!capabilities) { return null; } const place = capabilities.images.openaiPlace; - const where = backend !== "openai" || !place ? "" : place === "local" ? " on this server's own network" : ` at ${place}`; + const where = backend !== "openai" || !place ? "" : place === "local" ? ` ${t("on this server's own network")}` : ` ${t("at {place}", { place })}`; return (

    - Pictures are painted by {PAINTERS[backend]} - {where}. Its address, model and key are the server's, set in Admin > Image generation, so every - campaign here shares them. + {t("Pictures are painted by {painter}{where}. Its address, model and key are the server's, set in Admin > Image generation, so every campaign here shares them.", { + painter: t(PAINTERS[backend]), + where, + })}

    ); } diff --git a/src/app/campaigns/[campaignId]/SafetyPause.tsx b/src/app/campaigns/[campaignId]/SafetyPause.tsx index e921e38684..533d6acfbe 100644 --- a/src/app/campaigns/[campaignId]/SafetyPause.tsx +++ b/src/app/campaigns/[campaignId]/SafetyPause.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import { Hand } from "lucide-react"; import { useState } from "react"; import { cn } from "@/lib/cn"; +import { useT } from "@/lib/locale"; // The X-card's two faces (docs/vtt-parity-implementation-plan.md 9.1). // Every player sees a calm gold scrim, "The table is taking a breath", @@ -23,6 +24,7 @@ export function SafetyPause({ paused: boolean; steersStory: boolean; }) { + const t = useT(); const [busy, setBusy] = useState(null); if (!paused) { return null; @@ -40,23 +42,23 @@ export function SafetyPause({ } } return ( -
    +
    -

    The table is taking a breath

    +

    {t("The table is taking a breath")}

    {steersStory - ? "Someone raised the X-card. Nothing is said about who or why. Choose how to go on." - : "Someone raised the X-card. Nothing more needs saying. The story waits."} + ? t("Someone raised the X-card. Nothing is said about who or why. Choose how to go on.") + : t("Someone raised the X-card. Nothing more needs saying. The story waits.")}

    {steersStory ? (
    {( [ - ["rewind", "Withdraw the last passage"], - ["reroll", "Write it again, elsewhere"], - ["continue", "Continue"], + ["rewind", t("Withdraw the last passage")], + ["reroll", t("Write it again, elsewhere")], + ["continue", t("Continue")], ] as const ).map(([action, label]) => (
    )} diff --git a/src/app/campaigns/[campaignId]/handTargets.ts b/src/app/campaigns/[campaignId]/handTargets.ts index 2a3f9d77a3..25a7d2444a 100644 --- a/src/app/campaigns/[campaignId]/handTargets.ts +++ b/src/app/campaigns/[campaignId]/handTargets.ts @@ -71,12 +71,12 @@ export function handTargets( ? enemy.regenerating.stopped ? t("down, dies at its turn") : t("down, regenerates at its turn") - : enemy.health, + : t(enemy.health), edges?.[enemy.id]?.cover ? t(edges[enemy.id].cover === 2 ? "half cover" : "3/4 cover") : null, edges?.[enemy.id]?.flanking ? t("flanked") : null, - ...enemy.conditions.slice(0, 2), + ...enemy.conditions.slice(0, 2).map((condition) => t(condition)), ] .filter(Boolean) .join(" · "), @@ -93,7 +93,7 @@ export function handTargets( conditions: entry.conditions, ...(edges?.[entry.id] ? { edge: edges[entry.id] } : {}), ...featured(entry.id), - note: `${entry.currentHp}/${effectiveMaxHp(entry)} hp`, + note: t("{hp}/{max} hp", { hp: entry.currentHp, max: effectiveMaxHp(entry) }), })); const party: HandTargetChip[] = living .filter((entry) => entry.id === selfId || sideOf(entry.id, "sheet") === mine) diff --git a/src/app/settings/PlayerPollLinkSetup.tsx b/src/app/settings/PlayerPollLinkSetup.tsx index 3a44c63bf7..b73097d693 100644 --- a/src/app/settings/PlayerPollLinkSetup.tsx +++ b/src/app/settings/PlayerPollLinkSetup.tsx @@ -37,25 +37,20 @@ export function PlayerPollLinkSetup({ grantId, characterName }: { grantId: strin return (
    -

    Or: a poll link, for an agent nothing can send requests to

    +

    {t("Or: a poll link, for an agent nothing can send requests to")}

    - If {characterName}'s agent cannot take incoming requests (a hosted assistant whose hooks can only check a - URL), give its hook this link to check every minute or so. It answers whether {characterName} has something to do - now. Wake the agent when wake is true and fingerprint differs from the one it last woke the - agent for. Use this or a receiver, not both. + {t("If {characterName}'s agent cannot take incoming requests (a hosted assistant whose hooks can only check a URL), give its hook this link to check every minute or so. It answers whether {characterName} has something to do now. Wake the agent when wake is true and fingerprint differs from the one it last woke the agent for. Use this or a receiver, not both.", { characterName })}

    {link ? (
    - +

    - Shown once. The link is the secret: keep it in the hook's settings, not in a chat. If your hero falls and you - bring in another, it wakes the agent for the new one. Revoking this connection stops it; a new one from Poll link - on the connection's row replaces it, and the row says if it ever stops on its own. + {t("Shown once. The link is the secret: keep it in the hook's settings, not in a chat. If your hero falls and you bring in another, it wakes the agent for the new one. Revoking this connection stops it; a new one from Poll link on the connection's row replaces it, and the row says if it ever stops on its own.")}

    ) : ( )} {error ? ( diff --git a/src/components/EmbeddingLanguageLine.tsx b/src/components/EmbeddingLanguageLine.tsx index 183652ef48..15285fc683 100644 --- a/src/components/EmbeddingLanguageLine.tsx +++ b/src/components/EmbeddingLanguageLine.tsx @@ -3,6 +3,7 @@ import { TriangleAlert } from "lucide-react"; import { cn } from "@/lib/cn"; import type { CampaignLanguage } from "@/lib/db/campaigns"; +import { useT } from "@/lib/locale"; import { TABLE_LANGUAGE_NAMES, type TableLanguage } from "@/lib/schemas/game-settings-options"; import { useEmbeddingWarning } from "@/lib/use-embedding-warning"; @@ -21,6 +22,7 @@ export function EmbeddingLanguageLine({ campaigns?: readonly CampaignLanguage[]; className?: string; }) { + const t = useT(); const warning = useEmbeddingWarning(languages); if (!warning) { return null; @@ -32,7 +34,7 @@ export function EmbeddingLanguageLine({ {warning.body} {concerned.length - ? ` Campaigns concerned: ${concerned.map((campaign) => `${campaign.title} (${TABLE_LANGUAGE_NAMES[campaign.language].english})`).join(", ")}.` + ? ` ${t("Campaigns concerned: {list}.", { list: concerned.map((campaign) => `${campaign.title} (${t(TABLE_LANGUAGE_NAMES[campaign.language].english)})`).join(", ") })}` : null}

    diff --git a/src/components/SceneTitle.tsx b/src/components/SceneTitle.tsx index 99ee86033e..4126047c91 100644 --- a/src/components/SceneTitle.tsx +++ b/src/components/SceneTitle.tsx @@ -4,6 +4,7 @@ import { useEffect, useRef, useState, type CSSProperties } from "react"; import { cn } from "@/lib/cn"; import { ExtrudedTitle } from "@/components/ui/GoldTitle"; import { prefersReducedMotion } from "@/lib/effects-mode"; +import { useT } from "@/lib/locale"; import type { TitleCard } from "@/lib/scene/state"; // The title card (docs/vtt-parity-implementation-plan.md section 2.4): a @@ -50,6 +51,16 @@ const SCRIM: Record = { act: "bg-[radial-gradient(ellipse_at_center,rgba(28,20,44,0.78),rgba(6,4,12,0.9))]", }; +function translateCardLabel(t: (key: string, vars?: Record) => string, text: string): string { + const ch = /^Chapter (\d+)$/.exec(text); + if (ch) return t("Chapter {n}", { n: ch[1] }); + const act = /^Act ([IVXLCDM\d]+)$/.exec(text); + if (act) return t("Act {n}", { n: act[1] }); + const endAct = /^End of Act ([IVXLCDM\d]+)$/.exec(text); + if (endAct) return t("End of Act {n}", { n: endAct[1] }); + return text; +} + export function SceneTitle({ card, onShown, @@ -57,6 +68,7 @@ export function SceneTitle({ card: TitleCard | null; onShown: (id: string) => void; }) { + const t = useT(); const [phase, setPhase] = useState<"in" | "hold" | "out" | null>(null); const [shownId, setShownId] = useState(null); const reduced = prefersReducedMotion(); @@ -108,6 +120,9 @@ export function SceneTitle({ return null; } + const title = translateCardLabel(t, card.title); + const subtitle = card.subtitle ? translateCardLabel(t, card.subtitle) : undefined; + if (reduced) { return (
    -

    {card.title}

    - {card.subtitle ?

    {card.subtitle}

    : null} +

    {title}

    + {subtitle ?

    {subtitle}

    : null}
    ); @@ -142,11 +157,11 @@ export function SceneTitle({
    - {card.title} + {title}
    - {card.subtitle ?

    {card.subtitle}

    : null} + {subtitle ?

    {subtitle}

    : null}
    {armorRows.length ? ( - + ) : null} {weaponRows.length ? ( - + ) : null} {sheet.description ? ( - +
    {renderRules(sheet.description)}
    ) : null} @@ -470,6 +474,7 @@ export function InfoChipList({ }>; emptyText?: string; }) { + const t = useT(); if (!items.length) { return emptyText ?

    {emptyText}

    : null; } @@ -494,7 +499,7 @@ export function InfoChipList({ {item.name} {(item.meta ?? item.lead?.label) ? {item.meta ?? item.lead?.label} : null} - {line ?? "Select the mark beside it for the full entry."} + {line ?? t("Select the mark beside it for the full entry.")} } diff --git a/src/lib/battlemap/hand-attack-lines.ts b/src/lib/battlemap/hand-attack-lines.ts index 89e32b0ae7..0c25654439 100644 --- a/src/lib/battlemap/hand-attack-lines.ts +++ b/src/lib/battlemap/hand-attack-lines.ts @@ -18,6 +18,10 @@ import type { AttackKind } from "@/lib/dm/pc-attack-profile"; import type { CharacterSheet } from "@/lib/schemas/sheet"; import type { CombatRiders } from "@/lib/srd/feature-effects"; import { addFlat, type HandCard, type HandTurn } from "@/lib/battlemap/hand-core"; +import { translate } from "@/lib/messages-logic"; + +type T = (key: string, vars?: Record) => string; +const enT: T = (key, vars) => translate("en", key, vars); export type AttackDamageLine = { // The expression the hit rolls, before Sneak Attack and a target's own @@ -29,21 +33,24 @@ export type AttackDamageLine = { // The damage a hit rolls with what the sheet adds to it. A once-a-turn rider // (Divine Strike, Divine Fury) rides the next hit while the turn has not // spent it, so it is in the line until the turn's mark says it landed. -export function attackDamageLine(input: { - sheet: CharacterSheet; - turn: HandTurn; - profile: AttackProfile; - riders: CombatRiders; - kind: AttackKind; - // The weapon thrown past its reach: a ranged attack, so Rage and the - // riders of a melee hit stay off it (attack-damage-riders.ts). - atRange?: boolean; -}): AttackDamageLine { +export function attackDamageLine( + input: { + sheet: CharacterSheet; + turn: HandTurn; + profile: AttackProfile; + riders: CombatRiders; + kind: AttackKind; + // The weapon thrown past its reach: a ranged attack, so Rage and the + // riders of a melee hit stay off it (attack-damage-riders.ts). + atRange?: boolean; + }, + t: T = enT, +): AttackDamageLine { const { turn, profile } = input; const read = attackDamageRiders(input); let damage = addFlat(profile.damageExpression, read.rageBonus); const notes: string[] = []; - if (read.rageBonus) notes.push(`Rage +${read.rageBonus}.`); + if (read.rageBonus) notes.push(t("Rage +{bonus}.", { bonus: read.rageBonus })); for (const rider of read.abilityRiders) { damage = addFlat(damage, rider.amount); notes.push(`${rider.feature} +${rider.amount}.`); @@ -54,7 +61,15 @@ export function attackDamageLine(input: { for (const rider of read.featureRiders) { if (rider.oncePerTurn && spent.has(`rider:${rider.feature.toLowerCase()}`)) continue; damage = `${damage}+${rider.dice}`; - notes.push(`${rider.feature} +${rider.dice}${rider.type ? ` ${rider.type}` : ""}${rider.oncePerTurn ? " on the first hit this turn" : ""}.`); + notes.push( + rider.oncePerTurn + ? t("{feature} +{dice}{type} on the first hit this turn.", { + feature: rider.feature, + dice: rider.dice, + type: rider.type ? ` ${t(rider.type)}` : "", + }) + : `${rider.feature} +${rider.dice}${rider.type ? ` ${t(rider.type)}` : ""}.`, + ); } return { damage, notes }; } diff --git a/src/lib/battlemap/hand-core.ts b/src/lib/battlemap/hand-core.ts index 98ef375303..186afadb8b 100644 --- a/src/lib/battlemap/hand-core.ts +++ b/src/lib/battlemap/hand-core.ts @@ -611,6 +611,9 @@ function standingReason(sheet: CharacterSheet, turn: HandTurn, kind: ActKind, ve const acting = actingEncounter(turn, kind)?.order[0]?.name; const who = acting ?? "someone else"; if (verdict.error === `It is ${who}'s turn, not ${name}'s. Off their own turn a character can only use their reaction. What they declared waits for their turn.`) { + if (who === "the enemy") { + return t("It is the enemy's turn, not {name}'s. Off their own turn a character can only use their reaction. What they declared waits for their turn.", { name }); + } return t("It is {who}'s turn, not {name}'s. Off their own turn a character can only use their reaction. What they declared waits for their turn.", { who: acting ? acting : t("someone else"), name }); } break; diff --git a/src/lib/battlemap/hand-play.ts b/src/lib/battlemap/hand-play.ts index e6af367d15..37d9b4e4e0 100644 --- a/src/lib/battlemap/hand-play.ts +++ b/src/lib/battlemap/hand-play.ts @@ -22,9 +22,10 @@ import { type HandIntent, type HandTurn, } from "@/lib/battlemap/hand-core"; -import { areaArgs, describePick, hasPick, type AreaPick, type HandArea } from "@/lib/battlemap/hand-area"; +import { areaArgs, describePick, hasPick, pickWords, type AreaPick, type HandArea } from "@/lib/battlemap/hand-area"; import type { HandShare } from "@/lib/battlemap/hand-intent"; -import { conditionWord } from "@/lib/battlemap/hand-display"; +import { cardDisplayName, conditionWord } from "@/lib/battlemap/hand-display"; +import { contentName } from "@/lib/content/names"; import { textKey } from "@/lib/language/text-logic"; import { translate, type Locale } from "@/lib/messages-logic"; import { isConditionNamed } from "@/lib/srd/feature-names"; @@ -474,6 +475,147 @@ export function composeSentence( } } +// The localized display sentence shown in the Aim Bar preview while keeping +// `composeSentence` untouched for engine parsing. +export function composeDisplaySentence( + card: HandCard, + aim: HandAim | null, + riders: HandCard[] = [], + choices: HandChoices = {}, + t: T = enT, + locale: Locale = "en", +): string { + if (locale === "en") return composeSentence(card, aim, riders, choices); + const who = aim?.kind === "self" ? t("myself") : aim?.name ?? ""; + const intent = card.intent; + const displayCard = cardDisplayName(card, locale); + if (intent.card === "attack") { + const weapon = intent.weapon === "Unarmed strike" ? t("an unarmed strike") : contentName("items", intent.weapon, locale); + const bonusAttack = intent.attack?.bonusAttack; + const target = who || t("the nearest enemy"); + const lead = intent.offHand + ? who + ? t("I make my off-hand attack against {who} with {weapon} as a bonus action.", { who, weapon }) + : t("I make my off-hand attack with {weapon} as a bonus action.", { weapon }) + : bonusAttack + ? t("I attack {who} with {weapon} as a bonus action ({feature}).", { who: target, weapon, feature: t(BONUS_ATTACK_NAME[bonusAttack] ?? card.name.replace(/ attack$/, "")) }) + : t("I attack {who} with {weapon}.", { who: target, weapon }); + const options = (choices.options ?? []).map((id) => ` ${t(OPTION_CLAUSE[id].trim())}`).join(""); + const riderNotes = riders + .map((rider) => { + if (rider.intent.card !== "rider") return ""; + if (rider.intent.rider === "Divine Smite") { + return rider.intent.slotLevel + ? ` ${t("If it hits, I use Divine Smite with a level {level} slot.", { level: rider.intent.slotLevel })}` + : ` ${t("If it hits, I use Divine Smite.")}`; + } + return ` ${t("I use {rider} on this attack.", { rider: cardDisplayName(rider, locale) })}`; + }) + .join(""); + return lead + options + riderNotes; + } + if (intent.card === "spell") { + const spell = contentName("spells", intent.spell, locale); + const shared = shareList(card, aim, choices); + const named = shared.length > 1 || (shared.length === 1 && shared.every((share) => share.count > 1)) ? sharePhrase(card, shared) : who; + const where = !named ? "" : aim?.kind === "enemy" ? ` ${t("at {who}", { who: named })}` : ` ${t("on {who}", { who: named })}`; + const slot = intent.item ? "" : intent.slotLevel ? ` ${t("using a level {level} slot", { level: intent.slotLevel })}` : ""; + const ring = intent.item ? ` ${t("from my {item}", { item: contentName("items", intent.item, locale) })}` : ""; + const how = card.cost === "bonus" ? ` ${t("as a bonus action")}` : card.cost === "reaction" ? ` ${t("as a reaction")}` : ""; + const picked = chosenLabel(card, choices); + const laid = card.area && hasPick(card.area, choices.area) ? ` ${pickWords(t, card.area, choices.area ?? {})}` : ""; + return t("I cast {spell}{ring}{picked}{where}{laid}{how}{slot}.", { + spell, + ring, + picked: picked ? ` (${picked})` : "", + where, + laid, + how, + slot, + }); + } + if (intent.card === "reaction") { + const at = !who ? "" : aim?.kind === "enemy" ? ` ${t("at {who}", { who })}` : ` ${t("for {who}", { who })}`; + if (intent.spell && intent.item) { + return t("I cast {spell} from my {item}{at} as a reaction.", { spell: contentName("spells", intent.spell, locale), item: contentName("items", intent.item, locale), at }); + } + return intent.spell + ? t("I cast {spell}{at} as a reaction{slot}.", { spell: contentName("spells", intent.spell, locale), at, slot: intent.slotLevel && intent.slotLevel > 1 ? ` ${t("using a level {level} slot", { level: intent.slotLevel })}` : "" }) + : t("I use {feature}{at} as my reaction.", { feature: displayCard, at }); + } + if (intent.card === "feature") { + const shared = shareList(card, aim, choices); + const chosen = shared.length > 1 ? sharePhrase(card, shared) : who; + const where = !chosen || aim?.kind === "self" ? "" : ` ${t("on {who}", { who: chosen })}`; + const how = card.cost === "bonus" ? ` ${t("as a bonus action")}` : ""; + const picked = chosenLabel(card, choices); + const named = `${displayCard}${picked ? ` (${picked})` : ""}`; + return card.compose ? t("I use {named}{where} for {unit}.", { named, where, unit: t(card.unit ?? "hit points") }) : t("I use {named}{where}{how}.", { named, where, how }); + } + if (intent.card === "rider") return t("I use {rider} on my next hit.", { rider: displayCard }); + if (intent.card === "monster") return ""; + if (intent.card === "gear") { + const rawItem = chosenLabel(card, choices) ?? ""; + const item = rawItem ? contentName("items", rawItem, locale) : t("it"); + switch (intent.action) { + case "equip": + return card.id === "gear:don-shield" ? t("I strap on my {item}.", { item }) : t("I draw my {item}.", { item }); + case "unequip": + return card.id === "gear:doff-shield" ? t("I take off my {item}.", { item }) : t("I stow my {item}.", { item }); + case "drop": + return t("I drop my {item}.", { item }); + case "pick_up": + return t("I pick up the {item}.", { item }); + case "hand": + return t("I hand my {item} to {who}.", { item, who: who || t("my ally") }); + case "use": + return aim && aim.kind !== "self" ? t("I give {who} my {item} to drink.", { who, item }) : t("I drink my {item}.", { item }); + } + } + const route = intent.bonus ? card.name.replace(/:.*/, "").trim() : ""; + const bonus = route ? ` ${t("as a bonus action ({route})", { route: t(route) })}` : ""; + switch (intent.action) { + case "dodge": + return t("I take the Dodge action{bonus}.", { bonus }); + case "dash": + return t("I Dash{bonus}.", { bonus }); + case "disengage": + return t("I Disengage{bonus} and step away.", { bonus }); + case "help": + return t("I take the Help action for {who}.", { who: who || t("my ally") }); + case "hide": + return t("I Hide{bonus}.", { bonus }); + case "search": + return t("I take the Search action."); + case "escape": + return card.name.slice(0, 8) === "Escape: " + ? t("I try to break free of {spell}.", { spell: contentName("spells", card.name.slice("Escape: ".length), locale) }) + : t("I try to escape the grapple."); + case "ready": { + const trigger = choices.trigger?.trim().replace(/\.$/, ""); + const picked = chosenValue(card, choices) ?? ""; + const held = picked.slice(0, 1) === "@" ? t(READIED_WORDS[picked.slice(1) as Readiable] ?? picked.slice(1)) : picked ? contentName("spells", picked, locale) : t("an attack"); + return trigger ? t("I ready {held} for when {trigger}.", { held, trigger }) : t("I ready an action: "); + } + case "grapple": + return t("I try to grapple {who}.", { who: who || t("the nearest enemy") }); + case "shove": + return t("I shove {who}.", { who: who || t("the nearest enemy") }); + case "use-object": + return t("I use an object{bonus}: ", { bonus }); + case "end-turn": + return t("I end my turn."); + case "stand-up": + return t("I stand up."); + case "stabilize": + return t("I try to stabilize {who}.", { who: who || t("my dying ally") }); + case "wake": + return t("I shake {who} awake.", { who: who || t("my ally") }); + case "dismount": + return t("I dismount."); + } +} + // The optional structured half of the commit. The action route validates // `content` and `kind` and drops what it does not know, so this costs an // older server nothing and gives a newer one the card without parsing prose. diff --git a/src/lib/battlemap/hand.ts b/src/lib/battlemap/hand.ts index 9796d82d1c..87090703df 100644 --- a/src/lib/battlemap/hand.ts +++ b/src/lib/battlemap/hand.ts @@ -197,7 +197,7 @@ function attackCards(sheet: CharacterSheet, turn: HandTurn, riders: CombatRiders { riders, offHand, martialArts, worn: magicItemRiders(sheet.equipment, sheet).weaponRiders }, ); // The damage and the roll as pc_attack makes them (hand-attack-lines.ts). - const line = attackDamageLine({ sheet, turn, profile, riders, kind: "weapon" }); + const line = attackDamageLine({ sheet, turn, profile, riders, kind: "weapon" }, t); const rolled = attackRollLine(sheet, profile.toHit, options.board?.attackAura, profile); const damage = line.damage; const notes: string[] = []; @@ -205,11 +205,18 @@ function attackCards(sheet: CharacterSheet, turn: HandTurn, riders: CombatRiders // pair of shortswords is one row of two), so it says what it is first: a // player with two blades equipped took it for a second copy and thought // two-weapon fighting was missing. - if (offHand) notes.push(`Off-hand attack, your bonus action: the ${name} in your other hand, after you take the Attack action with a ${dualWields(sheet.feats, sheet.campaignId) ? "one-handed melee" : "light melee"} weapon.`); + if (offHand) { + notes.push( + t("Off-hand attack, your bonus action: the {name} in your other hand, after you take the Attack action with a {kind} weapon.", { + name, + kind: dualWielder ? t("one-handed melee") : t("light melee"), + }), + ); + } // Which weapon is out, on the card itself (held-default.ts): a player // could not tell, and asked for one they thought was drawn. const wield = natural ? undefined : wieldOf(sheet, name); - if (wield === "stowed") notes.push(guessDrawNote(sheet, name) ?? "Packed away: the attack draws it with your free object interaction."); + if (wield === "stowed") notes.push(guessDrawNote(sheet, name) ?? t("Packed away: the attack draws it with your free object interaction.")); if (!offHand && allowed > 1) notes.push(tp("Extra Attack: {count} swings on this action.", "Extra Attack: {count} swings on this action.", { count: allowed })); if (riders.sneakAttackDice > 0 && profile.sneakEligible) { notes.push(t("Sneak Attack +{dice}d6 once a turn when it applies.", { dice: riders.sneakAttackDice })); @@ -219,7 +226,7 @@ function attackCards(sheet: CharacterSheet, turn: HandTurn, riders: CombatRiders // pc_attack rolls without Rage or a melee hit's riders (Improved Divine // Smite). The card showed the melee sum for a throw too. const thrown = profile.thrown && !profile.ranged && !offHand - ? attackDamageLine({ sheet, turn, profile, riders, kind: "weapon", atRange: true }).damage + ? attackDamageLine({ sheet, turn, profile, riders, kind: "weapon", atRange: true }, t).damage : null; const thrownDamage = thrown && thrown !== damage ? thrown : null; if (thrownDamage) notes.push(`Thrown at range: ${thrownDamage}, without the melee bonuses.`); diff --git a/src/lib/content/item-descriptions-fr.ts b/src/lib/content/item-descriptions-fr.ts new file mode 100644 index 0000000000..34132b74de --- /dev/null +++ b/src/lib/content/item-descriptions-fr.ts @@ -0,0 +1,162 @@ +import { textKey } from "@/lib/language/text-logic"; +import { rulebookPage } from "@/lib/rulebook/book"; +import { rulebookPageIdFor } from "@/lib/rulebook/catalog-rows"; + +// French descriptions for SRD 5.1 equipment, adventuring gear, tools, and +// mounts (used on the server when /api/content/items answers in French). +// Magic items fall through to the official French SRD 5.1 rulebook pages +// in src/lib/rulebook/srd-5.1-fr.json. + +const GEAR_DESC_FR: Record = { + "abacus": "Un boulier utilisé pour effectuer des calculs rapidement.", + "acid vial": "Au prix d’une action, tu peux projeter le contenu de cette fiole sur une créature située à 1,50 m (5 pi) ou moins, ou lancer la fiole jusqu’à 6 m (20 pi) pour qu’elle se brise à l’impact. Dans les deux cas, fais une attaque à distance contre une créature ou un objet, en considérant l’acide comme une arme improvisée. En cas de réussite, la cible subit 2d6 dégâts d’acide.", + "alchemist s fire flask": "Ce fluide collant et adhésif s’enflamme au contact de l’air. Au prix d’une action, tu peux lancer cette flasque jusqu’à 6 m (20 pi) ; elle se brise à l’impact. Fais une attaque à distance contre une créature ou un objet, en considérant le feu grégeois comme une arme improvisée. En cas de réussite, la cible subit 1d4 dégâts de feu au début de chacun de ses tours. Une créature peut mettre fin à ces dégâts en utilisant son action pour réussir un test de Dextérité DD 10 afin d’éteindre les flammes.", + "antitoxin vial": "Une créature qui boit cette fiole de liquide obtient l’avantage aux jets de sauvegarde contre le poison pendant 1 heure. Elle ne confère aucun avantage aux morts-vivants ni aux créatures artificielles.", + "arcane focus": "Un focaliseur arcanique est un objet spécial (orbe, cristal, baguette, bâton en bois, sceptre ou objet similaire) conçu pour canaliser l’énergie des sorts profanes. Un ensorceleur, un magicien ou un occultiste peut l’utiliser comme focaliseur d’incantation.", + "backpack": "Un sac à dos en cuir pouvant contenir jusqu’à 30 litres (1 pied cube) ou 30 lb d’équipement. Tu peux aussi attacher des objets à l’extérieur, comme un sac de couchage ou une corde enroulée.", + "ball bearings bag of 1000": "Au prix d’une action, tu peux répandre ces petites billes métalliques hors de leur bourse pour couvrir une surface carrée de 3 m (10 pi) de côté. Une créature qui traverse cette zone doit réussir un jet de sauvegarde de Dextérité DD 10 ou tomber à terre. Une créature qui se déplace dans la zone à la moitié de sa vitesse n’a pas besoin de faire ce jet de sauvegarde.", + "barrel": "Un tonneau en bois cerclé de fer pouvant contenir jusqu’à 150 litres de liquide ou 4 pieds cubes de solides.", + "basket": "Un panier tressé pouvant contenir jusqu’à 2 pieds cubes ou 40 lb d’équipement.", + "bedroll": "Un sac de couchage simple offrant un peu de chaleur et de confort pour dormir en plein air.", + "bell": "Une petite clochette qui tinte clairement lorsqu’on la secoue.", + "blanket": "Une couverture épaisse en laine pour se protéger du froid.", + "block and tackle": "Un jeu de poulies avec un câble passé dedans et un crochet pour l’attacher à un objet. Un palan te permet de hisser jusqu’à quatre fois le poids que tu peux normalement soulever.", + "book": "Un livre peut contenir de la poésie, des récits historiques, des informations relatives à un domaine précis de savoir, des diagrammes et notes sur des engins gnomes, ou tout ce qui peut être représenté par du texte ou des illustrations.", + "bottle glass": "Une bouteille en verre solide dotée d’un bouchon, pouvant contenir jusqu’à 0,75 litre de liquide.", + "bucket": "Un seau en bois ou en métal pouvant contenir jusqu’à 11 litres de liquide ou un demi-pied cube de solides.", + "caltrops bag of 20": "Au prix d’une action, tu peux répandre un sac de chausse-trappes sur une case carrée de 1,50 m (5 pi) de côté. Toute créature qui entre dans la zone doit réussir un jet de sauvegarde de Dextérité DD 15 ou arrêter son déplacement ce tour-ci et subir 1 dégât perforant. Subir ces dégâts réduit sa vitesse de marche de 3 m (10 pi) jusqu’à ce qu’elle récupère au moins 1 point de vie. Une créature qui se déplace dans la zone à la moitié de sa vitesse n’a pas besoin de faire ce jet.", + "candle": "Pendant 1 heure, une bougie diffuse une lumière vive dans un rayon de 1,50 m (5 pi) et une lumière faible sur 1,50 m (5 pi) supplémentaires.", + "case crossbow bolt": "Cet étui en bois peut contenir jusqu’à vingt carreaux d’arbalète.", + "case map or scroll": "Cet étui cylindrique en cuir peut contenir jusqu’à dix feuilles de papier roulées ou cinq feuilles de parchemin roulées.", + "chain 10 feet": "Une chaîne a une CA de 10 et 10 points de vie. Elle peut être brisée par un test de Force DD 20 réussi.", + "chalk 1 piece": "Un morceau de craie permettant de tracer des marques sur la pierre, le bois ou le métal.", + "chest": "Un coffre en bois renforcé de fer pouvant contenir jusqu’à 12 pieds cubes ou 300 lb d’équipement.", + "climber s kit": "Un matériel d’escalade comprend des pitons spéciaux, des pointes de bottes, des gants et un harnais. Tu peux utiliser ce matériel au prix d’une action pour t’ancrer ; tant que tu es ancré, tu ne peux pas tomber de plus de 7,50 m (25 pi) depuis le point d’ancrage, et tu ne peux pas grimper à plus de 7,50 m (25 pi) de ce point sans défaire l’ancrage.", + "clothes common": "Des vêtements simples et robustes portés au quotidien par les gens ordinaires.", + "clothes costume": "Une tenue de scène ou de déguisement colorée, adaptée aux représentations ou aux mascarades.", + "clothes fine": "Des vêtements raffinés taillés dans de beaux tissus, dignes des nobles et des riches marchands.", + "clothes traveler s": "Des vêtements solides, des bottes et une cape conçus pour résister aux longs voyages et aux intempéries.", + "component pouch": "Une sacoche en cuir étanche fixée à la ceinture, dotée de compartiments pour contenir toutes les composantes matérielles et autres objets spéciaux dont tu as besoin pour lancer tes sorts, à l’exception des composantes ayant un coût spécifique.", + "crowbar": "Utiliser un pied de biche confère l’avantage aux tests de Force où l’effet de levier peut s’appliquer.", + "druidic focus": "Un focaliseur druidique peut être un brin de gui ou de houx, une baguette ou un sceptre taillé dans du bois d’if ou un autre bois spécial, un bâton tiré entier d’un arbre vivant, ou un objet totémique incorporant plumes, fourrure, os et dents d’animaux sacrés. Un druide peut l’utiliser comme focaliseur d’incantation.", + "fishing tackle": "Ce matériel comprend une canne à pêche en bois, une ligne en soie, des flotteurs en liège, des hameçons en acier, des plombs, des leurres en velours et des filets à mailles fines.", + "flask": "Une flasque ou une chope pouvant contenir jusqu’à 0,5 litre de liquide.", + "grappling hook": "Un grappin en fer à accrocher au bout d’une corde pour escalader ou saisir un rebord à distance.", + "hammer": "Un marteau ordinaire servant à enfoncer des clous ou des pitons.", + "hammer sledge": "Une lourde masse à deux mains pour briser la pierre ou enfoncer des pieux.", + "healer s kit": "Ce nécessaire est une pochette en cuir contenant des bandages, des onguents et des attelles. La trousse permet 10 utilisations. Au prix d’une action, tu peux dépenser une utilisation pour stabiliser une créature à 0 point de vie sans avoir besoin de faire un test de Sagesse (Médecine).", + "holy symbol": "Un symbole sacré est la représentation d’un dieu ou d’un panthéon. Il peut s’agir d’une amulette portant le symbole d’une divinité, du même symbole gravé ou incrusté comme emblème sur un bouclier, ou d’une minuscule boîte renfermant un fragment de relique sacrée. Un clerc ou un paladin peut l’utiliser comme focaliseur d’incantation.", + "holy water flask": "Au prix d’une action, tu peux asperger d’eau bénite une créature située à 1,50 m (5 pi) ou moins, ou lancer la flasque jusqu’à 6 m (20 pi) pour qu’elle se brise à l’impact. Dans les deux cas, fais une attaque à distance contre une créature cible, en considérant l’eau bénite comme une arme improvisée. Si la cible est un fiélon ou un mort-vivant, elle subit 2d6 dégâts radiants.", + "hourglass": "Un sablier mesurant l’écoulement du temps avec précision.", + "hunting trap": "Lorsque tu utilises ton action pour le tendre, ce piège forme un anneau à mâchoires en dents de scie qui se referme lorsqu’une créature marche sur la plaque de pression centrale. Le piège est fixé par une lourde chaîne à un objet immobile. Une créature qui marche sur la plaque doit réussir un jet de sauvegarde de Dextérité DD 13 ou subir 1d4 dégâts perforants et voir son déplacement s’arrêter. Tant qu’elle reste prise, son déplacement est limité par la longueur de la chaîne (1 m / 3 pi). Une créature peut utiliser son action pour faire un test de Force DD 13 et se libérer ou libérer une autre créature à portée ; chaque échec inflige 1 dégât perforant.", + "ink 1 ounce bottle": "Une petite bouteille contenant environ 30 cl d’encre noire pour écrire.", + "ink pen": "Une plume taillée pour écrire avec de l’encre sur du papier ou du parchemin.", + "jug": "Une cruche ou un pichet pouvant contenir jusqu’à 4 litres de liquide.", + "ladder 10 foot": "Une échelle en bois droite de 3 m (10 pi) de haut.", + "lamp": "Une lampe diffuse une lumière vive dans un rayon de 4,50 m (15 pi) et une lumière faible sur 9 m (30 pi) supplémentaires. Une fois allumée, elle brûle pendant 6 heures avec une flasque d’huile (0,5 litre).", + "lantern bullseye": "Une lanterne sourde diffuse une lumière vive dans un cône de 18 m (60 pi) et une lumière faible sur 18 m (60 pi) supplémentaires. Une fois allumée, elle brûle pendant 6 heures avec une flasque d’huile.", + "lantern hooded": "Une lanterne à capote diffuse une lumière vive dans un rayon de 9 m (30 pi) et une lumière faible sur 9 m (30 pi) supplémentaires. Une fois allumée, elle brûle pendant 6 heures avec une flasque d’huile. Au prix d’une action, tu peux baisser la capote pour réduire la lumière à une lumière faible dans un rayon de 1,50 m (5 pi).", + "lock": "Une clé est fournie avec le cadenas. Sans la clé, une créature qui maîtrise les outils de voleur peut crocheter ce cadenas avec un test de Dextérité DD 15 réussi. Ton MJ peut décider que de meilleurs cadenas existent à des prix plus élevés.", + "magnifying glass": "Cette lentille permet d’observer de près de petits objets. Elle est aussi utile pour remplacer le briquet afin d’allumer un feu. Allumer un feu avec une loupe nécessite une lumière aussi vive que celle du soleil, de l’amadou et environ 5 minutes. Une loupe confère l’avantage aux tests de caractéristique effectués pour estimer ou inspecter un objet petit ou très détaillé.", + "manacles": "Ces entraves métalliques peuvent retenir une créature de taille Petite ou Moyenne. S’en échapper nécessite un test de Dextérité DD 20 réussi. Les briser nécessite un test de Force DD 20 réussi. Chaque paire de menottes est fournie avec une clé. Sans la clé, une créature maîtrisant les outils de voleur peut crocheter la serrure avec un test de Dextérité DD 15 réussi. Les menottes ont 15 points de vie.", + "mess kit": "Cette boîte en fer-blanc contient une tasse et des couverts simples. La boîte se ferme hermétiquement, et un côté sert de poêle tandis que l’autre s’utilise comme assiette ou bol peu profond.", + "mirror steel": "Un petit miroir en acier poli, pratique pour regarder autour d’un angle sans se découvrir.", + "oil flask": "L’huile est vendue en flasque d’argile de 0,5 litre. Au prix d’une action, tu peux asperger une créature à 1,50 m (5 pi) ou moins ou lancer la flasque jusqu’à 6 m (20 pi). Fais une attaque à distance contre la cible ; en cas de réussite, elle est couverte d’huile. Si la cible subit des dégâts de feu avant que l’huile ne sèche (1 minute), elle subit 5 dégâts de feu supplémentaires. Tu peux aussi verser une flasque d’huile sur une case de 1,50 m (5 pi) de côté ; allumée, elle brûle pendant 2 rounds et inflige 5 dégâts de feu à toute créature qui entre dans la zone ou y termine son tour.", + "paper one sheet": "Une feuille de papier fin pour écrire ou dessiner.", + "parchment one sheet": "Une feuille de parchemin robuste en peau préparée.", + "perfume vial": "Un petit flacon d’huile parfumée.", + "pick miner s": "Une pioche robuste conçue pour fendre la roche et creuser.", + "piton": "Un piton en fer à planter dans la pierre pour fixer une corde d’escalade.", + "poison basic vial": "Tu peux utiliser le poison de cette fiole pour enduire une arme tranchante ou perforante ou jusqu’à trois munitions. Appliquer le poison prend une action. Une créature touchée par l’arme ou la munition empoisonnée doit faire un jet de sauvegarde de Constitution DD 10 ou subir 1d4 dégâts de poison. Une fois appliqué, le poison conserve son efficacité pendant 1 minute avant de sécher.", + "pole 10 foot": "Une perche en bois de 3 m (10 pi) de long, utile pour sonder le sol devant soi.", + "pot iron": "Une marmite en fer pouvant contenir jusqu’à 4 litres.", + "potion of healing": "Un personnage qui boit le liquide rouge et magique de cette fiole récupère 2d4 + 2 points de vie. Boire ou administrer une potion prend une action.", + "pouch": "Une bourse en tissu ou en cuir pouvant contenir jusqu’à 20 billes de fronde ou 50 dards de sarbacane, ou d’autres petits objets.", + "quiver": "Un carquois peut contenir jusqu’à 20 flèches.", + "ram portable": "Tu peux utiliser un bélier portable pour enfoncer des portes. Ce faisant, tu gagnes un bonus de +4 au test de Force. Un autre personnage peut t’aider à manier le bélier, ce qui te confère l’avantage au test.", + "rations 1 day": "Les rations se composent d’aliments secs adaptés aux longs voyages, comme de la viande séchée, des fruits secs, des biscuits de mer et des noix.", + "robes": "Une robe ample portée par les érudits, les mages ou les membres du clergé.", + "rope hempen 50 feet": "Une corde en chanvre de 15 m (50 pi) a 2 points de vie et peut être rompue par un test de Force DD 17 réussi.", + "rope silk 50 feet": "Une corde en soie de 15 m (50 pi) a 2 points de vie et peut être rompue par un test de Force DD 17 réussi.", + "sack": "Un sac en toile pouvant contenir jusqu’à 1 pied cube ou 30 lb d’équipement.", + "scale merchant s": "Une balance comprend un petit fléau, des plateaux et un assortiment de poids jusqu’à 2 livres. Elle te permet de mesurer le poids exact de petits objets, comme des métaux précieux ou des marchandises, afin d’en déterminer la valeur.", + "sealing wax": "Un bâton de cire colorée utilisé pour cacheter des lettres ou des documents.", + "shovel": "Une pelle solide pour creuser la terre ou déblayer des décombres.", + "signal whistle": "Un petit sifflet produisant un son perçant audible à bonne distance.", + "signet ring": "Une bague ornée d’un sceau personnel permettant de marquer la cire à cacheter.", + "soap": "Un pain de savon pour se laver.", + "spellbook": "Indispensable aux magiciens, un grimoire est un tome relié de cuir contenant 100 feuilles de vélin vierges prêtes à recevoir des sorts.", + "spikes iron 10": "Dix pointes en fer pouvant servir à caler une porte ou à ancrer une corde.", + "spyglass": "Les objets observés à travers une longue-vue sont grossis au double de leur taille.", + "tent two person": "Un abri en toile simple et portable, prévu pour abriter deux personnes.", + "tinderbox": "Ce petit récipient contient du silex, un briquet en acier et de l’amadou (généralement du tissu sec imbibé d’huile) servant à allumer un feu. L’utiliser pour allumer une torche — ou tout autre matériau inflammable exposé — prend une action. Allumer tout autre feu prend 1 minute.", + "torch": "Une torche brûle pendant 1 heure et diffuse une lumière vive dans un rayon de 6 m (20 pi) et une lumière faible sur 6 m (20 pi) supplémentaires. Si tu fais une attaque de corps à corps avec une torche allumée et que tu touches, elle inflige 1 dégât de feu.", + "vial": "Une petite fiole en verre bouchée pouvant contenir jusqu’à 12 cl de liquide.", + "waterskin": "Une outre en cuir pouvant contenir jusqu’à 2 litres (4 pintes) de liquide une fois pleine.", + "whetstone": "Une pierre à aiguiser pour entretenir le tranchant des lames.", + "alchemist s supplies": "Ce matériel permet de produire des substances alchimiques comme l’acide ou le feu grégeois, ainsi que d’identifier des potions ou des produits chimiques.", + "brewer s supplies": "Tout le nécessaire pour brasser de la bière, du cidre ou d’autres boissons fermentées.", + "calligrapher s supplies": "Des encres, des plumes et du papier fin pour calligraphier des textes ou détecter les faux.", + "carpenter s tools": "Des outils de menuiserie et de charpente pour travailler le bois et bâtir des abris ou des structures.", + "cartographer s tools": "Des plumes, de l’encre, du parchemin, une règle et un compas pour dresser des cartes précises.", + "cobbler s tools": "Des outils pour fabriquer et réparer des bottes et des chaussures.", + "cook s utensils": "Des marmites, des couteaux et des ustensiles pour préparer des repas même en voyage.", + "disguise kit": "Cette pochette de cosmétiques, teintures capillaires et petits accessoires permet de créer des déguisements qui modifient ton apparence physique. La maîtrise de ce matériel te permet d’ajouter ton bonus de maîtrise aux tests de caractéristique effectués pour créer un déguisement visuel.", + "forgery kit": "Cette petite boîte contient divers papiers et parchemins, plumes et encres, sceaux et cire à cacheter, feuilles d’or et d’argent et petits outils pour imiter des écritures et des cachets. La maîtrise de ce matériel permet d’ajouter ton bonus de maîtrise aux tests visant à réaliser une contrefaçon physique d’un document.", + "glassblower s tools": "Des cannes à souffler et des pinces pour façonner le verre fondu.", + "herbalism kit": "Ce matériel comprend divers instruments (pinces, mortier et pilon, sachets et fioles) utilisés par les herboristes pour préparer des remèdes et des potions. La maîtrise de ce matériel permet d’ajouter ton bonus de maîtrise aux tests visant à identifier ou appliquer des herbes. Elle est également requise pour fabriquer des antitoxines et des potions de guérison.", + "jeweler s tools": "Des outils de précision pour tailler les gemmes et façonner les métaux précieux.", + "leatherworker s tools": "Des alênes, des couteaux et des aiguilles pour travailler le cuir et réparer les armures légères.", + "mason s tools": "Des marteaux, des ciseaux et une truelle pour tailler la pierre et monter des murs.", + "navigator s tools": "Cet ensemble d’instruments sert à la navigation en mer. La maîtrise des instruments de navigateur permet de tracer la route d’un navire et d’éviter de se perdre en mer.", + "painter s supplies": "Des pinceaux, des pigments et des toiles pour peindre et esquisser.", + "poisoner s kit": "Un matériel d’empoisonneur comprend des fioles, des produits chimiques et d’autres équipements nécessaires à la préparation de poisons. La maîtrise de ce matériel permet d’ajouter ton bonus de maîtrise aux tests effectués pour fabriquer ou utiliser des poisons.", + "potter s tools": "Des outils pour façonner l’argile et réaliser des récipients en céramique.", + "smith s tools": "Des marteaux, des pinces et des limes pour forger et réparer le métal, les armes et les armures.", + "thieves tools": "Cet ensemble d’outils comprend une petite lime, un jeu de crochets, un petit miroir monté sur une poignée métallique, une paire de ciseaux à lames fines et une paire de pinces. La maîtrise de ces outils permet d’ajouter ton bonus de maîtrise aux tests de caractéristique effectués pour désamorcer des pièges ou crocheter des serrures.", + "tinker s tools": "Des outils fins pour réparer les mécanismes, les serrures et les petits objets métalliques.", + "weaver s tools": "Des navettes, des aiguilles et du fil pour tisser et réparer des étoffes.", + "woodcarver s tools": "Des gouges et des ciseaux pour sculpter le bois.", + "burglar s pack": "Comprend un sac à dos, un sac de 1 000 billes, 3 m de ficelle, une cloche, 5 bougies, un pied de biche, un marteau, 10 pitons, une lanterne à capote, 2 flasques d’huile, 5 jours de rations, une boîte à amadou et une outre, plus 15 m de corde en chanvre attachés sur le côté.", + "diplomat s pack": "Comprend un coffre, 2 étuis à cartes ou à parchemins, des vêtements de qualité, une bouteille d’encre, un porte-plume, une lampe, 2 flasques d’huile, 5 feuilles de papier, un flacon de parfum, de la cire à cacheter et du savon.", + "dungeoneer s pack": "Comprend un sac à dos, un pied de biche, un marteau, 10 pitons, 10 torches, une boîte à amadou, 10 jours de rations et une outre, plus 15 m de corde en chanvre attachés sur le côté.", + "entertainer s pack": "Comprend un sac à dos, un sac de couchage, 2 costumes, 5 bougies, 5 jours de rations, une outre et des accessoires de déguisement.", + "explorer s pack": "Comprend un sac à dos, un sac de couchage, une gamelle, une boîte à amadou, 10 torches, 10 jours de rations et une outre, plus 15 m de corde en chanvre attachés sur le côté.", + "priest s pack": "Comprend un sac à dos, une couverture, 10 bougies, une boîte à amadou, un tronc à offrandes, 2 blocs d’encens, un encensoir, des habits liturgiques, 2 jours de rations et une outre.", + "scholar s pack": "Comprend un sac à dos, un livre de savoir, une bouteille d’encre, un porte-plume, 10 feuilles de parchemin, un petit sac de sable et un petit couteau.", + "arrows 20": "Vingt flèches pour arc court ou arc long.", + "blowgun needles 50": "Cinquante dards pour sarbacane.", + "crossbow bolts 20": "Vingt carreaux pour arbalète.", + "sling bullets 20": "Vingt billes de plomb pour fronde.", +}; + +function stripLeadingMeta(md: string): string { + const idx = md.indexOf("\n\n"); + return idx === -1 ? md : md.slice(idx + 2).trim(); +} + +export function frenchItemDescription(name: string): string | null { + const pageId = rulebookPageIdFor("item", name); + if (pageId) { + const fr = rulebookPage(pageId, "fr"); + if (fr?.page.md) { + return stripLeadingMeta(fr.page.md); + } + } + const key = textKey(name.replace(/['‘’ʼ´]/g, "")); + return GEAR_DESC_FR[key] ?? null; +} + +export function localizeItemEntryFr(entry: T): T { + if (entry.source === "homebrew" || !entry.data || typeof entry.data !== "object") { + return entry; + } + const desc = frenchItemDescription(entry.name); + if (!desc) { + return entry; + } + return { + ...entry, + data: { ...(entry.data as Record), desc }, + }; +} diff --git a/src/lib/dm/speech.ts b/src/lib/dm/speech.ts index 730d69b080..6778f85d8d 100644 --- a/src/lib/dm/speech.ts +++ b/src/lib/dm/speech.ts @@ -432,6 +432,13 @@ function splitsOneLine(between: string): boolean { return !between.includes("\n") && !QUOTE_OPEN.test(between) && wordCount(between) <= SPEECH_WINDOW_WORDS; } +function attachTrailingComma(parts: SpeechCardPart[]): void { + const last = parts.at(-1); + if (last?.kind === "words" && !/[,.!?…:;—–-]$/.test(last.text)) { + last.text = `${last.text},`; + } +} + // The cards the transcript draws for a message's segments. Two lines of one // speaker around a short tag are one card with the tag kept inside it: // drawn apart, the reader met the same face twice with the tag stranded @@ -452,12 +459,29 @@ export function cardsOf(segments: readonly SpeechSegment[]): SpeechCard[] { } if (last?.kind === "prose" && before?.kind === "speech" && sameSpeaker(before.speaker, segment.speaker) && splitsOneLine(last.text)) { out.pop(); - before.parts.push({ kind: "tag", text: last.text.trim() }, { kind: "words", text: segment.text }); + const trimmed = last.text.trim(); + if (trimmed.startsWith(",")) attachTrailingComma(before.parts); + before.parts.push({ kind: "tag", text: trimmed.replace(/^,\s*/, "") }, { kind: "words", text: segment.text }); continue; } out.push({ kind: "speech", speaker: segment.speaker, parts: [{ kind: "words", text: segment.text }] }); } - return out; + // French guillemets place commas outside the closing quote (« ... », murmure + // Isolda); move the leading comma onto the end of the preceding speech card + // so neither the speech bubble ends unpunctuated nor the prose starts with ', '. + const cleaned: SpeechCard[] = []; + for (let i = 0; i < out.length; i += 1) { + const card = out[i]; + const prev = cleaned.at(-1); + if (card.kind === "prose" && prev?.kind === "speech") { + if (/^\s*,/.test(card.text)) attachTrailingComma(prev.parts); + const stripped = card.text.replace(/^\s*,\s*/, ""); + if (stripped) cleaned.push({ kind: "prose", text: stripped }); + } else { + cleaned.push(card); + } + } + return cleaned; } // The lines a message keeps after a rewrite: every earlier line, so an diff --git a/src/lib/harness/picture-test.ts b/src/lib/harness/picture-test.ts index c0339494a5..7ec1bbd822 100644 --- a/src/lib/harness/picture-test.ts +++ b/src/lib/harness/picture-test.ts @@ -25,6 +25,10 @@ export type PictureStageId = "painted" | "saved" | "shape"; export type PictureStage = { id: PictureStageId; ok: boolean | null; detail?: string }; +type T = (key: string, vars?: Record) => string; +const passT: T = (key, vars) => + vars ? key.replace(/\{([^{}]+)\}/g, (_, k) => String(vars[k] ?? `{${k}}`)) : key; + export type PictureTestResult = { image?: GeneratedImage; stages: PictureStage[]; @@ -44,14 +48,17 @@ export const TEST_MAP_PROMPT = locationMapPrompt("hand-drawn parchment cartograp // Pure: the stages a finished run earned, so scripts/test-harness-pictures.mjs // can check every verdict without painting. -export function pictureStages(input: { - image: GeneratedImage | null; - error: string; - file: { bytes: number; kind: string | null; width: number; height: number } | null; -}): PictureStage[] { +export function pictureStages( + input: { + image: GeneratedImage | null; + error: string; + file: { bytes: number; kind: string | null; width: number; height: number } | null; + }, + t: T = passT, +): PictureStage[] { if (!input.image) { return [ - { id: "painted", ok: false, detail: input.error || "No picture came back." }, + { id: "painted", ok: false, detail: input.error || t("No picture came back.") }, { id: "saved", ok: null }, { id: "shape", ok: null }, ]; @@ -60,23 +67,23 @@ export function pictureStages(input: { const width = input.file?.width || input.image.width; const height = input.file?.height || input.image.height; return [ - { id: "painted", ok: true, detail: `${input.image.elapsedSeconds ?? "?"} s through the tables' own picture queue` }, + { id: "painted", ok: true, detail: t("{seconds} s through the tables' own picture queue", { seconds: input.image.elapsedSeconds ?? "?" }) }, { id: "saved", ok: savedOk, - detail: savedOk ? `${input.file?.kind?.toUpperCase()}, ${Math.round((input.file?.bytes ?? 0) / 1024)} KB` : "The file the table would be sent is missing or unreadable.", + detail: savedOk ? `${input.file?.kind?.toUpperCase()}, ${Math.round((input.file?.bytes ?? 0) / 1024)} KB` : t("The file the table would be sent is missing or unreadable."), }, // A square picture still shows (the map panel crops it), so the shape // informs rather than fails. { id: "shape", ok: width > 0 && height > 0 ? width > height : null, - detail: width && height ? `${width} x ${height}${width > height ? "" : ", not the landscape a map asks for; the table crops it"}` : undefined, + detail: width && height ? `${width} x ${height}${width > height ? "" : t(", not the landscape a map asks for; the table crops it")}` : undefined, }, ]; } -export async function testHarnessPictures(): Promise { +export async function testHarnessPictures(t: T = passT): Promise { const settings = { ...configuredDefaultStorySettings(), imageBackend: "harness" as const }; let image: GeneratedImage | null = null; let error = ""; @@ -104,7 +111,7 @@ export async function testHarnessPictures(): Promise { const campaigns = await campaignPictures(); return { ...(painted ? { image: painted } : {}), - stages: pictureStages({ image: painted, error, file }), + stages: pictureStages({ image: painted, error, file }, t), ...(error ? { error } : {}), campaigns, wouldMove: strandedMoves(campaigns, "harness", Boolean(painted)).length, diff --git a/src/lib/harness/test-run.ts b/src/lib/harness/test-run.ts index 131fe14894..7d051877cd 100644 --- a/src/lib/harness/test-run.ts +++ b/src/lib/harness/test-run.ts @@ -15,6 +15,10 @@ export type TestStage = { detail?: string; }; +type T = (key: string, vars?: Record) => string; +const passT: T = (key, vars) => + vars ? key.replace(/\{(\w+)\}/g, (_, k) => String(vars[k] ?? `{${k}}`)) : key; + const PROBE_TOOL = { type: "function", function: { @@ -31,7 +35,7 @@ const PROBE_TOOL = { const SECRET = "lanternfall"; -export async function testHarness(idOverride?: HarnessId): Promise<{ stages: TestStage[]; ms: number }> { +export async function testHarness(idOverride?: HarnessId, t: T = passT): Promise<{ stages: TestStage[]; ms: number }> { const started = Date.now(); const config = harnessConfig(); const id = idOverride ?? (isHarnessId(config.id) ? config.id : null); @@ -51,17 +55,17 @@ export async function testHarness(idOverride?: HarnessId): Promise<{ stages: Tes const done = () => ({ stages, ms: Date.now() - started }); if (!id) { - set("found", false, "No agent program is chosen yet."); + set("found", false, t("No agent program is chosen yet.")); return done(); } const status = await probeHarness(id, { refresh: true }); if (!status.installed || status.availability !== "ok") { - set("found", false, status.message ?? `${ADAPTERS[id].label} was not found.`); + set("found", false, status.message ?? t("{label} was not found.", { label: ADAPTERS[id].label })); return done(); } set("found", true, `${status.version ?? ""} ${status.path ?? ""}`.trim()); if (status.auth.state === "signed-out") { - set("signedIn", false, status.message ?? `Run \`${ADAPTERS[id].signInHint}\` on this machine.`); + set("signedIn", false, status.message ?? t("Run `{cmd}` on this machine.", { cmd: ADAPTERS[id].signInHint })); return done(); } set("signedIn", true, [status.auth.plan, status.auth.account].filter(Boolean).join(" · ") || undefined); @@ -82,14 +86,14 @@ export async function testHarness(idOverride?: HarnessId): Promise<{ stages: Tes ); if (first.error) { const body = (await first.error.json().catch(() => ({}))) as { error?: string }; - set("handshake", false, body.error ?? "The program did not answer."); + set("handshake", false, body.error ?? t("The program did not answer.")); return done(); } const calls = Array.isArray(first.message?.tool_calls) ? (first.message?.tool_calls as Array<{ id: string; function: { name: string } }>) : []; const probeCall = calls.find((call) => call.function?.name === "table_check"); if (!probeCall) { set("handshake", true); - set("toolCall", false, "The program answered without calling ODM's tool, so it cannot run a table."); + set("toolCall", false, t("The program answered without calling ODM's tool, so it cannot run a table.")); releaseHarnessConversation(messages); return done(); } @@ -109,14 +113,14 @@ export async function testHarness(idOverride?: HarnessId): Promise<{ stages: Tes ); if (second.error) { const body = (await second.error.json().catch(() => ({}))) as { error?: string }; - set("toolCall", false, body.error ?? "The program stopped after the tool call."); + set("toolCall", false, body.error ?? t("The program stopped after the tool call.")); releaseHarnessConversation(messages); return done(); } releaseHarnessConversation(messages); const reply = String(second.message?.content ?? ""); const heard = reply.toLowerCase().includes(SECRET); - set("toolCall", heard, heard ? undefined : `It replied "${reply.slice(0, 80)}" instead of the tool's answer.`); + set("toolCall", heard, heard ? undefined : t("It replied \"{reply}\" instead of the tool's answer.", { reply: reply.slice(0, 80) })); // Every adapter stops a run that reaches for its own tools (a stray tool on // Claude's list, a command or file change from Codex), so a run that got // this far held its lockdown. That is what proves an adapter on this @@ -125,12 +129,12 @@ export async function testHarness(idOverride?: HarnessId): Promise<{ stages: Tes "lockdown", true, ADAPTERS[id].lockdown === "removed" - ? "Its own tools are removed; only the table's tools are offered." - : "Its own tools are contained: read-only, an empty folder, every approval refused.", + ? t("Its own tools are removed; only the table's tools are offered.") + : t("Its own tools are contained: read-only, an empty folder, every approval refused."), ); if (heard) { markLockdownProven(id); } - set("streaming", streamed.length > 0, streamed.length > 0 ? undefined : "The reply arrived whole rather than streamed."); + set("streaming", streamed.length > 0, streamed.length > 0 ? undefined : t("The reply arrived whole rather than streamed.")); return done(); } diff --git a/src/lib/help/item-sheet.ts b/src/lib/help/item-sheet.ts index ec4826aae1..2da5c34735 100644 --- a/src/lib/help/item-sheet.ts +++ b/src/lib/help/item-sheet.ts @@ -18,6 +18,11 @@ import { weaponNamed, type SrdWeapon } from "@/lib/srd/weapons"; // scripts/test-item-sheet.mjs drives it directly. type Row = Record; +type T = (key: string, vars?: Record) => string; +type Locale = "en" | "fr"; + +const enT: T = (key, vars) => + vars ? key.replace(/\{([a-zA-Z0-9_]+)\}/g, (match, name) => (name in vars ? String(vars[name]) : match)) : key; export type ItemProperty = { name: string; blurb: string | null }; @@ -68,16 +73,16 @@ function asType(category: string): string { return capitalize(category.trim().toLowerCase().replace(/s$/, "")); } -function formatPounds(pounds: number): string { - return `${Number(pounds.toFixed(2))} lb.`; +function formatPounds(pounds: number, t: T): string { + return t("{n} lb.", { n: Number(pounds.toFixed(2)) }); } // v1 rows say "3 lb." (armour rows say nothing), v2 rows "5.000" plus a unit, // homebrew a bare number. A zero means "not recorded", never "weightless". -function weightOf(row: Row): string | null { +function weightOf(row: Row, t: T): string | null { const value = row.weight; if (typeof value === "number") { - return value > 0 ? formatPounds(value) : null; + return value > 0 ? formatPounds(value, t) : null; } const text = str(row, "weight"); if (!text) { @@ -85,9 +90,18 @@ function weightOf(row: Row): string | null { } const pounds = num(text); if (pounds === null) { - return /^0+(\.0+)?\s*lb/i.test(text) ? null : text; + return /^0+(\.0+)?\s*lb/i.test(text) ? null : text.replace(/lb\.$/i, t("lb.")); } - return pounds > 0 ? formatPounds(pounds) : null; + return pounds > 0 ? formatPounds(pounds, t) : null; +} + +function localizeCoins(text: string, locale: Locale): string { + if (locale !== "fr") return text; + return text + .replace(/(^|\s)gp(?=$|\s)/g, "$1po") + .replace(/(^|\s)sp(?=$|\s)/g, "$1pa") + .replace(/(^|\s)cp(?=$|\s)/g, "$1pc") + .replace(/(^|\s)ep(?=$|\s)/g, "$1pe"); } // v1 rows say "15 gp", v2 rows a bare gold figure ("0.01"), homebrew @@ -95,45 +109,118 @@ function weightOf(row: Row): string | null { // "0 gp"; a price on something nobody buys is noise. Written as every price // is (priceText): a formatter of its own here wrote 0.15 gp as "15 cp" and // 1.5 gp as "1.5 gp", and passed "0.05 gp" through as the pack prints it. -function costOf(row: Row): string | null { +function costOf(row: Row, t: T, locale: Locale): string | null { const text = str(row, "cost"); if (!text) { return null; } const copper = packCostCopper(text); if (copper === null) { - return text; + return text.toLowerCase() === "varies" ? t("varies") : text; } - return copper > 0 ? priceText(text) : null; + return copper > 0 ? localizeCoins(priceText(text), locale) : null; } -function propertyOf(raw: string): ItemProperty { - const name = capitalize(raw.trim()); - const base = raw.trim().toLowerCase().split(" (")[0]; - return { name, blurb: WEAPON_PROPERTY_BLURBS[base] ?? null }; +const PROPERTY_LABELS: Record string> = { + ammunition: (t) => t("Ammunition"), + "double-headed": (t) => t("Double-headed"), + finesse: (t) => t("Finesse"), + gunpowder: (t) => t("Gunpowder"), + heavy: (t) => t("Heavy"), + light: (t) => t("Light"), + loading: (t) => t("Loading"), + magazine: (t) => t("Magazine"), + reach: (t) => t("Reach"), + special: (t) => t("Special"), + thrown: (t) => t("Thrown"), + "two-handed": (t) => t("Two-handed"), + versatile: (t) => t("Versatile"), +}; + +const DAMAGE_TYPE_LABELS: Record string> = { + acid: (t) => t("acid"), + bludgeoning: (t) => t("bludgeoning"), + cold: (t) => t("cold"), + fire: (t) => t("fire"), + force: (t) => t("force"), + lightning: (t) => t("lightning"), + necrotic: (t) => t("necrotic"), + piercing: (t) => t("piercing"), + poison: (t) => t("poison"), + psychic: (t) => t("psychic"), + radiant: (t) => t("radiant"), + slashing: (t) => t("slashing"), + thunder: (t) => t("thunder"), +}; + +const TYPE_LABELS: Record string> = { + "Adventuring gear": (t) => t("Adventuring gear"), + "Equipment pack": (t) => t("Equipment pack"), + Ammunition: (t) => t("Ammunition"), + Mount: (t) => t("Mount"), + Shield: (t) => t("Shield"), + Armor: (t) => t("Armor"), + "Light armor": (t) => t("Light armor"), + "Medium armor": (t) => t("Medium armor"), + "Heavy armor": (t) => t("Heavy armor"), + Weapon: (t) => t("Weapon"), + "Simple melee weapon": (t) => t("Simple melee weapon"), + "Simple ranged weapon": (t) => t("Simple ranged weapon"), + "Martial melee weapon": (t) => t("Martial melee weapon"), + "Martial ranged weapon": (t) => t("Martial ranged weapon"), + "Magic item": (t) => t("Magic item"), + "Wondrous item": (t) => t("Wondrous item"), + Potion: (t) => t("Potion"), + Ring: (t) => t("Ring"), + Rod: (t) => t("Rod"), + Scroll: (t) => t("Scroll"), + Staff: (t) => t("Staff"), + Wand: (t) => t("Wand"), +}; + +const RARITY_LABELS: Record string> = { + Common: (t) => t("Common"), + Uncommon: (t) => t("Uncommon"), + Rare: (t) => t("Rare"), + "Very rare": (t) => t("Very rare"), + Legendary: (t) => t("Legendary"), + Artifact: (t) => t("Artifact"), +}; + +function propertyOf(raw: string, t: T): ItemProperty { + const trimmed = raw.trim(); + const paren = trimmed.indexOf(" ("); + const base = (paren === -1 ? trimmed : trimmed.slice(0, paren)).toLowerCase(); + const suffix = paren === -1 ? "" : trimmed.slice(paren).replace(/^\(range /i, `(${t("range")} `); + const label = PROPERTY_LABELS[base]?.(t) ?? capitalize(paren === -1 ? trimmed : trimmed.slice(0, paren)); + const rawBlurb = WEAPON_PROPERTY_BLURBS[base] ?? null; + return { name: `${label}${suffix}`, blurb: rawBlurb ? t(rawBlurb) : null }; } -function damageOf(dice: string, type: string, bonus: number) { +function damageOf(dice: string, type: string, bonus: number, t: T) { // A Net's die is "0" (or "0 (restrains)"): it deals no damage. - const clean = /^0\b/.test(dice) ? "" : dice; + const clean = /^0(?=$|\s)/.test(dice) ? "" : dice; const lower = type.toLowerCase(); + const rawBlurb = clean ? (DAMAGE_TYPE_BLURBS[lower] ?? null) : null; return { damage: clean ? (bonus ? `${clean} + ${bonus}` : clean) : null, - damageType: clean && lower ? lower : null, - damageBlurb: clean ? (DAMAGE_TYPE_BLURBS[lower] ?? null) : null, + damageType: clean && lower ? (DAMAGE_TYPE_LABELS[lower]?.(t) ?? lower) : null, + damageBlurb: rawBlurb ? t(rawBlurb) : null, }; } -function weaponFromSrd(weapon: SrdWeapon, bonus: number): NonNullable { - const [dice = "", ...rest] = weapon.damage.split(" "); +function weaponFromSrd(weapon: SrdWeapon, bonus: number, t: T): NonNullable { + const space = weapon.damage.indexOf(" "); + const dice = space === -1 ? weapon.damage : weapon.damage.slice(0, space); + const rest = space === -1 ? "" : weapon.damage.slice(space + 1); return { - ...damageOf(dice, rest.join(" "), bonus), - range: weapon.rangeFt ? `${weapon.rangeFt} ft.` : null, - properties: (weapon.properties ?? []).map(propertyOf), + ...damageOf(dice, rest, bonus, t), + range: weapon.rangeFt ? t("{range} ft.", { range: weapon.rangeFt }) : null, + properties: (weapon.properties ?? []).map((entry) => propertyOf(entry, t)), }; } -function weaponFromPack(row: Row, bonus: number): NonNullable { +function weaponFromPack(row: Row, bonus: number, t: T): NonNullable { const properties = Array.isArray(row.properties) ? row.properties.filter((entry): entry is string => typeof entry === "string" && entry.trim() !== "") : []; @@ -142,29 +229,37 @@ function weaponFromPack(row: Row, bonus: number): NonNullable /\((?:range\s+)?(\d+\/\d+)\)/i.exec(entry)?.[1]) .find(Boolean); return { - ...damageOf(str(row, "damage_dice"), str(row, "damage_type"), bonus), - range: range ? `${range} ft.` : null, - properties: properties.map(propertyOf), + ...damageOf(str(row, "damage_dice"), str(row, "damage_type"), bonus, t), + range: range ? t("{range} ft.", { range }) : null, + properties: properties.map((entry) => propertyOf(entry, t)), }; } -function armorFromSrd(armor: SrdArmor, bonus: number): NonNullable { +function localizeAc(ac: string, t: T): string { + return ac + .replace(/Dex/g, t("Dex")) + .replace(/Con/g, t("Con")) + .replace(/Wis/g, t("Wis")) + .replace(/\(max (\d+)\)/g, `(${t("max")} $1)`); +} + +function armorFromSrd(armor: SrdArmor, bonus: number, t: T): NonNullable { const shield = armor.category === "shield"; const base = armor.baseAc + bonus; const dex = shield ? null : armor.dexCap === undefined - ? "Add your full Dexterity modifier." + ? t("Add your full Dexterity modifier.") : armor.dexCap === 0 - ? "Dexterity does not add to it." - : `Add your Dexterity modifier, up to +${armor.dexCap}.`; + ? t("Dexterity does not add to it.") + : t("Add your Dexterity modifier, up to +{cap}.", { cap: armor.dexCap }); const ac = shield ? `+${base}` : armor.dexCap === undefined - ? `${base} + Dex` + ? `${base} + ${t("Dex")}` : armor.dexCap === 0 ? String(base) - : `${base} + Dex (max ${armor.dexCap})`; + : `${base} + ${t("Dex")} (${t("max")} ${armor.dexCap})`; return { ac, dex, @@ -174,14 +269,17 @@ function armorFromSrd(armor: SrdArmor, bonus: number): NonNullable { +function armorFromPack(row: Row, bonus: number, t: T): NonNullable { const shield = str(row, "category").toLowerCase() === "shield"; const baseAc = num(row.base_ac) ?? 0; const flat = num(row.plus_flat_mod) ?? 0; - const acString = str(row, "ac_string") - .replace(/Dex modifier/g, "Dex") - .replace(/Con modifier/g, "Con") - .replace(/Wis modifier/g, "Wis"); + const acString = localizeAc( + str(row, "ac_string") + .replace(/Dex modifier/g, "Dex") + .replace(/Con modifier/g, "Con") + .replace(/Wis modifier/g, "Wis"), + t, + ); // A shield's row reads "0 +2": it adds to AC rather than setting it. const ac = shield && baseAc === 0 ? `+${flat + bonus}` : bonus ? `${acString} (+${bonus})` : acString; const usesDex = row.plus_dex_mod === true; @@ -189,7 +287,13 @@ function armorFromPack(row: Row, bonus: number): NonNullable const strength = num(row.strength_requirement); return { ac, - dex: shield ? null : !usesDex ? "Dexterity does not add to it." : cap > 0 ? `Add your Dexterity modifier, up to +${cap}.` : "Add your full Dexterity modifier.", + dex: shield + ? null + : !usesDex + ? t("Dexterity does not add to it.") + : cap > 0 + ? t("Add your Dexterity modifier, up to +{cap}.", { cap }) + : t("Add your full Dexterity modifier."), strength: strength && strength > 0 ? strength : null, stealthDisadvantage: row.stealth_disadvantage === true, shield, @@ -205,7 +309,13 @@ const isHomebrew = (row: Row) => typeof row.itemKind === "string"; // `rows` is every content-pack or homebrew row found for the name, the // direct slug hit first. Null when neither the rows nor the bundled tables // know anything about it. -export function buildItemSheet(name: string, rows: Array): ItemSheet | null { +export function buildItemSheet( + name: string, + rows: Array, + options?: { t?: T; locale?: Locale }, +): ItemSheet | null { + const t = options?.t ?? enT; + const locale = options?.locale ?? "en"; const found = rows.filter((row): row is Row => Boolean(row) && typeof row === "object"); const bonus = magicItemBonus(name); const homebrew = found.find(isHomebrew); @@ -221,13 +331,13 @@ export function buildItemSheet(name: string, rows: Array const brewArmor = homebrew?.armor as SrdArmor | undefined; const brewWeapon = homebrew?.weapon as SrdWeapon | undefined; if (brewArmor && typeof brewArmor.baseAc === "number") { - armor = armorFromSrd(brewArmor, bonus); + armor = armorFromSrd(brewArmor, bonus, t); type = brewArmor.category === "shield" ? "Shield" : `${capitalize(brewArmor.category)} armor`; } else if (brewWeapon && typeof brewWeapon.damage === "string") { - weapon = weaponFromSrd(brewWeapon, bonus); + weapon = weaponFromSrd(brewWeapon, bonus, t); type = `${capitalize(brewWeapon.category)} ${brewWeapon.kind} weapon`; } else if (packArmor) { - armor = armorFromPack(packArmor, bonus); + armor = armorFromPack(packArmor, bonus, t); type = asType(str(packArmor, "category")) || "Armor"; if (type !== "Shield" && !/armor$/i.test(type)) { type = `${type} armor`; @@ -235,15 +345,15 @@ export function buildItemSheet(name: string, rows: Array // The pack's armour rows carry no weight; the bundled table does. srdArmor = armorNamed(str(packArmor, "name") || name); } else if (packWeapon) { - weapon = weaponFromPack(packWeapon, bonus); + weapon = weaponFromPack(packWeapon, bonus, t); type = asType(str(packWeapon, "category")) || "Weapon"; } else if ((srdArmor = armorNamed(name))) { - armor = armorFromSrd(srdArmor, bonus); + armor = armorFromSrd(srdArmor, bonus, t); type = srdArmor.category === "shield" ? "Shield" : `${capitalize(srdArmor.category)} armor`; } else { const srdWeapon = weaponNamed(withoutBonus(name)); if (srdWeapon) { - weapon = weaponFromSrd(srdWeapon, bonus); + weapon = weaponFromSrd(srdWeapon, bonus, t); type = `${capitalize(srdWeapon.category)} ${srdWeapon.kind} weapon`; } } @@ -262,12 +372,16 @@ export function buildItemSheet(name: string, rows: Array if (!type && homebrew) { type = homebrew.itemKind === "magic_item" ? "Magic item" : capitalize(String(homebrew.itemKind)); } + if (type && TYPE_LABELS[type]) { + type = TYPE_LABELS[type](t); + } const weight = - found.map(weightOf).find(Boolean) ?? (srdArmor ? formatPounds(srdArmor.weightLb) : null); - const cost = found.map(costOf).find(Boolean) ?? null; + found.map((row) => weightOf(row, t)).find(Boolean) ?? (srdArmor ? formatPounds(srdArmor.weightLb, t) : null); + const cost = found.map((row) => costOf(row, t, locale)).find(Boolean) ?? null; const description = found.map((row) => describeContentEntry(row)).find(Boolean) ?? null; - const rarity = magic ? capitalize(str(magic, "rarity").toLowerCase()) : null; + const rawRarity = magic ? capitalize(str(magic, "rarity").toLowerCase()) : null; + const rarity = rawRarity ? (RARITY_LABELS[rawRarity]?.(t) ?? rawRarity) : null; const attunement = found.some( (row) => row.requiresAttunement === true || /attunement/i.test(str(row, "requires_attunement")), ); diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json index 4315d0556e..2f79c2c17a 100644 --- a/src/lib/i18n/fr.json +++ b/src/lib/i18n/fr.json @@ -8974,7 +8974,7 @@ "Or search by name:": "Ou cherche par nom :", "Tool proficiency": "Maîtrise d’outil", "Choose a tool...": "Choisir un outil…", - "Bonus ": "", + "Bonus ": "En bonus : ", " (one {list} cantrip)": " bonus (un sort mineur de la liste {list})", " ({word} {list} cantrips, {picked} of {count} picked)": " bonus ({word} sorts mineurs de la liste {list}, {picked} sur {count} choisis)", "A cantrip is a small spell you can cast as often as you like, forever. Pick one from the list below (tap ⓘ to read what each does), or search by name if you already have one in mind.": "Un sort mineur est un petit sort que tu peux lancer autant de fois que tu veux, pour toujours. Choisis-en un dans la liste ci-dessous (touche ⓘ pour lire ce qu’il fait), ou cherche par nom si tu en as déjà un en tête.", @@ -10556,7 +10556,324 @@ ", the least that plays the full rules.": ", le minimum qui joue les règles complètes.", "{name} cannot play the full rules: it holds fewer tools than the table's full set, so it plays on a reduced tool set and rules. Open Game Master does not support or test this, and fights and other rules may not run properly. For real play, choose another program.": "{name} ne peut pas jouer les règles complètes : il retient moins d’outils que le jeu complet de la table, il joue donc avec un jeu d’outils et des règles réduits. Open Game Master ne prend pas cela en charge et ne le teste pas, et les combats et d’autres règles peuvent mal fonctionner. Pour jouer pour de bon, choisis un autre programme.", "Let an agent you already have, Claude Code, Codex, opencode, Grok Build or Pi, narrate the tables on its own sign-in. It is started with none of its own tools: the only thing it can touch is the table's rules engine, turn by turn, under the same rules and caps as the built-in storyteller. ODM never asks for or stores its password or key.": "Permets à un agent externe que tu possèdes déjà (Claude Code, Codex, opencode, Grok Build ou Pi) d’animer les tables avec ses propres identifiants. Il démarre sans aucun de ses outils habituels : la seule chose avec laquelle il peut interagir est le moteur de règles de la table, tour par tour, selon les mêmes contraintes et limites que le narrateur intégré. OGM ne demande ni ne conserve jamais son mot de passe ou sa clé.", - "Claude Code, Codex, opencode, Grok Build or Pi, signed in on this computer, narrating on its own plan.": "Claude Code, Codex, opencode, Grok Build ou Pi, connecté sur cet ordinateur, qui raconte sur son propre forfait." + "Claude Code, Codex, opencode, Grok Build or Pi, signed in on this computer, narrating on its own plan.": "Claude Code, Codex, opencode, Grok Build ou Pi, connecté sur cet ordinateur, qui raconte sur son propre forfait.", + "The reviewed commit, {hash}": "Le commit examiné, {hash}", + "Install with {chosen} of {total} parts": "Installer avec {chosen} des {total} parties", + ", and up to {size} for its parts": ", et jusqu’à {size} pour ses parties", + "This world belongs to the device that hosts it: only the host can change this account.": "Ce monde appartient à l’appareil qui l’héberge : seul l’hôte peut modifier ce compte.", + "Host": "Hôte", + "Unknown action.": "Action inconnue.", + "Save this program as the server's agent before testing it.": "Enregistre ce programme comme agent du serveur avant de le tester.", + "Paint a test picture first.": "Génère d’abord une image de test.", + "The picture could not be made.": "L’image n’a pas pu être créée.", + "{names} acts first: wait for its turn, then take yours.": "{names} agit en premier : attends son tour, puis joue le tien.", + "{names} act first: wait for their turns, then take yours.": "{names} agissent en premier : attends leurs tours, puis joue le tien.", + "{name} holds nothing the watch stop answers with.": "{name} n’a aucune capacité permettant d’observer les jets.", + "Out of a fight the table is watched for Portent, Cosmic Omen or Restore Balance, and {name} has none of them to use.": "Hors combat, la table est surveillée pour Présage, Présage cosmique ou Rétablissement de l’équilibre, et {name} n’a aucun de ces pouvoirs disponible.", + "and hits": "et touche", + "The attack hits. Someone may still add to its damage.": "L’attaque touche. Quelqu’un peut encore augmenter ses dégâts.", + "{who} can still make you roll it again with Chronal Shift.": "{who} peut encore te faire relancer ce dé avec Décalage chronal.", + "{who} can still help with this roll.": "{who} peut encore aider sur ce jet.", + "End this encounter without a resolution? No XP is awarded.": "Mettre fin à ce combat sans résolution ? Aucun PX ne sera attribué.", + "End the fight now? XP is awarded and the board clears; it cannot be reopened.": "Terminer le combat maintenant ? Les PX sont attribués et le plateau est vidé ; il ne pourra pas être rouvert.", + "End the fight": "Terminer le combat", + "End it": "Terminer", + "The engine would not end the fight.": "Le moteur n’a pas voulu terminer le combat.", + "Force-end it without XP instead?": "Forcer la fin sans PX à la place ?", + "Force-end": "Forcer la fin", + "Round {n}": "Tour {n}", + "Rolling initiative": "Jet d’initiative", + "lair acted": "antre a agi", + "lair awake": "antre actif", + "End the fight: XP and the after-the-fight card": "Terminer le combat : PX et carte de fin de combat", + "Force-end the encounter (lead only)": "Forcer la fin du combat (chef uniquement)", + "End encounter": "Terminer le combat", + "{standing} of {total} standing": "{standing} sur {total} debout", + "{standing} standing": "{standing} debout", + "Legendary actions this round and resistances this fight": "Actions légendaires ce tour et résistances ce combat", + "Alive at 0 hit points after a blow meant to knock it out: out of the fight, not dying.": "Vivant à 0 PV après un coup destiné à l’assommer : hors combat, pas mourant.", + "fled": "en fuite", + "down, burning": "à terre, en feu", + "down, regenerating": "à terre, en régénération", + "dies at its turn": "meurt à son tour", + "regenerates at its turn": "se régénère à son tour", + "{name} attacks {target}.": "{name} attaque {target}.", + "Pick the creature {name} attacks.": "Choisis la créature que {name} attaque.", + "The creature {name} attacks": "La créature que {name} attaque", + "It attacks": "Elle attaque", + "Full text": "Texte complet", + "{name}, cannot be played now": "{name}, impossible à jouer maintenant", + "Moving {pick}.": "Déplacement de {pick}.", + "year {n}": "an {n}", + "Day {n}": "Jour {n}", + "It is now {date}.": "Nous sommes maintenant le {date}.", + "speed {feet} ft.": "vitesse {feet} ft.", + "controlled (shares your initiative)": "contrôlée (partage ton initiative)", + "independent (acts on its own turn)": "indépendante (agit à son propre tour)", + "{name} mounts up: {mount}.": "{name} monte en selle : {mount}.", + "{duration} pass:": "{duration} s’écoulent :", + "It is {character}'s turn again.": "C’est de nouveau le tour de {character}.", + "{character} ends their turn.": "{character} termine son tour.", + "{enemies} act before {character}.": "{enemies} agissent avant {character}.", + "Every character has fallen: the fight is lost.": "Tous les personnages sont tombés : le combat est perdu.", + "The party lead skipped {character}'s turn.": "Le chef du groupe a passé le tour de {character}.", + "I end my turn.": "Je termine mon tour.", + "I stand up.": "Je me relève.", + "I dismount.": "Je descends de monture.", + "I take the Search action.": "Je fais l’action Chercher.", + "I try to escape the grapple.": "J’essaie de me libérer de l’empoignade.", + "the nearest enemy": "l’ennemi le plus proche", + "myself": "moi-même", + "an unarmed strike": "une attaque à mains nues", + "I attack {who} with {weapon} as a bonus action ({feature}).": "J’attaque {who} avec {weapon} en action bonus ({feature}).", + "I attack {who} with {weapon}.": "J’attaque {who} avec {weapon}.", + "I make my off-hand attack against {who} with {weapon} as a bonus action.": "J’effectue mon attaque avec l’arme secondaire contre {who} avec {weapon} en action bonus.", + "I make my off-hand attack with {weapon} as a bonus action.": "J’effectue mon attaque avec l’arme secondaire avec {weapon} en action bonus.", + "I draw my {item}.": "Je dégaine {item}.", + "I stow my {item}.": "Je rengaine {item}.", + "I drop my {item}.": "Je lâche {item}.", + "I strap on my {item}.": "J’équipe {item}.", + "I take off my {item}.": "Je retire {item}.", + "I pick up the {item}.": "Je ramasse {item}.", + "as a bonus action ({route})": " en action bonus ({route})", + "I Dash{bonus}.": "Je fonce{bonus}.", + "I Disengage{bonus} and step away.": "Je me désengage{bonus} et je recule.", + "I Hide{bonus}.": "Je me cache{bonus}.", + "I take the Dodge action{bonus}.": "Je fais l’action Esquiver{bonus}.", + "my dying ally": "mon allié mourant", + "I try to grapple {who}.": "J’essaie d’empoigner {who}.", + "I shove {who}.": "Je bouscule {who}.", + "I try to stabilize {who}.": "J’essaie de stabiliser {who}.", + "I take the Help action for {who}.": "J’aide {who}.", + "my ally": "mon allié", + "I shake {who} awake.": "Je secoue {who} pour le réveiller.", + "If it hits, I use Divine Smite with a level {level} slot.": "Si ça touche, j’utilise Châtiment divin avec un emplacement de niveau {level}.", + "If it hits, I use Divine Smite.": "Si ça touche, j’utilise Châtiment divin.", + "I use {rider} on this attack.": "J’utilise {rider} sur cette attaque.", + "Take back this move and rewrite it": "Reprendre ce coup et le réécrire", + "Take back: remove this move and the GM's answer to it, and get its words back to correct": "Reprendre : supprime ce coup et la réponse du MJ, et récupère ton texte pour le corriger", + "New place discovered": "Nouveau lieu découvert", + "The party arrives": "Le groupe arrive", + "Narration is switched off on this server, so nothing will be read aloud. An admin turns it on in Admin > Speech.": "La narration est désactivée sur ce serveur, donc rien ne sera lu à voix haute. Un admin peut l’activer dans Admin > Voix.", + "the Kokoro speech server": "le serveur vocal Kokoro", + "an OpenAI-compatible speech server": "un serveur vocal compatible OpenAI", + "on this server's own network": "sur le réseau local de ce serveur", + "at {place}": "à {place}", + "Narration is on, but {server} {where} has no model picked, so nothing is read aloud until an admin picks one in Admin > Speech.": "La narration est activée, mais aucun modèle n’est choisi sur {server} {where} ; rien ne sera lu à voix haute tant qu’un admin n’en sélectionnera pas un dans Admin > Voix.", + "Narration is on, but {server} {where} is not answering, so passages will stay silent until it does. An admin can test it in Admin > Speech.": "La narration est activée, mais {server} {where} ne répond pas ; les passages resteront silencieux tant qu’il ne répondra pas. Un admin peut le tester dans Admin > Voix.", + "Each passage is sent as text to {server} {where} and comes back as audio.{local} The address, model and key are the server's, set in Admin > Speech.": "Chaque passage est envoyé en texte à {server} {where} et revient en audio.{local} L’adresse, le modèle et la clé sont ceux du serveur, configurés dans Admin > Voix.", + "Nothing leaves it.": "Rien n’en sort.", + "Pictures are painted by {painter}{where}. Its address, model and key are the server's, set in Admin > Image generation, so every campaign here shares them.": "Les images sont générées par {painter}{where}. Son adresse, son modèle et sa clé sont ceux du serveur, configurés dans Admin > Génération d’images, et partagés par toutes les campagnes ici.", + "The GM's answer to this move is taken back with it: the lines leave the chronicle, and the sheets, the clock and the fight go back to before the answer. The move's words come back to you to correct and send again.": "La réponse du MJ à ce coup est reprise avec lui : ces lignes quittent la chronique, et les fiches, l’horloge et le combat reviennent à l’état précédent. Ton texte revient pour que tu puisses le corriger et le renvoyer.", + "Take back and rewrite?": "Reprendre et réécrire ?", + "Take it back": "Reprendre", + "Take it back anyway?": "Reprendre quand même ?", + "Could not reach the table to take that move back.": "Impossible de joindre la table pour reprendre ce coup.", + "Could not take that move back.": "Impossible de reprendre ce coup.", + "Pinned: the GM keeps this message in mind every turn.": "Épinglé : le MJ garde ce message en mémoire à chaque tour.", + "Pinned: the GM keeps this passage in mind every turn.": "Épinglé : le MJ garde ce passage en mémoire à chaque tour.", + "Could not add that to Facts.": "Impossible d’ajouter cela aux Faits.", + "Could not reach the table to add that to Facts.": "Impossible de joindre la table pour ajouter cela aux Faits.", + "Added to Facts as established canon.": "Ajouté aux Faits comme élément établi.", + "model call": "appel au modèle", + "model calls": "appels au modèle", + "rolls": "jets", + "the creature you pick": "la créature de ton choix", + "each check or save an ally makes": "chaque test ou jet de sauvegarde d’un allié", + "each roll you can see": "chaque jet que tu peux voir", + "The game stops before {rolls}, so you can {what}. {end}": "Le jeu s’arrête avant {rolls}, pour que tu puisses {what}. {end}", + "It stays on until you turn it off.": "Cela reste actif jusqu’à ce que tu le désactives.", + "It turns off when the fight ends.": "Cela se désactive à la fin du combat.", + "Stop the game before {rolls}, so you can {what}. Only turn it on when it matters: every stop holds up the table.": "Arrête le jeu avant {rolls}, pour que tu puisses {what}. Ne l’active que quand c’est important : chaque arrêt met la table en pause.", + "levels": "niveaux", + "1 still to choose. ": "1 restant à choisir. ", + "Or: a poll link, for an agent nothing can send requests to": "Ou : un lien de sondage, pour un agent qui ne peut pas recevoir de requêtes entrantes", + "If {characterName}'s agent cannot take incoming requests (a hosted assistant whose hooks can only check a URL), give its hook this link to check every minute or so. It answers whether {characterName} has something to do now. Wake the agent when wake is true and fingerprint differs from the one it last woke the agent for. Use this or a receiver, not both.": "Si l’agent de {characterName} ne peut pas recevoir de requêtes entrantes (un assistant hébergé dont les hooks ne peuvent que consulter une URL), donne ce lien à son hook pour qu’il le vérifie environ chaque minute. Il indique si {characterName} a quelque chose à faire maintenant. Réveille l’agent quand wake vaut true et que fingerprint diffère de la dernière valeur ayant réveillé l’agent. Utilise ceci ou un récepteur, pas les deux.", + "the poll link": "le lien de sondage", + "Shown once. The link is the secret: keep it in the hook's settings, not in a chat. If your hero falls and you bring in another, it wakes the agent for the new one. Revoking this connection stops it; a new one from Poll link on the connection's row replaces it, and the row says if it ever stops on its own.": "Affiché une seule fois. Ce lien est un secret : garde-le dans les réglages du hook, pas dans un chat. Si ton héros tombe et que tu en fais entrer un autre, il réveille l’agent pour le nouveau. Révoquer cette connexion l’arrête ; un nouveau lien depuis Lien de sondage sur la ligne de la connexion le remplace, et la ligne indique s’il s’arrête de lui-même.", + "Make a poll link": "Créer un lien de sondage", + "On an NVIDIA graphics card up to the RTX 40 series, faster:": "Sur une carte graphique NVIDIA jusqu’à la série RTX 40, plus rapide :", + "On an NVIDIA RTX 50 series card:": "Sur une carte NVIDIA série RTX 50 :", + "Kokoro RTX 50 series command": "Commande Kokoro série RTX 50", + "special": "capacité spéciale", + "specials": "capacités spéciales", + "trait line": "ligne de trait", + "trait lines": "lignes de traits", + "picking locks": "crochetage de serrures", + "A bonus to these checks": "Un bonus à ces tests", + "Campaigns concerned: {list}.": "Campagnes concernées : {list}.", + "Find a help topic": "Rechercher une rubrique d’aide", + "Nothing in Help mentions that. Try another word.": "Rien dans l’aide ne mentionne cela. Essaie un autre mot.", + "Act {n}": "Acte {n}", + "End of Act {n}": "Fin de l’Acte {n}", + "on the mount, not carried": "sur la monture, non porté", + "On mount": "Sur la monture", + "On your mount, so it weighs nothing for you. Press to pack it, and carry its weight.": "Sur ta monture, donc cela ne pèse rien pour toi. Appuie pour le ranger dans ton sac et porter son poids.", + "In your pack, where it does nothing and you carry its weight. Press to put it on your mount.": "Dans ton sac, où cela n’a aucun effet et où tu portes son poids. Appuie pour le mettre sur ta monture.", + "Drag an item from the list above onto its place to put it on, or press a place to see what goes there.": "Glisse un objet de la liste ci-dessus sur son emplacement pour l’équiper, ou appuie sur un emplacement pour voir ce qui s’y place.", + "on the mount": "sur la monture", + "Roll one hit die with your own dice and enter it here. Your Constitution is added, and you heal that much.": "Lance un dé de vie avec tes propres dés et saisis le résultat ici. Ta Constitution est ajoutée, et tu récupères autant de PV.", + "The {form}'s armor class, {beastAc} before the spells on it; {name}'s own is {ac}.": "La classe d’armure de {form}, {beastAc} avant les sorts actifs ; celle de {name} est de {ac}.", + "The {form}'s armor class; {name}'s own is {ac}.": "La classe d’armure de {form} ; celle de {name} est de {ac}.", + "Spells on them change it from {ac}.": "Les sorts actifs la modifient par rapport à {ac}.", + "only out of the caster's sight; off the board, after its first turn": "uniquement hors de vue du lanceur ; hors plateau, après son premier tour", + "to {square}": "vers {square}", + "Tap another square to go there instead.": "Appuie sur une autre case pour y aller à la place.", + "Tap the square to move to.": "Appuie sur la case où te déplacer.", + "{feature} +{dice}{type} on the first hit this turn.": "{feature} +{dice}{type} sur le premier coup ce tour-ci.", + "It is the enemy's turn, not {name}'s. Off their own turn a character can only use their reaction. What they declared waits for their turn.": "C’est le tour de l’ennemi, pas celui de {name}. Hors de son propre tour, un personnage ne peut utiliser que sa réaction. Ce qu’il a déclaré attend son tour.", + "Wake": "Réveiller", + "An action: shake an ally within 5 ft out of Sleep or Hypnotic Pattern. They wake still prone.": "Une action : secoue un allié à 1,5 m (5 ft) pour le sortir de Sommeil ou Motif hypnotique. Il se réveille toujours à terre.", + "at {who}": "sur {who}", + "on {who}": "sur {who}", + "using a level {level} slot": "avec un emplacement de niveau {level}", + "from my {item}": "depuis {item}", + "as a reaction": "en réaction", + "I cast {spell}{ring}{picked}{where}{laid}{how}{slot}.": "Je lance {spell}{ring}{picked}{where}{laid}{how}{slot}.", + "for {who}": "pour {who}", + "I cast {spell} from my {item}{at} as a reaction.": "Je lance {spell} depuis {item}{at} en réaction.", + "I cast {spell}{at} as a reaction{slot}.": "Je lance {spell}{at} en réaction{slot}.", + "I use {feature}{at} as my reaction.": "J’utilise {feature}{at} en réaction.", + "I use {named}{where} for {unit}.": "J’utilise {named}{where} pour {unit}.", + "I use {named}{where}{how}.": "J’utilise {named}{where}{how}.", + "I use {rider} on my next hit.": "J’utilise {rider} sur mon prochain coup.", + "it": "cet objet", + "I hand my {item} to {who}.": "Je tends {item} à {who}.", + "I give {who} my {item} to drink.": "Je fais boire {item} à {who}.", + "I drink my {item}.": "Je bois {item}.", + "I try to break free of {spell}.": "J’essaie de me libérer de {spell}.", + "an attack": "une attaque", + "I ready {held} for when {trigger}.": "Je prépare {held} pour quand {trigger}.", + "I ready an action: ": "Je prépare une action : ", + "I use an object{bonus}: ": "J’utilise un objet{bonus} : ", + "{whom} took {damage}{type} damage": "{whom} a subi {damage}{type} dégâts", + "Your reaction gives advantage to the attack roll about to be made against the creature you pick, if it stands in the spirit's aura.": "Ta réaction donne l’avantage au jet d’attaque sur le point d’être effectué contre la créature de ton choix, si elle se trouve dans l’aura de l’esprit.", + "30 ft aura": "Aura de 30 ft", + "{whom} failed a save against {forcer}": "{whom} a raté un jet de sauvegarde contre {forcer}", + "{whom} failed a save": "{whom} a raté un jet de sauvegarde", + "+{bonus} on the save just failed. Only cantrips until the end of your next turn.": "+{bonus} au jet de sauvegarde qui vient d’échouer. Sorts mineurs uniquement jusqu’à la fin de ton prochain tour.", + "+{bonus} on the save just failed.": "+{bonus} au jet de sauvegarde qui vient d’échouer.", + "Only cantrips until the end of your next turn.": "Sorts mineurs uniquement jusqu’à la fin de ton prochain tour.", + "Sorcery points {points}": "Points de sorcellerie {points}", + "Infusion": "Infusion", + "foe": "ennemi", + "Intimidating Presence takes a creature {name} can see, and they are blinded.": "Présence intimidante exige une créature que {name} peut voir, et celle-ci est aveuglée.", + "Off-hand attack, your bonus action: the {name} in your other hand, after you take the Attack action with a {kind} weapon.": "Attaque avec l’arme secondaire, en action bonus : {name} dans ton autre main, après avoir fait l’action Attaquer avec une arme {kind}.", + "one-handed melee": "de corps à corps à une main", + "light melee": "de corps à corps légère", + "Packed away: the attack draws it with your free object interaction.": "Rangée : l’attaque la dégaine grâce à ton interaction gratuite avec un objet.", + "A treasure": "Un trésor", + "A rare find": "Une trouvaille rare", + "Added to your pack": "Ajouté à ton sac", + " and one use": " et une utilisation", + "{seconds} s through the tables' own picture queue": "{seconds} s via la file d’images des tables", + "The file the table would be sent is missing or unreadable.": "Le fichier qui serait envoyé à la table est manquant ou illisible.", + ", not the landscape a map asks for; the table crops it": ", pas le format paysage attendu par une carte ; la table la recadre", + "No agent program is chosen yet.": "Aucun programme d’agent n’est encore choisi.", + "{label} was not found.": "{label} est introuvable.", + "Run `{cmd}` on this machine.": "Exécute `{cmd}` sur cette machine.", + "The program did not answer.": "Le programme n’a pas répondu.", + "The program answered without calling ODM's tool, so it cannot run a table.": "Le programme a répondu sans appeler l’outil d’ODM, il ne peut donc pas gérer une table.", + "The program stopped after the tool call.": "Le programme s’est arrêté après l’appel de l’outil.", + "It replied \"{reply}\" instead of the tool's answer.": "Il a répondu « {reply} » au lieu de la réponse de l’outil.", + "Its own tools are removed; only the table's tools are offered.": "Ses propres outils sont retirés ; seuls ceux de la table sont proposés.", + "Its own tools are contained: read-only, an empty folder, every approval refused.": "Ses propres outils sont confinés : lecture seule, dossier vide, toute approbation refusée.", + "The reply arrived whole rather than streamed.": "La réponse est arrivée en bloc plutôt qu’en flux continu.", + "A {size} window is small for the helper; its longer jobs (summaries, lore checks) will go to the storyteller instead.": "Une fenêtre de {size} est petite pour l’assistant ; ses tâches plus longues (résumés, vérifications d’histoire) seront confiées au conteur à la place.", + "Every character is down and none can rise on their own.": "Tous les personnages sont à terre et aucun ne peut se relever seul.", + "{target} falls!": "{target} tombe !", + "natural 20": "20 naturel", + "success": "réussite", + "failure": "échec", + "incapacitated": "neutralisé", + "stunned": "étourdi", + "paralyzed": "paralysé", + "unconscious": "inconscient", + "petrified": "pétrifié", + "charmed": "charmé", + "{name} death save: rolled {total}, {result} ({tally}).": "{name} — jet de sauvegarde contre la mort : {total}, {result} ({tally}).", + "{name} death save: rolled {total}, {result}.": "{name} — jet de sauvegarde contre la mort : {total}, {result}.", + "{name} rolls a natural 20 on their death save and regains 1 HP!": "{name} obtient un 20 naturel à son jet de sauvegarde contre la mort et regagne 1 PV !", + "{name} succeeds their third death save and is stable (unconscious at 0 HP). They regain 1 hit point in {hours} hour.": "{name} réussit son troisième jet de sauvegarde contre la mort et est stable (inconscient à 0 PV). Il regagne 1 point de vie dans {hours} heure.", + "{name} succeeds their third death save and is stable (unconscious at 0 HP). They regain 1 hit point in {hours} hours.": "{name} réussit son troisième jet de sauvegarde contre la mort et est stable (inconscient à 0 PV). Il regagne 1 point de vie dans {hours} heures.", + "{name} succeeds their third death save and is stable at 0 HP, still raging on their feet.": "{name} réussit son troisième jet de sauvegarde contre la mort et est stable à 0 PV, toujours debout sous l’effet de la rage.", + "{name} fails their third death save. Rage Beyond Death holds the death off: they die when the rage ends, if they are still at 0 hit points then.": "{name} échoue à son troisième jet de sauvegarde contre la mort. Rage par-delà la mort retarde le trépas : il meurt à la fin de sa rage s’il est toujours à 0 point de vie.", + "{name} fails their final death save and dies.": "{name} échoue à son dernier jet de sauvegarde contre la mort et meurt.", + "{name} is {by} and loses its turn.": "{name} est {by} et perd son tour.", + "{name} is {by} and loses their turn.": "{name} est {by} et perd son tour.", + "{name} is caught by surprise and does nothing this round.": "{name} est pris par surprise et n’agit pas ce tour-ci.", + "{name} has no one left to fight.": "{name} n’a plus personne à combattre.", + "{name} closes in on {target} but cannot reach them this turn.": "{name} se rapproche de {target} mais ne peut l’atteindre à ce tour.", + "{name} cannot reach {target} this turn.": "{name} ne peut pas atteindre {target} à ce tour.", + "{name} moves for a shot at {target} but is still out of range.": "{name} se déplace pour tirer sur {target} mais reste hors de portée.", + "{name} cannot get {target} within range this turn.": "{name} ne peut pas mettre {target} à portée à ce tour.", + "{name} moves but still has no clear line to {target}.": "{name} se déplace mais n’a toujours pas de ligne de vue dégagée sur {target}.", + "{name} has no clear line to {target} this turn.": "{name} n’a pas de ligne de vue dégagée sur {target} à ce tour.", + "{name} is too frightened to close in on {target}.": "{name} est trop effrayé pour s’approcher de {target}.", + "{name} does not close in while {holder} holds a readied action.": "{name} ne s’approche pas tant que {holder} garde une action préparée.", + "{name} is {by} and makes no attack.": "{name} est {by} et n’effectue aucune attaque.", + "{name} finds no one it can attack this turn.": "{name} ne trouve personne à attaquer à ce tour.", + "{name}'s turn has not come yet.": "Le tour de {name} n’est pas encore arrivé.", + "{name} does not attack this turn.": "{name} n’attaque pas à ce tour.", + "The party takes a short rest ({duration})": "Le groupe prend un repos court ({duration})", + "Inside the genie's vessel, the party takes a short rest ({duration})": "À l’intérieur du réceptacle du génie, le groupe prend un repos court ({duration})", + "The party takes a long rest ({duration})": "Le groupe prend un repos long ({duration})", + "No benefit from it for {who}.": "Aucun bénéfice pour {who}.", + "{n} week": "{n} semaine", + "{n} weeks": "{n} semaines", + "{n} day": "{n} jour", + "{n} days": "{n} jours", + "{n} hour": "{n} heure", + "{n} hours": "{n} heures", + "{n} minute": "{n} minute", + "{n} minutes": "{n} minutes", + "Firstday": "Primedi", + "Seconday": "Duodi", + "Midweek": "Tridi", + "Fourthday": "Quartidi", + "Fifthday": "Quintidi", + "Restday": "Sextidi", + "Midday": "Septidi", + "Deepwinter": "Givrefond", + "Frostmoon": "Lunegel", + "Thaw": "Dégel", + "Greening": "Verdoiement", + "Bloom": "Floraison", + "Seedfall": "Semailles", + "Highsun": "Haut-Soleil", + "Longlight": "Longjour", + "Firstharvest": "Prémices", + "Goldfall": "Chutdor", + "Leafturn": "Feuilletourne", + "Yearsend": "Fin-d’An", + "First Month": "Premier Mois", + "Second Month": "Deuxième Mois", + "Third Month": "Troisième Mois", + "Fourth Month": "Quatrième Mois", + "Fifth Month": "Cinquième Mois", + "Sixth Month": "Sixième Mois", + "Seventh Month": "Septième Mois", + "Eighth Month": "Huitième Mois", + "Ninth Month": "Neuvième Mois", + "Tenth Month": "Dixième Mois", + "Eleventh Month": "Onzième Mois", + "Twelfth Month": "Douzième Mois", + "deep night": "nuit profonde", + "before dawn": "avant l’aube", + "morning": "matin", + "midday": "midi", + "afternoon": "après-midi", + "evening": "soir", + "night": "nuit", + "winter": "hiver", + "spring": "printemps", + "summer": "été", + "autumn": "automne", + "{name} comes round with {hp} hit point.": "{name} reprend connaissance avec {hp} point de vie.", + "{name} comes round with {hp} hit points.": "{name} reprend connaissance avec {hp} points de vie.", + "{name}'s rage ends: their turn passed with no attack made and no damage taken.": "La rage de {name} prend fin : son tour s’est écoulé sans attaque ni dégâts subis.", + "{attacker} is {distance} ft from {target}, out of melee reach ({reach} ft).": "{attacker} est à {distance} pieds de {target}, hors d’allonge de mêlée ({reach} pieds).", + "{attacker} is {distance} ft from {target}, beyond this attack's {range} ft maximum range.": "{attacker} est à {distance} pieds de {target}, au-delà de la portée maximale de cette attaque ({range} pieds)." }, "contexts": { "Remove": { @@ -12336,6 +12653,14 @@ "{names} cannot play the full rules, so it is left off the list. \u0000{names} cannot play the full rules, so they are left off the list. ": [ "{names} ne peut pas jouer les règles complètes, il reste donc hors de la liste. ", "{names} ne peuvent pas jouer les règles complètes, ils restent donc hors de la liste. " + ], + "{count} player\u0000{count} players": [ + "{count} joueur", + "{count} joueurs" + ], + "{count} time\u0000{count} times": [ + "{count} fois", + "{count} fois" ] } }