fix(journey): the day mark reads as its language writes it, and a country mark names its country by one rule

The day word of every language now says where the number goes ("DAY {day}",
"{day}日目", "第{day}天", "{day}. GÜN"), and one helper builds the mark for the
engine, the auto layout, a template and the Travel panel, so Japanese,
Korean and Chinese no longer read "日目 3". A word stored without the
placeholder is followed by the number as before. The panel's own day word is
gone with its only reader.

A country mark carries the name as its words beside the outline and a flag
mark sets it small beside the flag, the same for the engine's value, the
panel's tile, the assistant's add and a template's country mark; a flag in a
template keeps the place its name was drawn in. A flag or country mark asked
for by its own code is named after that country without the journey having
to name one.
This commit is contained in:
Maurice
2026-10-23 04:21:01 +00:00
parent 49dd591f8f
commit 317c1ee5ad
40 changed files with 231 additions and 115 deletions
@@ -4,8 +4,8 @@ import type {
BookBadgeVariant, BookElement, BookMapScope, BookMetric, BookPageSetup, BookTravelContext, JourneyStats,
} from '@trek/shared'
import {
BOOK_METRICS, bookBadgeValue, bookCountryName, bookElementId as uid, bookTravelBadge, bookTravelCountries,
bookTravelMap, bookTravelSize, bookTravelStats,
BOOK_METRICS, bookBadgeValue, bookCountryMark, bookCountryName, bookElementId as uid, bookTravelBadge,
bookTravelCountries, bookTravelMap, bookTravelSize, bookTravelStats,
} from '@trek/shared'
import { useStudioStore } from '../../store/studioStore'
import { PanelHead } from './StudioPanelHead'
@@ -170,16 +170,14 @@ export function StudioTravelPanel({
* What the book engine's factories read: the journey, its recorded way and
* the words in the reader's language. Every tile below is built by the
* factory the engine's `add` calls. Where it lands is the panel's own:
* centred across the spread, where `add` takes the right page. Two words are
* still the panel's too, so a mark placed here and one the assistant adds
* can read differently: the country mark carries the name in `text`, where
* the engine's value has it in `sub`, and the day mark says `dayWord`, where
* the engine says `day` (the two differ in ja, ko, zh and zh-TW).
* centred across the spread, where `add` takes the right page. The day word
* is the engine's too, handed over as its template: `t` leaves the `{day}`
* in it untouched, and `bookDayText` puts the number there.
*/
const travel: BookTravelContext = {
locale, stats, path, entries: [],
labels: {
day: t('journey.studio.dayWord'), stations: t('journey.studio.stations'), summary: t('journey.studio.summary'),
day: t('journey.studio.day'), stations: t('journey.studio.stations'), summary: t('journey.studio.summary'),
countries: t('journey.studio.countries'), distance: t('journey.studio.metric.distance'),
pros: t('journey.editor.pros'), cons: t('journey.editor.cons'),
},
@@ -564,7 +562,7 @@ export function StudioTravelPanel({
*/}
<div className="st-travel-grid" style={{ marginTop: 6 }}>
{stats.countries.slice(0, 12).map(c => {
const el = badgeEl('country', { text: countryName(c.code), sub: '', code: c.code })
const el = badgeEl('country', bookCountryMark('country', c.code, countryName(c.code)))
return (
<Card key={`mark-${c.code}`} label={countryName(c.code)} onClick={() => place(el)}>
<TravelPreview el={el} minHeight={30} maxHeight={44} />