# lang This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`. ## `lang.create` *Source: `src/store/lang/create.js`* Creates a new language by its ISO 639 code. **Parameters** | Name | Type | Description | | --- | --- | --- | | `iso639` | `string` | The ISO 639 language code (e.g. `'de'`). | | `[tx]` | `object` | Optional transaction to run within. | **Returns** `Promise` — The id of the created language. **Example** ```js const id = await store.lang.create('de'); // => 1 ``` ## `lang.delete` *Source: `src/store/lang/delete.js`* Deletes a language by its id. **Parameters** | Name | Type | Description | | --- | --- | --- | | `id` | `number` | The id of the language to delete. | **Returns** `Promise` **Example** ```js await store.lang.delete(1); ``` ## `lang.ensure` *Source: `src/store/lang/ensure.js`* Returns the id of a language by ISO code, creating it if it does not exist. **Parameters** | Name | Type | Description | | --- | --- | --- | | `iso639` | `string` | The ISO 639 language code (e.g. `'de'`). | | `[tx]` | `object` | Optional transaction to run within. | **Returns** `Promise` — The id of the language. **Example** ```js const id = await store.lang.ensure('de'); // => 1 ``` ## `lang.getByIso639` *Source: `src/store/lang/getByIso639.js`* Returns a language row by its ISO 639 code. **Parameters** | Name | Type | Description | | --- | --- | --- | | `iso639` | `string` | The ISO 639 language code (e.g. `'de'`). | | `[tx]` | `object` | Optional transaction to run within. | **Returns** `Promise<{id: number, iso639: string}>` — The language row, or `undefined` if not found. **Example** ```js const lang = await store.lang.getByIso639('de'); // => { id: 1, iso639: 'de' } ``` ## `lang.list` *Source: `src/store/lang/list.js`* Lists all languages. **Returns** `Promise>` — All language rows. **Example** ```js const languages = await store.lang.list(); // => [{ id: 1, iso639: 'de' }] ```