ra-language-farsi
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "ra-language-farsi", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Farsi translations for React-Admin, the frontend framework for building admin applications on top of REST/GraphQL services.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -37,7 +37,8 @@ # Farsi Translations for React-Admin | ||
## RTL | ||
Material UI is already supprting RTL, so we can add its support to react admin using these 2 steps: | ||
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). You can also connect this property to redux. | ||
*public/index.html* | ||
1. Change `dir` property to `rtl` in your root elements (like body). | ||
Using HTML (*public/index.html*): | ||
```html | ||
@@ -52,3 +53,3 @@ <body> | ||
Or `body` CSS: | ||
Using CSS style: | ||
```css | ||
@@ -60,7 +61,18 @@ body { | ||
2. Define a theme and set **direction** to **rtl**. | ||
Or Pure JS: | ||
```js | ||
document.getElementsByTagName("body")[0].setAttribute('dir', 'rtl'); | ||
``` | ||
2. 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**](https://github.com/alitaheri/jss-rtl) plugin to make sure everything works properly. | ||
```javascript | ||
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({ | ||
@@ -71,10 +83,13 @@ direction: 'rtl', | ||
const App = () => ( | ||
<Admin theme={theme}> | ||
// ... | ||
</Admin> | ||
<StylesProvider jss={jss}> | ||
<Admin theme={theme}> | ||
// ... | ||
</Admin> | ||
</StylesProvider> | ||
); | ||
``` | ||
## License | ||
This translation is licensed under the [BSD Licence](LICENSE), and sponsored by [Hamid FzM](https://hamidfzm.com). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11252
92