Skip to content

Commit a591cbe

Browse files
committed
feat: add sdk.languages skill
1 parent 54d623d commit a591cbe

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

skills/user-skills/webiny-sdk/SKILL.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: >
66
Use this skill when the developer is building a Next.js, Vue, Node.js, or any external app
77
that needs to fetch or write content to Webiny, set up the SDK, use the Result pattern,
88
list/get/create/update/publish entries, filter and sort queries, use TypeScript generics
9-
for type safety, work with the File Manager, or create API keys programmatically.
9+
for type safety, work with the File Manager, list languages, or create API keys programmatically.
1010
Covers read vs preview mode, the `values` wrapper requirement, correct method names,
1111
and the `fields` required parameter.
1212
---
@@ -271,6 +271,33 @@ await webiny.cms.deleteEntryRevision({
271271
});
272272
```
273273

274+
## Languages
275+
276+
`webiny.languages.listLanguages()` returns all **enabled** languages — disabled languages are always filtered out server-side, so no filter parameter is needed.
277+
278+
```typescript
279+
import type { Language } from "@webiny/sdk";
280+
281+
const result = await webiny.languages.listLanguages();
282+
283+
if (result.isOk()) {
284+
const languages: Language[] = result.value;
285+
// languages[0].code, .name, .direction, .isDefault
286+
}
287+
```
288+
289+
The `Language` type:
290+
291+
```typescript
292+
interface Language {
293+
id: string;
294+
code: string; // e.g. "en-US"
295+
name: string; // e.g. "English (US)"
296+
direction?: "ltr" | "rtl";
297+
isDefault?: boolean;
298+
}
299+
```
300+
274301
## File Manager
275302

276303
```typescript
@@ -324,6 +351,7 @@ Register (**YOU MUST include the `.ts` file extension in the `src` prop** — om
324351
| `webiny.cms` | Headless CMS | List, get, create, update, publish, unpublish, delete entry revisions |
325352
| `webiny.fileManager` | File Manager | List, upload, and manage files and folders |
326353
| `webiny.tenantManager` | Multi-tenancy | Create, install, enable, disable tenants |
354+
| `webiny.languages` | Languages | List enabled languages (id, code, name, direction, isDefault) |
327355

328356
## Common Mistakes
329357

0 commit comments

Comments
 (0)