Home / Function/ getPathByLocale() — astro Function Reference

getPathByLocale() — astro Function Reference

Architecture documentation for the getPathByLocale() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  c08b3bda_012f_60ce_98b8_ee2d9f91b5d8["getPathByLocale()"]
  e4a1ef92_c598_36b5_dc33_9ab2535360bc["index.ts"]
  c08b3bda_012f_60ce_98b8_ee2d9f91b5d8 -->|defined in| e4a1ef92_c598_36b5_dc33_9ab2535360bc
  36f44c90_d8b0_06bb_56d5_2aa4474c23dd["redirectToFallback()"]
  36f44c90_d8b0_06bb_56d5_2aa4474c23dd -->|calls| c08b3bda_012f_60ce_98b8_ee2d9f91b5d8
  style c08b3bda_012f_60ce_98b8_ee2d9f91b5d8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/i18n/index.ts lines 183–198

export function getPathByLocale(locale: string, locales: Locales): string {
	for (const loopLocale of locales) {
		if (typeof loopLocale === 'string') {
			if (loopLocale === locale) {
				return loopLocale;
			}
		} else {
			for (const code of loopLocale.codes) {
				if (code === locale) {
					return loopLocale.path;
				}
			}
		}
	}
	throw new AstroError(i18nNoLocaleFoundInPath);
}

Domain

Subdomains

Frequently Asked Questions

What does getPathByLocale() do?
getPathByLocale() is a function in the astro codebase, defined in packages/astro/src/i18n/index.ts.
Where is getPathByLocale() defined?
getPathByLocale() is defined in packages/astro/src/i18n/index.ts at line 183.
What calls getPathByLocale()?
getPathByLocale() is called by 1 function(s): redirectToFallback.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free