开源软件名称(OpenSource Name):evandhq/react-persian开源软件地址(OpenSource Url):https://github.com/evandhq/react-persian开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):react-persianreact-persian is a set of react components for Persian localization. InstallationYou can install this package via npm install react-persian --save ComponentsPersianNumberYou can use import React from 'react';
import { PersianNumber } from 'react-persian';
class Test extends React.Component {
render() {
return (<div>
سال تولد: <PersianNumber>1372</PersianNumber> <!-- ۱۳۷۲ -->
</div>);
}
} Properties
PersianNumberWordsYou import React from 'react';
import { PersianNumberWords } from 'react-persian';
class Test extends React.Component {
render() {
return (<div>
قیمت: <PersianNumberWords>5600</PersianNumberWords> <!-- پنج هزار و ششصد -->
</div>);
}
} functionslatinToPersianYou can use import { latinToPersian } from 'react-persian';
class Test extends React.Component {
render() {
return (<button onClick={() => console.log(latingToPersian('44'))}>show 44 in persian</button>)
}
} arabicToPersianYou can use import { arabicToPersian } from 'react-persian';
class Test extends React.Component {
render() {
return (<button onClick={() => console.log(arabicToPersian('٤٥'))}>show ٤٥ in persian</button>)
}
} formatStringYou can use import { formatString } from 'react-persian';
class Test extends React.Component {
render() {
return (<button onClick={() => console.log(formatString('۲۵۰۰۰۰۰۰۰'))}> is equal to ۲۵۰,۰۰۰,۰۰۰</button>)
}
} removeCommasFromStringYou can use import { removeCommasFromString } from 'react-persian';
class Test extends React.Component {
render() {
return (<button onClick={() => console.log(removeCommasFromString('۲۵۰,۰۰۰,۰۰۰'))}> is equal to ۲۵۰۰۰۰۰۰۰ (without commas)</button>)
}
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论