-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logging to messages validation (#22296)
* Add logging and parallelization to messages validation * Refactor dev/i18n * Resolve comments * Remove parallelism and fix tests * Resolve comments
- Loading branch information
1 parent
9c01863
commit 4cf727a
Showing
38 changed files
with
701 additions
and
517 deletions.
There are no files selected for viewing
31 changes: 0 additions & 31 deletions
31
src/dev/i18n/__snapshots__/extract_code_messages.test.js.snap
This file was deleted.
Oops, something went wrong.
179 changes: 50 additions & 129 deletions
179
src/dev/i18n/__snapshots__/extract_default_translations.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,142 +1,63 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`dev/i18n/extract_default_translations extracts messages to en.json 1`] = ` | ||
"{ | ||
\\"formats\\": { | ||
\\"number\\": { | ||
\\"currency\\": { | ||
\\"style\\": \\"currency\\" | ||
}, | ||
\\"percent\\": { | ||
\\"style\\": \\"percent\\" | ||
} | ||
exports[`dev/i18n/extract_default_translations extracts messages from path to map 1`] = ` | ||
Array [ | ||
Array [ | ||
"plugin_1.id_1", | ||
Object { | ||
"context": undefined, | ||
"message": "Message 1", | ||
}, | ||
\\"date\\": { | ||
\\"short\\": { | ||
\\"month\\": \\"numeric\\", | ||
\\"day\\": \\"numeric\\", | ||
\\"year\\": \\"2-digit\\" | ||
}, | ||
\\"medium\\": { | ||
\\"month\\": \\"short\\", | ||
\\"day\\": \\"numeric\\", | ||
\\"year\\": \\"numeric\\" | ||
}, | ||
\\"long\\": { | ||
\\"month\\": \\"long\\", | ||
\\"day\\": \\"numeric\\", | ||
\\"year\\": \\"numeric\\" | ||
}, | ||
\\"full\\": { | ||
\\"weekday\\": \\"long\\", | ||
\\"month\\": \\"long\\", | ||
\\"day\\": \\"numeric\\", | ||
\\"year\\": \\"numeric\\" | ||
} | ||
], | ||
Array [ | ||
"plugin_1.id_2", | ||
Object { | ||
"context": "Message context", | ||
"message": "Message 2", | ||
}, | ||
\\"time\\": { | ||
\\"short\\": { | ||
\\"hour\\": \\"numeric\\", | ||
\\"minute\\": \\"numeric\\" | ||
}, | ||
\\"medium\\": { | ||
\\"hour\\": \\"numeric\\", | ||
\\"minute\\": \\"numeric\\", | ||
\\"second\\": \\"numeric\\" | ||
}, | ||
\\"long\\": { | ||
\\"hour\\": \\"numeric\\", | ||
\\"minute\\": \\"numeric\\", | ||
\\"second\\": \\"numeric\\", | ||
\\"timeZoneName\\": \\"short\\" | ||
}, | ||
\\"full\\": { | ||
\\"hour\\": \\"numeric\\", | ||
\\"minute\\": \\"numeric\\", | ||
\\"second\\": \\"numeric\\", | ||
\\"timeZoneName\\": \\"short\\" | ||
} | ||
} | ||
}, | ||
\\"plugin_1.id_1\\": \\"Message 1\\", | ||
\\"plugin_1.id_2\\": { | ||
\\"text\\": \\"Message 2\\", | ||
\\"comment\\": \\"Message context\\" | ||
}, | ||
\\"plugin_1.id_3\\": \\"Message 3\\", | ||
\\"plugin_1.id_4\\": \\"Message 4\\", | ||
\\"plugin_1.id_5\\": \\"Message 5\\", | ||
\\"plugin_1.id_6\\": \\"Message 6\\", | ||
\\"plugin_1.id_7\\": \\"Message 7\\" | ||
}" | ||
`; | ||
|
||
exports[`dev/i18n/extract_default_translations injects default formats into en.json 1`] = ` | ||
"{ | ||
\\"formats\\": { | ||
\\"number\\": { | ||
\\"currency\\": { | ||
\\"style\\": \\"currency\\" | ||
}, | ||
\\"percent\\": { | ||
\\"style\\": \\"percent\\" | ||
} | ||
], | ||
Array [ | ||
"plugin_1.id_3", | ||
Object { | ||
"context": undefined, | ||
"message": "Message 3", | ||
}, | ||
], | ||
Array [ | ||
"plugin_1.id_4", | ||
Object { | ||
"context": undefined, | ||
"message": "Message 4", | ||
}, | ||
], | ||
Array [ | ||
"plugin_1.id_5", | ||
Object { | ||
"context": undefined, | ||
"message": "Message 5", | ||
}, | ||
], | ||
Array [ | ||
"plugin_1.id_6", | ||
Object { | ||
"context": "", | ||
"message": "Message 6", | ||
}, | ||
\\"date\\": { | ||
\\"short\\": { | ||
\\"month\\": \\"numeric\\", | ||
\\"day\\": \\"numeric\\", | ||
\\"year\\": \\"2-digit\\" | ||
}, | ||
\\"medium\\": { | ||
\\"month\\": \\"short\\", | ||
\\"day\\": \\"numeric\\", | ||
\\"year\\": \\"numeric\\" | ||
}, | ||
\\"long\\": { | ||
\\"month\\": \\"long\\", | ||
\\"day\\": \\"numeric\\", | ||
\\"year\\": \\"numeric\\" | ||
}, | ||
\\"full\\": { | ||
\\"weekday\\": \\"long\\", | ||
\\"month\\": \\"long\\", | ||
\\"day\\": \\"numeric\\", | ||
\\"year\\": \\"numeric\\" | ||
} | ||
], | ||
Array [ | ||
"plugin_1.id_7", | ||
Object { | ||
"context": undefined, | ||
"message": "Message 7", | ||
}, | ||
\\"time\\": { | ||
\\"short\\": { | ||
\\"hour\\": \\"numeric\\", | ||
\\"minute\\": \\"numeric\\" | ||
}, | ||
\\"medium\\": { | ||
\\"hour\\": \\"numeric\\", | ||
\\"minute\\": \\"numeric\\", | ||
\\"second\\": \\"numeric\\" | ||
}, | ||
\\"long\\": { | ||
\\"hour\\": \\"numeric\\", | ||
\\"minute\\": \\"numeric\\", | ||
\\"second\\": \\"numeric\\", | ||
\\"timeZoneName\\": \\"short\\" | ||
}, | ||
\\"full\\": { | ||
\\"hour\\": \\"numeric\\", | ||
\\"minute\\": \\"numeric\\", | ||
\\"second\\": \\"numeric\\", | ||
\\"timeZoneName\\": \\"short\\" | ||
} | ||
} | ||
}, | ||
\\"plugin_2.message-id\\": \\"Message text\\" | ||
}" | ||
], | ||
] | ||
`; | ||
|
||
exports[`dev/i18n/extract_default_translations throws on id collision 1`] = ` | ||
"[37m[41m I18N ERROR [49m[39m Error in src/dev/i18n/__fixtures__/extract_default_translations/test_plugin_3/test_file.jsx | ||
Error: [37m[41m I18N ERROR [49m[39m There is more than one default message for the same id \\"plugin_3.duplicate_id\\": | ||
Error: There is more than one default message for the same id \\"plugin_3.duplicate_id\\": | ||
\\"Message 1\\" and \\"Message 2\\"" | ||
`; | ||
|
||
exports[`dev/i18n/extract_default_translations throws on wrong message namespace 1`] = `"[37m[41m I18N ERROR [49m[39m Expected \\"wrong_plugin_namespace.message-id\\" id to have \\"plugin_2\\" namespace. See i18nrc.json for the list of supported namespaces."`; | ||
exports[`dev/i18n/extract_default_translations throws on wrong message namespace 1`] = `"Expected \\"wrong_plugin_namespace.message-id\\" id to have \\"plugin_2\\" namespace. See .i18nrc.json for the list of supported namespaces."`; |
21 changes: 0 additions & 21 deletions
21
src/dev/i18n/__snapshots__/extract_handlebars_messages.test.js.snap
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
src/dev/i18n/__snapshots__/extract_html_messages.test.js.snap
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/dev/i18n/__snapshots__/extract_i18n_call_messages.test.js.snap
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
src/dev/i18n/__snapshots__/extract_pug_messages.test.js.snap
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
src/dev/i18n/__snapshots__/extract_react_messages.test.js.snap
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.