Socket
Book a DemoInstallSign in
Socket

@laserfiche/lf-resource-library

Package Overview
Dependencies
Maintainers
0
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@laserfiche/lf-resource-library

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

5.0.1
latest
Source
npmnpm
Version published
Weekly downloads
14
-44%
Maintainers
0
Weekly downloads
 
Created
Source

Introduction

Contains resource files that can be used in conjunction with LfLocalizationService from @laserfiche/lf-js-utils.

Creating a new resource

  • Create a folder under resources (e.g. my-new-resources)
  • In that folder create a resource file for each supported language.
  • 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
  • Required/Default Language: en.json
    • If a resource key is not found in the selected language, the en string will be used.
  • 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

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:

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:

Example Usages:

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

[Example Usages]

 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.

Contribution

We welcome contributions and feedback. Please follow our contributing guidelines.

FAQs

Package last updated on 22 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.