# @laserfiche/lf-resource-library

> a library containing resource files that can be used in conjunction with LfLocalizationService from `@laserfiche/lf-js-utils`

Latest version **5.0.3** (published 2025-10-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @laserfiche/lf-resource-library
pnpm add @laserfiche/lf-resource-library
yarn add @laserfiche/lf-resource-library
bun add @laserfiche/lf-resource-library
```

## Health

**Score 35/100 (D)** — status: stable.

Positive: no vulnerabilities.

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

Negative: stale.

## Facts

| | |
|---|---|
| Version | 5.0.3 |
| Published | 2025-10-21 |
| First published | 2022-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 449.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | lfits, alexgomezlf, lf-ke-jin, paolo.laserfiche, bzajzon-laserfiche |

## Links

- npm: https://www.npmjs.com/package/@laserfiche/lf-resource-library
- Repository: https://github.com/Laserfiche/lf-resource-library
- Homepage: https://github.com/Laserfiche/lf-resource-library#readme
- Issues: https://github.com/Laserfiche/lf-resource-library/issues
- npm.io page: https://npm.io/package/@laserfiche/lf-resource-library

## Recent versions

- 5.0.3 (latest) — 2025-10-21
- 5.0.3--preview-20087675986 (next) — 2025-12-10
- 5.0.3--preview-20081622648 — 2025-12-09
- 5.0.2 — 2025-10-06
- 5.0.2--preview-18208992384 — 2025-10-03
- 5.0.2--preview-17843203499 — 2025-09-18
- 5.0.1--preview-17841861523 — 2025-09-18
- 5.0.1--preview-17840713220 — 2025-09-18
- 5.0.1 — 2024-11-22
- 5.0.1--preview-11980991387 — 2024-11-22
- 5.0.1--preview-11959933322 — 2024-11-21
- 5.0.0 — 2023-06-14
- 4.0.7--preview-5259062684 — 2023-06-13
- 4.0.6 — 2023-04-14
- 4.0.6--preview-4641848342 — 2023-04-07
- … 28 more at https://npm.io/package/@laserfiche/lf-resource-library/versions

## README

# Introduction

Contains resource files that can be used in conjunction with LfLocalizationService from [`@laserfiche/lf-js-utils`](https://github.com/Laserfiche/lf-js-utils).

## Creating a new resource

1. Create a folder under resources (e.g. my-new-resources)
2. In that folder create a resource file for each supported language.
3. The file name should be in the format languagecode2-country/regioncode2. languagecode2 is a lowercase two-letter code derived from ISO 639-1. country/regioncode2 is derived from ISO 3166 and usually consists of two uppercase letters, or a BCP-47 language tag. codes. The file should have an extension of .json
   - en-US.json
   - zh-Hans.json
4. Required/Default Language: en.json
   - If a resource key is not found in the selected language, the en string will be used.
5. Optional Language: For Laserfiche, we recommend providing resources for at least: ar-EG, en-US, en-GB, es-MX, fr-CA, fr-FR, pt-BR, zh-Hans, zh-Hant

## Documentation

### With LfLocalizationService from [`@laserfiche/lf-js-utils`](https://github.com/Laserfiche/lf-js-utils)

`LfLocalizationService` is a service that handles internationalization and localization, mapping text to its corresponding translated texts in the selected language. `@laserfiche/lf-resource-library` provides language resources files in JSON that can be utilized by LfLocalizationService.

**Install @laserfiche/lf-js-utils:**

```ts
npm install  @laserfiche/lf-js-utils
```

**Import LfLocalizationService:**

```ts
import { LfLocalizationService } from "@laserfiche/lf-js-utils";
```

**In node, import any fetch polyfill which suits your requirements:**
examples:

- [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch)
- [cross-fetch](https://www.npmjs.com/package/cross-fetch)
- [whatwg-fetch](https://www.npmjs.com/package/whatwg-fetch)

**Example Usages**:

```ts
let localizationService = new LfLocalizationService();
localizationService.setLanguage('es-MX');
await localizationService.initResourcesFromUrlAsync('https://cdn.jsdelivr.net/npm/@laserfiche/lf-resource-library@5/resources/laserfiche-base');
let loading =  localizationService.getString('LOADING'); // loading -> 'Cargando...'
```

## [Icons](https://github.com/Laserfiche/lf-resource-library/blob/HEAD/resources/icons/document-icons-documentation.md)

[**Example Usages**]

```ts
 export function getDocumentIconUrlFromIconId(iconId: string): string {
    return `https://cdn.jsdelivr.net/npm/@laserfiche/lf-resource-library@5/resources/icons/document-icons.svg#${iconId}`;
}
```

## Change Log

See CHANGELOG [here](https://github.com/Laserfiche/lf-resource-library/blob/HEAD/CHANGELOG.md).

## Contribution

We welcome contributions and feedback. Please follow our [contributing guidelines](https://github.com/Laserfiche/lf-resource-library/blob/HEAD/CONTRIBUTING.md).

---
_Source: https://npm.io/package/@laserfiche/lf-resource-library · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
