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

rosetty-react

Package Overview
Dependencies
Maintainers
1
Versions
533
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rosetty-react

[![Maintainability](https://api.codeclimate.com/v1/badges/82e2c932c7dde770cdd4/maintainability)](https://codeclimate.com/github/flexper/rosetty-react/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/82e2c932c7dde770cdd4/test_covera

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Maintainability Test Coverage npm npm Snyk Vulnerabilities for npm package NPM

Rosetty React

Complete Intl/I18n solution for React base on Rosetty

Usage

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

import { I18nHOC, locales as rosettyLocales } from 'rosetty-react';

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

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

module.exports = App;

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

import { useI18n } from 'rosetty-react';

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

module.exports = Home;

API

I18nHOC

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

Return a component who instantiate the Rosetty Context.

locales

Return: Record<string, Locale>

Return I18n locales from rosetty

Maintain

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

FAQs

Package last updated on 30 Apr 2022

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