@vectoriox/iox-ui 5.190.0 → 5.191.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1197,6 +1197,11 @@ const FORM_WORDS = /* @__PURE__ */ Object.freeze({
1197
1197
  email: 'Email us',
1198
1198
  link: 'Book online',
1199
1199
  },
1200
+ announce: {
1201
+ failed: 'That did not send.',
1202
+ oneField: '1 field needs attention.',
1203
+ fields: '{count} fields need attention.',
1204
+ },
1200
1205
  },
1201
1206
  he: {
1202
1207
  field: 'שם השדה',
@@ -1219,6 +1224,11 @@ const FORM_WORDS = /* @__PURE__ */ Object.freeze({
1219
1224
  email: 'כתבו לנו',
1220
1225
  link: 'הזמנה אונליין',
1221
1226
  },
1227
+ announce: {
1228
+ failed: 'השליחה לא הצליחה.',
1229
+ oneField: 'שדה אחד דורש תשומת לב.',
1230
+ fields: '{count} שדות דורשים תשומת לב.',
1231
+ },
1222
1232
  },
1223
1233
  });
1224
1234
  /** The language a form speaks for a `lang` attribute or site locale: design-core's subtag (`he-IL` → `he`), the old
@@ -1314,12 +1324,17 @@ function submitOutcome(response, afterSend = FormAfterSend.Message) {
1314
1324
  return { state: FormRenderState.Idle, errors: response.errors, reset: false };
1315
1325
  return { state: FormRenderState.Error, reset: false };
1316
1326
  }
1317
- /** What the live region says after a refused submit: how many fields need attention, or that it did not send. */
1318
- function failureAnnouncement(errors) {
1327
+ /**
1328
+ * What the live region says after a refused submit: how many fields need attention, or that it did not send — in the
1329
+ * page's language (iox-ui#161: a Hebrew visitor heard English at the moment something went wrong). The words are
1330
+ * forms-core's ONE form words table; English for a language it does not hold.
1331
+ */
1332
+ function failureAnnouncement(errors, lang) {
1319
1333
  const count = errors ? Object.keys(errors).length : 0;
1334
+ const words = formWords(lang).announce;
1320
1335
  if (!count)
1321
- return 'That did not send.';
1322
- return `${count} ${count === 1 ? 'field needs' : 'fields need'} attention.`;
1336
+ return words.failed;
1337
+ return count === 1 ? words.oneField : words.fields.replace('{count}', String(count));
1323
1338
  }
1324
1339
  const FORM_FIELDS_ATTRIBUTE = 'data-iox-form-fields';
1325
1340
  function clientFormSpec(spec) {
@@ -1568,7 +1583,7 @@ const FORM_PRESET_WORDS_HE = /* @__PURE__ */ Object.freeze({
1568
1583
  });
1569
1584
  /** A preset in a language: Hebrew when `lang` is, else the preset as it is. Fresh objects; the shape never changes. */
1570
1585
  function formPresetIn(def, lang) {
1571
- const he = (lang ?? '').toLowerCase().startsWith('he') ? FORM_PRESET_WORDS_HE[def.id] : undefined;
1586
+ const he = formLanguageOf(lang) === FormWordsLanguage.He ? FORM_PRESET_WORDS_HE[def.id] : undefined;
1572
1587
  if (!he)
1573
1588
  return def;
1574
1589
  return {