mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
Improved log and moved out of the page
This commit is contained in:
22
lib/usage-warns.ts
Normal file
22
lib/usage-warns.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export function missingLocaleInPages(): [string[], () => void] {
|
||||
const invalidPaths: string[] = []
|
||||
const log = () => {
|
||||
if (invalidPaths.length) {
|
||||
const single = invalidPaths.length === 0
|
||||
const pages = single ? 'page' : 'pages'
|
||||
|
||||
console.log(
|
||||
`The ${pages} "${invalidPaths.join(', ')}" ${
|
||||
single ? 'does' : 'do'
|
||||
} not include a locale, when using i18n web pages from BigCommerce
|
||||
are expected to have a locale or they will be ignored.\n
|
||||
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]
|
||||
}
|
Reference in New Issue
Block a user