# @sap-ux/i18n

> Library for i18n

Latest version **1.0.5** (published 2026-10-06) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @sap-ux/i18n
pnpm add @sap-ux/i18n
yarn add @sap-ux/i18n
bun add @sap-ux/i18n
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2026-10-06 |
| First published | 2024-02-15 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 158 |
| Maintainers | tqueck, kranthie.sap, sap_extncrepos, sap-ospo-admin, devinea |

## Links

- npm: https://www.npmjs.com/package/@sap-ux/i18n
- Repository: https://github.com/SAP/open-ux-tools
- Issues: https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Ai18n
- npm.io page: https://npm.io/package/@sap-ux/i18n

## Recent versions

- 1.0.5 (latest) — 2026-10-06
- 1.0.4 — 2026-09-22
- 1.0.3 — 2026-08-25
- 1.0.2 — 2026-07-03
- 1.0.1 — 2026-06-04
- 1.0.0 — 2026-05-30
- 0.4.0 — 2026-05-15
- 0.3.11 — 2026-04-30
- 0.3.10 — 2026-03-26
- 0.3.9 — 2026-02-23
- 0.3.7 — 2025-12-18
- 0.3.6 — 2025-12-15
- 0.3.5 — 2025-11-05
- 0.3.4 — 2025-10-07
- 0.3.3 — 2025-08-13
- … 15 more at https://npm.io/package/@sap-ux/i18n/versions

## README

[![Changelog](https://img.shields.io/badge/changelog-8A2BE2)](https://github.com/SAP/open-ux-tools/blob/main/packages/i18n/CHANGELOG.md) [![Github repo](https://img.shields.io/badge/github-repo-blue)](https://github.com/SAP/open-ux-tools/tree/main/packages/i18n)

# [`@sap-ux/i18n`](https://github.com/SAP/open-ux-tools/tree/main/packages/i18n)

Package containing low level APIs and utility functions for working with i18n of a project. For more convenient high level APIs on i18n, check [`@sap-ux/project-access`](../project-access)


## Installation
Npm
`npm install --save @sap-ux/i18n`

Yarn
`yarn add @sap-ux/i18n`

Pnpm
`pnpm add @sap-ux/i18n`

## Usage

### Read i18n bundle from a CAP project

```typescript
import { getCapI18nBundle } from '@sap-ux/i18n';
import { join } from 'path';

/**
 * Sample CDS environment
 **/
const env = Object.freeze({
    i18n: {
        folders: ['_i18n', 'i18n', 'assets/i18n'],
        default_language: 'en'
    }
});
const PROJECT_ROOT = 'absolute/path/to/project';
const filePaths = [join(PROJECT_ROOT, 'srv', 'service.cds')];
const bundle = await getCapI18nBundle(PROJECT_ROOT, env, filePaths);
```
For detailed example usage check unit test of [`getCapI18nBundle`](./test/unit/read/cap/bundle.test.ts)


### Read i18n properties file of a project

```typescript
import { getPropertiesI18nBundle } from '@sap-ux/i18n';
import { join } from 'path';
import { getWebappPath } from '@sap-ux/project-access';

const PROJECT_ROOT = 'absolute/path/to/project';
const i18nFilePath = join(await getWebappPath(PROJECT_ROOT), 'i18n', 'i18n.properties');
const bundle = await getPropertiesI18nBundle(i18nFilePath);

```
For detailed example usage check unit test of [`getPropertiesI18nBundle`](./test/unit/read/properties/bundle.test.ts)

### Write to i18n file of a CAP project

```typescript
import { createCapI18nEntries } from '@sap-ux/i18n';
import { join } from 'path';

const newEntries = [
    {
        key: 'NewKey',
        value: 'New Value'
    }
];
/**
 * Sample CDS environment
 **/
const env = Object.freeze({
    i18n: {
        folders: ['_i18n', 'i18n', 'assets/i18n'],
        default_language: 'en'
    }
});
const PROJECT_ROOT = 'absolute/path/to/project';
const cdsFilePath = join(PROJECT_ROOT, 'src', 'service.cds')
const result = await createCapI18nEntries(PROJECT_ROOT, cdsFilePath, newEntries, env);
```
For detailed example usage check unit test of [`createCapI18nEntries`](./test/unit/write/cap/create.test.ts)

### Write to i18n properties file of a project

```typescript
import { createPropertiesI18nEntries } from '@sap-ux/i18n';
import { join } from 'path';
import { getWebappPath } from '@sap-ux/project-access';

const newEntries = [
    {
        key: 'NewKey',
        value: 'New Value'
    }
];
const PROJECT_ROOT = 'absolute/path/to/project';
const i18nFilePath = join(getWebappPath(PROJECT_ROOT), 'i18n', 'i18n.properties');

const result = await createPropertiesI18nEntries(i18nFilePath, newEntries, PROJECT_ROOT);
```
For detailed example usage check unit test of [`createPropertiesI18nEntries`](./test/unit/write/properties/create.test.ts)


For more available APIs, check in [`/src/index`](./src/index.ts)


## Keywords
i18n
CAP i18n
UI5 i18n

---
_Source: https://npm.io/package/@sap-ux/i18n · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
