0

I am trying to change the language of react native date picker. But I don't have any clear idea about localisation and internationalisation please give some examples to understand that concept. Thanks a lot !

  • look at this link it may help you https://www.npmjs.com/package/react-native-localization – channu Jul 25 '19 at 04:42
  • you can check https://stackoverflow.com/q/46933896/7719316 – Munni Jul 25 '19 at 04:44
  • Hello @channu , Thanks a lot for your reply. I checked the link which you comment that is working perfectly in the application but I don't know have to implement that into the react native date picker. could you please give some example. Thanks again! – KarthikeyanMCK Jul 25 '19 at 04:59
  • Hi @Munni, Thanks a lot for your reply. I am trying to change the language in the react native date picker, please give some example from react native date picker. Thanks again! – KarthikeyanMCK Jul 25 '19 at 05:09

2 Answers2

0

Generally speaking, components, which support display in different languages, would change their interface automatically when the device's language is changed.

Some components might provide the capability for the user to choose a specific locale at run time. They will probably provide a method to change the locale.

Bilal Abdeen
  • 1,627
  • 1
  • 19
  • 41
  • Hello Bilal , Yes, you are correct I checked that also. But I looking to change the date picker language only in my application language option. If I choose the language into my application that changes only affect my date picker not system. I don't have any clear idea about moment package locale usage and date-fns package usage, I don't know how to implement correctly in the code. could you please give some explanation with example. Thanks a lot! – KarthikeyanMCK Jul 25 '19 at 07:36
  • I don't know much about this topic. I suggest you search on Google for something like: how to set the locale on react-native. – Bilal Abdeen Jul 25 '19 at 22:10
0
import React from 'react'
import DatePicker from 'react-native-datepicker'
import 'moment/locale/he'

export default class ScheduleDatePicker extends React.Component {
state={
 date:''
}
  render () {
    var locale = 'he'
    return (
      <DatePicker
        mode='date'
        format='LLLL'
        locale={locale}
        showIcon={true}
        style={{width: 300, marginHorizonhel: 5}}
        date={new Date()}


        onDateChange={(date) => { this.setState({date:date}) }}
      />
    )
  }
}

https://github.com/xgfe/react-native-datepicker/issues/253 This is link which I referred, but it's change the language only a date text not inside the date picker. Thanks a lot!