Rocky_Mountain_Vending/.pnpm-store/v10/files/c8/4f3204eed7ca8ebf54edac51e2d9ae81c0c63f2df286efdd85178b97bd12830074c8a47467f229b53304d74711021a5c09cf06d8d4cf33abc41fd579b613b1
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

22 lines
No EOL
1,020 B
Text

import { addPathPrefix } from './add-path-prefix';
import { pathHasPrefix } from './path-has-prefix';
/**
* For a given path and a locale, if the locale is given, it will prefix the
* locale. The path shouldn't be an API path. If a default locale is given the
* prefix will be omitted if the locale is already the default locale.
*/ export function addLocale(path, locale, defaultLocale, ignorePrefix) {
// If no locale was given or the locale is the default locale, we don't need
// to prefix the path.
if (!locale || locale === defaultLocale) return path;
const lower = path.toLowerCase();
// If the path is an API path or the path already has the locale prefix, we
// don't need to prefix the path.
if (!ignorePrefix) {
if (pathHasPrefix(lower, '/api')) return path;
if (pathHasPrefix(lower, `/${locale.toLowerCase()}`)) return path;
}
// Add the locale prefix to the path.
return addPathPrefix(path, `/${locale}`);
}
//# sourceMappingURL=add-locale.js.map