@open-slot-ui/core 0.5.0 → 0.5.1

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.
package/dist/index.cjs CHANGED
@@ -2253,15 +2253,18 @@ function collectSocialCopy(spec) {
2253
2253
  if (spec.game?.name) out.push({ source: "game.name", text: spec.game.name });
2254
2254
  const en = spec.locale?.messages?.en;
2255
2255
  if (en) {
2256
- for (const [k, v] of Object.entries(en)) if (typeof v === "string") out.push({ source: `locale.en[${JSON.stringify(k)}]`, text: v });
2256
+ for (const [k, v] of Object.entries(en)) if (typeof v === "string") out.push({ source: `locale.en[${JSON.stringify(k)}]`, text: v, key: k });
2257
2257
  }
2258
2258
  return out;
2259
2259
  }
2260
2260
  function checkSocialPhrases(spec) {
2261
+ const socialEn = spec.locale?.socialMessages?.en ?? {};
2262
+ const render = (e) => socialEn[e.key ?? e.text] ?? openuiSocialDefaults[e.key ?? e.text] ?? e.text;
2261
2263
  const issues = [];
2262
- for (const { source, text } of collectSocialCopy(spec)) {
2264
+ for (const e of collectSocialCopy(spec)) {
2265
+ const text = render(e);
2263
2266
  const matches = findForbiddenPhrases(text);
2264
- if (matches.length) issues.push({ source, text, matches });
2267
+ if (matches.length) issues.push({ source: e.source, text, matches });
2265
2268
  }
2266
2269
  return issues;
2267
2270
  }