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

ra-language-farsi

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ra-language-farsi

Farsi translations for React-Admin, the frontend framework for building admin applications on top of REST/GraphQL services.

  • 1.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
191
decreased by-3.05%
Maintainers
1
Weekly downloads
 
Created
Source

Farsi Translations for React-Admin

Farsi translations for React-Admin, the frontend framework for building admin applications on top of REST/GraphQL services.

react-admin-demo

Installation

npm

npm install --save ra-language-farsi

yarn

yarn add ra-language-farsi

Usage

import farsiMessages from 'ra-language-farsi';
import polyglotI18nProvider from 'ra-i18n-polyglot';

const messages = {
    'fa': farsiMessages,
};

const i18nProvider = polyglotI18nProvider(locale => messages[locale], 'fa');

<Admin i18nProvider={i18nProvider}>
  ...
</Admin>

RTL

Material UI is already supprting RTL, so we can add its support to React Admin using these 2 steps:

  1. Change dir property to rtl in your root elements (like body).

Using HTML (public/index.html):

<body>
<noscript>
  You need to enable JavaScript to run this app.
</noscript>
<div id="root" dir="rtl"></div>
</body>

Using CSS style:

body {
  direction: rtl;
}

Or Pure JS:

document.getElementsByTagName("body")[0].setAttribute('dir', 'rtl');
  1. Define a theme and set direction to rtl. Also defining an RTL theme might be not enough to flip all React Admin components. So we use jss-rtl plugin to make sure everything works properly.
import { createMuiTheme } from '@material-ui/core/styles';
import {create} from 'jss';
import rtl from 'jss-rtl';
import {StylesProvider, jssPreset} from '@material-ui/core/styles';

// Configure JSS
const jss = create({plugins: [...jssPreset().plugins, rtl()]});

const theme = createMuiTheme({
  direction: 'rtl',
});

const App = () => (
    <StylesProvider jss={jss}>
        <Admin theme={theme}>
            // ...
        </Admin>
    </StylesProvider>
);

License

This translation is licensed under the BSD Licence, and sponsored by Hamid FzM.

Keywords

FAQs

Package last updated on 12 Feb 2020

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