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

rosetty-solid

Package Overview
Dependencies
Maintainers
0
Versions
312
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rosetty-solid

[![Maintainability](https://api.codeclimate.com/v1/badges/a777c53f5370b6900930/maintainability)](https://codeclimate.com/github/qlaffont/rosetty-solid/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/a777c53f5370b6900930/test_cover

  • 2.0.180
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
increased by44.32%
Maintainers
0
Weekly downloads
 
Created
Source

Maintainability Test Coverage npm npm Snyk Vulnerabilities for npm package NPM

Rosetty solid

Complete Intl/I18n solution for Solid based on Rosetty

Usage

//In your app.js file, add the following code:

import { RosettyProvider } from 'rosetty-solid';
import { fr } from 'date-fns/locale';

const locales = { fr: { dict: {}, locale: fr } };
const defaultLanguage = 'fr';

const App = ({ children }) => (
  <RosettyProvider locales={locales} defaultLanguage={defaultLanguage}>
    {children}
  </RosettyProvider>
);

module.exports = App;

//In your components file, add the following code:

import { useRosetty } from 'rosetty-solid';

const Home = () => {
  const { t } = useRosetty();
  return <h1>{t('home')}</h1>;
};

module.exports = Home;

API

RosettyProvider

Options

Field NameTypeDescription
localesRecord<string, Language>Specify dictionnary and locale to use for each lang
defaultLanguagestring?Specify default language to use (should be the same as config)

Return: Rosetty Context HOC + {actualLang: string} who contain your current language

Return a component who instantiate the Rosetty Context.

WARNING FOR LOCALE !

You need to import locale from date-fns package.

const { enGB } = require('date-fns/locale');

Maintain

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

FAQs

Package last updated on 20 Sep 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

  • 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