@laserfiche/lf-resource-library
Advanced tools
Comparing version
{ | ||
"name": "@laserfiche/lf-resource-library", | ||
"version": "1.0.0--preview-2042216176", | ||
"version": "1.0.0--preview-2061241180", | ||
"description": "a library containing resource files that can be used in conjunction with LfLocalizationService from `@laserfiche/lf-js-utils`", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -15,3 +15,40 @@ # Introduction | ||
# 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/resource-manager` provides language resources files in JSON that can be utlized by LfLocalizationService. | ||
**Install @laserfiche/lf-js-utils:** | ||
``` | ||
npm install @laserfiche/lf-js-utils | ||
``` | ||
**Import LfLocalizationService:** | ||
``` | ||
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'); | ||
await localizationService.initResourcesFromUrlAsync('https://cdn.jsdelivr.net/npm/@laserfiche/lf-resource-library@1.0.0/resources/laserfiche-base'); | ||
let loading = localizationService.getString('LOADING'); // loading -> 'Cargando...' | ||
``` | ||
# [Icons](https://github.com/Laserfiche/lf-resource-library/blob/main/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@1.0.0/resources/icons/document-icons.svg#${iconId}`; | ||
} | ||
``` | ||
# Contribution | ||
We welcome contributions and feedback. Please follow our [contributing guidelines](https://github.com/Laserfiche/lf-resource-library/blob/main/CONTRIBUTING.md). |
@@ -12,3 +12,2 @@ { | ||
"CLOSE": "Close", | ||
"DEFAULT" : "Default", | ||
"EMPTY_FILE_EXPLORER": "This folder is empty.", | ||
@@ -65,2 +64,2 @@ "FIELD_NOT_DATE": "Date fields must be in the format ${0}.", | ||
"YES": "Yes" | ||
} | ||
} |
47224
3.4%54
217.65%558
-0.36%