Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

561 B
Raw Blame
import { localizePath } from '../config/locales.mjs';

export const withBase = (path: string, baseUrl: string) => {
  const normalizedBase = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
  const normalizedPath = path.replace(/^\//, '');

  return `${normalizedBase}${normalizedPath}`;
};

/** A site path, without the base path, as a link from a page in `locale`: root-only paths stay at the root. */
export const localizedHref = (path: string, { locale, base }: { locale: string | undefined; base: string }) =>
  withBase(localizePath(path, locale), base);