Gathering detailed insights and metrics for @sandhose/i18next-fs-backend
NPM was acquired by GitHub in March 2020.
Gathering detailed insights and metrics for @sandhose/i18next-fs-backend
NPM was acquired by GitHub in March 2020.
npm install @sandhose/i18next-fs-backend
70.2
Supply Chain
98.3
Quality
75
Maintenance
100
Vulnerability
100
License
99 Stars
134 Commits
18 Forks
5 Watching
1 Branches
10 Contributors
Updated on 21 Nov 2024
JavaScript (98.82%)
Pug (1.07%)
TypeScript (0.11%)
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
100%
2
Compared to previous week
Last month
-81%
11
Compared to previous month
Last year
427%
606
Compared to previous year
This is an i18next backend to be used in Node.js and Deno. It will load resources from the file system.
It's based on the deprecated i18next-node-fs-backend and can mostly be used as a drop-in replacement.
It will load resources from filesystem. Right now it supports following filetypes:
exports
or export default
)1# npm package 2$ npm install i18next-fs-backend
Wiring up:
1import i18next from 'i18next'; 2import Backend from 'i18next-fs-backend'; 3 4i18next.use(Backend).init(i18nextOptions);
for Deno:
1import i18next from 'https://deno.land/x/i18next/index.js' 2import Backend from 'https://deno.land/x/i18next_fs_backend/index.js' 3 4i18next.use(Backend).init(i18nextOptions);
1{ 2 // path where resources get loaded from, or a function 3 // returning a path: 4 // function(lngs, namespaces) { return customPath; } 5 // the returned path will interpolate lng, ns if provided like giving a static path 6 loadPath: '/locales/{{lng}}/{{ns}}.json', 7 8 // path to post missing resources 9 addPath: '/locales/{{lng}}/{{ns}}.missing.json', 10 11 // if you use i18next-fs-backend as caching layer in combination with i18next-chained-backend, you can optionally set an expiration time 12 // an example on how to use it as cache layer can be found here: https://github.com/i18next/i18next-fs-backend/blob/master/example/caching/app.js 13 // expirationTime: 60 * 60 * 1000 14}
Options can be passed in:
preferred - by setting options.backend in i18next.init:
1import i18next from 'i18next'; 2import Backend from 'i18next-fs-backend'; 3 4i18next.use(Backend).init({ 5 backend: options, 6});
on construction:
1import Backend from 'i18next-fs-backend'; 2const Backend = new Backend(null, options);
via calling init:
1import Backend from 'i18next-fs-backend'; 2const Backend = new Backend(); 3Backend.init(null, options);
To properly type the backend options, you can import the FsBackendOptions
interface and use it as a generic type parameter to the i18next's init
method, e.g.:
1import i18n from 'i18next' 2import FsBackend, { FsBackendOptions } from 'i18next-fs-backend' 3 4i18n 5 .use(FsBackend) 6 .init<FsBackendOptions>({ 7 backend: { 8 // fs backend options 9 }, 10 11 // other i18next options 12 })
1// i18n.js 2const { join } = require('path') 3const { readdirSync, lstatSync } = require('fs') 4const i18next = require('i18next') 5const Backend = require('i18next-fs-backend') 6i18next 7 .use(Backend) 8 .init({ 9 // debug: true, 10 initImmediate: false, 11 fallbackLng: 'en', 12 lng: 'en', 13 preload: readdirSync(join(__dirname, '../locales')).filter((fileName) => { 14 const joinedPath = join(join(__dirname, '../locales'), fileName) 15 const isDirectory = lstatSync(joinedPath).isDirectory() 16 return isDirectory 17 }), 18 ns: 'backend-app', 19 defaultNS: 'backend-app', 20 backend: { 21 loadPath: join(__dirname, '../locales/{{lng}}/{{ns}}.json') 22 } 23 })
No vulnerabilities found.
Reason
12 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/23 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
branch protection not enabled on development/release branches
Details
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More