{infoRow('birthYear', t('Naissance'), birthFilled, renderEditableValue({ field: 'birthYear', value: person.birthDate || person.birthYear, placeholder: t('Date de naissance'), type: 'date' }), true)}
{infoRow('birthPlace', t('Lieu'), isFilled(getEditValue('birthPlace', person.birthPlace)), renderEditableValue({ field: 'birthPlace', value: person.birthPlace || '', placeholder: t('Lieu de naissance'), format: formatPlace }))}
- {infoRow('birthName', t('Nom de naissance'), isFilled(getEditValue('birthName', person.birthName)), renderEditableValue({ field: 'birthName', value: person.birthName || '', placeholder: t('Nom de naissance') }))}
+ {infoRow('birthName', t('Nom de naissance'), isFilled(getEditValue('birthName', person.birthName)), renderEditableValue({ field: 'birthName', value: person.birthName || '', placeholder: t('Nom de naissance'), format: surnameLabel, caps: true }))}
{infoRow('nickname', t('Surnom'), isFilled(getEditValue('nickname', person.nickname)), renderEditableValue({ field: 'nickname', value: person.nickname || '', placeholder: t('Surnom') }))}
{editMode && (
@@ -1068,7 +1068,7 @@ const PersonCard = ({
const partnerId = u.partner1Id === person.id ? u.partner2Id : u.partner1Id
const partner = persons.find(p => p.id === partnerId)
const yearRange = u.startYear ? (u.endYear ? `${u.startYear}–${u.endYear}` : t('depuis {year}', { year: u.startYear })) : ''
- return `${partner ? firstNameLabel(partner) : '?'} ${partner?.lastName || ''}${yearRange ? ` (${yearRange})` : ''}`
+ return `${partner ? firstNameLabel(partner) : '?'} ${surnameLabel(partner?.lastName)}${yearRange ? ` (${yearRange})` : ''}`
}).join(', ')}
@@ -1359,7 +1359,7 @@ const RelationSearchInline = forwardRef(function RelationSearchInline(
{p.photo ? : {p.firstName[0]}}
-
{firstNameLabel(p)} {p.lastName || ''}
+
{firstNameLabel(p)} {surnameLabel(p.lastName)}
{p.birthYear &&
{p.birthYear}}
diff --git a/frontend/src/components/PhotoStartPanel.jsx b/frontend/src/components/PhotoStartPanel.jsx
index 5c1aed0..9884051 100644
--- a/frontend/src/components/PhotoStartPanel.jsx
+++ b/frontend/src/components/PhotoStartPanel.jsx
@@ -1,3 +1,4 @@
+import { surnameLabel } from '../utils/personName.js'
import { useEffect, useMemo, useRef, useState } from 'react'
import { Check, FolderOpen, ImagePlus, X } from 'lucide-react'
import './PhotoStartPanel.css'
@@ -310,7 +311,7 @@ export default function PhotoStartPanel({
{state.preview ?

: initialsOf(person)}
- {`${person.firstName} ${person.lastName || ''}`.trim()}
+ {`${person.firstName} ${surnameLabel(person.lastName)}`.trim()}
{years && {years}}
{state.error && {state.error}}
diff --git a/frontend/src/components/ProposalCard.jsx b/frontend/src/components/ProposalCard.jsx
index 8cc8c23..7c500f6 100644
--- a/frontend/src/components/ProposalCard.jsx
+++ b/frontend/src/components/ProposalCard.jsx
@@ -1,7 +1,7 @@
import { X } from 'lucide-react'
import { t, dateLocale } from '../i18n/index.js'
-import { firstNameLabel } from '../utils/personName.js'
+import { firstNameLabel, surnameLabel } from '../utils/personName.js'
import PzBusy from './PzBusy'
import './ProposalCard.css'
import { initialsOf } from '../utils/initial.js'
@@ -73,7 +73,7 @@ function ReviewActions({ ghost, review }) {
export default function ProposalCard({ person, summary = '', review = null, onClose }) {
const ghost = person?.ghost
const years = [person?.birthYear, person?.deathYear].filter(Boolean).join(' – ')
- const name = [firstNameLabel(person), person?.lastName].filter(Boolean).join(' ')
+ const name = [firstNameLabel(person), surnameLabel(person?.lastName)].filter(Boolean).join(' ')
const initials = initialsOf(person)
return (
@@ -88,7 +88,7 @@ export default function ProposalCard({ person, summary = '', review = null, onCl
{ghost?.source === 'draft' ? t('Brouillon') : ghost?.source === 'sent' ? t('En attente') : t('Proposition')}
{person?.firstName ? person.firstName : {firstNameLabel(person)}}
- {person?.lastName && <>{' '}{person.lastName}>}
+ {person?.lastName && <>{' '}{surnameLabel(person.lastName)}>}
{years &&
{years}
}
diff --git a/frontend/src/components/SearchSourcesPanel.jsx b/frontend/src/components/SearchSourcesPanel.jsx
index e94644e..9787c74 100644
--- a/frontend/src/components/SearchSourcesPanel.jsx
+++ b/frontend/src/components/SearchSourcesPanel.jsx
@@ -7,7 +7,7 @@ import { t, dateLocale } from '../i18n/index.js'
import { fetchSearchSources, searchSource } from '../api/searchSourcesApi.js'
import { SEARCH_LINKS, SEARCH_LINK_REGIONS } from '../data/searchLinks.js'
import { changesFromResult, personFromResult } from '../utils/searchResultChanges.js'
-import { fullNameLabel } from '../utils/personName.js'
+import { fullNameLabel, surnameLabel } from '../utils/personName.js'
import Skeleton from './Skeleton.jsx'
import PortraitThumb from './PortraitThumb.jsx'
import { withEmphasis } from '../utils/richText.jsx'
@@ -384,7 +384,7 @@ function SearchSourcesPanel({ visible, treeId, token, persons = [], canApply = f
diff --git a/frontend/src/components/galaxy/renderers.js b/frontend/src/components/galaxy/renderers.js
index 668c9e0..7495c36 100644
--- a/frontend/src/components/galaxy/renderers.js
+++ b/frontend/src/components/galaxy/renderers.js
@@ -12,7 +12,7 @@ import {
} from './constants'
import { getEntranceProgress, drawPartialBezier } from './utils'
import { fitNickname } from '../../utils/nickname.js'
-import { firstNameLabel, isFirstNameUnknown } from '../../utils/personName.js'
+import { firstNameLabel, isFirstNameUnknown, surnameLabel } from '../../utils/personName.js'
import { initialsOf } from '../../utils/initial.js'
import { blurhashCanvas } from '../../utils/blurhash.js'
@@ -634,7 +634,7 @@ function drawPersonNode(ctx, node, pos, nodeProgress, {
ctx.textAlign = 'center'
ctx.textBaseline = 'middle'
// Réglage « nom de famille sous le prénom » (#168) : celui de naissance s'il est connu, coupé comme le surnom
- const familyName = fullNames && withDetail ? String(person.birthName || person.lastName || '').trim() : ''
+ const familyName = fullNames && withDetail ? surnameLabel(person.birthName || person.lastName) : ''
const familyLabel = familyName ? fitNickname(ctx, familyName, NICKNAME_MAX_W) : ''
const lineShift = familyLabel ? 15 : 0
if (nameLabel) {
diff --git a/frontend/src/components/search/SearchResultsDropdown.jsx b/frontend/src/components/search/SearchResultsDropdown.jsx
index 727c6ee..0d057e8 100644
--- a/frontend/src/components/search/SearchResultsDropdown.jsx
+++ b/frontend/src/components/search/SearchResultsDropdown.jsx
@@ -1,6 +1,6 @@
import './SearchResultsDropdown.css'
import { t } from '../../i18n/index.js'
-import { firstNameLabel } from '../../utils/personName.js'
+import { firstNameLabel, surnameLabel } from '../../utils/personName.js'
import PortraitThumb from '../PortraitThumb.jsx'
// Raison du match renvoyée par usePersonSearch (valeur française), traduite à l'affichage
@@ -70,7 +70,7 @@ function SearchResultsDropdown({
{/* Info personne */}
- {firstNameLabel(person)} {person.lastName}
+ {firstNameLabel(person)} {surnameLabel(person.lastName)}
{person.birthYear && {person.birthYear}{person.deathYear ? `–${person.deathYear}` : ''}}
diff --git a/frontend/src/hooks/useTreeAccess.js b/frontend/src/hooks/useTreeAccess.js
index 8547182..33bd5e2 100644
--- a/frontend/src/hooks/useTreeAccess.js
+++ b/frontend/src/hooks/useTreeAccess.js
@@ -1,5 +1,6 @@
import { useCallback, useMemo, useRef, useState } from 'react'
import { setMediaToken } from '../utils/mediaToken.js'
+import { setSurnameUppercase } from '../utils/personName.js'
import { API_BASE_URL } from '../api/client'
import { fetchTreeGraph, unlockTreeAccess } from '../api/treeApi'
import { loadGraphData, persons as graphPersons, resetToDemoData } from '../data/mockData'
@@ -41,6 +42,7 @@ export function useTreeAccess() {
accessMode: '',
rootPersonId: null,
accessToken: '',
+ surnameUppercase: false,
})
const [bootState, setBootState] = useState('loading')
const [gateLoading, setGateLoading] = useState(false)
@@ -68,6 +70,7 @@ export function useTreeAccess() {
const openTreeGraph = async (treeId, token, options = {}) => {
const graphPayload = await fetchTreeGraph(treeId, token)
setMediaToken(graphPayload.mediaToken)
+ setSurnameUppercase(graphPayload.surnameUppercase)
loadGraphData(graphPayload.graph, {
mediaToken: graphPayload.mediaToken,
apiBaseUrl: API_BASE_URL,
@@ -99,6 +102,7 @@ export function useTreeAccess() {
accessMode: options.accessMode ?? current.accessMode,
rootPersonId: preferredRootPersonId,
accessToken: token,
+ surnameUppercase: graphPayload.surnameUppercase,
}))
const effectiveRole = normalizeRole(options.role)
@@ -195,7 +199,9 @@ export function useTreeAccess() {
accessMode: 'demo',
rootPersonId: null,
accessToken: '',
+ surnameUppercase: false,
})
+ setSurnameUppercase(false)
setBootState('ready')
}
diff --git a/frontend/src/i18n/en/arbre.js b/frontend/src/i18n/en/arbre.js
index ac68e77..a973a13 100644
--- a/frontend/src/i18n/en/arbre.js
+++ b/frontend/src/i18n/en/arbre.js
@@ -9,6 +9,8 @@ export default {
"Une belle-famille plus large qu'un écran s'ouvre dans son propre onglet au lieu d'être dessinée dans l'arbre. Réglage de ce navigateur.": 'An in-law family wider than a screen opens in its own tab instead of being drawn in the tree. Saved in this browser.',
'Le nom de famille sous le prénom': 'Last name under the first name',
"Le nom de naissance quand il est connu, sinon le nom d'usage. Réglage de ce navigateur.": 'The maiden name when it is known, otherwise the current last name. Saved in this browser.',
+ 'Les noms de famille en capitales': 'Last names in capitals',
+ 'Jeanne MARTIN plutôt que Jeanne Martin, pour toute la famille. Les noms restent enregistrés comme ils ont été tapés.': 'Jeanne MARTIN rather than Jeanne Martin, for the whole family. Names stay saved the way they were typed.',
// Arbre sur canvas (components/galaxy/renderers.js)
'Voir les parents': 'See parents',
'Voir {firstName}': 'See {firstName}',
diff --git a/frontend/src/styles/pz.css b/frontend/src/styles/pz.css
index fb975ae..fd9c0af 100644
--- a/frontend/src/styles/pz.css
+++ b/frontend/src/styles/pz.css
@@ -101,6 +101,8 @@ p, li, blockquote, figcaption, dd, .pz-sub, .pz-small, .pz-hint, .pz-error, .pz-
outline: none; border-color: var(--pz-a500); box-shadow: 0 0 0 3px var(--pz-a100);
}
.pz-hint { font: 400 12.5px/1.45 var(--pz-sans); color: var(--pz-muted); margin: 0; }
+/* Nom de famille en capitales (réglage de l'arbre) : seul l'affichage change, l'indication garde sa casse */
+.pz-caps:not(:placeholder-shown) { text-transform: uppercase; }
.pz-error {
display: flex; gap: 8px; align-items: flex-start; padding: 11px 14px; border-radius: var(--pz-r-s);
background: var(--pz-danger-bg); color: var(--pz-danger); font: 500 13.5px/1.45 var(--pz-sans);
diff --git a/frontend/src/utils/lifeTimeline.js b/frontend/src/utils/lifeTimeline.js
index c378a1c..f69debd 100644
--- a/frontend/src/utils/lifeTimeline.js
+++ b/frontend/src/utils/lifeTimeline.js
@@ -6,7 +6,7 @@
// enfant), limitée aux années où la personne a vécu. Une fiche sans aucun événement a donc déjà une frise.
import { t, dateLocale } from '../i18n/index.js'
-import { firstNameLabel } from './personName.js'
+import { firstNameLabel, surnameLabel } from './personName.js'
import { formatPlace } from './place.js'
import { ageInYears } from './age.js'
@@ -62,7 +62,7 @@ const yearOf = (value) => {
return match ? Number(match[1]) : null
}
-const fullName = (p) => [p?.firstName, p?.lastName].filter(Boolean).join(' ')
+const fullName = (p) => [p?.firstName, surnameLabel(p?.lastName)].filter(Boolean).join(' ')
// « 12 mars » pour une date complète, rien pour une année seule (stockée au 1er janvier)
function dayMonth(value) {
diff --git a/frontend/src/utils/personName.js b/frontend/src/utils/personName.js
index 4f68de1..86822a2 100644
--- a/frontend/src/utils/personName.js
+++ b/frontend/src/utils/personName.js
@@ -1,4 +1,22 @@
-import { t } from '../i18n/index.js'
+import { locale, t } from '../i18n/index.js'
+
+// Noms de famille en capitales (« Bertrand GAUTHIER ») : réglage de l'arbre ouvert, reçu avec le graphe.
+// Seul l'affichage change, le nom reste enregistré tel qu'il a été tapé.
+let surnameUppercase = false
+
+export function setSurnameUppercase(on) {
+ surnameUppercase = Boolean(on)
+}
+
+export function isSurnameUppercase() {
+ return surnameUppercase
+}
+
+// Nom de famille (ou de naissance) tel qu'il s'affiche
+export function surnameLabel(value) {
+ const name = String(value ?? '').trim()
+ return surnameUppercase ? name.toLocaleUpperCase(locale) : name
+}
// Prénom inconnu : le backend stocke une chaîne vide. L'affichage dit « Prénom inconnu » (en italique).
export function isFirstNameUnknown(person) {
@@ -11,5 +29,5 @@ export function firstNameLabel(person) {
// « Prénom Nom » pour une phrase ou une liste ; le prénom inconnu s'affiche comme son libellé
export function fullNameLabel(person) {
- return [firstNameLabel(person), person?.lastName].filter(Boolean).join(' ').trim()
+ return [firstNameLabel(person), surnameLabel(person?.lastName)].filter(Boolean).join(' ').trim()
}
diff --git a/frontend/src/utils/personName.test.js b/frontend/src/utils/personName.test.js
index bb6391e..591a9df 100644
--- a/frontend/src/utils/personName.test.js
+++ b/frontend/src/utils/personName.test.js
@@ -1,5 +1,5 @@
-import { describe, expect, it } from 'vitest'
-import { firstNameLabel, fullNameLabel, isFirstNameUnknown } from './personName.js'
+import { afterEach, describe, expect, it } from 'vitest'
+import { firstNameLabel, fullNameLabel, isFirstNameUnknown, setSurnameUppercase, surnameLabel } from './personName.js'
describe('prénom inconnu', () => {
it('un prénom vide ou blanc est inconnu', () => {
@@ -18,3 +18,26 @@ describe('prénom inconnu', () => {
expect(fullNameLabel({ firstName: 'Marie', lastName: '' })).toBe('Marie')
})
})
+
+describe('noms de famille en capitales', () => {
+ afterEach(() => setSurnameUppercase(false))
+
+ it('laisse le nom tel qu il a été tapé tant que le réglage est éteint', () => {
+ expect(surnameLabel('Gauthier')).toBe('Gauthier')
+ expect(fullNameLabel({ firstName: 'Bertrand', lastName: 'Gauthier' })).toBe('Bertrand Gauthier')
+ })
+
+ it('met le nom en capitales, accents et particules compris, sans toucher au prénom', () => {
+ setSurnameUppercase(true)
+ expect(surnameLabel(' de la Fontaine ')).toBe('DE LA FONTAINE')
+ expect(surnameLabel('Lefèvre-Hébert')).toBe('LEFÈVRE-HÉBERT')
+ expect(fullNameLabel({ firstName: 'Bertrand', lastName: 'Gauthier' })).toBe('Bertrand GAUTHIER')
+ expect(fullNameLabel({ firstName: '', lastName: 'Gauthier' })).toBe('Prénom inconnu GAUTHIER')
+ })
+
+ it('ne transforme pas une valeur absente', () => {
+ setSurnameUppercase(true)
+ expect(surnameLabel(null)).toBe('')
+ expect(surnameLabel(undefined)).toBe('')
+ })
+})