1 | #!/usr/bin/env node
|
2 |
|
3 | const extract = require('@digidem/extract-react-intl-messages')
|
4 |
|
5 | const LOCALES = ['en', 'es', 'fr', 'pt']
|
6 | const COMPONENT_NAMES = [
|
7 | 'ReportView',
|
8 | 'MapView',
|
9 | 'MediaView',
|
10 | 'ObservationDialog',
|
11 | 'FilterPanel'
|
12 | ]
|
13 |
|
14 | const opts = {
|
15 | defaultLocale: 'en',
|
16 | descriptions: true
|
17 | }
|
18 |
|
19 |
|
20 |
|
21 | ;(async function() {
|
22 | await COMPONENT_NAMES.map(componentName => {
|
23 | const pattern = `src/${componentName}/**/!(*.test|*.stories).js`
|
24 | return extract(LOCALES, pattern, 'messages/' + componentName, opts)
|
25 | })
|
26 | })()
|
27 |
|
28 | extract(LOCALES, 'src/messages.js', 'messages/shared', opts)
|