mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
* add toc/bread changes * add xaml-services * add ported wpf content * add xaml-services info to docfx * Fix links 1 * Fix links 2 * Fix links 3 * Fix links 4 * Fix links 5 * Fix links 6 * Fix links 7 * Fix xaml-services link * Fix snippets 1 * Fix snippets 2 * adjust breadcrumb and toc * remove preserve-view from breadcrumbs * add empty view to toc item xaml * update include * remove contextual toc for vs article :(
46 lines
2.8 KiB
Markdown
46 lines
2.8 KiB
Markdown
---
|
|
title: "xml:lang Handling in XAML"
|
|
ms.date: "03/30/2017"
|
|
helpviewer_keywords:
|
|
- "XAML [XAML Services], xml:lang attribute"
|
|
- "xml:lang attribute [XAML Services]"
|
|
- "RFC 3066 standard [XAML Services]"
|
|
- "standards [XAML Services], RFC 3066"
|
|
ms.assetid: 7aac0078-a1c5-41f8-b8b0-975510d9dca0
|
|
---
|
|
# xml:lang Handling in XAML
|
|
|
|
The `xml:lang` attribute is an XML-defined attribute that declares the language and culture information for an element in XML. This same meaning of the attribute persists in XAML; however, some additional considerations apply.
|
|
|
|
## XAML Attribute Usage
|
|
|
|
```xaml
|
|
<object xml:lang="rfc3066lang" />
|
|
```
|
|
|
|
## XAML Values
|
|
|
|
|||
|
|
|-|-|
|
|
|*rfc3066lang*|A string that is derived from the [RFC 3066](https://www.ietf.org/rfc/rfc3066.txt) standard and identifies either a language or a language-region. When it is the latter, the language and region are separated by a single hyphen. See <xref:System.Windows.Markup.XmlLanguage> for more information about the values and format.|
|
|
|
|
## Remarks
|
|
|
|
The definition for the `xml:lang` attribute in [!INCLUDE[TLA2#tla_xaml](../includes/tla2sharptla-xaml-md.md)] is derived from `xml:lang` as defined as a "special attribute" by the World Wide Web Consortium (W3C) for XML. Language and culture information is potentially processed in different ways by elements, depending on their implementations; however, there is no default [!INCLUDE[TLA2#tla_xaml](../includes/tla2sharptla-xaml-md.md)] processing of the `xml:lang` attribute.
|
|
|
|
The default value of the `xml:lang` attribute is an empty string at the attribute level.
|
|
|
|
The `xml:lang` attribute effects and the value of the attribute are generally perpetuated to child elements, when interpreted by systems that act on `xml:lang` values.
|
|
|
|
When interpreted by XAML writers of .NET XAML Services, an `xml:lang` value can create <xref:System.Windows.Markup.XmlLanguage> or <xref:System.Globalization.CultureInfo> objects in the underlying object representation; however, that behavior depends on whether the value specified for `xml:lang` is a valid construction for those classes.
|
|
|
|
Frameworks can create associations between framework-defined properties and the meaning of `xml:lang` in XML by applying <xref:System.Windows.Markup.XmlLangPropertyAttribute> to the property.
|
|
|
|
## WPF Usage Nodes
|
|
|
|
For elements that are derived classes of <xref:System.Windows.FrameworkElement> or <xref:System.Windows.FrameworkContentElement>, you can use the equivalent <xref:System.Windows.FrameworkElement.Language%2A> dependency property instead of the `xml:lang` attribute. By default, the <xref:System.Windows.FrameworkElement.Language%2A> property uses "en-US" if it is not otherwise set, either through the property or through processing the `xml:lang` attribute.
|
|
|
|
## See also
|
|
|
|
- [Globalization for WPF](../framework/wpf/advanced/globalization-for-wpf.md)
|