Skip to content

Commit 7b49d72

Browse files
authored
Merge pull request #119 from nikitakonan/master
2 parents c3c90c0 + b3f534c commit 7b49d72

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ const Header = ({siteTitle}) => {
281281
| siteUrl | string | public site url, is used to generate language specific meta tags |
282282
| pages | array | an array of [page options](#page-options) used to modify plugin behaviour for specific pages |
283283
| i18nextOptions | object | [i18next configuration options](https://www.i18next.com/overview/configuration-options) |
284+
| verbose | boolean | Verbose output. Default is true |
284285

285286
## Page options
286287

src/plugin/onCreateNode.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const onCreateNode = async (
1616
reporter
1717
}: // @ts-ignore
1818
CreateNodeArgs<FileSystemNode>,
19-
{localeJsonSourceName = 'locale'}: PluginOptions
19+
{localeJsonSourceName = 'locale', verbose = true}: PluginOptions
2020
) => {
2121
if (!unstable_shouldOnCreateNode({node})) {
2222
return;
@@ -45,10 +45,13 @@ export const onCreateNode = async (
4545
return;
4646
}
4747

48-
const activity = reporter.activityTimer(
49-
`gatsby-plugin-react-i18next: create node: ${relativeDirectory}/${name}`
50-
);
51-
activity.start();
48+
let activity;
49+
if (verbose) {
50+
activity = reporter.activityTimer(
51+
`gatsby-plugin-react-i18next: create node: ${relativeDirectory}/${name}`
52+
);
53+
activity.start();
54+
}
5255

5356
// relativeDirectory name is language name.
5457
const language = relativeDirectory;
@@ -86,5 +89,7 @@ export const onCreateNode = async (
8689
// staled issue: https://github.com/gatsbyjs/gatsby/issues/19993
8790
createParentChildLink({parent: node, child: localeNode});
8891

89-
activity.end();
92+
if (verbose && activity) {
93+
activity.end();
94+
}
9095
};

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export type PluginOptions = {
2323
localeJsonSourceName?: string;
2424
localeJsonNodeName?: string;
2525
fallbackLanguage?: string;
26+
verbose?: boolean;
2627
};
2728

2829
export type I18NextContext = {

0 commit comments

Comments
 (0)