Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[react-native-paper-dates] The locale en is not registered, see README!, key: typeInDate #473

Open
vinayzerozilla opened this issue Oct 15, 2023 · 8 comments

Comments

@vinayzerozilla
Copy link

Issue

Giving the warning [react-native-paper-dates] The locale en is not registered, see README!, key: typeInDate

Expected Behavior

it shouldn't give warning after the setting the locale also

Code

<DatePickerModal
         locale="en" 
          mode="single"
          visible={open}
          onDismiss={onDismissSingle}
          date={props.date}
          onConfirm={onConfirmSingle}
        />

Environment

  1. react-native -v: 0.72.4
  2. node -v: v18.18.0
  3. npm -v: 9.8.1
  4. yarn --version:
  5. target platform: Android | iOS : Android
  6. operating system: Windows

image

@pfiwinf
Copy link

pfiwinf commented Nov 4, 2023

Got the same issue

@fbpatel003
Copy link

I have same issue !

@pfiwinf
Copy link

pfiwinf commented Nov 5, 2023

found this:

https://web-ridge.github.io/react-native-paper-dates/docs/intro

Scroll down to Custom, you can register your own locale, seems like a workaround. With this it worked for me.

@UIT19521334
Copy link

Can you explain more about the way to fix the warning

@pfiwinf
Copy link

pfiwinf commented Jan 10, 2024

I just registered my preferred language at the "Custom" part in https://web-ridge.github.io/react-native-paper-dates/docs/intro.

Like:

import { registerTranslation } from 'react-native-paper-dates'
registerTranslation('pl', {
  save: 'Save',
  selectSingle: 'Select date',
  selectMultiple: 'Select dates',
  selectRange: 'Select period',
  notAccordingToDateFormat: (inputFormat) =>
    `Date format must be ${inputFormat}`,
  mustBeHigherThan: (date) => `Must be later then ${date}`,
  mustBeLowerThan: (date) => `Must be earlier then ${date}`,
  mustBeBetween: (startDate, endDate) =>
    `Must be between ${startDate} - ${endDate}`,
  dateIsDisabled: 'Day is not allowed',
  previous: 'Previous',
  next: 'Next',
  typeInDate: 'Type in date',
  pickDateFromCalendar: 'Pick date from calendar',
  close: 'Close',
})

And here i just added my own translation.

@UIT19521334
Copy link

I'm really happy because I successfully resolved the issue that was causing a warning. It feels great to have everything working smoothly now. Thanks so much for your help!

@Nicholson85
Copy link

Nicholson85 commented Feb 5, 2024

I think the problem stems from the documentation using en-gb as an example.

Replacing registerTranslation("en-GB", enGB); with registerTranslation("en", enGB); fixes the problem for me and doesnt require you to implement your own custom localisation.

@asaduryan
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants