ra-language-farsi
Advanced tools
+1
-1
| { | ||
| "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", |
+23
-8
@@ -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). |
11252
4.84%92
19.48%