4
0
forked from crowetic/commerce
commerce/lib/usage-warns.ts

27 lines
849 B
TypeScript
Raw Normal View History

2020-10-29 19:25:19 -05:00
/**
* The utils here are used to help developers use the example
*/
2020-10-29 19:21:46 -05:00
export function missingLocaleInPages(): [string[], () => void] {
const invalidPaths: string[] = []
const log = () => {
if (invalidPaths.length) {
2020-10-29 19:25:19 -05:00
const single = invalidPaths.length === 1
2020-10-29 19:21:46 -05:00
const pages = single ? 'page' : 'pages'
console.log(
`The ${pages} "${invalidPaths.join(', ')}" ${
single ? 'does' : 'do'
2020-10-29 19:26:44 -05:00
} not include a locale, or the locale is not supported. When using i18n, web pages from
BigCommerce are expected to have a locale or they will be ignored.\n
2020-10-29 19:21:46 -05:00
Please update the ${pages} to include the default locale or make the ${pages} invisible by
unchecking the "Navigation Menu" option in the settings of ${
single ? 'the' : 'each'
} web page\n`
)
}
}
return [invalidPaths, log]
}