Skip to content

Commit 8f120fa

Browse files
committed
fix(plugin-grid): the bulk confirm sentence formats in the display locale
BulkActionDialog reads useDisplayLocale(), the locale the console's action runners already install, and passes it through bulkConfirmText to fillTemplateHoles's locale parameter. The bulk confirm sentence's currency, number and date holes render in the viewer's locale instead of en-US. No second locale resolution: absent, the engine keeps en-US. Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup Co-authored-by: Claude <noreply@anthropic.com>
1 parent a70aa00 commit 8f120fa

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎ui/packages/plugin-grid/src/components/BulkActionDialog.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
} from '@object-ui/components';
2222
import { AlertTriangle, CheckCircle2, Loader2, XCircle } from 'lucide-react';
2323
import { useObjectTranslation } from '@object-ui/react';
24+
import { useDisplayLocale } from '@object-ui/i18n';
2425
import { getLazyFieldWidget } from '@object-ui/fields';
2526
// The two shared allow-tables of widgets that are fed the dialog's own
2627
// in-progress values as their record — one definition each for this dialog, the
@@ -160,6 +161,10 @@ export const BulkActionDialog: React.FC<BulkActionDialogProps> = ({
160161
skippedCount = 0,
161162
}) => {
162163
const { t } = useObjectTranslation();
164+
// The viewer's display locale, the one every date, number and currency
165+
// renderer and the console's action runners read: the confirm sentence's
166+
// formatters render in it (objectstack#26307). ⛔ No second resolution.
167+
const displayLocale = useDisplayLocale();
163168
const params = def?.params ?? [];
164169

165170
// Effective multi-value semantics for an `update` param: an explicit
@@ -410,7 +415,7 @@ export const BulkActionDialog: React.FC<BulkActionDialogProps> = ({
410415
</DialogTitle>
411416
{step === 'confirm' && (
412417
<DialogDescription>
413-
{bulkConfirmText(def.confirmText, { count: rows.length, params, values, lookupLabels }) ?? t('grid.bulk.confirmDefault', { count: rows.length, defaultValue: `This will apply to ${rows.length} record(s).` })}
418+
{bulkConfirmText(def.confirmText, { count: rows.length, params, values, lookupLabels }, displayLocale) ?? t('grid.bulk.confirmDefault', { count: rows.length, defaultValue: `This will apply to ${rows.length} record(s).` })}
414419
</DialogDescription>
415420
)}
416421
</DialogHeader>

‎ui/packages/plugin-grid/src/components/bulkConfirmText.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,20 @@ export function bulkConfirmTemplateScope(scope: BulkConfirmScope): Record<string
125125
* notifications and the single-record `confirmText` render with, so the
126126
* engine's whitelisted formatters apply (`{{ count | number }}`) and no hole
127127
* holds logic. A sentence without a `{{ }}` hole is shown as written.
128+
*
129+
* `locale` is the viewer's display locale, the BCP-47 tag the dialog reads
130+
* from `useDisplayLocale()`; the formatters (`currency`, `number`, `date`)
131+
* render in it (objectstack#26307). It goes to `fillTemplateHoles`'s own
132+
* locale channel, apart from the roots, so a param named `locale` stays a
133+
* value the sentence prints. ⛔ No second resolution of it here: absent, the
134+
* engine formats in `en-US`.
128135
*/
129136
export function bulkConfirmText(
130137
confirmText: BulkActionDef['confirmText'] | null | undefined,
131138
scope: BulkConfirmScope,
139+
locale?: string,
132140
): string | undefined {
133141
const source = bulkConfirmTextSource(confirmText);
134142
if (source === undefined || !hasTemplateHoles(source)) return source;
135-
return fillTemplateHoles(source, bulkConfirmTemplateScope(scope));
143+
return fillTemplateHoles(source, bulkConfirmTemplateScope(scope), locale);
136144
}

0 commit comments

Comments
 (0)