Localization ClassDelta Engine Documentation
For localizing an application to a language. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Content ContentData
    DeltaEngine.Content.Xml XmlContent
      DeltaEngine.Content.Xml Localization

Namespace: DeltaEngine.Content.Xml
Assembly: DeltaEngine.Content.Xml (in DeltaEngine.Content.Xml.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class Localization : XmlContent

The Localization type exposes the following members.

Constructors

  NameDescription
Protected methodLocalization
Initializes a new instance of the Localization class
Top
Methods

  NameDescription
Protected methodCreateDefault (Inherited from ContentData.)
Public methodDispose (Inherited from ContentData.)
Protected methodDisposeData (Inherited from XmlContent.)
Public methodGetText
Public methodInternalCreateDefault (Inherited from ContentData.)
Protected methodLoadData (Inherited from XmlContent.)
Public methodToString (Inherited from ContentData.)
Top
Fields

  NameDescription
Protected fieldContentChanged (Inherited from ContentData.)
Top
Properties

  NameDescription
Protected propertyAllowCreationIfContentNotFound (Inherited from ContentData.)
Public propertyData (Inherited from XmlContent.)
Public propertyIsDisposed (Inherited from ContentData.)
Public propertyMetaData (Inherited from ContentData.)
Public propertyName (Inherited from ContentData.)
Public propertyTwoLetterLanguageName
Top
Remarks

Tests: DeltaEngine.Content.Xml.Tests.LocalizationTests
Examples

1 unit tests call DeltaEngine.Content.Xml.Localization
[Test]
public void GetLocalizedString()
{
    ContentLoader.Use<MockContentLoader>();
    var localization = ContentLoader.Load<Localization>("Texts");
    localization.TwoLetterLanguageName = "en";
    Assert.AreEqual(localization.GetText("Go"), "Go");
    localization.TwoLetterLanguageName = "de";
    Assert.AreEqual(localization.GetText("Go"), "Los");
    localization.TwoLetterLanguageName = "es";
    Assert.AreEqual(localization.GetText("Go"), "¡vamos!");
    Assert.Throws<KeyNotFoundException>(
        () => localization.GetText("ThatIsATestExampleToThrowOneException"));
    ContentLoader.DisposeIfInitialized();
}
See Also