From 0cd67675c57c208127227070dd2a1bd1381e8f14 Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 10 Aug 2026 11:14:02 +0200 Subject: [PATCH] Describe the chain when nothing describes the branch --- .../Planner/PlaceDetailsColumn.test.tsx | 38 ++++ .../components/Planner/PlaceDetailsColumn.tsx | 15 +- server/src/nest/maps/maps.service.ts | 23 +++ .../place-enrichment.service.ts | 47 ++++- .../unit/nest/place-enrichment.brand.test.ts | 188 ++++++++++++++++++ shared/src/i18n/ar/places.ts | 2 + shared/src/i18n/br/places.ts | 2 + shared/src/i18n/ca/places.ts | 2 + shared/src/i18n/cs/places.ts | 2 + shared/src/i18n/de/places.ts | 2 + shared/src/i18n/en/places.ts | 2 + shared/src/i18n/es/places.ts | 2 + shared/src/i18n/fr/places.ts | 2 + shared/src/i18n/gr/places.ts | 2 + shared/src/i18n/hu/places.ts | 2 + shared/src/i18n/id/places.ts | 2 + shared/src/i18n/it/places.ts | 2 + shared/src/i18n/ja/places.ts | 2 + shared/src/i18n/ko/places.ts | 2 + shared/src/i18n/nl/places.ts | 2 + shared/src/i18n/pl/places.ts | 2 + shared/src/i18n/ru/places.ts | 2 + shared/src/i18n/sv/places.ts | 2 + shared/src/i18n/tr/places.ts | 2 + shared/src/i18n/uk/places.ts | 2 + shared/src/i18n/vi/places.ts | 2 + shared/src/i18n/zh-TW/places.ts | 2 + shared/src/i18n/zh/places.ts | 2 + shared/src/maps/maps.schema.ts | 11 + 29 files changed, 365 insertions(+), 3 deletions(-) create mode 100644 server/tests/unit/nest/place-enrichment.brand.test.ts diff --git a/client/src/components/Planner/PlaceDetailsColumn.test.tsx b/client/src/components/Planner/PlaceDetailsColumn.test.tsx index 761f6ec54..917b786d0 100644 --- a/client/src/components/Planner/PlaceDetailsColumn.test.tsx +++ b/client/src/components/Planner/PlaceDetailsColumn.test.tsx @@ -440,3 +440,41 @@ describe('PlaceDetailsColumn — no Google key', () => { expect(screen.queryByText('places.details.noKeyTitle')).not.toBeInTheDocument() }) }) +/** + * FE-PDC-030..031 — a description that is about the chain, not the place. + * + * The whole safety argument for showing it rests on the heading saying so. + */ +describe('PlaceDetailsColumn — chain description', () => { + it('FE-PDC-030: heads a brand text differently and says what it describes', async () => { + placeEnrichment.mockResolvedValue({ + photos: [], + facts: [], + description: { + text: 'L’Osteria ist eine deutsche Restaurantkette.', + source: 'wikipedia', + sourceUrl: 'https://de.wikipedia.org/wiki/L%E2%80%99Osteria', + license: 'CC BY-SA 4.0', + aboutBrand: true, + }, + }) + renderColumn() + + expect(await screen.findByText('places.details.aboutBrand')).toBeInTheDocument() + expect(screen.getByText('places.details.aboutBrandNote')).toBeInTheDocument() + expect(screen.queryByText('places.details.description')).not.toBeInTheDocument() + }) + + it('FE-PDC-031: a description of the place itself keeps the plain heading', async () => { + placeEnrichment.mockResolvedValue({ + photos: [], + facts: [], + description: { text: 'Ein Museum.', source: 'wikipedia', sourceUrl: null, license: 'CC BY-SA 4.0' }, + }) + renderColumn() + + expect(await screen.findByText('places.details.description')).toBeInTheDocument() + expect(screen.queryByText('places.details.aboutBrand')).not.toBeInTheDocument() + expect(screen.queryByText('places.details.aboutBrandNote')).not.toBeInTheDocument() + }) +}) diff --git a/client/src/components/Planner/PlaceDetailsColumn.tsx b/client/src/components/Planner/PlaceDetailsColumn.tsx index 4c197d3b4..4ed33ab77 100644 --- a/client/src/components/Planner/PlaceDetailsColumn.tsx +++ b/client/src/components/Planner/PlaceDetailsColumn.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useRef, useState } from 'react' import { Accessibility, Bike, + Building2, Check, ChefHat, ChevronDown, @@ -631,10 +632,22 @@ function DescriptionBlock({ ? 'Wikivoyage' : 'Wikipedia' + // A description of the chain is not a description of this place, and the + // heading is where that gets said. Without it the reader has no way to tell + // that "a German restaurant chain serving pizza and pasta" is about the + // company rather than the branch they are about to add to their trip. + const aboutBrand = !!description.aboutBrand + return (
- {t('places.details.description')} + {aboutBrand ? t('places.details.aboutBrand') : t('places.details.description')}
+ {aboutBrand && ( +

+ + {t('places.details.aboutBrandNote')} +

+ )}

{description.text}

{description.sourceUrl ? ( diff --git a/server/src/nest/maps/maps.service.ts b/server/src/nest/maps/maps.service.ts index 36a1a225d..2b24a19a6 100644 --- a/server/src/nest/maps/maps.service.ts +++ b/server/src/nest/maps/maps.service.ts @@ -166,6 +166,29 @@ function normalizeCategoryName(raw: string): string | null { return value.replace(/^(category|kategorie|categorie|categoría|categoria)\s*:/i, '').trim() || null; } +/** + * The chain a place belongs to, when it belongs to one. + * + * Read separately from `readWikiIdentity` and never mixed into it. Following + * `brand:wikidata` as if it described the place is how "L'Osteria Rostock" + * ends up illustrated with the company logo and described as a franchise + * operator — which is why the picture ladder never sees these. For a + * description they are still worth something: a branch of a chain has no + * article of its own and never will, and "L'Osteria is a German restaurant + * chain serving pizza and pasta" beats an empty column, as long as the reader + * is told that is what they are looking at. + */ +export function readBrandIdentity(extratags: Record | null | undefined): { + wikidata: string | null; + wikipedia: string | null; +} { + const read = (key: string): string | null => { + const value = extratags?.[key]; + return typeof value === 'string' && value.trim() ? value.trim() : null; + }; + return { wikidata: read('brand:wikidata'), wikipedia: read('brand:wikipedia') }; +} + /** Picks the three identity tags out of a Nominatim `extratags` blob. */ export function readWikiIdentity(extratags: Record | null | undefined): WikiIdentity { const out: WikiIdentity = { wikipedia: null, wikidata: null, wikimedia_commons: null }; diff --git a/server/src/nest/place-enrichment/place-enrichment.service.ts b/server/src/nest/place-enrichment/place-enrichment.service.ts index a1990e312..d379f5561 100644 --- a/server/src/nest/place-enrichment/place-enrichment.service.ts +++ b/server/src/nest/place-enrichment/place-enrichment.service.ts @@ -11,7 +11,14 @@ import type { } from '@trek/shared'; import { safeFetchFollow } from '../../utils/ssrfGuard'; import { DatabaseService } from '../database/database.service'; -import { MapsService, readWikiIdentity, withPhotoFetchSlot, type CommonsCandidate, type WikiIdentity } from '../maps/maps.service'; +import { + MapsService, + readBrandIdentity, + readWikiIdentity, + withPhotoFetchSlot, + type CommonsCandidate, + type WikiIdentity, +} from '../maps/maps.service'; import { buildOsmDetails, isGooglePlaceId, parseWikipediaTag, rankCommonsCandidates, toWikiLang } from '../maps/maps.helpers'; import { PlacePhotoCacheService } from '../place-photos/place-photo-cache.service'; @@ -83,6 +90,12 @@ export function candidateKey(placeId: string, identity: string): string { interface PlaceIdentity extends WikiIdentity { /** Full OSM tag set, when the identity came from a Nominatim lookup. */ osmTags: Record | null; + /** + * The chain this place belongs to. Kept apart from the fields above on + * purpose — it describes something else, and only the description is allowed + * to fall back to it. The picture ladder never reads it. + */ + brand: { wikidata: string | null; wikipedia: string | null }; } /** A ranked Commons pick, tagged with the rung of the ladder it came from. */ @@ -317,12 +330,17 @@ export class PlaceEnrichmentService { wikidata: fromPayload('wikidata'), wikimedia_commons: fromPayload('wikimedia_commons'), osmTags: null, + brand: { wikidata: null, wikipedia: null }, }; if (carried.wikipedia || carried.wikidata || carried.wikimedia_commons) return carried; const resolved = await this.maps.resolveOsmIdentity(req.name, req.lat, req.lng, { lang: req.lang }); if (!resolved) return carried; - return { ...readWikiIdentity(resolved.tags), osmTags: resolved.tags }; + return { + ...readWikiIdentity(resolved.tags), + osmTags: resolved.tags, + brand: readBrandIdentity(resolved.tags), + }; } // ── Photos ───────────────────────────────────────────────────────────────── @@ -526,6 +544,31 @@ export class PlaceEnrichmentService { } } + // Last, and about something else: the chain this place belongs to. + // + // A branch of a chain has no article of its own and never will, and Google + // keeps no editorial summary for one either — L'Osteria Rostock came back + // empty from every source above. The company does have an article, and + // "L'Osteria is a German restaurant chain serving pizza and pasta" is worth + // more than nothing as long as nobody mistakes it for a description of this + // particular branch. The `aboutBrand` flag is what stops that: the column + // heads the block differently, and it is the only reason this is allowed to + // run at all. Note the pictures do NOT get the same treatment — a chain's + // logo passed off as a photo of the restaurant would be a plain lie. + const brand = await this.fetchWikiDescription( + { ...identity, wikipedia: identity.brand.wikipedia, wikidata: identity.brand.wikidata }, + req.lang, + ); + if (brand) { + return { + text: brand.text, + source: brand.source, + sourceUrl: brand.sourceUrl, + license: 'CC BY-SA 4.0', + aboutBrand: true, + }; + } + return null; } diff --git a/server/tests/unit/nest/place-enrichment.brand.test.ts b/server/tests/unit/nest/place-enrichment.brand.test.ts new file mode 100644 index 000000000..ff6f06027 --- /dev/null +++ b/server/tests/unit/nest/place-enrichment.brand.test.ts @@ -0,0 +1,188 @@ +/** + * ENRICH-090..096 — falling back to the chain a place belongs to. + * + * L'Osteria Rostock came back empty from every source: no Wikipedia article of + * its own (a branch never has one), and Google holds no editorial summary for a + * chain restaurant either — verified live, the call goes out and returns null. + * The company does have an article, reachable through OSM's `brand:wikidata`. + * + * The rule that makes this safe: it may describe, it may not illustrate, and it + * must say what it is describing. + */ +import { describe, it, expect, vi, beforeEach } from 'vitest'; + +const { mockDbGet, mockDbRun } = vi.hoisted(() => ({ + mockDbGet: vi.fn(() => undefined as any), + mockDbRun: vi.fn(), +})); + +vi.mock('../../../src/db/database', () => ({ + db: { + prepare: (sql: string) => ({ + get: (...params: unknown[]) => mockDbGet(sql, ...params), + run: (...params: unknown[]) => mockDbRun(sql, ...params), + all: () => [], + }), + }, +})); + +vi.mock('../../../src/utils/ssrfGuard', () => ({ + safeFetchFollow: vi.fn(async () => ({ ok: false, arrayBuffer: async () => new ArrayBuffer(0) })), + checkSsrf: vi.fn(async () => ({ allowed: true })), + SsrfBlockedError: class extends Error {}, +})); + +vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) })); + +import { db } from '../../../src/db/database'; +import { DatabaseService } from '../../../src/nest/database/database.service'; +import { PlaceEnrichmentService } from '../../../src/nest/place-enrichment/place-enrichment.service'; +import { readBrandIdentity } from '../../../src/nest/maps/maps.service'; +import type { MapsService } from '../../../src/nest/maps/maps.service'; +import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service'; + +const REQ = { lat: 54.088, lng: 12.1409, name: "L'Osteria Rostock", placeId: 'ChIJosteria', lang: 'de' }; + +/** The real Nominatim extratags for L'Osteria Rostock. */ +const BRANCH_TAGS = { + 'brand:wikidata': 'Q17323478', + 'brand:wikipedia': 'de:L’Osteria', + cuisine: 'pizza', +}; + +const CHAIN_EXTRACT = { + text: 'L’Osteria ist eine deutsche Restaurantkette mit Schwerpunkt auf Pizza und Pasta.', + sourceUrl: 'https://de.wikipedia.org/wiki/L%E2%80%99Osteria', + source: 'wikipedia' as const, +}; + +function mapsStub(over: Partial> = {}) { + return { + getMapsKey: vi.fn(() => null as string | null), + photosDisabled: vi.fn(() => false), + detailsDisabled: vi.fn(() => false), + fetchGooglePhotoRefs: vi.fn(async () => []), + fetchGooglePhotoBytes: vi.fn(async () => null), + fetchCommonsCandidates: vi.fn(async () => []), + fetchCommonsCategoryCandidates: vi.fn(async () => []), + fetchWikidataCandidates: vi.fn(async () => ({ candidates: [], commonsCategory: null })), + fetchCommonsFilesByName: vi.fn(async () => new Map()), + fetchWikiLeadImageName: vi.fn(async () => null), + fetchEditorialSummary: vi.fn(async () => null as string | null), + fetchWikiExtract: vi.fn(async () => null as typeof CHAIN_EXTRACT | null), + fetchWikiExtractFor: vi.fn(async () => null as typeof CHAIN_EXTRACT | null), + fetchWikidataSitelinks: vi.fn(async () => ({}) as Record), + resolveOsmIdentity: vi.fn(async () => null as { tags: Record; osmUrl: string | null; matchedName: string } | null), + details: vi.fn(async () => ({ place: null })), + ...over, + } as unknown as MapsService; +} + +const cacheStub = () => + ({ get: vi.fn(() => null), put: vi.fn(async () => ({ photoUrl: '/x', filePath: '/x', attribution: null })) }) as unknown as PlacePhotoCacheService; + +const make = (maps: MapsService) => new PlaceEnrichmentService(new DatabaseService(db as never), maps, cacheStub()); + +/** A place whose own identity is empty but that belongs to a chain. */ +const branchOfAChain = (over: Partial> = {}) => + mapsStub({ + resolveOsmIdentity: vi.fn(async () => ({ tags: BRANCH_TAGS, osmUrl: null, matchedName: "L'Osteria" })), + ...over, + }); + +beforeEach(() => { + mockDbGet.mockReset(); + mockDbGet.mockReturnValue(undefined); + mockDbRun.mockReset(); +}); + +describe('readBrandIdentity', () => { + it('ENRICH-090: reads the brand tags and nothing else', () => { + expect(readBrandIdentity(BRANCH_TAGS)).toEqual({ wikidata: 'Q17323478', wikipedia: 'de:L’Osteria' }); + expect(readBrandIdentity({ wikidata: 'Q1' })).toEqual({ wikidata: null, wikipedia: null }); + expect(readBrandIdentity(null)).toEqual({ wikidata: null, wikipedia: null }); + }); +}); + +describe('chain fallback', () => { + it('ENRICH-091: describes the chain when nothing describes the place', async () => { + const maps = branchOfAChain({ + fetchWikidataSitelinks: vi.fn(async () => ({ dewiki: 'L’Osteria' })), + fetchWikiExtractFor: vi.fn(async () => CHAIN_EXTRACT), + }); + + const out = await make(maps).enrich(1, REQ); + + expect(out.description).toMatchObject({ text: CHAIN_EXTRACT.text, aboutBrand: true, license: 'CC BY-SA 4.0' }); + expect(maps.fetchWikidataSitelinks).toHaveBeenCalledWith('Q17323478', expect.any(Array)); + }); + + it('ENRICH-092: never lets the chain illustrate the place', async () => { + // A chain's logo passed off as a photo of this restaurant is a plain lie, + // so the picture ladder does not read the brand tags at all. + const maps = branchOfAChain({ + fetchWikidataCandidates: vi.fn(async () => ({ candidates: [], commonsCategory: null })), + fetchWikiExtractFor: vi.fn(async () => CHAIN_EXTRACT), + fetchWikidataSitelinks: vi.fn(async () => ({ dewiki: 'L’Osteria' })), + }); + + await make(maps).enrich(1, REQ); + + // Called with nothing, or not at all — but never with the brand's Q-id. + for (const call of (maps.fetchWikidataCandidates as unknown as { mock: { calls: unknown[][] } }).mock.calls) { + expect(call[0]).not.toBe('Q17323478'); + } + }); + + it('ENRICH-093: marks the text so the column can head it differently', async () => { + const maps = branchOfAChain({ + fetchWikidataSitelinks: vi.fn(async () => ({ dewiki: 'L’Osteria' })), + fetchWikiExtractFor: vi.fn(async () => CHAIN_EXTRACT), + }); + + const out = await make(maps).enrich(1, REQ); + + // Without this flag the reader has no way to tell that "a German restaurant + // chain" is about the company and not about the branch they are adding. + expect(out.description?.aboutBrand).toBe(true); + }); + + it('ENRICH-094: a place with its own article never reaches the chain', async () => { + const OWN = { ...CHAIN_EXTRACT, text: 'Das Museum Ludwig zeigt moderne Kunst.' }; + const maps = mapsStub({ + details: vi.fn(async () => ({ place: { source: 'openstreetmap', wikidata: 'Q1' } })), + fetchWikidataSitelinks: vi.fn(async () => ({ dewiki: 'Museum Ludwig' })), + fetchWikiExtractFor: vi.fn(async () => OWN), + }); + + const out = await make(maps).enrich(1, REQ); + + expect(out.description).toMatchObject({ text: OWN.text }); + expect(out.description?.aboutBrand).toBeUndefined(); + }); + + it('ENRICH-095: Google still wins over the chain', async () => { + // Google describes THIS branch; the chain article does not. + const maps = branchOfAChain({ + getMapsKey: vi.fn(() => 'key'), + fetchEditorialSummary: vi.fn(async () => 'Casual chain spot for wood-fired pizza.'), + fetchWikidataSitelinks: vi.fn(async () => ({ dewiki: 'L’Osteria' })), + fetchWikiExtractFor: vi.fn(async () => CHAIN_EXTRACT), + }); + + const out = await make(maps).enrich(1, REQ); + + expect(out.description).toMatchObject({ source: 'google', text: 'Casual chain spot for wood-fired pizza.' }); + expect(out.description?.aboutBrand).toBeUndefined(); + }); + + it('ENRICH-096: a place with no brand tag still ends with no description', async () => { + const maps = mapsStub({ + resolveOsmIdentity: vi.fn(async () => ({ tags: { cuisine: 'pizza' }, osmUrl: null, matchedName: 'Kiosk' })), + }); + + const out = await make(maps).enrich(1, REQ); + + expect(out.description).toBeNull(); + }); +}); diff --git a/shared/src/i18n/ar/places.ts b/shared/src/i18n/ar/places.ts index 6887217a1..cd2fe539f 100644 --- a/shared/src/i18n/ar/places.ts +++ b/shared/src/i18n/ar/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'لم يتم العثور على شيء لهذا المكان.', 'places.details.noKeyTitle': 'تتوفر تفاصيل أكثر', 'places.details.noKeyHint': 'بدون مفتاح Google API يستخدم هذا التثبيت المصادر الحرة فقط. اطلب من مسؤول TREK إضافة مفتاح للحصول على التقييمات وساعات العمل والصور.', + 'places.details.aboutBrand': 'عن السلسلة', + 'places.details.aboutBrandNote': 'يصف السلسلة، لا هذا الفرع.', 'places.details.fact.rating': 'التقييم', 'places.details.fact.cuisine': 'المطبخ', 'places.details.fact.openingHours': 'ساعات العمل', diff --git a/shared/src/i18n/br/places.ts b/shared/src/i18n/br/places.ts index c6e4d06b1..9a51323f7 100644 --- a/shared/src/i18n/br/places.ts +++ b/shared/src/i18n/br/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Nada encontrado para este lugar.', 'places.details.noKeyTitle': 'Mais detalhes disponíveis', 'places.details.noKeyHint': 'Sem uma chave de API do Google, esta instância usa apenas fontes livres. Peça ao administrador do TREK para adicionar uma para avaliações, horários e fotos.', + 'places.details.aboutBrand': 'Sobre a rede', + 'places.details.aboutBrandNote': 'Descreve a rede, não esta unidade.', 'places.details.fact.rating': 'Avaliação', 'places.details.fact.cuisine': 'Cozinha', 'places.details.fact.openingHours': 'Horário', diff --git a/shared/src/i18n/ca/places.ts b/shared/src/i18n/ca/places.ts index c66f9fb97..7056bf151 100644 --- a/shared/src/i18n/ca/places.ts +++ b/shared/src/i18n/ca/places.ts @@ -97,6 +97,8 @@ const places: TranslationStrings = { 'places.details.nothing': "No s'ha trobat res per a aquest lloc.", 'places.details.noKeyTitle': 'Hi ha més detalls disponibles', 'places.details.noKeyHint': 'Sense una clau API de Google, aquesta instància només fa servir fonts lliures. Demana a l\'administració de TREK que n\'afegeixi una per a valoracions, horaris i fotos.', + 'places.details.aboutBrand': 'Sobre la cadena', + 'places.details.aboutBrandNote': 'Descriu la cadena, no aquest local.', 'places.details.fact.rating': 'Valoració', 'places.details.fact.cuisine': 'Cuina', 'places.details.fact.openingHours': 'Horari', diff --git a/shared/src/i18n/cs/places.ts b/shared/src/i18n/cs/places.ts index 6a6c6ba44..5cd2df76d 100644 --- a/shared/src/i18n/cs/places.ts +++ b/shared/src/i18n/cs/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Pro toto místo se nic nenašlo.', 'places.details.noKeyTitle': 'K dispozici je více podrobností', 'places.details.noKeyHint': 'Bez klíče Google API používá tato instance jen volné zdroje. Požádejte správce TREK o jeho přidání pro hodnocení, otevírací dobu a fotografie.', + 'places.details.aboutBrand': 'O řetězci', + 'places.details.aboutBrandNote': 'Popisuje řetězec, ne tuto pobočku.', 'places.details.fact.rating': 'Hodnocení', 'places.details.fact.cuisine': 'Kuchyně', 'places.details.fact.openingHours': 'Otevírací doba', diff --git a/shared/src/i18n/de/places.ts b/shared/src/i18n/de/places.ts index 17e55b911..90c2173ca 100644 --- a/shared/src/i18n/de/places.ts +++ b/shared/src/i18n/de/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Zu diesem Ort wurde nichts gefunden.', 'places.details.noKeyTitle': 'Mehr Details möglich', 'places.details.noKeyHint': 'Ohne Google-API-Key nutzt diese Instanz nur freie Quellen. Wende dich an deine TREK-Administration, um Bewertungen, Öffnungszeiten und Fotos freizuschalten.', + 'places.details.aboutBrand': 'Über die Kette', + 'places.details.aboutBrandNote': 'Beschreibt die Kette, nicht diese Filiale.', 'places.details.fact.rating': 'Bewertung', 'places.details.fact.cuisine': 'Küche', 'places.details.fact.openingHours': 'Öffnungszeiten', diff --git a/shared/src/i18n/en/places.ts b/shared/src/i18n/en/places.ts index e990b0fbd..90ea728c0 100644 --- a/shared/src/i18n/en/places.ts +++ b/shared/src/i18n/en/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Nothing found for this place.', 'places.details.noKeyTitle': 'More detail is available', 'places.details.noKeyHint': 'Without a Google API key this instance can only use free sources. Ask your TREK administrator to add one for ratings, opening hours and photos.', + 'places.details.aboutBrand': 'About the chain', + 'places.details.aboutBrandNote': 'This describes the chain, not this branch.', 'places.details.fact.rating': 'Rating', 'places.details.fact.cuisine': 'Cuisine', 'places.details.fact.openingHours': 'Opening hours', diff --git a/shared/src/i18n/es/places.ts b/shared/src/i18n/es/places.ts index 8396235ce..458f7774f 100644 --- a/shared/src/i18n/es/places.ts +++ b/shared/src/i18n/es/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'No se encontró nada para este lugar.', 'places.details.noKeyTitle': 'Hay más detalles disponibles', 'places.details.noKeyHint': 'Sin una clave de API de Google, esta instancia solo usa fuentes libres. Pide a tu administrador de TREK que añada una para valoraciones, horarios y fotos.', + 'places.details.aboutBrand': 'Sobre la cadena', + 'places.details.aboutBrandNote': 'Describe la cadena, no este local.', 'places.details.fact.rating': 'Valoración', 'places.details.fact.cuisine': 'Cocina', 'places.details.fact.openingHours': 'Horario', diff --git a/shared/src/i18n/fr/places.ts b/shared/src/i18n/fr/places.ts index 5790b835b..190dd7a63 100644 --- a/shared/src/i18n/fr/places.ts +++ b/shared/src/i18n/fr/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Rien trouvé pour ce lieu.', 'places.details.noKeyTitle': 'Plus de détails disponibles', 'places.details.noKeyHint': 'Sans clé API Google, cette instance n\'utilise que des sources libres. Demandez à votre administrateur TREK d\'en ajouter une pour les avis, les horaires et les photos.', + 'places.details.aboutBrand': 'À propos de la chaîne', + 'places.details.aboutBrandNote': 'Décrit la chaîne, pas cet établissement.', 'places.details.fact.rating': 'Note', 'places.details.fact.cuisine': 'Cuisine', 'places.details.fact.openingHours': 'Horaires', diff --git a/shared/src/i18n/gr/places.ts b/shared/src/i18n/gr/places.ts index 5482aab35..d7cf13cbc 100644 --- a/shared/src/i18n/gr/places.ts +++ b/shared/src/i18n/gr/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Δεν βρέθηκε τίποτα για αυτήν την τοποθεσία.', 'places.details.noKeyTitle': 'Διατίθενται περισσότερες λεπτομέρειες', 'places.details.noKeyHint': 'Χωρίς κλειδί Google API, αυτή η εγκατάσταση χρησιμοποιεί μόνο ελεύθερες πηγές. Ζητήστε από τον διαχειριστή TREK να προσθέσει ένα για βαθμολογίες, ώρες λειτουργίας και φωτογραφίες.', + 'places.details.aboutBrand': 'Σχετικά με την αλυσίδα', + 'places.details.aboutBrandNote': 'Περιγράφει την αλυσίδα, όχι αυτό το κατάστημα.', 'places.details.fact.rating': 'Βαθμολογία', 'places.details.fact.cuisine': 'Κουζίνα', 'places.details.fact.openingHours': 'Ωράριο', diff --git a/shared/src/i18n/hu/places.ts b/shared/src/i18n/hu/places.ts index 8bb2e71f0..b9c736ea5 100644 --- a/shared/src/i18n/hu/places.ts +++ b/shared/src/i18n/hu/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Ehhez a helyhez nem található semmi.', 'places.details.noKeyTitle': 'További részletek érhetők el', 'places.details.noKeyHint': 'Google API-kulcs nélkül ez a példány csak szabad forrásokat használ. Kérd a TREK rendszergazdáját, hogy adjon hozzá egyet az értékelésekhez, nyitvatartáshoz és fotókhoz.', + 'places.details.aboutBrand': 'A láncról', + 'places.details.aboutBrandNote': 'A láncot írja le, nem ezt az egységet.', 'places.details.fact.rating': 'Értékelés', 'places.details.fact.cuisine': 'Konyha', 'places.details.fact.openingHours': 'Nyitvatartás', diff --git a/shared/src/i18n/id/places.ts b/shared/src/i18n/id/places.ts index 887cb2f11..59170197b 100644 --- a/shared/src/i18n/id/places.ts +++ b/shared/src/i18n/id/places.ts @@ -98,6 +98,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Tidak ada yang ditemukan untuk tempat ini.', 'places.details.noKeyTitle': 'Tersedia detail lebih lanjut', 'places.details.noKeyHint': 'Tanpa kunci API Google, instans ini hanya memakai sumber bebas. Minta administrator TREK menambahkannya untuk rating, jam buka, dan foto.', + 'places.details.aboutBrand': 'Tentang jaringan', + 'places.details.aboutBrandNote': 'Menjelaskan jaringannya, bukan cabang ini.', 'places.details.fact.rating': 'Peringkat', 'places.details.fact.cuisine': 'Masakan', 'places.details.fact.openingHours': 'Jam buka', diff --git a/shared/src/i18n/it/places.ts b/shared/src/i18n/it/places.ts index e317e0561..b5e537728 100644 --- a/shared/src/i18n/it/places.ts +++ b/shared/src/i18n/it/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Nessun risultato per questo luogo.', 'places.details.noKeyTitle': 'Sono disponibili più dettagli', 'places.details.noKeyHint': 'Senza una chiave API di Google questa istanza usa solo fonti libere. Chiedi all\'amministratore di TREK di aggiungerne una per valutazioni, orari e foto.', + 'places.details.aboutBrand': 'Sulla catena', + 'places.details.aboutBrandNote': 'Descrive la catena, non questa sede.', 'places.details.fact.rating': 'Valutazione', 'places.details.fact.cuisine': 'Cucina', 'places.details.fact.openingHours': 'Orari', diff --git a/shared/src/i18n/ja/places.ts b/shared/src/i18n/ja/places.ts index 97148fde0..ddc2ad4c2 100644 --- a/shared/src/i18n/ja/places.ts +++ b/shared/src/i18n/ja/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'この場所の情報は見つかりませんでした。', 'places.details.noKeyTitle': 'さらに詳しい情報を表示できます', 'places.details.noKeyHint': 'Google API キーがない場合、このインスタンスは自由に使えるソースのみを利用します。評価・営業時間・写真のために、TREK の管理者にキーの追加を依頼してください。', + 'places.details.aboutBrand': 'チェーンについて', + 'places.details.aboutBrandNote': 'この店舗ではなくチェーン全体の説明です。', 'places.details.fact.rating': '評価', 'places.details.fact.cuisine': '料理', 'places.details.fact.openingHours': '営業時間', diff --git a/shared/src/i18n/ko/places.ts b/shared/src/i18n/ko/places.ts index cba6afce0..81b40c34a 100644 --- a/shared/src/i18n/ko/places.ts +++ b/shared/src/i18n/ko/places.ts @@ -98,6 +98,8 @@ const places: TranslationStrings = { 'places.details.nothing': '이 장소에 대한 정보를 찾지 못했습니다.', 'places.details.noKeyTitle': '더 자세한 정보를 볼 수 있습니다', 'places.details.noKeyHint': 'Google API 키가 없으면 이 인스턴스는 무료 소스만 사용합니다. 평점, 영업시간, 사진을 보려면 TREK 관리자에게 키 추가를 요청하세요.', + 'places.details.aboutBrand': '체인 소개', + 'places.details.aboutBrandNote': '이 지점이 아니라 체인에 대한 설명입니다.', 'places.details.fact.rating': '평점', 'places.details.fact.cuisine': '요리', 'places.details.fact.openingHours': '영업시간', diff --git a/shared/src/i18n/nl/places.ts b/shared/src/i18n/nl/places.ts index 5c9bcbfb2..b8fa93959 100644 --- a/shared/src/i18n/nl/places.ts +++ b/shared/src/i18n/nl/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Niets gevonden voor deze plaats.', 'places.details.noKeyTitle': 'Meer details beschikbaar', 'places.details.noKeyHint': 'Zonder Google API-sleutel gebruikt deze installatie alleen vrije bronnen. Vraag je TREK-beheerder er een toe te voegen voor beoordelingen, openingstijden en foto\'s.', + 'places.details.aboutBrand': 'Over de keten', + 'places.details.aboutBrandNote': 'Beschrijft de keten, niet deze vestiging.', 'places.details.fact.rating': 'Beoordeling', 'places.details.fact.cuisine': 'Keuken', 'places.details.fact.openingHours': 'Openingstijden', diff --git a/shared/src/i18n/pl/places.ts b/shared/src/i18n/pl/places.ts index e231c64e3..21a103ca1 100644 --- a/shared/src/i18n/pl/places.ts +++ b/shared/src/i18n/pl/places.ts @@ -90,6 +90,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Nic nie znaleziono dla tego miejsca.', 'places.details.noKeyTitle': 'Dostępnych jest więcej szczegółów', 'places.details.noKeyHint': 'Bez klucza API Google ta instancja korzysta tylko ze źródeł otwartych. Poproś administratora TREK o dodanie klucza, aby uzyskać oceny, godziny otwarcia i zdjęcia.', + 'places.details.aboutBrand': 'O sieci', + 'places.details.aboutBrandNote': 'Opisuje sieć, a nie ten lokal.', 'places.details.fact.rating': 'Ocena', 'places.details.fact.cuisine': 'Kuchnia', 'places.details.fact.openingHours': 'Godziny otwarcia', diff --git a/shared/src/i18n/ru/places.ts b/shared/src/i18n/ru/places.ts index f58247f21..e2392bf37 100644 --- a/shared/src/i18n/ru/places.ts +++ b/shared/src/i18n/ru/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Для этого места ничего не найдено.', 'places.details.noKeyTitle': 'Доступно больше подробностей', 'places.details.noKeyHint': 'Без ключа Google API этот экземпляр использует только свободные источники. Попросите администратора TREK добавить ключ для оценок, часов работы и фотографий.', + 'places.details.aboutBrand': 'О сети', + 'places.details.aboutBrandNote': 'Описывает сеть, а не это заведение.', 'places.details.fact.rating': 'Рейтинг', 'places.details.fact.cuisine': 'Кухня', 'places.details.fact.openingHours': 'Часы работы', diff --git a/shared/src/i18n/sv/places.ts b/shared/src/i18n/sv/places.ts index 829fd778d..b03db9923 100644 --- a/shared/src/i18n/sv/places.ts +++ b/shared/src/i18n/sv/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Inget hittades för den här platsen.', 'places.details.noKeyTitle': 'Fler detaljer finns tillgängliga', 'places.details.noKeyHint': 'Utan en Google API-nyckel använder den här instansen bara fria källor. Be din TREK-administratör lägga till en för betyg, öppettider och foton.', + 'places.details.aboutBrand': 'Om kedjan', + 'places.details.aboutBrandNote': 'Beskriver kedjan, inte det här stället.', 'places.details.fact.rating': 'Betyg', 'places.details.fact.cuisine': 'Kök', 'places.details.fact.openingHours': 'Öppettider', diff --git a/shared/src/i18n/tr/places.ts b/shared/src/i18n/tr/places.ts index 79c5f8ff2..cd58fd6d3 100644 --- a/shared/src/i18n/tr/places.ts +++ b/shared/src/i18n/tr/places.ts @@ -101,6 +101,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Bu yer için bir şey bulunamadı.', 'places.details.noKeyTitle': 'Daha fazla ayrıntı mevcut', 'places.details.noKeyHint': 'Google API anahtarı olmadan bu örnek yalnızca özgür kaynakları kullanır. Puanlar, açılış saatleri ve fotoğraflar için TREK yöneticinizden bir anahtar eklemesini isteyin.', + 'places.details.aboutBrand': 'Zincir hakkında', + 'places.details.aboutBrandNote': 'Bu şubeyi değil, zinciri anlatır.', 'places.details.fact.rating': 'Puan', 'places.details.fact.cuisine': 'Mutfak', 'places.details.fact.openingHours': 'Çalışma saatleri', diff --git a/shared/src/i18n/uk/places.ts b/shared/src/i18n/uk/places.ts index 9e077c5fe..1f569f769 100644 --- a/shared/src/i18n/uk/places.ts +++ b/shared/src/i18n/uk/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Для цього місця нічого не знайдено.', 'places.details.noKeyTitle': 'Доступно більше деталей', 'places.details.noKeyHint': 'Без ключа Google API цей екземпляр використовує лише вільні джерела. Попросіть адміністратора TREK додати ключ, щоб отримати оцінки, години роботи та фото.', + 'places.details.aboutBrand': 'Про мережу', + 'places.details.aboutBrandNote': 'Описує мережу, а не цей заклад.', 'places.details.fact.rating': 'Рейтинг', 'places.details.fact.cuisine': 'Кухня', 'places.details.fact.openingHours': 'Години роботи', diff --git a/shared/src/i18n/vi/places.ts b/shared/src/i18n/vi/places.ts index 255cd55be..f0f4b174b 100644 --- a/shared/src/i18n/vi/places.ts +++ b/shared/src/i18n/vi/places.ts @@ -99,6 +99,8 @@ const places: TranslationStrings = { 'places.details.nothing': 'Không tìm thấy gì cho địa điểm này.', 'places.details.noKeyTitle': 'Có thêm thông tin chi tiết', 'places.details.noKeyHint': 'Không có khóa API Google, phiên bản này chỉ dùng nguồn miễn phí. Hãy đề nghị quản trị viên TREK thêm khóa để có xếp hạng, giờ mở cửa và ảnh.', + 'places.details.aboutBrand': 'Về chuỗi', + 'places.details.aboutBrandNote': 'Mô tả chuỗi, không phải chi nhánh này.', 'places.details.fact.rating': 'Đánh giá', 'places.details.fact.cuisine': 'Ẩm thực', 'places.details.fact.openingHours': 'Giờ mở cửa', diff --git a/shared/src/i18n/zh-TW/places.ts b/shared/src/i18n/zh-TW/places.ts index b31d1a86b..b4cf00fba 100644 --- a/shared/src/i18n/zh-TW/places.ts +++ b/shared/src/i18n/zh-TW/places.ts @@ -97,6 +97,8 @@ const places: TranslationStrings = { 'places.details.nothing': '找不到此地點的資訊。', 'places.details.noKeyTitle': '可取得更多詳細資訊', 'places.details.noKeyHint': '沒有 Google API 金鑰時,此執行個體僅使用免費來源。請聯絡 TREK 管理員新增金鑰,以取得評分、營業時間與照片。', + 'places.details.aboutBrand': '關於該連鎖品牌', + 'places.details.aboutBrandNote': '描述的是連鎖品牌,而非本分店。', 'places.details.fact.rating': '評分', 'places.details.fact.cuisine': '菜系', 'places.details.fact.openingHours': '營業時間', diff --git a/shared/src/i18n/zh/places.ts b/shared/src/i18n/zh/places.ts index 8098229dd..df5478bc2 100644 --- a/shared/src/i18n/zh/places.ts +++ b/shared/src/i18n/zh/places.ts @@ -97,6 +97,8 @@ const places: TranslationStrings = { 'places.details.nothing': '未找到该地点的信息。', 'places.details.noKeyTitle': '可获取更多详情', 'places.details.noKeyHint': '没有 Google API 密钥时,此实例仅使用免费来源。请联系 TREK 管理员添加密钥,以获取评分、营业时间和照片。', + 'places.details.aboutBrand': '关于该连锁品牌', + 'places.details.aboutBrandNote': '描述的是连锁品牌,而非本门店。', 'places.details.fact.rating': '评分', 'places.details.fact.cuisine': '菜系', 'places.details.fact.openingHours': '营业时间', diff --git a/shared/src/maps/maps.schema.ts b/shared/src/maps/maps.schema.ts index ddea0308d..12de6bd5a 100644 --- a/shared/src/maps/maps.schema.ts +++ b/shared/src/maps/maps.schema.ts @@ -132,6 +132,17 @@ export const placeDescriptionSchema = z.object({ source: placeDescriptionSourceSchema, sourceUrl: z.string().nullable(), license: z.string().nullable(), + /** + * True when the text describes the CHAIN this place belongs to, not the place + * itself — an article about L'Osteria the company, reached through the OSM + * `brand:wikidata` tag, shown for a branch that nothing else describes. + * + * A flag rather than a source of its own: it is still a Wikipedia article + * under the same licence, and the distinction the reader needs is "this is + * about the brand", which the client says in the heading. Optional so a + * payload written before this landed still parses. + */ + aboutBrand: z.boolean().optional(), }); export type PlaceDescription = z.infer;