Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

FormattedMessage evaluated twice, description is removed and enforceDescriptions fails #22

Closed
@rvulpescu

Description

@rvulpescu

Hi,

I'm using this message which the extraction plugin (v 2.0) parses twice.
I also attempted using defineMessages();

          <FormattedMessage
              defaultMessage= {'Hello 2, {name}! How are you today?'}
              description= 'Welcome greeting to the user'
              id={'greeting'}
              values={{'name': 'Fox'}}
          />

For some reason the description attribute is being removed and the final .json does not contain the description of the message. If mandatory descriptions are required, the parsing will stop since this message is invalid.

Why do you remove it at index.js#178?

                    if (descriptor.defaultMessage) {
                        storeMessage(descriptor, path, state);

                        attributes.filter(function (attr) {
                            var keyPath = attr.get('name');
                            var key = getMessageDescriptorKey(keyPath);
                            return key === 'description';
                        }).forEach(function (attr) {
                            return attr.remove();
                        }); 
                    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions