BamlLocalizer Class

BamlLocalizer Class

 

Extracts resources from a BAML file and generates a localized version of a BAML source.

Namespace:   System.Windows.Markup.Localizer
Assembly:  PresentationFramework (in PresentationFramework.dll)

System.Object
  System.Windows.Markup.Localizer.BamlLocalizer

public class BamlLocalizer

NameDescription
System_CAPS_pubmethodBamlLocalizer(Stream)

Initializes a new instance of the BamlLocalizer class with the specified BAML source stream.

System_CAPS_pubmethodBamlLocalizer(Stream, BamlLocalizabilityResolver)

Initializes a new instance of the BamlLocalizer class with the specified localizability resolver and BAML source stream.

System_CAPS_pubmethodBamlLocalizer(Stream, BamlLocalizabilityResolver, TextReader)

Initializes a new instance of the BamlLocalizer class with the specified localizability resolver, BAML source stream, and TextReader.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodExtractResources()

Extracts all localizable resources from a BAML stream.

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOnErrorNotify(BamlLocalizerErrorNotifyEventArgs)

Raises the ErrorNotify event.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodUpdateBaml(Stream, BamlLocalizationDictionary)

Applies resource updates to the BAML source and writes the updated version to a specified stream in order to create a localized version of the source BAML.

NameDescription
System_CAPS_pubeventErrorNotify

Occurs when the BamlLocalizer encounters abnormal conditions.

This class is the primary entry point to the BAML localization API. You must create an instance of this class for each BAML source that you localize.

The following example demonstrates how to use a BamlLocalizer.


// Obtain the BAML stream.
Stream source = entry.Value as Stream;

// Create a BamlLocalizer on the stream.
BamlLocalizer localizer = new BamlLocalizer(source);
BamlLocalizationDictionary resources = localizer.ExtractResources();

// Write out all the localizable resources in the BAML.
foreach (DictionaryEntry resourceEntry in resources)
{
    BamlLocalizableResourceKey key = resourceEntry.Key as BamlLocalizableResourceKey;
    BamlLocalizableResource value = resourceEntry.Value as BamlLocalizableResource;
    Console.WriteLine(
        "    {0}.{1}.{2} = {3}",
        key.Uid,
        key.ClassName,
        key.PropertyName,
        value.Content
        );                                
}

.NET Framework
Available since 3.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft