语言

Localization 类

定义

该 Localization 类定义本地化属性和注释的附加属性。

public ref class Localization abstract sealed
public static class Localization
type Localization = class
Public Class Localization
继承
Localization

示例

下面的代码示例演示为文本块定义的本地化属性和注释。

<!-- Define localization attributes and comments for the text block.
    - The content is visible to the localizer and can be changed.
    - The font size property is visible to the localizer and can be changed.
    - The comment specifies that the trademark font size should be used. -->
<TextBlock
  FontSize="14"
  Localization.Attributes=
    "$Content(Text Readable Modifiable) FontSize(Font Readable Modifiable)"
  Localization.Comments=
    "$Content(Trademark) FontSize(Trademark font size)" >
  your company name here
</TextBlock>

注解

标记作者可能对可扩展应用程序标记语言 (XAML) UI 中的元素有特定要求,例如文本长度、字体系列或字号的约束。 本地化人员需要了解它们才能提供一致的本地化。 可以在可扩展应用程序标记语言(XAML)内指定本地化属性,使作者能够将其本地化需求传达给本地化人员。 这些属性提供本地化规则和提示,可用于修改应用程序。 有两种类型的本地化属性:

  • 本地化属性。 这些属性指定要本地化的资源,例如 FontFamily。

  • 本地化注释。 注释是标记作者包括的自由格式文本。

有关如何使用这些本地化属性的详细信息,请参阅 本地化属性和注释。

字段

名称 说明
AttributesProperty

标识 Attributes 附加属性。

CommentsProperty

标识 Comments 附加属性。

附加属性

名称 说明
Attributes

该 Localization 类定义本地化属性和注释的附加属性。

Comments

该 Localization 类定义本地化属性和注释的附加属性。

方法

名称 说明
GetAttributes(Object)

从指定的元素获取附加属性的值 AttributesProperty 。

GetComments(Object)

从指定的元素获取附加属性的值 CommentsProperty 。

SetAttributes(Object, String)

AttributesProperty设置指定元素的附加属性。

SetComments(Object, String)

将 CommentsProperty 附加属性设置为指定的元素。

适用于