Skip to content

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

Open

Description

@vinayzerozilla

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

Activity

  1. pfiwinf commented on Nov 4, 2023

    @pfiwinf

    Got the same issue

  2. fbpatel003 commented on Nov 5, 2023

    @fbpatel003

    I have same issue !

  3. pfiwinf commented on Nov 5, 2023

    @pfiwinf

    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.

  4. UIT19521334 commented on Jan 10, 2024

    @UIT19521334

    Can you explain more about the way to fix the warning

  5. pfiwinf commented on Jan 10, 2024

    @pfiwinf

    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.

  6. UIT19521334 commented on Jan 10, 2024

    @UIT19521334

    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!

  7. Nicholson85 commented on Feb 5, 2024

    @Nicholson85

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions