fix(i18n): every language says one file and five files its own way

Finishes the plural work the previous wip commit started. t() picks a
count string's form by the language's own Intl.PluralRules, and every
locale now spells out the forms its language reaches with whole
numbers, about 160 count strings in all: one, few and many in Russian,
Ukrainian and Polish, one and few in Czech and Slovak, five forms in
Arabic, one in the others, none in Japanese, Korean, Chinese, Thai,
Vietnamese and Indonesian. Each language was translated and then
reviewed on its own. English no longer reads "1 files", "1 updates
available" or "photo(s)".

Count labels shown next to a number now take that number too: the
atlas and admin statistics, the trip cards, journey and shared trip
pills, packing templates, receipts, storage usage, the Studio export
note. A heading that shared its key with a counted label keeps a key of
its own (the boarding pass heading, the Bookings tab), so languages that
put a noun after a number in the singular keep a plural heading. The
plugin hosts chip passed its count through .replace() after t() and
never got a form; three toasts sent the count as text. Mail and push
texts for shared photos and suppressed storage failures pick their form
in code through pluralForm.

A whole number sent as text counts too, which is how in-app
notification params arrive, and the plural rule follows the language of
the strings on screen while another one still loads.

The parity check knows which forms each language needs and refuses
missing and impossible ones. It also reads keys that contain a colon
now: it skipped them, which hid 58 missing plugin permission texts in
Catalan and 35 in Vietnamese, both translated. The client parity test
covers every language of the registry instead of a hand-kept list of 19,
and the placeholder spec lets a form spell its number out only where
its category is that one number. Brazilian Portuguese error screens
were in Breton, and an Arabic dashboard label held Hebrew text.
This commit is contained in:
Maurice
2026-10-08 00:01:59 +00:00
parent 55697b75c1
commit bee500880e
851 changed files with 11378 additions and 6077 deletions
+4 -4
View File
@@ -199,10 +199,10 @@ export default function MAdmin() {
{/* Stats grid (§6.3) */}
{stats && (
<div className="mb-3 grid grid-cols-2 gap-[10px]">
<MAdminStat label={t('admin.stats.users')} value={stats.totalUsers} icon={Users} />
<MAdminStat label={t('admin.stats.trips')} value={stats.totalTrips} icon={Briefcase} />
<MAdminStat label={t('admin.stats.places')} value={stats.totalPlaces} icon={Map} />
<MAdminStat label={t('admin.stats.files')} value={stats.totalFiles || 0} icon={FileText} />
<MAdminStat label={t('admin.stats.users', { count: stats.totalUsers })} value={stats.totalUsers} icon={Users} />
<MAdminStat label={t('admin.stats.trips', { count: stats.totalTrips })} value={stats.totalTrips} icon={Briefcase} />
<MAdminStat label={t('admin.stats.places', { count: stats.totalPlaces })} value={stats.totalPlaces} icon={Map} />
<MAdminStat label={t('admin.stats.files', { count: stats.totalFiles || 0 })} value={stats.totalFiles || 0} icon={FileText} />
</div>
)}
@@ -261,7 +261,7 @@ export default function MAdminPackingTemplateManager() {
<button type="button" className="min-w-0 flex-1 text-start" onClick={() => toggleExpand(tmpl.id)}>
<div className="truncate text-[0.8125rem] font-bold text-m-ink">{tmpl.name}</div>
<div className="mt-[1px] font-geist text-[0.59375rem] text-m-faint">
{tmpl.category_count} {t('admin.packingTemplates.categories')} · {tmpl.item_count} {t('admin.packingTemplates.items')}
{tmpl.category_count} {t('admin.packingTemplates.categories', { count: tmpl.category_count })} · {tmpl.item_count} {t('admin.packingTemplates.items', { count: tmpl.item_count })}
</div>
</button>
)}
@@ -1409,7 +1409,7 @@ function InstalledRow({ p, t, busy, hasUpdate, latestVer, newerIncompatible, blo
>
<Globe size={12} className={p.egressHostCount > 0 ? 'text-[color:var(--m-st-info)]' : 'text-[color:var(--m-st-pending)]'} />
{p.egressHostCount > 0
? t('admin.plugins.allowedHosts.count').replace('{n}', String(p.egressHostCount))
? t('admin.plugins.allowedHosts.count', { n: p.egressHostCount })
: t('admin.plugins.allowedHosts.add')}
</button>
)}
@@ -510,7 +510,7 @@ export default function MAdminStoragePanel(): React.ReactElement {
</p>
{rowUsage && (
<p className="mt-1 font-geist text-[0.625rem] text-m-muted">
{t('storage.usage.line', { objects: String(rowUsage.objects), size: formatBytes(rowUsage.bytes) })}
{t('storage.usage.line', { count: rowUsage.objects, size: formatBytes(rowUsage.bytes) })}
{row.name === 'uploads-local' && state.usage!.legacyPhotos.objects > 0
? ` (${t('storage.usage.legacyNote')})`
: ''}
@@ -772,7 +772,7 @@ export default function MAdminStoragePanel(): React.ReactElement {
{state.usage?.categories[category] && (
<p className="mb-1 font-geist text-[0.625rem] text-m-muted">
{t('storage.usage.line', {
objects: String(state.usage.categories[category]!.objects),
count: state.usage.categories[category]!.objects,
size: formatBytes(state.usage.categories[category]!.bytes),
})}
</p>
@@ -37,7 +37,7 @@ export default function MAdminUsersSection({ admin, t, locale }: MAdminUsersSect
<div className="mb-1 flex items-center gap-2">
<span className="text-[0.875rem] font-extrabold text-m-ink">{t('admin.tabs.users')}</span>
<span className="font-geist text-[0.625rem] font-bold text-m-faint">
{users.length} {t('admin.stats.users').toLowerCase()}
{users.length} {t('admin.stats.users', { count: users.length })}
</span>
<MAdminButton className="ms-auto" onClick={() => setShowCreateUser(true)}>
<UserPlus size={12} strokeWidth={2.2} />
+1 -1
View File
@@ -193,7 +193,7 @@ export default function MAtlas() {
<div className="min-w-0 flex-1">
<div className="truncate text-[1.0625rem] font-extrabold text-m-ink">{resolveName(selectedCountry)}</div>
<div className="mt-[4px] flex flex-wrap gap-1">
{[[countryDetail.places.length, t('atlas.places')], [countryDetail.trips.length, t('atlas.trips')]].map(([n, label]) => (
{[[countryDetail.places.length, t('atlas.places', { count: countryDetail.places.length })], [countryDetail.trips.length, t('atlas.trips', { count: countryDetail.trips.length })]].map(([n, label]) => (
<span key={label} className="rounded-full bg-[color:var(--m-ic)] px-2 py-[1px] font-geist text-[0.625rem] font-bold tabular-nums text-m-muted">
{n} {label}
</span>
@@ -13,11 +13,11 @@ interface MAtlasStatsCardProps {
export default function MAtlasStatsCard({ stats }: MAtlasStatsCardProps) {
const { t } = useTranslation()
const cols: [number, string][] = [
[stats.totalCountries, t('atlas.countries')],
[stats.totalTrips, t('atlas.trips')],
[stats.totalPlaces, t('atlas.places')],
[stats.totalCities || 0, t('atlas.cities')],
[stats.totalDays, t('atlas.days')],
[stats.totalCountries, t('atlas.countries', { count: stats.totalCountries })],
[stats.totalTrips, t('atlas.trips', { count: stats.totalTrips })],
[stats.totalPlaces, t('atlas.places', { count: stats.totalPlaces })],
[stats.totalCities || 0, t('atlas.cities', { count: stats.totalCities || 0 })],
[stats.totalDays, t('atlas.days', { count: stats.totalDays })],
]
// All five columns are spoken for, so the planned count rides along with the country
// number as a superscript rather than claiming a sixth column.
@@ -562,8 +562,8 @@ function MTripListCard({ trip, locale, t, badge, pluginBadges, actions, onOpen }
</div>
<div className="my-[13px] h-px bg-[color:var(--m-rowbr)]" />
<div className="flex text-center">
<ListStat value={trip.day_count ?? 0} label={t('dashboard.days')} />
<ListStat value={trip.place_count ?? 0} label={t('dashboard.places')} />
<ListStat value={trip.day_count ?? 0} label={t('dashboard.days', { count: trip.day_count ?? 0 })} />
<ListStat value={trip.place_count ?? 0} label={t('dashboard.places', { count: trip.place_count ?? 0 })} />
<ListStat value={trip.shared_count ?? 0} label={t('dashboard.card.buddies', { count: trip.shared_count ?? 0 })} />
</div>
<MTripBadges items={pluginBadges} />
@@ -299,7 +299,7 @@ export default function MJourneyDetail() {
if (failed.length > 0) {
toast.error(t('journey.editor.uploadPartialFailed', { failed: String(failed.length), total: String(normalized.length) }))
} else {
toast.success(t('journey.photosUploaded', { count: String(files.length) }))
toast.success(t('journey.photosUploaded', { count: files.length }))
}
loadJourney(Number(id))
} catch (err) {
@@ -95,7 +95,7 @@ export default function MBagsSheet({
<span className="font-geist text-[0.71875rem] text-m-faint">{formatWeight(unassignedWeight)}</span>
</div>
<div className="font-geist text-[0.65625rem] text-m-faint">
{unassigned.length} {t('admin.packingTemplates.items')}
{unassigned.length} {t('admin.packingTemplates.items', { count: unassigned.length })}
</div>
</div>
)}
@@ -307,7 +307,7 @@ function BagRow({ planner, bag, itemCount, weight, pct, tripMembers, canEdit, on
<div className="h-[7px] overflow-hidden rounded-full bg-[color:var(--m-ic)]">
<div className="h-full rounded-full" style={{ width: `${pct}%`, background: bag.color }} />
</div>
<div className="mt-[3px] font-geist text-[0.65625rem] text-m-faint">{itemCount} {t('admin.packingTemplates.items')}</div>
<div className="mt-[3px] font-geist text-[0.65625rem] text-m-faint">{itemCount} {t('admin.packingTemplates.items', { count: itemCount })}</div>
</div>
)
}
@@ -670,7 +670,7 @@ function ExpenseRow({ item, ctx, base, locale, t, canEdit, onEdit, onDelete, onT
className="inline-flex items-center gap-1 rounded-full border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] px-2 py-0.5 text-[0.625rem] font-semibold text-m-muted active:scale-95 transition-all"
>
<Receipt size={11} className="text-m-faint" />
<span>{t('costs.receipts') || 'Beleg'}{item.receipts!.length > 1 ? ` (${item.receipts!.length})` : ''}</span>
<span>{t('costs.receipts', { count: item.receipts!.length })}{item.receipts!.length > 1 ? ` (${item.receipts!.length})` : ''}</span>
</button>
)}
</div>
@@ -374,7 +374,7 @@ export default function MPackingListTab({ planner }: { planner: TripPlanner }) {
<Package size={14} strokeWidth={2} className="flex-none text-m-muted" />
<span className="min-w-0 flex-1">
<span className="block truncate text-[0.78125rem] font-semibold text-m-ink">{tmpl.name}</span>
<span className="block font-geist text-[0.625rem] text-m-faint">{tmpl.item_count} {t('admin.packingTemplates.items')}</span>
<span className="block font-geist text-[0.625rem] text-m-faint">{tmpl.item_count} {t('admin.packingTemplates.items', { count: tmpl.item_count })}</span>
</span>
</button>
))}