Socket
Book a DemoInstallSign in
Socket

rosetty

Package Overview
Dependencies
Maintainers
1
Versions
372
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rosetty

[![Maintainability](https://api.codeclimate.com/v1/badges/1ff0c28615640d86e758/maintainability)](https://codeclimate.com/github/qlaffont/rosetty/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/1ff0c28615640d86e758/test_coverage)](

4.0.10
latest
Source
npmnpm
Version published
Weekly downloads
3
-57.14%
Maintainers
1
Weekly downloads
 
Created
Source

Maintainability Test Coverage npm npm Snyk Vulnerabilities for npm package NPM

Rosetty

Complete Intl/I18n solution for browser and node. Old Owner: @flexper

  • React Implementation : Rosetty React

Usage

const { rosetty } = require('rosetty');

const r = rosetty(
  {
    en: {
      dict: {
        test: 'This is a test',
      },
      locale: 'en-GB',
    },
  },
  'en'
);

console.log(r.t('test')); // This is a test

API

rosetty(config, defaultLang?)

Options

Field NameTypeDescription
configRecord<string, Language>Specify dictionary and locale to use for each lang
defaultLangstring?Specify default language to use (should be the same as config)
translateFallbackboolean?Return fallback if translation is not defined

Return

Field NameTypeDescription
changeLang(newLang: string) => voidChange current lang
languagesstring[]List of languages who can be selected
getCurrentLang() => stringReturn current lang
t(key: string, params?: Record<string, any>, dict?: Record<string, any>) => string OR undefinedReturn translated text https://github.com/lukeed/rosetta#rosettatkey-params-lang. If dict is defined, he will use dict.
displayNamesDocumentationConsistent translation of language, region and script display names
listFormatDocumentationLanguage-sensitive list formatting
numberFormatDocumentationLanguage-sensitive number formatting
pluralRulesDocumentationPlural-sensitive formatting and plural-related language rules
dateTimeFormatDocumentationLanguage-sensitive date and time formatting
relativeTimeFormatDocumentationLanguage-sensitive relative time formatting
collatorDocumentationLanguage-sensitive string comparison
segmenterDocumentationLanguage-sensitive text segmentation
durationFormatDocumentationLanguage-sensitive duration formatting (Experimental)

Locale Configuration

The locale field in the configuration should be a valid BCP 47 language tag (e.g., 'en-GB', 'fr', 'de-DE') or an Intl.Locale instance.

// Using string locale
const config = {
  en: {
    dict: {},
    locale: 'en-GB'
  }
};

// Using Intl.Locale
const config = {
  en: {
    dict: {},
    locale: new Intl.Locale('en-GB')
  }
};

Polyfill Support (Node.JS OR Browser)

To use this library, you maybe need to add polyfills as some features are still experimental.

To fix this :

Maintain

This package use TSdx. Please check documentation to update this package.

FAQs

Package last updated on 12 Jul 2025

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.