mirror of
https://github.com/vercel/commerce.git
synced 2025-07-30 05:31:22 +00:00
.vscode
assets
components
config
framework
lib
api
click-outside
hooks
colors.ts
focus-trap.tsx
get-slug.ts
range-map.ts
search.tsx
to-pixels.ts
usage-warns.ts
pages
public
.editorconfig
.env.template
.gitignore
.prettierignore
.prettierrc
README.md
codegen.json
commerce.config.json
global.d.ts
license.md
next-env.d.ts
next.config.js
package.json
postcss.config.js
tailwind.config.js
tsconfig.json
yarn.lock
27 lines
849 B
TypeScript
27 lines
849 B
TypeScript
/**
|
|
* The utils here are used to help developers use the example
|
|
*/
|
|
|
|
export function missingLocaleInPages(): [string[], () => void] {
|
|
const invalidPaths: string[] = []
|
|
const log = () => {
|
|
if (invalidPaths.length) {
|
|
const single = invalidPaths.length === 1
|
|
const pages = single ? 'page' : 'pages'
|
|
|
|
console.log(
|
|
`The ${pages} "${invalidPaths.join(', ')}" ${
|
|
single ? 'does' : 'do'
|
|
} 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
|
|
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]
|
|
}
|