Home / Function/ computePreferredLocale() — astro Function Reference

computePreferredLocale() — astro Function Reference

Architecture documentation for the computePreferredLocale() function in render-context.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  259723fe_8d99_f1f3_d6ad_afa57fadf1b8["computePreferredLocale()"]
  b7425a46_8c1f_1122_7ae3_a00e52db1d90["RenderContext"]
  259723fe_8d99_f1f3_d6ad_afa57fadf1b8 -->|defined in| b7425a46_8c1f_1122_7ae3_a00e52db1d90
  d91ba7de_e6ec_e3f2_d698_49f283edc9ab["createActionAPIContext()"]
  d91ba7de_e6ec_e3f2_d698_49f283edc9ab -->|calls| 259723fe_8d99_f1f3_d6ad_afa57fadf1b8
  0007f436_547e_7fd2_f341_1a05d84a40a6["createAstroPagePartial()"]
  0007f436_547e_7fd2_f341_1a05d84a40a6 -->|calls| 259723fe_8d99_f1f3_d6ad_afa57fadf1b8
  style 259723fe_8d99_f1f3_d6ad_afa57fadf1b8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/render-context.ts lines 853–860

	computePreferredLocale() {
		const {
			pipeline: { i18n },
			request,
		} = this;
		if (!i18n) return;
		return (this.#preferredLocale ??= computePreferredLocale(request, i18n.locales));
	}

Domain

Subdomains

Frequently Asked Questions

What does computePreferredLocale() do?
computePreferredLocale() is a function in the astro codebase, defined in packages/astro/src/core/render-context.ts.
Where is computePreferredLocale() defined?
computePreferredLocale() is defined in packages/astro/src/core/render-context.ts at line 853.
What calls computePreferredLocale()?
computePreferredLocale() is called by 2 function(s): createActionAPIContext, createAstroPagePartial.

Analyze Your Own Codebase

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

Try Supermodel Free