Uploaded image for project: 'stripes-components'
  1. stripes-components
  2. STCOM-399

Spike: Determine better workflows for MCL header localization

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Closed (View Workflow)
    • Priority: P3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
    • Template:
    • Sprint:
      stripes-force Sprint 53, stripes-force Sprint 54

      Description

      Problem

      • We're having to force strings into columnMapping instead of the preferred ergonomics of <FormattedMessage> because sorting breaks.
      • See https://github.com/folio-org/ui-data-import/pull/20
      • We should figure out a way to accept a node like <FormattedMessage>.

      Spike outcomes

      • Evaluate the two options
        • Ability to pass node as MCL (table) column header
        • Derive multiple translation stripes from a single formatting component
      • Will post results in JIRA description and of course PR

      Outcome

      Approach

      The new <IntlConsumer> component allows apps to declaratively switch from using the injectIntl HOC.
      Example transition...
      Old code:

      // Some comments here
      import { injectIntl } from 'react-intl';
      //...
      <SearchAndSort
        columnMapping={{
          name: this.props.intl.formatMessage({ id: 'module.mappedName' }),
          status: this.props.intl.formatMessage({ id: 'module.mappedStatus' }),
           ...
        }}
      />
      
      export injectIntl(ThisComponent)
      

      New Code

      // import new component form stripes-core
      import { IntlConsumer } from '@folio/stripes/core';
      
      //...
      <IntlConsumer>
        { intl => (
          <SearchAndSort
            columnMapping={{
            name: intl.formatMessage({ id: 'module.mappedName' }),
            status: intl.formatMessage({ id: 'module.mappedStatus' }),
             ...
            }}
          />
        )}
      </IntlConsumer>
      
      // remove the injectIntl HOC...
      export default ThisComponent;
      

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                JohnC John Coburn
                Reporter:
                cherewaty Jeffrey Cherewaty
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases