LocaleProvider
Set the language of built-in SnowUI interface messages for an application or subtree, with custom overrides.
We are building SnowUI components into interfaces people can use directly in AI conversations. Conversational UI is still in development; this page demonstrates website usage. Supported chat platforms and component versions will be announced after verification. Generating and using SnowUI interfaces inside AI conversations is completely free. It is not a project, uses no project or developer-seat quota, and requires no SnowUI registration, activation, or paid proof.
How LocaleProvider works
LocaleProvider supplies language context to descendant components. It adds no HTML wrapper, visual style, or layout of its own. Place it around the part of your application that should share a language.
It translates supported built-in messages, such as dialog close labels and color-scheme controls. Your page titles, content, and application messages remain owned by your application.
Import
LocaleProvider is included in the publicly downloadable Components package under the SnowUI license. Follow Quick Start to install the package and load the shared stylesheet.
import { LocaleProvider } from '@snowui-design-system/components';Use SnowUI to build the interface described by my requirements or design below. A core direction for SnowUI is interactive interfaces generated by AI in conversation. This capability is in development; official components have not yet completed chat-host acceptance. If I request an interface inside a conversation, verify host execution capabilities, component versions, and actual adapter evidence first. Use only verified subsets and allowed actions; preserve user input and distinguish local interaction, business submission, and conversation continuation. If unsupported, explain the limitation and use an authorized alternative. A web preview, code, or visual imitation does not establish in-conversation interaction. Generating and using SnowUI interfaces inside AI conversations is completely free. It is not a project, uses no project or developer-seat quota, and requires no SnowUI registration, activation, or paid proof. This exemption also covers real work and authorized data: do not require a product ID, usage declaration, project ledger, or release check for conversation-only use. Review the separate product license only if the result is adopted into an independent website or application; never register a chat or generated surface as a project. The linked AI documents are reviewed English translations of the current public component and design guidance. Check the installed package version and revisit the linked pages when source or product scope changes. On first adoption, read the complete LICENSE: https://snowui.dev/LICENSE. For an installed version, its bundled license applies. Reuse checks within the same task, version, product and confirmed scope. Prepare downloads, installation, materials, and the environment using https://snowui.dev/llms/en/setup.md and machine setup https://snowui.dev/llms/setup.json. Detect actual file, terminal, Svelte build, resource-loading, and in-message rendering capabilities first. In an authorized Svelte 5 environment, reuse compatible dependencies or use pnpm add --save-exact @snowui-design-system/components@0.3.0-alpha.11 @snowui-design-system/resource-svelte@1.0.31 (or the existing package manager), resolve resource-base transitively, load @snowui-design-system/components/styles once, and run the component/material interaction checks. Select real named materials from https://snowui.dev/llms/resources.json. Never use a maintainer's disk path or load the full library into each message. Report download, installation, build, asset loading, in-message interaction, and continuation separately. Provide a non-secret setup summary for later use. A local install or copied prompt does not configure another AI product or a new chat. Discover that host and follow a real verified connection when available; machine setup currently has no SnowUI chat connection URL. Do not invent endpoints, bypass host permissions, write AI memory, or claim unexecuted installation or rendering. Read the design guide: https://snowui.dev/llms/en/design-system.md. Break the page into regions and implement them with public components and semantic HTML. Read the styling order once: https://snowui.dev/llms/en/styling.md. Match public Props such as variant and size first and preserve the original styles where possible. If customization is necessary, use your own class (including existing Tailwind), then instance style. Same-category Tokens are recommended; use only public roots, parts and documented overrides. Select components as needed: https://snowui.dev/llms/en/component-selection.md. Use https://snowui.dev/llms-en.txt to discover them, then read only the relevant API, composition rules and examples. For SnowUI Figma input, also read https://snowui.dev/llms/en/figma.md. The official package is for Svelte 5. Confirm the target framework; explain any necessary port instead of pretending a changed import provides another framework. Conversation-only use follows the free exemption above without project or seat review. For independent products only, Free use does not require registration, an account, a public key or a signed paid license file; follow the LICENSE limits on purpose, projects and developers. A claimed paid plan is not verified authorization. Verify trusted evidence when paid rights are needed; unavailable evidence or documents remain unknown, and only permitted work may continue. Apply my requirements below. Do not invent APIs, addresses or authorization. Use LocaleProvider guide section import. Read the actual code in this section: https://snowui.dev/components/locale-provider#import. Complete public manual: https://snowui.dev/llms/en/components/locale-provider/reference.md Component guide: https://snowui.dev/llms/en/components/locale-provider.mdPublic API: https://snowui.dev/llms/en/components/locale-provider/api.mdDependency: @snowui-design-system/components; read the example's actual imports and load the package stylesheet once. Preserve its behavior and adapt only what my requirements need.Choose a language
The default language is zh-CN. Set locale="en-US" for the built-in English catalog. The following color-scheme control receives its accessible label from the surrounding provider.
<script lang="ts"> import { ColorSchemeButton, LocaleProvider } from "@snowui-design-system/components";</script> <LocaleProvider locale="en-US"> <ColorSchemeButton /></LocaleProvider>Use SnowUI to build the interface described by my requirements or design below. A core direction for SnowUI is interactive interfaces generated by AI in conversation. This capability is in development; official components have not yet completed chat-host acceptance. If I request an interface inside a conversation, verify host execution capabilities, component versions, and actual adapter evidence first. Use only verified subsets and allowed actions; preserve user input and distinguish local interaction, business submission, and conversation continuation. If unsupported, explain the limitation and use an authorized alternative. A web preview, code, or visual imitation does not establish in-conversation interaction. Generating and using SnowUI interfaces inside AI conversations is completely free. It is not a project, uses no project or developer-seat quota, and requires no SnowUI registration, activation, or paid proof. This exemption also covers real work and authorized data: do not require a product ID, usage declaration, project ledger, or release check for conversation-only use. Review the separate product license only if the result is adopted into an independent website or application; never register a chat or generated surface as a project. The linked AI documents are reviewed English translations of the current public component and design guidance. Check the installed package version and revisit the linked pages when source or product scope changes. On first adoption, read the complete LICENSE: https://snowui.dev/LICENSE. For an installed version, its bundled license applies. Reuse checks within the same task, version, product and confirmed scope. Prepare downloads, installation, materials, and the environment using https://snowui.dev/llms/en/setup.md and machine setup https://snowui.dev/llms/setup.json. Detect actual file, terminal, Svelte build, resource-loading, and in-message rendering capabilities first. In an authorized Svelte 5 environment, reuse compatible dependencies or use pnpm add --save-exact @snowui-design-system/components@0.3.0-alpha.11 @snowui-design-system/resource-svelte@1.0.31 (or the existing package manager), resolve resource-base transitively, load @snowui-design-system/components/styles once, and run the component/material interaction checks. Select real named materials from https://snowui.dev/llms/resources.json. Never use a maintainer's disk path or load the full library into each message. Report download, installation, build, asset loading, in-message interaction, and continuation separately. Provide a non-secret setup summary for later use. A local install or copied prompt does not configure another AI product or a new chat. Discover that host and follow a real verified connection when available; machine setup currently has no SnowUI chat connection URL. Do not invent endpoints, bypass host permissions, write AI memory, or claim unexecuted installation or rendering. Read the design guide: https://snowui.dev/llms/en/design-system.md. Break the page into regions and implement them with public components and semantic HTML. Read the styling order once: https://snowui.dev/llms/en/styling.md. Match public Props such as variant and size first and preserve the original styles where possible. If customization is necessary, use your own class (including existing Tailwind), then instance style. Same-category Tokens are recommended; use only public roots, parts and documented overrides. Select components as needed: https://snowui.dev/llms/en/component-selection.md. Use https://snowui.dev/llms-en.txt to discover them, then read only the relevant API, composition rules and examples. For SnowUI Figma input, also read https://snowui.dev/llms/en/figma.md. The official package is for Svelte 5. Confirm the target framework; explain any necessary port instead of pretending a changed import provides another framework. Conversation-only use follows the free exemption above without project or seat review. For independent products only, Free use does not require registration, an account, a public key or a signed paid license file; follow the LICENSE limits on purpose, projects and developers. A claimed paid plan is not verified authorization. Verify trusted evidence when paid rights are needed; unavailable evidence or documents remain unknown, and only permitted work may continue. Apply my requirements below. Do not invent APIs, addresses or authorization. Use LocaleProvider guide section locale. Read the actual code in this section: https://snowui.dev/components/locale-provider#locale. Complete public manual: https://snowui.dev/llms/en/components/locale-provider/reference.md Component guide: https://snowui.dev/llms/en/components/locale-provider.mdPublic API: https://snowui.dev/llms/en/components/locale-provider/api.mdDependency: @snowui-design-system/components; read the example's actual imports and load the package stylesheet once. Preserve its behavior and adapt only what my requirements need.Change language at runtime
Pass reactive state to locale to update supported built-in messages without recreating the provider. Store the selected language in your application if it should persist between visits.
<script lang="ts"> import { ColorSchemeButton, LocaleProvider } from "@snowui-design-system/components"; let locale = $state("en-US");</script> <label> Interface language <select bind:value={locale}> <option value="en-US">English</option> <option value="zh-CN">简体中文</option> </select></label> <LocaleProvider {locale}> <ColorSchemeButton /></LocaleProvider>Use SnowUI to build the interface described by my requirements or design below. A core direction for SnowUI is interactive interfaces generated by AI in conversation. This capability is in development; official components have not yet completed chat-host acceptance. If I request an interface inside a conversation, verify host execution capabilities, component versions, and actual adapter evidence first. Use only verified subsets and allowed actions; preserve user input and distinguish local interaction, business submission, and conversation continuation. If unsupported, explain the limitation and use an authorized alternative. A web preview, code, or visual imitation does not establish in-conversation interaction. Generating and using SnowUI interfaces inside AI conversations is completely free. It is not a project, uses no project or developer-seat quota, and requires no SnowUI registration, activation, or paid proof. This exemption also covers real work and authorized data: do not require a product ID, usage declaration, project ledger, or release check for conversation-only use. Review the separate product license only if the result is adopted into an independent website or application; never register a chat or generated surface as a project. The linked AI documents are reviewed English translations of the current public component and design guidance. Check the installed package version and revisit the linked pages when source or product scope changes. On first adoption, read the complete LICENSE: https://snowui.dev/LICENSE. For an installed version, its bundled license applies. Reuse checks within the same task, version, product and confirmed scope. Prepare downloads, installation, materials, and the environment using https://snowui.dev/llms/en/setup.md and machine setup https://snowui.dev/llms/setup.json. Detect actual file, terminal, Svelte build, resource-loading, and in-message rendering capabilities first. In an authorized Svelte 5 environment, reuse compatible dependencies or use pnpm add --save-exact @snowui-design-system/components@0.3.0-alpha.11 @snowui-design-system/resource-svelte@1.0.31 (or the existing package manager), resolve resource-base transitively, load @snowui-design-system/components/styles once, and run the component/material interaction checks. Select real named materials from https://snowui.dev/llms/resources.json. Never use a maintainer's disk path or load the full library into each message. Report download, installation, build, asset loading, in-message interaction, and continuation separately. Provide a non-secret setup summary for later use. A local install or copied prompt does not configure another AI product or a new chat. Discover that host and follow a real verified connection when available; machine setup currently has no SnowUI chat connection URL. Do not invent endpoints, bypass host permissions, write AI memory, or claim unexecuted installation or rendering. Read the design guide: https://snowui.dev/llms/en/design-system.md. Break the page into regions and implement them with public components and semantic HTML. Read the styling order once: https://snowui.dev/llms/en/styling.md. Match public Props such as variant and size first and preserve the original styles where possible. If customization is necessary, use your own class (including existing Tailwind), then instance style. Same-category Tokens are recommended; use only public roots, parts and documented overrides. Select components as needed: https://snowui.dev/llms/en/component-selection.md. Use https://snowui.dev/llms-en.txt to discover them, then read only the relevant API, composition rules and examples. For SnowUI Figma input, also read https://snowui.dev/llms/en/figma.md. The official package is for Svelte 5. Confirm the target framework; explain any necessary port instead of pretending a changed import provides another framework. Conversation-only use follows the free exemption above without project or seat review. For independent products only, Free use does not require registration, an account, a public key or a signed paid license file; follow the LICENSE limits on purpose, projects and developers. A claimed paid plan is not verified authorization. Verify trusted evidence when paid rights are needed; unavailable evidence or documents remain unknown, and only permitted work may continue. Apply my requirements below. Do not invent APIs, addresses or authorization. Use LocaleProvider guide section switch-language. Read the actual code in this section: https://snowui.dev/components/locale-provider#switch-language. Complete public manual: https://snowui.dev/llms/en/components/locale-provider/reference.md Component guide: https://snowui.dev/llms/en/components/locale-provider.mdPublic API: https://snowui.dev/llms/en/components/locale-provider/api.mdDependency: @snowui-design-system/components; read the example's actual imports and load the package stylesheet once. Preserve its behavior and adapt only what my requirements need.Customize built-in messages
Use messages to override specific catalog keys inside the provider. Omitted keys continue to use the selected language. Use the component’s explicit label property when the wording belongs to just one instance.
This example changes the two accessible labels used by ColorSchemeButton. Message keys are specific to the component; arbitrary application translation keys are not part of this catalog.
<script lang="ts"> import { ColorSchemeButton, LocaleProvider } from "@snowui-design-system/components";</script> <LocaleProvider locale="en-US" messages={{ "colorSchemeButton.toLight": "Use light appearance", "colorSchemeButton.toDark": "Use dark appearance"}}> <ColorSchemeButton /></LocaleProvider>Use SnowUI to build the interface described by my requirements or design below. A core direction for SnowUI is interactive interfaces generated by AI in conversation. This capability is in development; official components have not yet completed chat-host acceptance. If I request an interface inside a conversation, verify host execution capabilities, component versions, and actual adapter evidence first. Use only verified subsets and allowed actions; preserve user input and distinguish local interaction, business submission, and conversation continuation. If unsupported, explain the limitation and use an authorized alternative. A web preview, code, or visual imitation does not establish in-conversation interaction. Generating and using SnowUI interfaces inside AI conversations is completely free. It is not a project, uses no project or developer-seat quota, and requires no SnowUI registration, activation, or paid proof. This exemption also covers real work and authorized data: do not require a product ID, usage declaration, project ledger, or release check for conversation-only use. Review the separate product license only if the result is adopted into an independent website or application; never register a chat or generated surface as a project. The linked AI documents are reviewed English translations of the current public component and design guidance. Check the installed package version and revisit the linked pages when source or product scope changes. On first adoption, read the complete LICENSE: https://snowui.dev/LICENSE. For an installed version, its bundled license applies. Reuse checks within the same task, version, product and confirmed scope. Prepare downloads, installation, materials, and the environment using https://snowui.dev/llms/en/setup.md and machine setup https://snowui.dev/llms/setup.json. Detect actual file, terminal, Svelte build, resource-loading, and in-message rendering capabilities first. In an authorized Svelte 5 environment, reuse compatible dependencies or use pnpm add --save-exact @snowui-design-system/components@0.3.0-alpha.11 @snowui-design-system/resource-svelte@1.0.31 (or the existing package manager), resolve resource-base transitively, load @snowui-design-system/components/styles once, and run the component/material interaction checks. Select real named materials from https://snowui.dev/llms/resources.json. Never use a maintainer's disk path or load the full library into each message. Report download, installation, build, asset loading, in-message interaction, and continuation separately. Provide a non-secret setup summary for later use. A local install or copied prompt does not configure another AI product or a new chat. Discover that host and follow a real verified connection when available; machine setup currently has no SnowUI chat connection URL. Do not invent endpoints, bypass host permissions, write AI memory, or claim unexecuted installation or rendering. Read the design guide: https://snowui.dev/llms/en/design-system.md. Break the page into regions and implement them with public components and semantic HTML. Read the styling order once: https://snowui.dev/llms/en/styling.md. Match public Props such as variant and size first and preserve the original styles where possible. If customization is necessary, use your own class (including existing Tailwind), then instance style. Same-category Tokens are recommended; use only public roots, parts and documented overrides. Select components as needed: https://snowui.dev/llms/en/component-selection.md. Use https://snowui.dev/llms-en.txt to discover them, then read only the relevant API, composition rules and examples. For SnowUI Figma input, also read https://snowui.dev/llms/en/figma.md. The official package is for Svelte 5. Confirm the target framework; explain any necessary port instead of pretending a changed import provides another framework. Conversation-only use follows the free exemption above without project or seat review. For independent products only, Free use does not require registration, an account, a public key or a signed paid license file; follow the LICENSE limits on purpose, projects and developers. A claimed paid plan is not verified authorization. Verify trusted evidence when paid rights are needed; unavailable evidence or documents remain unknown, and only permitted work may continue. Apply my requirements below. Do not invent APIs, addresses or authorization. Use LocaleProvider guide section messages. Read the actual code in this section: https://snowui.dev/components/locale-provider#messages. Complete public manual: https://snowui.dev/llms/en/components/locale-provider/reference.md Component guide: https://snowui.dev/llms/en/components/locale-provider.mdPublic API: https://snowui.dev/llms/en/components/locale-provider/api.mdDependency: @snowui-design-system/components; read the example's actual imports and load the package stylesheet once. Preserve its behavior and adapt only what my requirements need.Scope and nested providers
Each component reads the nearest LocaleProvider. A nested provider establishes its own locale and messages; it does not merge overrides from its parent. Declare the nested locale explicitly to make that boundary clear.
Here, the first control uses English and the second uses Chinese. Neither setting changes components outside its provider.
<script lang="ts"> import { ColorSchemeButton, LocaleProvider } from "@snowui-design-system/components";</script> <LocaleProvider locale="en-US"> <ColorSchemeButton /> <LocaleProvider locale="zh-CN"> <ColorSchemeButton /> </LocaleProvider></LocaleProvider>Use SnowUI to build the interface described by my requirements or design below. A core direction for SnowUI is interactive interfaces generated by AI in conversation. This capability is in development; official components have not yet completed chat-host acceptance. If I request an interface inside a conversation, verify host execution capabilities, component versions, and actual adapter evidence first. Use only verified subsets and allowed actions; preserve user input and distinguish local interaction, business submission, and conversation continuation. If unsupported, explain the limitation and use an authorized alternative. A web preview, code, or visual imitation does not establish in-conversation interaction. Generating and using SnowUI interfaces inside AI conversations is completely free. It is not a project, uses no project or developer-seat quota, and requires no SnowUI registration, activation, or paid proof. This exemption also covers real work and authorized data: do not require a product ID, usage declaration, project ledger, or release check for conversation-only use. Review the separate product license only if the result is adopted into an independent website or application; never register a chat or generated surface as a project. The linked AI documents are reviewed English translations of the current public component and design guidance. Check the installed package version and revisit the linked pages when source or product scope changes. On first adoption, read the complete LICENSE: https://snowui.dev/LICENSE. For an installed version, its bundled license applies. Reuse checks within the same task, version, product and confirmed scope. Prepare downloads, installation, materials, and the environment using https://snowui.dev/llms/en/setup.md and machine setup https://snowui.dev/llms/setup.json. Detect actual file, terminal, Svelte build, resource-loading, and in-message rendering capabilities first. In an authorized Svelte 5 environment, reuse compatible dependencies or use pnpm add --save-exact @snowui-design-system/components@0.3.0-alpha.11 @snowui-design-system/resource-svelte@1.0.31 (or the existing package manager), resolve resource-base transitively, load @snowui-design-system/components/styles once, and run the component/material interaction checks. Select real named materials from https://snowui.dev/llms/resources.json. Never use a maintainer's disk path or load the full library into each message. Report download, installation, build, asset loading, in-message interaction, and continuation separately. Provide a non-secret setup summary for later use. A local install or copied prompt does not configure another AI product or a new chat. Discover that host and follow a real verified connection when available; machine setup currently has no SnowUI chat connection URL. Do not invent endpoints, bypass host permissions, write AI memory, or claim unexecuted installation or rendering. Read the design guide: https://snowui.dev/llms/en/design-system.md. Break the page into regions and implement them with public components and semantic HTML. Read the styling order once: https://snowui.dev/llms/en/styling.md. Match public Props such as variant and size first and preserve the original styles where possible. If customization is necessary, use your own class (including existing Tailwind), then instance style. Same-category Tokens are recommended; use only public roots, parts and documented overrides. Select components as needed: https://snowui.dev/llms/en/component-selection.md. Use https://snowui.dev/llms-en.txt to discover them, then read only the relevant API, composition rules and examples. For SnowUI Figma input, also read https://snowui.dev/llms/en/figma.md. The official package is for Svelte 5. Confirm the target framework; explain any necessary port instead of pretending a changed import provides another framework. Conversation-only use follows the free exemption above without project or seat review. For independent products only, Free use does not require registration, an account, a public key or a signed paid license file; follow the LICENSE limits on purpose, projects and developers. A claimed paid plan is not verified authorization. Verify trusted evidence when paid rights are needed; unavailable evidence or documents remain unknown, and only permitted work may continue. Apply my requirements below. Do not invent APIs, addresses or authorization. Use LocaleProvider guide section scope. Read the actual code in this section: https://snowui.dev/components/locale-provider#scope. Complete public manual: https://snowui.dev/llms/en/components/locale-provider/reference.md Component guide: https://snowui.dev/llms/en/components/locale-provider.mdPublic API: https://snowui.dev/llms/en/components/locale-provider/api.mdDependency: @snowui-design-system/components; read the example's actual imports and load the package stylesheet once. Preserve its behavior and adapt only what my requirements need.Overrides and fallbacks
Messages resolve in this order: an explicit component label, provider messages, the selected language catalog, the default zh-CN catalog, and finally the message key.
The current built-in catalogs are zh-CN and en-US. Resolution tries the exact locale, then a registered language-only catalog, then zh-CN. No language-only catalogs are currently registered: use en-US rather than assuming en or en-GB will resolve to English.
Application content and formatting
LocaleProvider does not translate arbitrary children or change the document’s lang or dir attributes. Keep those attributes and your application translations in sync with the language selected by your application.
Use the documented locale and formatting options of date and number components for formatted values. This provider’s public contract covers built-in UI messages; it does not promise to reformat every date or number in the application.
API Reference
| Property | Type | Default | Example | Description |
|---|---|---|---|---|
locale | string | "zh-CN" | locale="Example" | Current locale identifier. Built-in locales are zh-CN and en-US. An unknown locale falls back by language subtag, then to zh-CN. |
messages | SnowUIMessageOverrides | {} | messages={value} | Override built-in message keys only within this LocaleProvider subtree. |
children | Snippet | — | <LocaleProvider>Content</LocaleProvider> | Subtree receiving the locale and message overrides. Takes no arguments; LocaleProvider adds no DOM wrapper. |