forcedotcom/sf-skills / plugins/builder/experience-react/skills/experience-ui-bundle-localize
experience-ui-bundle-localize
VerifiedMUST activate to localize / internationalize a uiBundles/*/src/ project (React or Angular): extract hardcoded user-facing strings into Custom Labels, wire a runtime i18n library over the Platform SDK backend, add labels for another language, or troubleshoot label rendering across locales. Triggers: user-facing string literals in component files, a CustomLabels.labels-meta.xml, a src/i18n/ directory or label-manifest.ts, translation call sites, or requests to 'translate / localize / internationalize / support another language.' Scope: authenticated B2E UI Bundles and B2C site bundles. Use experience-ui-bundle-site-generate instead for site language configuration or sfdc_cms__languageSettings. DO NOT TRIGGER for B2B site bundles, building app shell/UI or styling, reading/writing/refreshing records (use experience-ui-bundle-salesforce-data-access), generating a new bundle (use experience-ui-bundle-frontend-generate), deploying (use experience-ui-bundle-deploy), or authoring translations in Translation Workbench.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 22.9 KB |
| references/angular/check-i18n-wired.shexecutable | script | 8.9 KB |
| references/angular/i18n-setup.md | markdown | 10.2 KB |
| references/angular/interpolation.md | markdown | 6.0 KB |
| references/angular/localize.md | markdown | 5.4 KB |
| references/common/gotchas.md | markdown | 14.5 KB |
| references/common/label-xml.md | markdown | 11.9 KB |
| references/common/platform-sdk-i18n.md | markdown | 7.6 KB |
| references/common/verifying.md | markdown | 15.0 KB |
| references/react/check-i18n-wired.shexecutable | script | 11.5 KB |
| references/react/i18n-setup.md | markdown | 10.7 KB |
| references/react/interpolation.md | markdown | 10.2 KB |
| references/react/localize.md | markdown | 3.8 KB |
| scripts/check-manifest-registered.shexecutable | script | 8.2 KB |
| scripts/check-org-api-version.shexecutable | script | 2.1 KB |
| scripts/detect-bundle-type.shexecutable | script | 6.4 KB |
| scripts/detect-framework.shexecutable | script | 2.2 KB |
| scripts/tests/test-detect-bundle-type.shexecutable | script | 9.1 KB |
references/angular/localize.md
View on GitHub# Angular reference — Localize an Angular UI Bundle
Framework-specific companion to `SKILL.md` for the **Angular** path. `SKILL.md` owns the
neutral workflow + guardrail spine (Step 0 routing, preconditions, the five steps, and the
guardrails); this file owns everything Angular/ngx-translate-specific: the runtime library, the
call convention, the wiring shape, and the framework depth doc. The shared engine and the
framework-neutral depth docs live in [`../common/`](../common/).
## Library & call convention
An Angular UI Bundle can't use `@salesforce/label/*` the way LWC does — those imports resolve at
compile time inside the platform's compiler, which your standalone Angular bundle doesn't go
through. Instead the app **fetches labels at runtime** through the Salesforce GraphQL UI API and
hands them to **[ngx-translate](https://ngx-translate.org/)** (`@ngx-translate/core`) to render.
The engine that does the fetching is the same one React uses — see
[`../common/platform-sdk-i18n.md`](../common/platform-sdk-i18n.md). What's Angular-specific is
that ngx-translate loads translations through a **`TranslateLoader`**, so instead of React's
shipped `SalesforceBackend` you write a small custom loader that issues the same
`uiapi.platform.labels` GraphQL query.
```html
<!-- template: pipe form (most common) -->
<h1>{{ 'Welcome_Text' | translate }}</h1>
<!-- template: directive form -->
<h1 [translate]="'Welcome_Text'"></h1>
```
```typescript
// component/service: imperative form
constructor(private translate: TranslateService) {}
label = this.translate.instant("Welcome_Text"); // sync (translations already loaded)
this.translate.get("Welcome_Text").subscribe(v => …); // async Observable
```
- **Call sites:** the `translate` pipe / directive in templates, and
`TranslateService.instant / get / stream("Key")` in code. The key is the bare `<fullName>`
(the `c` namespace is the default).
- **Files scanned for user-facing strings / call sites:** `.html` (templates) and `.ts`
(inline templates + service calls).
- **To use `t`-style translation in a component:** import ngx-translate's `TranslatePipe` (and/or
`TranslateDirective`) into the standalone component's `imports`, and/or inject
`TranslateService`.
## Step 2 (Extract) — Angular specifics
Replace the template literal with the `translate` pipe and import `TranslatePipe` into the
component's `imports` array:
```html
<!-- Before: <h1>Welcome</h1> -->
<!-- After: <h1>{{ 'Welcome_Text' | translate }}</h1> -->
```
```typescript
import { TranslatePipe } from "@ngx-translate/core";
@Component({
selector: "app-welcome",
standalone: true,
imports: [TranslatePipe], // ← add
templateUrl: "./welcome.html",
})
export class Welcome {}
```
For strings built in TypeScript (dynamic messages, `aria-label` bindings), inject
`TranslateService` and call `instant(...)` / `get(...)`.
## Step 4 (Wire) — Angular specifics
Install ngx-translate (tell the user to run, from the UI bundle dir — pick a `@ngx-translate/core`
release compatible with the bundle's Angular version; the standalone `provideTranslateService`
API is v16+):
```bash
npm install @ngx-translate/core
```
Then scaffold the two files — the custom `SalesforceTranslateLoader` (`src/i18n/salesforce-translate-loader.ts`)
and the label manifest (`src/i18n/label-manifest.ts`) — register the loader via
`provideTranslateService(...)` in `src/app/app.config.ts`, and at boot fetch the i18n context and
call `TranslateService.use(lang)` before the app renders. Full loader code and the B2E vs B2C
configuration are in [i18n-setup.md](./i18n-setup.md).
## Scripts
Run them from the UI bundle dir (they scan `src/` relative to the current directory). The first
three are framework-neutral and live in the skill's shared `scripts/` folder; `check-i18n-wired.sh`
is Angular-specific (ngx-translate `provideTranslateService` / `TranslateLoader` detection) and
ships here in the Angular reference folder.
| Script | Purpose |
|--------|---------|
| [`check-org-api-version.sh`](../../scripts/check-org-api-version.sh) | Precondition 4 — org supports API v68.0+ |
| [`detect-bundle-type.sh`](../../scripts/detect-bundle-type.sh) | Precondition 5 — classify B2E / B2C / internal |
| [`check-manifest-registered.sh --framework angular`](../../scripts/check-manifest-registered.sh) | Step 3 — every `translate` key is registered in the manifest (`--framework angular` selects the `.html` pipe/directive + `.ts` service-call grammar) |
| [`check-i18n-wired.sh`](./check-i18n-wired.sh) | Step 4 — the loader + `provideTranslateService` are wired, called at boot, and the manifest reaches the loader |
## Depth docs
Framework-neutral (shared with React), in [`../common/`](../common/):
- [platform-sdk-i18n.md](../common/platform-sdk-i18n.md) — the shared runtime engine: the Labels GraphQL query, `fetchI18nContext`, the manifest format, batching, and fallback
- [label-xml.md](../common/label-xml.md) — Custom Labels and translation metadata XML shapes; the `namespace:Key` rules
- [verifying.md](../common/verifying.md) — serve URL, locale flip, and verifying labels render
- [gotchas.md](../common/gotchas.md) — the silent-fail traps: unregistered manifest keys, API-version bake-in, stale label cache
Angular-specific (this folder):
- [i18n-setup.md](./i18n-setup.md) — the two files you write: the custom `TranslateLoader` + the label manifest
- [interpolation.md](./interpolation.md) — positional `{0}/{1}` placeholder interpolation with ngx-translate
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |