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

ra-language-farsi

Package Overview
Dependencies
Maintainers
0
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.

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
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 { createTheme } 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 = createTheme({
  direction: 'rtl',
});

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

Version Compatibility

  • For React-Admin v5, use version 5.x of this package.
  • For React-Admin v4, use version 4.x of this package.
  • For React-Admin v3, use version 3.x of this package.
  • For React-Admin v2, use version 2.x of this package.
  • For React-Admin v1, use version 1.x of this package.

License

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

Keywords

FAQs

Package last updated on 29 Jul 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