react-intl#defineMessages JavaScript Examples

The following examples show how to use react-intl#defineMessages. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TableBlockEdit.jsx    From volto-slate with MIT License 6 votes vote down vote up
messages = defineMessages({
  insertRowBefore: {
    id: 'Insert row before',
    defaultMessage: 'Insert row before',
  },
  insertRowAfter: {
    id: 'Insert row after',
    defaultMessage: 'Insert row after',
  },
  deleteRow: {
    id: 'Delete row',
    defaultMessage: 'Delete row',
  },
  insertColBefore: {
    id: 'Insert col before',
    defaultMessage: 'Insert col before',
  },
  insertColAfter: {
    id: 'Insert col after',
    defaultMessage: 'Insert col after',
  },
  deleteCol: {
    id: 'Delete col',
    defaultMessage: 'Delete col',
  },
})
Example #2
Source File: TitleBlockEdit.jsx    From volto-slate with MIT License 6 votes vote down vote up
messages = defineMessages({
  description: {
    id: 'Add a description…',
    defaultMessage: 'Add a description…',
  },
  title: {
    id: 'Type the title…',
    defaultMessage: 'Type the title…',
  },
})
Example #3
Source File: messages.js    From volto-slate with MIT License 6 votes vote down vote up
messages = defineMessages({
  edit: {
    id: 'Edit element',
    defaultMessage: 'Edit element',
  },
  delete: {
    id: 'Remove element',
    defaultMessage: 'Remove element',
  },
})
Example #4
Source File: index.js    From volto-slate with MIT License 6 votes vote down vote up
messages = defineMessages({
  edit: {
    id: 'Edit link',
    defaultMessage: 'Edit link',
  },
  delete: {
    id: 'Remove link',
    defaultMessage: 'Remove link',
  },
})
Example #5
Source File: index.js    From volto-slate with MIT License 6 votes vote down vote up
messages = defineMessages({
  add: {
    id: 'Add link',
    defaultMessage: 'Add link',
  },
  edit: {
    id: 'Edit link',
    defaultMessage: 'Edit link',
  },
})
Example #6
Source File: StyleMenu.jsx    From volto-slate with MIT License 6 votes vote down vote up
messages = defineMessages({
  allStylesApplied: {
    id: 'All Styles Applied',
    defaultMessage: 'All Styles Applied',
  },
  noStyle: {
    id: 'No Style',
    defaultMessage: 'No Style',
  },
  fontStyle: {
    id: 'Font Style',
    defaultMessage: 'Font Style',
  },
  paragraphStyle: {
    id: 'Paragraph Style',
    defaultMessage: 'Paragraph Style',
  },
})
Example #7
Source File: index.js    From volto-slate with MIT License 6 votes vote down vote up
messages = defineMessages({
  deleteTable: {
    id: 'Delete table',
    defaultMessage: 'Delete table',
  },
  insertRowBefore: {
    id: 'Insert row before',
    defaultMessage: 'Insert row before',
  },
  insertRowAfter: {
    id: 'Insert row after',
    defaultMessage: 'Insert row after',
  },
  deleteRow: {
    id: 'Delete row',
    defaultMessage: 'Delete row',
  },
  insertColBefore: {
    id: 'Insert col before',
    defaultMessage: 'Insert col before',
  },
  insertColAfter: {
    id: 'Insert col after',
    defaultMessage: 'Insert col after',
  },
  deleteCol: {
    id: 'Delete col',
    defaultMessage: 'Delete col',
  },
})
Example #8
Source File: BlocksBrowserNav.jsx    From volto-slate with MIT License 6 votes vote down vote up
messages = defineMessages({
  browse: {
    id: 'Browse',
    defaultMessage: 'Browse',
  },
  back: {
    id: 'Back',
    defaultMessage: 'Back',
  },
  select: {
    id: 'Select',
    defaultMessage: 'Select',
  },
})
Example #9
Source File: BlocksBrowserWidget.jsx    From volto-slate with MIT License 6 votes vote down vote up
messages = defineMessages({
  placeholder: {
    id: 'No items selected',
    defaultMessage: 'No items selected',
  },
  edit: {
    id: 'Edit',
    defaultMessage: 'Edit',
  },
  delete: {
    id: 'Delete',
    defaultMessage: 'Delete',
  },
  openObjectBrowser: {
    id: 'Open object browser',
    defaultMessage: 'Open object browser',
  },
})
Example #10
Source File: index.test.js    From awsboilerplate with MIT License 6 votes vote down vote up
describe('<Toggle />', () => {
  it('should contain default text', () => {
    const defaultEnMessage = 'someContent';
    const defaultDeMessage = 'someOtherContent';
    const messages = defineMessages({
      en: {
        id: 'boilerplate.containers.LocaleToggle.en',
        defaultMessage: defaultEnMessage,
      },
      de: {
        id: 'boilerplate.containers.LocaleToggle.en',
        defaultMessage: defaultDeMessage,
      },
    });
    const { container } = render(
      <IntlProvider locale="en">
        <Toggle values={['en', 'de']} messages={messages} />
      </IntlProvider>,
    );
    expect(container.firstChild).toMatchSnapshot();
  });

  it('should not have ToggleOptions if props.values is not defined', () => {
    const { container } = render(<Toggle />);
    const elements = container.querySelectorAll('option');
    expect(elements).toHaveLength(1);
    expect(container.firstChild.value).toEqual('--');
  });
});
Example #11
Source File: index.test.js    From awsboilerplate with MIT License 6 votes vote down vote up
describe('<ToggleOption />', () => {
  it('should render default language messages', () => {
    const defaultEnMessage = 'someContent';
    const message = defineMessages({
      enMessage: {
        id: 'boilerplate.containers.LocaleToggle.en',
        defaultMessage: defaultEnMessage,
      },
    });
    const { container } = render(
      <IntlProvider locale="en">
        <ToggleOption value="en" message={message.enMessage} />
      </IntlProvider>,
    );
    expect(container.firstChild).toMatchSnapshot();
  });

  it('should display `value`(two letter language code) when `message` is absent', () => {
    const { queryByText } = render(
      <IntlProvider locale="de">
        <ToggleOption value="de" />
      </IntlProvider>,
    );
    expect(queryByText('de')).toBeDefined();
  });
});
Example #12
Source File: messages.js    From rainbow-modules with MIT License 6 votes vote down vote up
messages = defineMessages({
    emailPlaceholder: {
        id: 'EmailPasswordSignUpForm.emailPlaceholder',
        defaultMessage: 'Enter your email',
        description: 'Placeholder for the email input in the sign up form',
    },
    passwordPlaceholder: {
        id: 'EmailPasswordSignUpForm.passwordPlaceholder',
        defaultMessage: 'Enter your password',
        description: 'Placeholder for the password input in the sign up form',
    },
})
Example #13
Source File: messages.js    From rainbow-modules with MIT License 6 votes vote down vote up
messages = defineMessages({
    namePlaceholder: {
        id: 'EmailPasswordSignUpForm.namePlaceholder',
        defaultMessage: 'Enter your name',
        description: 'Placeholder for the name input in the sign up form',
    },
    emailPlaceholder: {
        id: 'EmailPasswordSignUpForm.emailPlaceholder',
        defaultMessage: 'Enter your email',
        description: 'Placeholder for the email input in the sign up form',
    },
    passwordPlaceholder: {
        id: 'EmailPasswordSignUpForm.passwordPlaceholder',
        defaultMessage: 'Enter your password',
        description: 'Placeholder for the password input in the sign up form',
    },
})
Example #14
Source File: messages.js    From rainbow-modules with MIT License 6 votes vote down vote up
messages = defineMessages({
    confirmationModalHeader: {
        id: 'CreditCardPicker.ConfirmationModal.header',
        defaultMessage: 'Are you sure you want delete this credit card?',
        description: 'Header text of the confirmation modal when remove a card',
    },
    confirmationModalQuestion: {
        id: 'CreditCardPicker.ConfirmationModal.question',
        defaultMessage: "This card will be deleted immediately. You can't undo this action.",
        description: 'Question text of the confirmation modal when remove a card',
    },
    confirmationModalOkButtonLabel: {
        id: 'CreditCardPicker.ConfirmationModal.okButtonLabel',
        defaultMessage: 'Delete',
        description: 'Ok button label of the confirmation modal when remove a card',
    },
    confirmationModalCancelButtonLabel: {
        id: 'CreditCardPicker.ConfirmationModal.cancelButtonLabel',
        defaultMessage: 'Cancel',
        description: 'Cancel button label of the confirmation modal when remove a card',
    },
})
Example #15
Source File: messages.js    From rainbow-modules with MIT License 6 votes vote down vote up
messages = defineMessages({
    setupIntentModalTitle: {
        id: 'StripeCheckoutModal.setupIntent.title',
        defaultMessage: 'Add Card',
    },
    paymentIntentModalTitle: {
        id: 'StripeCheckoutModal.paymentIntent.title',
        defaultMessage: 'Pay With',
    },
    errorMessage: {
        id: 'StripeCheckoutModal.errorMessage',
        defaultMessage: 'Upps! Something went wrong',
    },
    inputNameLabel: {
        id: 'StripeCheckoutModal.cardholderLabel',
        defaultMessage: 'Cardholder Name',
    },
    inputNamePlaceholder: {
        id: 'StripeCheckoutModal.cardholderPlaceholder',
        defaultMessage: 'Enter the name on your card',
    },
    cardLabel: {
        id: 'StripeCheckoutModal.cardInformationLabel',
        defaultMessage: 'Card Information',
    },
    cancelButtonLabel: {
        id: 'StripeCheckoutModal.cancelButtonLabel',
        defaultMessage: 'Cancel',
    },
    setupIntentOkButtonLabel: {
        id: 'StripeCheckoutModal.setupIntent.okButtonLabel',
        defaultMessage: 'Save',
    },
    paymentIntentOkButtonLabel: {
        id: 'StripeCheckoutModal.paymentIntent.okButtonLabel',
        defaultMessage: 'Pay',
    },
})
Example #16
Source File: messages.js    From rainbow-modules with MIT License 6 votes vote down vote up
messages = defineMessages({
    clickToCopy: {
        id: 'CopyToClipboardButton.clickToCopy',
        defaultMessage: 'Click to copy',
        description: 'Text for the tooltip that describes the action of copy to clipboard',
    },
    copied: {
        id: 'CopyToClipboardButton.copied',
        defaultMessage: 'Copied',
        description:
            'Text for the tooltip that describes that the text was copied to the clipboard',
    },
})
Example #17
Source File: AddressTypeahead.jsx    From covid19-testing with Apache License 2.0 6 votes vote down vote up
messages = defineMessages({
  currentLocation: {
    id: 'addressTypeAhead.currentLocation',
    defaultMessage: 'Current location',
    description: '',
  },
  addressPrompt: {
    id: 'addressTypeAhead.addressPrompt',
    defaultMessage: 'Enter an address, city, or ZIP code',
    description: '',
  },
})
Example #18
Source File: FacilityItem.jsx    From covid19-testing with Apache License 2.0 6 votes vote down vote up
Messages = defineMessages({
  HOURS: {
    defaultMessage: 'Hours:',
    description: 'Title for hours the facility is open',
    id: 'search.facility.hours',
  },
  CLOSED: {
    defaultMessage: 'Closed',
    description: 'Label indicating that a facility is closed',
    id: 'search.facility.closed',
  },
  SHOW_MORE: {
    defaultMessage: 'Show more',
    description: 'Toggle to display the hours of operation',
    id: 'search.facility.showMore',
  },
  SHOW_LESS: {
    defaultMessage: 'Show less',
    description: 'Toggle to hide the hours of operation',
    id: 'search.facility.showLess',
  },
  UNABLE_TO_DETERMINE: {
    defaultMessage: 'Unable to determine availability',
    description:
      'Label indicating that we are currently unable to determine if the facility is available',
    id: 'search.facility.unableToDetermine',
  },
})
Example #19
Source File: index.test.js    From bank-client with MIT License 6 votes vote down vote up
describe('<Toggle />', () => {
  it('should contain default text', () => {
    const defaultEnMessage = 'someContent';
    const messages = defineMessages({
      en: {
        id: 'boilerplate.containers.LocaleToggle.en',
        defaultMessage: defaultEnMessage,
      },
    });
    const { container } = render(
      <IntlProvider locale={DEFAULT_LOCALE}>
        <Toggle values={['en']} messages={messages} />
      </IntlProvider>,
    );
    expect(container.firstChild).toMatchSnapshot();
  });

  //   it('should not have ToggleOptions if props.values is not defined', () => {
  //     const { container } = render(<Toggle />);
  //     const elements = container.querySelectorAll('option');
  //     expect(elements).toHaveLength(1);
  //     expect(container.firstChild).toHaveTextContent('--');
  //   });
});
Example #20
Source File: index.test.js    From QiskitFlow with Apache License 2.0 5 votes vote down vote up
messages = defineMessages({
  someMessage: {
    id: 'some.id',
    defaultMessage: 'This is some default message',
    en: 'This is some en message',
  },
})
Example #21
Source File: schema.js    From volto-slate with MIT License 5 votes vote down vote up
messages = defineMessages({
  hideHeaders: {
    id: 'Hide headers',
    defaultMessage: 'Hide headers',
  },
  responsive: {
    id: 'Responsive',
    defaultMessage: 'Responsive',
  },
  sortable: {
    id: 'Make the table sortable',
    defaultMessage: 'Make the table sortable',
  },
  sortableDescription: {
    id: 'Visible only in view mode',
    defaultMessage: 'Visible only in view mode',
  },
  fixed: {
    id: 'Fixed width table cells',
    defaultMessage: 'Fixed width table cells',
  },
  compact: {
    id: 'Make the table compact',
    defaultMessage: 'Make the table compact',
  },
  basic: {
    id: 'Reduce complexity',
    defaultMessage: 'Reduce complexity',
  },
  celled: {
    id: 'Divide each row into separate cells',
    defaultMessage: 'Divide each row into separate cells',
  },
  inverted: {
    id: 'Table color inverted',
    defaultMessage: 'Table color inverted',
  },
  striped: {
    id: 'Stripe alternate rows with color',
    defaultMessage: 'Stripe alternate rows with color',
  },
  textAlign: {
    id: 'Align text',
    defaultMessage: 'Align text',
  },
  verticalAlign: {
    id: 'Vertical align',
    defaultMessage: 'Vertical align',
  },
  left: {
    id: 'Left',
    defaultMessage: 'Left',
  },
  center: {
    id: 'Center',
    defaultMessage: 'Center',
  },
  right: {
    id: 'Right',
    defaultMessage: 'Right',
  },
  bottom: {
    id: 'Bottom',
    defaultMessage: 'Bottom',
  },
  middle: {
    id: 'Middle',
    defaultMessage: 'Middle',
  },
  top: {
    id: 'Top',
    defaultMessage: 'Top',
  },
})
Example #22
Source File: DefaultTextBlockEditor.jsx    From volto-slate with MIT License 5 votes vote down vote up
messages = defineMessages({
  text: {
    id: 'Type text…',
    defaultMessage: 'Type text…',
  },
})
Example #23
Source File: DetachedTextBlockEditor.jsx    From volto-slate with MIT License 5 votes vote down vote up
messages = defineMessages({
  text: {
    id: 'Type text…',
    defaultMessage: 'Type text…',
  },
})
Example #24
Source File: DefaultSlateView.jsx    From volto-slate with MIT License 5 votes vote down vote up
messages = defineMessages({
  unknownBlock: {
    id: 'Unknown Block',
    defaultMessage: 'Unknown Block {block}',
  },
})
Example #25
Source File: HtmlSlateWidget.jsx    From volto-slate with MIT License 5 votes vote down vote up
messages = defineMessages({
  error: {
    id:
      'An error has occurred while editing "{name}" field. We have been notified and we are looking into it. Please save your work and retry. If the issue persists please contact the site administrator.',
    defaultMessage:
      'An error has occurred while editing "{name}" field. We have been notified and we are looking into it. Please save your work and retry. If the issue persists please contact the site administrator.',
  },
})
Example #26
Source File: RichTextWidgetView.jsx    From volto-slate with MIT License 5 votes vote down vote up
messages = defineMessages({
  error: {
    id:
      'An error has occurred while rendering "{name}" field. We have been notified and we are looking into it. If the issue persists please contact the site administrator.',
    defaultMessage:
      'An error has occurred while rendering "{name}" field. We have been notified and we are looking into it. If the issue persists please contact the site administrator.',
  },
})
Example #27
Source File: index.test.js    From hackchat-client with Do What The F*ck You Want To Public License 5 votes vote down vote up
messages = defineMessages({
  someMessage: {
    id: 'some.id',
    defaultMessage: 'This is some default message',
    en: 'This is some en message',
  },
})
Example #28
Source File: messages.js    From rainbow-modules with MIT License 5 votes vote down vote up
messages = defineMessages({
    clearButton: {
        id: 'FloatingSearch.clearButton.text',
        defaultMessage: 'Clear',
        description: 'Text of the button to clear the FloatingSearch',
    },
})
Example #29
Source File: messages.js    From rainbow-modules with MIT License 5 votes vote down vote up
messages = defineMessages({
    filterButton: {
        id: 'FloatingSearchButtonIcon.filterButton.label',
        defaultMessage: 'Filter',
        description: 'Label of the FloatingSearchButtonIcon',
    },
})