Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

factorial-i18n

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

factorial-i18n

Factorial i18n library

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
111
decreased by-47.89%
Maintainers
2
Weekly downloads
 
Created
Source

Factorial i18n

Minimal library for dealing i18n. Supports pluralization and interpolation.

Build Status JavaScript Style Guide

Installation

npm install factorial-i18n --save
yarn add factorial-i18n

Example

const translations = {
  en: {
    common: { hello: 'hello %{name}', },
    beers: { one: '%{count} beer', other: '%{count} beers' }
  },
  es: {
    common: { hello: 'hola %{name}', },
    beers: { one: '%{count} cerveza', other: '%{count} cervezas' }
  }
}

const i18n = new I18n()

i18n.setTranslations(translations)
i18n.setLocale('es')
i18n.t('common.hello') // => Hola
i18n.tp('common.beers', { count: 0 }) // => 0 cervezas
i18n.tp('common.beers', { count: 1 }) // => 1 cerveza

Where is it used?

Developed and battle tested in production in Factorial

FAQs

Package last updated on 19 Sep 2023

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc