For localizing an application to a language.
View code on GitHub
Inheritance Hierarchy
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
The Localization type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | Localization | Initializes a new instance of the Localization class |
Methods
Name | Description | |
---|---|---|
![]() | CreateDefault | (Inherited from ContentData.) |
![]() | Dispose | (Inherited from ContentData.) |
![]() | DisposeData | (Inherited from XmlContent.) |
![]() | GetText | |
![]() | InternalCreateDefault | (Inherited from ContentData.) |
![]() | LoadData | (Inherited from XmlContent.) |
![]() | ToString | (Inherited from ContentData.) |
Fields
Name | Description | |
---|---|---|
![]() | ContentChanged | (Inherited from ContentData.) |
Properties
Name | Description | |
---|---|---|
![]() | AllowCreationIfContentNotFound | (Inherited from ContentData.) |
![]() | Data | (Inherited from XmlContent.) |
![]() | IsDisposed | (Inherited from ContentData.) |
![]() | MetaData | (Inherited from ContentData.) |
![]() | Name | (Inherited from ContentData.) |
![]() | TwoLetterLanguageName |
Remarks
Examples
[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