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

Add extractSourceLocation option #73

Merged
merged 1 commit into from
Sep 3, 2016
Merged

Add extractSourceLocation option #73

merged 1 commit into from
Sep 3, 2016

Conversation

ericf
Copy link
Collaborator

@ericf ericf commented Sep 2, 2016

This option will provide metadata in the Message Description for the file and location in the file where the message was defined. When enabled and running it on this file you'll get this result:

[
  {
    "id": "app.title",
    "defaultMessage": "React Intl Translations Example",
    "file": "src/client/components/app.js",
    "start": {
      "line": 23,
      "column": 20
    },
    "end": {
      "line": 26,
      "column": 22
    }
  },
  {
    "id": "app.locales_menu_heading",
    "defaultMessage": "Locales:",
    "file": "src/client/components/app.js",
    "start": {
      "line": 32,
      "column": 20
    },
    "end": {
      "line": 35,
      "column": 22
    }
  }
]

Fixes #71

Todos

  • Add option to README
  • Add Tests

This option will provide metadata in the Message Description for the
file and location in the file where the message was defined. When
enabled and running it on [this file][1] you'll get this result:

```json
[
  {
    "id": "app.title",
    "defaultMessage": "React Intl Translations Example",
    "file": "src/client/components/app.js",
    "start": {
      "line": 23,
      "column": 20
    },
    "end": {
      "line": 26,
      "column": 22
    }
  },
  {
    "id": "app.locales_menu_heading",
    "defaultMessage": "Locales:",
    "file": "src/client/components/app.js",
    "start": {
      "line": 32,
      "column": 20
    },
    "end": {
      "line": 35,
      "column": 22
    }
  }
]
```

Fixes #71

[1]: https://github.com/yahoo/react-intl/blob/25f3f64d86ac86281157117b5bdb9fa30d1d615f/examples/translations/src/client/components/app.js
@ericf ericf merged commit 0d00e71 into master Sep 3, 2016
@ericf ericf deleted the src-meta branch September 3, 2016 02:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant