rosetty-solid
Version:
[](https://codeclimate.com/github/qlaffont/rosetty-solid/maintainability) [ • 2.2 kB
Markdown
[](https://codeclimate.com/github/qlaffont/rosetty-solid/maintainability) [](https://codeclimate.com/github/qlaffont/rosetty-solid/test_coverage)    
Complete Intl/I18n solution for Solid based on [Rosetty](https://github.com/qlaffont/rosetty)
```js
//In your app.js file, add the following code:
import { RosettyProvider } from 'rosetty-solid';
import fr from 'dayjs/locale/fr';
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;
```
**Options**
| Field Name | Type | Description |
| --------------- | ------------------------ | -------------------------------------------------------------- |
| locales | Record<string, Language> | Specify dictionnary and locale to use for each lang |
| defaultLanguage | string? | 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.
**You need to import locale from `dayjs` package.**
```js
const fr = require('dayjs/locale/fr');
```
This package use [TSdx](https://github.com/jaredpalmer/tsdx). Please check documentation to update this package.