SuperAPI AI 工具集

experience-ui-bundle-localize

前端与建站

查看项目

更新于 10-15 21:43

技能介绍

用途:把 UI Bundle(React 或 Angular)中的用户可见硬编码字符串抽取为 Salesforce Custom Labels,并在运行时通过 Platform SDK 接入标准 i18n 库,实现本地化/国际化。

主要能力:扫描组件文件中的用户可见字符串(含 aria-label、alt 等无障碍文本),生成 Custom Label 元数据并替换为翻译调用;把键注册到 src/i18n/label-manifest.ts;检查并搭建 i18n 接线;引导跨语言验证。UI Bundle 无法像 LWC 那样使用编译期标签导入,需在运行时经 Salesforce GraphQL UI API 获取标签。

使用方式:先确定框架(可由上下文指定,或用 bash "<SKILL_DIR>/scripts/detect-framework.sh" "<app-or-uiBundle-root>" 检测),再按 references/<framework>/localize.md 执行五步:检测、抽取、注册、接线、验证。注册检查用 bash <SKILL_DIR>/scripts/check-manifest-registered.sh --framework <framework>;接线检查用 bash <SKILL_DIR>/references/<framework>/check-i18n-wired.sh。

前置条件:项目须为 uiBundles/*/src/;Platform SDK 等依赖需 ≥11.49.3;目标组织须支持 API v68.0+(Release 264),可用 bash <SKILL_DIR>/scripts/check-org-api-version.sh <org-alias-or-username> 检查;须为 B2E 或明确 B2C(非 B2B),B2C 还需管理员已启用 GraphQLApiOrgPrefForGuestUsers。

限制:不支持 React/Angular 之外的框架;B2B 或类型不明时须停止;B2C 接线需覆盖 labelFallback、显示语言与方向;不得擅自启用组织偏好。其余细节暂未提供。