mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 08:53:13 +00:00
fix(i18n): every count-bearing string is a plural group
The plural parity check only knows the groups en already declares, so a
"{count} ..." string added as a plain key kept one form in every
language: Polish read "Usuń 1 spakowanych", Czech "Odstranit 1
hotových" and Greek "1 λεπτά". 44 such en keys become plural groups with their
forms in all 27 locales: the collection, packing, day plan and offline
banner counts, the relative times, the audit log, the tour and transit
minutes, the share and photo hints. Labels like "Notes: {count}" get
their forms too, so a language can still inflect them later. The
dashboard's hand-rolled activeOne/activeMany pair, unused, becomes one
group, dashboard.subtitle.active.
i18n-parity now refuses an en string with {count} or {n} that is no
plural group. NOT_PLURAL lists the eleven where the number is never a
quantity (a day number, a step, a waypoint, the equator multiplier),
each with its reason, and an entry that stops matching fails as well.
Callers that worked around the engine:
- Copy to trip switched between two keys on placeIds.length > 1;
collections.copyN now carries the one-place wording as its `one` form,
where the language's `one` is the number 1 alone.
- The plugin dependency toasts said "addon(s)" and "plugin(s)"; they are
groups now and the panels pass the list length as the count.
- The dismissed suggestions count went in as a string and the comp days
as a formatted string, so no form was picked; both pass numbers.
This commit is contained in:
@@ -924,7 +924,7 @@ describe('AdminPluginsPanel — enabling a plugin', () => {
|
||||
fireEvent.click(rowToggle('Gotify'))
|
||||
|
||||
expect(await screen.findByText('Plugin activated')).toBeInTheDocument()
|
||||
expect(await screen.findByText(/enabled required plugin\(s\) first: core/i)).toBeInTheDocument()
|
||||
expect(await screen.findByText(/enabled the required plugin first: core/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-023: a disabled required addon is reported as a toast, not a dialog', async () => {
|
||||
@@ -936,7 +936,7 @@ describe('AdminPluginsPanel — enabling a plugin', () => {
|
||||
|
||||
fireEvent.click(rowToggle('Gotify'))
|
||||
|
||||
expect(await screen.findByText(/enable the required addon\(s\) first: journey/i)).toBeInTheDocument()
|
||||
expect(await screen.findByText(/enable the required addon first: journey/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-024: any other activation failure surfaces the server message', async () => {
|
||||
@@ -984,7 +984,7 @@ describe('AdminPluginsPanel — enabling a plugin', () => {
|
||||
|
||||
expect(await screen.findByText('Downloaded trek-core')).toBeInTheDocument()
|
||||
expect(installed).toEqual({ id: 'trek-core', constraint: '^1.0.0', withDependencies: true })
|
||||
expect(await screen.findByText(/enable the required addon\(s\) first: journey/i)).toBeInTheDocument()
|
||||
expect(await screen.findByText(/enable the required addon first: journey/i)).toBeInTheDocument()
|
||||
await waitFor(() => expect(screen.queryByText('Missing dependencies')).not.toBeInTheDocument())
|
||||
})
|
||||
|
||||
|
||||
@@ -647,7 +647,7 @@ export default function AdminPluginsPanel() {
|
||||
if (e?.response?.status === 409 && d?.code === 'CONSENT_REQUIRED') {
|
||||
setConsentQueue(qq => [...qq, { plugin: p, version: latest[p.id] ?? p.version ?? '', newPermissions: d.newPermissions ?? [], newEgress: d.newEgress ?? [] }])
|
||||
} else if (e?.response?.status === 409 && d?.code === 'ADDON_DISABLED') {
|
||||
toast.error(t('admin.plugins.dep.addonDisabledToast', { addons: (d.addons ?? []).join(', ') }))
|
||||
toast.error(t('admin.plugins.dep.addonDisabledToast', { count: (d.addons ?? []).length, addons: (d.addons ?? []).join(', ') }))
|
||||
} else if (e?.response?.status === 409 && d?.code === 'DEPENDENCY_MISSING') {
|
||||
setDepResolve({ plugin: p, missing: d.missing ?? [], versionMismatch: d.versionMismatch ?? [] })
|
||||
} else {
|
||||
@@ -661,7 +661,7 @@ export default function AdminPluginsPanel() {
|
||||
return adminApi.pluginActivate(p.id)
|
||||
.then(() => {
|
||||
toast.success(t('admin.plugins.activated'))
|
||||
if (cascaded.length) toast.success(t('admin.plugins.dep.autoEnabled', { plugins: cascaded.join(', ') }))
|
||||
if (cascaded.length) toast.success(t('admin.plugins.dep.autoEnabled', { count: cascaded.length, plugins: cascaded.join(', ') }))
|
||||
setDepResolve(null)
|
||||
})
|
||||
.catch((e: ActivateErr) => onActivateError(p, e))
|
||||
@@ -686,7 +686,7 @@ export default function AdminPluginsPanel() {
|
||||
adminApi.pluginInstall(depId, { constraint, withDependencies: true })
|
||||
.then((r: { installed?: string[]; requiredAddons?: string[]; trekRangeBypassed?: TrekRangeBypass | null }) => {
|
||||
toast.success(t('admin.plugins.dep.downloaded', { id: depId }))
|
||||
if (r?.requiredAddons?.length) toast.error(t('admin.plugins.dep.addonDisabledToast', { addons: r.requiredAddons.join(', ') }))
|
||||
if (r?.requiredAddons?.length) toast.error(t('admin.plugins.dep.addonDisabledToast', { count: r.requiredAddons.length, addons: r.requiredAddons.join(', ') }))
|
||||
bypass.notice(depId, r?.trekRangeBypassed)
|
||||
return attemptActivate(parent)
|
||||
})
|
||||
|
||||
@@ -104,7 +104,7 @@ export default function CopyToTripModal({ isOpen, onClose, placeIds, onCopy, t }
|
||||
tint={NEUTRAL_TINT}
|
||||
labelId={labelId}
|
||||
onClose={onClose}
|
||||
title={placeIds.length > 1 ? t('collections.copyN', { count: placeIds.length }) : t('collections.copyToTripTitle')}
|
||||
title={t('collections.copyN', { count: placeIds.length })}
|
||||
/>
|
||||
)}
|
||||
footer={(
|
||||
|
||||
@@ -366,7 +366,7 @@ export function JourneySettingsDialog({ journey, onClose, onSaved, onOpenInvite,
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block text-content" style={fs(13, 'body')}>{t('journey.suggestions.restore')}</span>
|
||||
<span className="block text-content-faint" style={fs(11.5)}>
|
||||
{t('journey.suggestions.restoreCount', { count: String(journey.dismissed_count) })}
|
||||
{t('journey.suggestions.restoreCount', { count: journey.dismissed_count ?? 0 })}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
@@ -203,7 +203,7 @@ function StatCard({ stat: s, isMe, canEdit, selectedYear, isShiftedYear, onSave,
|
||||
{compUsed > 0 && (
|
||||
<div className="flex items-center gap-1.5 px-2 py-1 rounded-md" style={{ background: 'var(--vg-surf2)', border: '1px solid var(--vg-line)' }}>
|
||||
<Clock size={9} style={{ color: 'var(--vg-ink3)' }} />
|
||||
<span className="text-[10px]" style={{ color: 'var(--vg-ink2)' }}>{t('vacay.compUsedCount', { count: fmtDays(compUsed) })}</span>
|
||||
<span className="text-[10px]" style={{ color: 'var(--vg-ink2)' }}>{t('vacay.compUsedCount', { count: Number(fmtDays(compUsed)) })}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user