Gathering detailed insights and metrics for y18n
Gathering detailed insights and metrics for y18n
Gathering detailed insights and metrics for y18n
Gathering detailed insights and metrics for y18n
i18next-cli-language-detector
i18next language detector module for CLI
y18n-browser
the bare-bones internationalization library used by yargs, made browser friendly
lokales
Lightweight barebones i18n localization written in Typescript.
babel-plugin-as-macro
add macro power to javascript code
npm install y18n
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
146 Stars
113 Commits
48 Forks
17 Watching
85 Branches
20 Contributors
Updated on 19 Jul 2024
Minified
Minified + Gzipped
JavaScript (59.97%)
TypeScript (40.03%)
Cumulative downloads
Total Downloads
Last day
-8.8%
12,873,570
Compared to previous day
Last week
1%
76,103,904
Compared to previous week
Last month
13.9%
311,479,535
Compared to previous month
Last year
7.2%
3,150,594,906
Compared to previous year
The bare-bones internationalization library used by yargs.
Inspired by i18n.
simple string translation:
1const __ = require('y18n')().__; 2 3console.log(__('my awesome string %s', 'foo'));
output:
my awesome string foo
using tagged template literals
1const __ = require('y18n')().__; 2 3const str = 'foo'; 4 5console.log(__`my awesome string ${str}`);
output:
my awesome string foo
pluralization support:
1const __n = require('y18n')().__n; 2 3console.log(__n('one fish %s', '%d fishes %s', 2, 'foo'));
output:
2 fishes foo
As of v5
y18n
supports Deno:
1import y18n from "https://deno.land/x/y18n/deno.ts"; 2 3const __ = y18n({ 4 locale: 'pirate', 5 directory: './test/locales' 6}).__ 7 8console.info(__`Hi, ${'Ben'} ${'Coe'}!`)
You will need to run with --allow-read
to load alternative locales.
The JSON language files should be stored in a ./locales
folder.
File names correspond to locales, e.g., en.json
, pirate.json
.
When strings are observed for the first time they will be added to the JSON file corresponding to the current locale.
Create an instance of y18n with the config provided, options include:
directory
: the locale directory, default ./locales
.updateFiles
: should newly observed strings be updated in file, default true
.locale
: what locale should be used.fallbackToLanguage
: should fallback to a language-only file (e.g. en.json
)
be allowed if a file matching the locale does not exist (e.g. en_US.json
),
default true
.Print a localized string, %s
will be replaced with arg
s.
This function can also be used as a tag for a template literal. You can use it
like this: __`hello ${'world'}`
. This will be equivalent to
__('hello %s', 'world')
.
Print a localized string with appropriate pluralization. If %d
is provided
in the string, the count
will replace this placeholder.
Set the current locale being used.
What locale is currently being used?
Update the current locale with the key value pairs in obj
.
Libraries in this ecosystem make a best effort to track Node.js' release schedule. Here's a post on why we think this is important.
ISC
The latest stable version of the package.
Stable Version
3
7.3/10
Summary
Prototype Pollution in y18n
Affected Versions
>= 5.0.0, < 5.0.5
Patched Versions
5.0.5
7.3/10
Summary
Prototype Pollution in y18n
Affected Versions
= 4.0.0
Patched Versions
4.0.1
7.3/10
Summary
Prototype Pollution in y18n
Affected Versions
< 3.2.2
Patched Versions
3.2.2
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 6/16 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- 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
security policy file not detected
Details
Reason
project is not fuzzed
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